yum

package
v0.0.9-rc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

cli/service

Tests notice

Tests for cli/service are using samples with complete yum repositories so require some data generation for yum package.

Test environment
Base image
docker run -it rockylinux/rockylinux:9.4
Dependencies
dnf install -y \
    createrepo_c \
    pinentry \
    rpm-build \
    rpm-sign \
    vim
Generate GPG key
gpg --gen-key

Follow instructions but please remember to leave something meaning in key name like the following name: archived test repository sample

Export GPG public key for further tests update:

gpg --export -a 'archived test repository sample' > RPM-GPG-KEY-testrepo
Fill .rpmmacros

~/.rpmmacros:

%_signature gpg
%_gpg_path /root/.gnupg
%_gpg_name archived test repository sample
%_gpgbin /usr/bin/gpg2
Generate packages

testpkg.spec:

Name:       testpkg
Version:    1
Release:    1
Summary:    Test RPM package
License:    FIXME

%description
Test RPM package

%prep

%build
cat > hello-world.sh <<EOF
#!/usr/bin/bash

set -euo pipefail

echo "Hello world"
EOF

%install
mkdir -p %{buildroot}/usr/bin/
install -m 755 hello-world.sh %{buildroot}/usr/bin/hello-world.sh

%files
/usr/bin/hello-world.sh

%changelog
rpmbuild -ba testpkg.spec
Sign package
rpm --addsign rpmbuild/RPMS/x86_64/testpkg-1-1.x86_64.rpm
rpm --addsign rpmbuild/SRPMS/testpkg-1-1.src.rpm
Generate repository metadata
mkdir repo
cp -vr {rpmbuild/RPMS,rpmbuild/SRPMS} repo/
cd repo && createrepo .

All done but note this almost definitely will require to update tests!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileNotFound             = errors.New("file not found")
	ErrChecksumMismatch         = errors.New("checksum mismatch")
	ErrNotSupportedChecksumAlgo = errors.New("not supported checksum algorithm is in use")
)

Functions

func New

func New(url string) *yumRepo

Types

type YumRepo

type YumRepo interface {
	Packages(ctx context.Context) ([]models.Package, error)
	Metadata() map[string][]byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL