rpmmd

package
v0.274.1-0...-ae79efd Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRepositoriesFromFile

func LoadRepositoriesFromFile(filename string) (map[string][]RepoConfig, error)

func LoadRepositoriesFromReader

func LoadRepositoriesFromReader(r io.Reader) (map[string][]RepoConfig, error)

Types

type Checksum

type Checksum struct {
	// Type is the type of checksum, e.g. "sha256", "sha512", "md5", etc.
	Type string
	// Value is the checksum value, e.g. "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" for sha256.
	Value string
}

Checksum represents a checksum with its type

func (Checksum) String

func (c Checksum) String() string

type DistrosRepoConfigs

type DistrosRepoConfigs map[string]map[string][]RepoConfig

type ModuleConfigData

type ModuleConfigData struct {
	Name     string
	Stream   string
	Profiles []string
	State    string
}

type ModuleConfigFile

type ModuleConfigFile struct {
	Path string
	Data ModuleConfigData
}

type ModuleFailsafeFile

type ModuleFailsafeFile struct {
	Path string
	Data string
}

type ModuleSpec

type ModuleSpec struct {
	ModuleConfigFile ModuleConfigFile
	FailsafeFile     ModuleFailsafeFile
}

type Package

type Package struct {
	Name    string
	Epoch   uint
	Version string
	Release string
	Arch    string

	// RPM package Group
	Group string

	// File size of the RPM package
	DownloadSize uint64
	// Size the RPM package should occupy after installing on disk
	// NB: The actual size on disk may vary based on block size and filesystem overhead.
	InstallSize uint64

	License string

	// RPM package source package filename
	SourceRpm string

	BuildTime time.Time
	Packager  string
	Vendor    string

	// RPM package URL (project home address)
	URL string

	Summary     string
	Description string

	// Regular dependencies
	Provides        RelDepList
	Requires        RelDepList // RegularRequires + PreRequires
	RequiresPre     RelDepList
	Conflicts       RelDepList
	Obsoletes       RelDepList
	RegularRequires RelDepList

	// Weak dependencies
	Recommends  RelDepList
	Suggests    RelDepList
	Enhances    RelDepList
	Supplements RelDepList

	// List of files and directories the RPM package contains
	Files []string

	// Repodata
	// RPM package relative path/location from repodata
	Location string
	// RPM package remote location where the package can be download from
	RemoteLocations []string

	// Checksum object representing RPM package checksum and its type
	Checksum Checksum
	// Checksum object representing RPM package header checksum and its type.
	HeaderChecksum Checksum

	// Repository ID this package belongs to
	// TODO: Deprecated: use Repo instead
	RepoID string
	// Direct reference to the repository configuration this package belongs to
	Repo *RepoConfig

	// Resolved reason why a package was / would be installed.
	Reason string

	// Convenience values coming from the respective repository config
	Secrets   string
	CheckGPG  bool
	IgnoreSSL bool
}

RPM package representation

Based on libdnf5: https://github.com/rpm-software-management/dnf5/blob/main/include/libdnf5/rpm/package.hpp DNF4 version: https://github.com/rpm-software-management/libdnf/blob/dnf-4-master/libdnf/hy-package.h

Some fields that are not relevant for us, or that can be deduced from existing fields, are omitted, specifically: - Various EVR or NEVRA getter methods, which would use existing fields - get_source_name() - RPM package source package name - get_debugsource_name() - RPM package debugsource package name - get_debuginfo_name_of_source() - RPM package debuginfo package name for the source package - get_debuginfo_name() - RPM package debuginfo package name - get_prereq_ignoreinst() - get_depends() - RPM package dependencies (requires + enhances + suggests + supplements + recommends) - get_changelogs() - get_hdr_end() - get_media_number() - get_package_path() - Path to the RPM package on the local file system - is_available_locally() - is_installed() - is_excluded() - get_from_repo_id() - For an installed package, return id of repo from the package was installed - get_install_time() - get_rpmdbid()

func (Package) EVRA

func (p Package) EVRA() string

EVRA returns the package's Epoch:Version-Release.Arch string. If the package Epoch is 0, it is omitted and only Version-Release.Arch is returned.

func (Package) FullNEVRA

func (p Package) FullNEVRA() string

FullNEVRA returns the package's Name-Epoch:Version-Release.Arch string. Epoch is never omitted.

func (Package) NVR

func (p Package) NVR() string

NVR returns the package's Name-Version-Release string.

type PackageList

type PackageList []Package

func (PackageList) Package

func (pl PackageList) Package(packageName string) (*Package, error)

type PackageSet

type PackageSet struct {
	Include         []string
	Exclude         []string
	EnabledModules  []string
	Repositories    []RepoConfig
	InstallWeakDeps bool
}

The inputs to depsolve, a set of packages to include and a set of packages to exclude. The Repositories are used when depsolving this package set in addition to the base repositories.

func (PackageSet) Append

func (ps PackageSet) Append(other PackageSet) PackageSet

Append the Include and Exclude package list from another PackageSet and return the result.

type RelDep

type RelDep struct {
	// Name is the name of the dependency, e.g. "openssl-libs".
	Name string
	// Relationship to the version, e.g. "=", ">", ">=", etc. (optional)
	Relationship string
	// Version of the dependency, e.g. "3.0.1", etc. (optional)
	Version string
}

RelDep represents an RPM dependency with a name, an optional relationship operator and an optional version.

type RelDepList

type RelDepList []RelDep

type RepoConfig

type RepoConfig struct {
	// the repo id is not always required and is ignored in some cases.
	// For example, it is not required in osbuild-depsolve-dnf, but it is a required
	// field for creating a repo file in `/etc/yum.repos.d/`
	Id             string   `json:"id,omitempty"`
	Name           string   `json:"name,omitempty"`
	BaseURLs       []string `json:"baseurls,omitempty"`
	Metalink       string   `json:"metalink,omitempty"`
	MirrorList     string   `json:"mirrorlist,omitempty"`
	GPGKeys        []string `json:"gpgkeys,omitempty"`
	CheckGPG       *bool    `json:"check_gpg,omitempty"`
	CheckRepoGPG   *bool    `json:"check_repo_gpg,omitempty"`
	Priority       *int     `json:"priority,omitempty"`
	IgnoreSSL      *bool    `json:"ignore_ssl,omitempty"`
	MetadataExpire string   `json:"metadata_expire,omitempty"`
	ModuleHotfixes *bool    `json:"module_hotfixes,omitempty"`
	RHSM           bool     `json:"rhsm,omitempty"`
	Enabled        *bool    `json:"enabled,omitempty"`
	ImageTypeTags  []string `json:"image_type_tags,omitempty"`
	PackageSets    []string `json:"package_sets,omitempty"`

	// These fields are only filled out by the worker during the
	// depsolve job for certain baseurls.
	SSLCACert     string `json:"sslcacert,omitempty"`
	SSLClientKey  string `json:"sslclientkey,omitempty"`
	SSLClientCert string `json:"sslclientcert,omitempty"`
}

func (*RepoConfig) Hash

func (r *RepoConfig) Hash() string

Hash calculates an ID string that uniquely represents a repository configuration. The Name and ImageTypeTags fields are not considered in the calculation.

Jump to

Keyboard shortcuts

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