Package

class Package

Public Functions

~Package()
Package(const Package &src)
Package &operator=(const Package &src)
Package(Package &&src) noexcept
Package &operator=(Package &&src) noexcept
bool operator==(const Package &other) const noexcept
bool operator!=(const Package &other) const noexcept
bool operator<(const Package &other) const noexcept
PackageId get_id() const noexcept
std::string get_name() const

Since

5.0

Returns:

RPM package Name (RPMTAG_NAME).

std::string get_epoch() const

Since

5.0

Returns:

RPM package Epoch (RPMTAG_EPOCH).

std::string get_version() const

Since

5.0

Returns:

RPM package Version (RPMTAG_VERSION).

std::string get_release() const

Since

5.0

Returns:

RPM package Release (RPMTAG_RELEASE).

std::string get_arch() const

Since

5.0

Returns:

RPM package Arch (RPMTAG_ARCH).

std::string get_evr() const

Since

5.0

Returns:

RPM package EVR (Epoch:Version-Release). If the Epoch is 0, it is omitted from the output.

std::string get_nevra() const

Since

5.0

Returns:

RPM package NEVRA (Name-Epoch:Version-Release.Arch). If the Epoch is 0, it is omitted from the output.

std::string get_full_nevra() const

Since

5.0

Returns:

RPM package NEVRA (Name-Epoch:Version-Release.Arch). The Epoch is always present even if it is 0.

std::string get_na() const

Since

5.0

Returns:

RPM package NA (Name.Arch).

std::string get_group() const

Since

5.0

Returns:

RPM package Group (RPMTAG_GROUP).

unsigned long long get_download_size() const

Since

5.0

Returns:

File size of the RPM package.

unsigned long long get_install_size() const

Since

5.0

Note

The actual size on disk may vary based on block size and filesystem overhead. Libdnf doesn’t provide any method to compute the actual size on disk.

Returns:

Size the RPM package should occupy after installing on disk (RPMTAG_LONGSIZE). The information is always present - it is retrieved from rpmdb if the package is installed or from repodata if the package is available.

std::string get_license() const

Since

5.0

Returns:

RPM package License (RPMTAG_LICENSE).

std::string get_source_name() const

Since

5.0

Returns:

RPM package source name.

std::string get_debugsource_name() const

Since

5.0.10

Returns:

name of the debugsource package for this package E.g. krb5-libs -> krb5-debugsource

std::string get_debuginfo_name_of_source() const

Since

5.0.10

Returns:

name of the debuginfo package for source package of this package. E.g. krb5-libs -> krb5-debuginfo

std::string get_debuginfo_name() const

Since

5.0.10

Returns:

name of the debuginfo package for this package. If this package is a debuginfo package, return its name. If this package is a debugsource package, returns the debuginfo package for the base package. E.g. kernel-PAE -> kernel-PAE-debuginfo

std::string get_sourcerpm() const

Since

5.0

Returns:

RPM package source package filename (RPMTAG_SOURCERPM).

unsigned long long get_build_time() const

Since

5.0

Returns:

RPM package build timestamp (RPMTAG_BUILDTIME).

std::string get_packager() const

Since

5.0

Returns:

RPM package Packager (RPMTAG_PACKAGER).

std::string get_vendor() const

Since

5.0

Returns:

RPM package Vendor (RPMTAG_VENDOR).

std::string get_url() const

Since

5.0

Returns:

RPM package URL (project home address) (RPMTAG_URL).

std::string get_summary() const

Since

5.0

Returns:

RPM package Summary (RPMTAG_SUMMARY).

std::string get_description() const

Since

5.0

Returns:

RPM package Description (RPMTAG_DESCRIPTION).

ReldepList get_provides() const

Since

5.0

Returns:

List of RPM package Provides (RPMTAG_PROVIDENAME, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDEVERSION).

ReldepList get_requires() const

Since

5.0

Returns:

List of RPM package Requires (RPMTAG_REQUIRENAME, RPMTAG_REQUIREFLAGS, RPMTAG_REQUIREVERSION).

ReldepList get_requires_pre() const

Since

5.0

Returns:

List of RPM package Requires(pre).

ReldepList get_conflicts() const

Since

5.0

Returns:

List of RPM package Conflicts (RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTFLAGS, RPMTAG_CONFLICTVERSION).

ReldepList get_obsoletes() const

Since

5.0

Returns:

List of RPM package Obsoletes (RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEFLAGS, RPMTAG_OBSOLETEVERSION).

ReldepList get_prereq_ignoreinst() const
ReldepList get_regular_requires() const
ReldepList get_recommends() const

Since

5.0

Returns:

List of RPM package Recommends (RPMTAG_RECOMMENDNAME, RPMTAG_RECOMMENDFLAGS, RPMTAG_RECOMMENDVERSION).

ReldepList get_suggests() const

Since

5.0

Returns:

List of RPM package Suggests (RPMTAG_SUGGESTNAME, RPMTAG_SUGGESTFLAGS, RPMTAG_SUGGESTVERSION).

ReldepList get_enhances() const

Since

5.0

Returns:

List of RPM package Enhances (RPMTAG_ENHANCENAME, RPMTAG_ENHANCEFLAGS, RPMTAG_ENHANCEVERSION).

ReldepList get_supplements() const

Since

5.0

Returns:

List of RPM package Supplements (RPMTAG_SUPPLEMENTNAME, RPMTAG_SUPPLEMENTFLAGS, RPMTAG_SUPPLEMENTVERSION).

ReldepList get_depends() const

Since

5.0.10

Returns:

List of RPM package dependencies (requires + enhances + suggests + supplements + recommends).

std::vector<std::string> get_files() const

Since

5.0

Note

Information whether the returned files are actual files, directories or ghosted files is not available.

Returns:

List of files and directories the RPM package contains (RPMTAG_FILENAMES). If file lists are not loaded, empty list is returned.

std::vector<Changelog> get_changelogs() const

Since

5.0

Returns:

List of package changelog entries. If other repository metadata are

std::string get_baseurl() const

Since

5.0

Returns:

RPM package baseurl from repodata (<location xml:base="...">).

std::string get_location() const

Since

5.0

Returns:

RPM package relative path/location from repodata (<location href="...">).

std::vector<std::string> get_remote_locations(const std::set<std::string> &protocols = {"https", "http", "ftp", "file"}) const

Since

5.1

Returns:

RPM package remote location where the package can be download from. Returns empty vector for installed and commandline packages.

Checksum get_checksum() const

Since

5.0

Returns:

Checksum object representing RPM package checksum and its type (<checksum type="type">checksum</checksum>).

Checksum get_hdr_checksum() const

Since

5.0

Returns:

Checksum object representing RPM package header checksum and its type.

unsigned long long get_hdr_end() const

Since

5.0

Returns:

RPM package header end (the header is located between file position 0 and the returned offset).

unsigned long long get_media_number() const

Since

5.0

Returns:

Number of media (usually a CD/DVD disc) on which the package is located.

std::string get_package_path() const

Since

5.0

Returns:

Path to the RPM package on the local file system:

  • If the package is a local package, return its path

  • If the package is a remote package downloaded to cache, return path to the cache

  • If the package is a remote package that hasn’t been downloaded yet, return path to the cache

bool is_available_locally() const

Since

5.0.8

Returns:

true if the package is available locally, false otherwise.

bool is_installed() const

Since

5.0

Returns:

true if the package is installed on the system, false otherwise.

bool is_excluded() const

Since

5.0

Returns:

true if the package is excluded, false otherwise.

std::string get_from_repo_id() const

TODO is_local.

For an installed package, return id of repo from the package was installed. For an available package, return an empty string.

unsigned long long get_install_time() const
Returns:

The unix timestamp (seconds since epoch) of when the package was installed. Return 0 if the package is not installed.

unsigned long long get_rpmdbid() const

Since

5.0

Returns:

The rpmdb database id (primary key) of the installed RPM package.

libdnf5::repo::RepoWeakPtr get_repo() const

Since

5.0

Note

This isn’t the repository the package was installed from.

Returns:

A Repo object that represents the repository the package belongs to.

std::string get_repo_id() const

Since

5.0

Note

This isn’t the repository the package was installed from.

Returns:

Id of the repository the package belongs to.

std::string get_repo_name() const

Since

5.0.10

Note

This isn’t the repository the package was installed from.

Returns:

Name of the repository the package belongs to.

libdnf5::transaction::TransactionItemReason get_reason() const

Since

5.0

Returns:

Resolved reason why a package was installed. A package can be installed due to multiple reasons, only the most significant is returned.

libdnf5::BaseWeakPtr get_base() const

Since

5.0.5

Returns:

The Base object to which this object belongs.

std::string to_string() const

Return NEVRA -> 0 epoch is not shown in string.

std::string to_string_description() const

Provide descriptive information about instance including NEVRA and ID.

int get_hash() const

Return unique ID representing Package.

Friends

friend class libdnf5::repo::Repo
friend class libdnf5::Goal
friend class libdnf5::base::Transaction
friend class libdnf5::rpm::Transaction

Checksum

class Checksum

Class contains checksum and checksum type.

Public Types

enum class Type

Values:

enumerator UNKNOWN
enumerator MD5
enumerator SHA1
enumerator SHA224
enumerator SHA256
enumerator SHA384
enumerator SHA512

Public Functions

~Checksum()
Checksum(const Checksum &src)
Checksum &operator=(const Checksum &src)
Checksum(Checksum &&src) noexcept
Checksum &operator=(Checksum &&src) noexcept
Type get_type() const noexcept
std::string get_type_str() const
const std::string &get_checksum() const noexcept

Return checksum in hex format.