libdnf5::rpm
-
using libdnf5::rpm::PackageSackWeakPtr = WeakPtr<PackageSack, false>
-
using libdnf5::rpm::RpmKeyPktPtr = std::unique_ptr<uint8_t, std::function<void(uint8_t *pkt)>>
-
using libdnf5::rpm::TransactionItem = base::TransactionPackage
Class represents one item in transaction set.
- Deprecated:
This alias is confusing, do not use it.
- LIBDNF_API std::vector< std::string > libdnf5::rpm::get_supported_arches ()
Returns a list of architectures supported by libdnf5.
- LIBDNF_API std::string libdnf5::rpm::get_base_arch (const std::string &arch)
Returns base architecture of the given
arch
. In case the base arch is not found the function returns empty string.- Parameters:
arch – Architecture.
- LIBDNF_API std::ostringstream & libdnf5::rpm::operator<< (std::ostringstream &out, const Nevra &nevra)
-
template<typename T>
inline std::string libdnf5::rpm::to_full_nevra_string(const T &obj) Create a full nevra string (always contains epoch) from an object.
-
template<typename T>
inline std::string libdnf5::rpm::to_nevra_string(const T &obj) Create a nevra string (0 epoch excluded) from an object.
-
template<typename F, typename T>
inline void libdnf5::rpm::copy_nevra_attributes(const F &from, T &to) Copy nevra attributes from one object to another.
- LIBDNF_API int libdnf5::rpm::rpmvercmp (const char *lhs, const char *rhs)
Compare alpha and numeric segments of two versions.
- Returns:
1 if
lhs
<rhs
, -1 iflhs
>rhs
, 0 if they are equal
-
template<typename L, typename R>
int libdnf5::rpm::evrcmp(const L &lhs, const R &rhs) Compare evr part of two objects
- Returns:
1 if
lhs
<rhs
, -1 iflhs
>rhs
, 0 if they are equal
-
template<typename L, typename R>
bool libdnf5::rpm::cmp_nevra(const L &lhs, const R &rhs) Compare two objects by their Name, Epoch:Version-Release and Arch.
- Returns:
true
iflhs
<rhs
. Returnfalse
otherwise.
-
template<typename L, typename R>
bool libdnf5::rpm::cmp_naevr(const L &lhs, const R &rhs) Compare two objects by their Name, Arch and Epoch:Version-Release.
- Returns:
true
iflhs
<rhs
. Returnfalse
otherwise.
-
struct Changelog
-
class Checksum
- #include <checksum.hpp>
Class contains checksum and checksum type.
Public Types
-
class KeyImportError : public libdnf5::Error
Public Functions
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
inline virtual const char *get_domain_name() const noexcept override
-
class KeyInfo
Public Functions
-
const std::string &get_key_id() const noexcept
-
std::string get_short_key_id() const
-
const std::vector<std::string> &get_user_ids() const noexcept
-
const std::string &get_fingerprint() const noexcept
-
const std::string &get_url() const noexcept
-
const std::string &get_path() const noexcept
-
const std::string &get_raw_key() const noexcept
-
const long int &get_timestamp() const noexcept
-
KeyInfo(const std::string &key_url, const std::string &key_path, const std::string &key_id, const std::vector<std::string> &user_ids, const std::string &fingerprint, long int timestamp, const std::string &raw_key)
-
~KeyInfo()
-
const std::string &get_key_id() const noexcept
-
struct Nevra
Public Types
Public Functions
-
Nevra()
-
~Nevra()
-
bool operator==(const Nevra &other) const
- Returns:
true
if all Nevra attributes (name
,epoch
,version
,release
andarch
) match.
-
void clear() noexcept
Returns false when parsing failed and stored data are in inconsistency state.
-
const std::string &get_name() const noexcept
-
const std::string &get_epoch() const noexcept
-
const std::string &get_version() const noexcept
-
const std::string &get_release() const noexcept
-
const std::string &get_arch() const noexcept
-
void set_name(const std::string &value)
-
void set_epoch(const std::string &value)
-
void set_version(const std::string &value)
-
void set_release(const std::string &value)
-
void set_arch(const std::string &value)
-
void set_name(std::string &&value)
-
void set_epoch(std::string &&value)
-
void set_version(std::string &&value)
-
void set_release(std::string &&value)
-
void set_arch(std::string &&value)
-
bool has_just_name() const
Public Static Functions
-
static const std::vector<Form> &get_default_pkg_spec_forms()
The default forms and their order determine pkg_spec matching.
-
Nevra()
-
class NevraIncorrectInputError : public libdnf5::Error
-
class Package
Public Functions
-
~Package()
-
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.
Friends
- friend class libdnf5::repo::Repo
- friend class libdnf5::Goal
- friend class libdnf5::base::Transaction
- friend class libdnf5::rpm::Transaction
-
~Package()
-
class PackageQuery : public libdnf5::rpm::PackageSet
Public Types
-
using ExcludeFlags = libdnf5::sack::ExcludeFlags
Public Functions
-
explicit PackageQuery(const libdnf5::BaseWeakPtr &base, ExcludeFlags flags = ExcludeFlags::APPLY_EXCLUDES, bool empty = false)
-
explicit PackageQuery(libdnf5::Base &base, ExcludeFlags flags = ExcludeFlags::APPLY_EXCLUDES, bool empty = false)
-
explicit PackageQuery(const PackageSet &pkgset, ExcludeFlags flags = ExcludeFlags::APPLY_EXCLUDES)
Construct a new PackageQuery based on given PackageSet. This is a shortcut to creating an empty PackageQuery and then updating it with the content of pkgset.
- Parameters:
pkgset – A packageset that the new query will contain
flags – Which excludes the query respects
-
PackageQuery(const PackageQuery &src)
-
PackageQuery(PackageQuery &&src) noexcept
-
~PackageQuery()
-
PackageQuery &operator=(const PackageQuery &src)
-
PackageQuery &operator=(PackageQuery &&src) noexcept
-
inline void filter_name(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
name
.- Since
5.0
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
void filter_name(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
name
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
void filter_name(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
name
based on names of the packages in thepackage_set
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_epoch(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
epoch
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_epoch(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
epoch
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
inline void filter_epoch(unsigned long pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
epoch
.- Since
5.2
- Parameters:
pattern – A number the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
.
-
void filter_epoch(const std::vector<unsigned long> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
epoch
.- Since
5.0
- Parameters:
patterns – A vector of numbers the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
.
-
inline void filter_version(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
version
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
,GLOB
,NOT_GLOB
.
-
void filter_version(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
version
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
,GLOB
,NOT_GLOB
.
-
inline void filter_release(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
release
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
,GLOB
,NOT_GLOB
.
-
void filter_release(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
release
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
,GLOB
,NOT_GLOB
.
-
inline void filter_arch(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
arch
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_arch(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
arch
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_name_arch(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
name
andarch
based on names and arches of the packages in thepackage_set
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_evr(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
epoch:version-release
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,GT
,LT
,GTE
,LTE
,EQ
.
-
void filter_evr(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
epoch:version-release
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,GT
,LT
,GTE
,LTE
,NEQ
.
-
inline void filter_nevra(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
name-[epoch:]version-release.arch
. The following matches are tolerant to omitted 0 epoch:EQ
,NEQ
,GT
,GTE
,LT
,LTE
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
,GLOB
,NOT_GLOB
,IGLOB
,NOT_IGLOB
,IEXACT
,NOT_IEXACT
.
-
void filter_nevra(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
name-[epoch:]version-release.arch
. The following matches are tolerant to omitted 0 epoch:EQ
,NEQ
,GT
,GTE
,LT
,LTE
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
,GLOB
,NOT_GLOB
,IGLOB
,NOT_IGLOB
,IEXACT
,NOT_IEXACT
.
-
void filter_nevra(const libdnf5::rpm::Nevra &nevra, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by the
name
,epoch
,version
,release
andarch
attributes from thenevra
object. Only the attributes that are not blank are used in the filter.- Since
5.0
- Parameters:
nevra – A Nevra object the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,IGLOB
,NOT_IGLOB
.
-
void filter_nevra(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
name-[epoch:]version-release.arch
attributes of the packages in thepackage_set
. Only packages whose name.arch is present in thepackage_set
are taken into account. Their epoch:version-release are then compared according to the value ofcmp_type
with those inpackage_set
. Only the matching packages are kept in the query. In caseNOT
is used incmp_type
, the matching packages are removed from the query.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
, and their combinations withNOT
.
-
inline void filter_sourcerpm(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
sourcerpm
.- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_sourcerpm(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
sourcerpm
.- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
inline void filter_url(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
url
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
void filter_url(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
url
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
inline void filter_summary(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
summary
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
void filter_summary(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
summary
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
inline void filter_description(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
description
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
void filter_description(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
description
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
void filter_provides(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
provides
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
void filter_provides(const Reldep &reldep, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
provides
.- Since
5.0
- Parameters:
reldep – RelDep object the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_provides(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
provides
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_provides(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
provides
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_requires(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
requires
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_requires(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
requires
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_requires(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
requires
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_requires(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
requires
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
void filter_conflicts(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
conflicts
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_conflicts(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
conflicts
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_conflicts(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
conflicts
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_conflicts(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
conflicts
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
void filter_obsoletes(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
obsoletes
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_obsoletes(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
obsoletes
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_obsoletes(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
obsoletes
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_obsoletes(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
obsoletes
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_recommends(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
recommends
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_recommends(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
recommends
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_recommends(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
recommends
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_recommends(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
recommends
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
void filter_suggests(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
suggests
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_suggests(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
suggests
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_suggests(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
suggests
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_suggests(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
suggests
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
void filter_enhances(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
enhances
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_enhances(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
enhances
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_enhances(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
enhances
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_enhances(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
enhances
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
void filter_supplements(const ReldepList &reldep_list, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
supplements
.- Since
5.0
- Parameters:
reldep_list – ReldepList with RelDep objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_supplements(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
supplements
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_supplements(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
supplements
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_supplements(const PackageSet &package_set, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
supplements
.- Since
5.0
- Parameters:
package_set – PackageSet with Package objects the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_file(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by
files
they contain.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
void filter_file(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by
files
they contain.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
,IEXACT
,NOT_IEXACT
,ICONTAINS
,NOT_ICONTAINS
,IGLOB
,NOT_IGLOB
,CONTAINS
,NOT_CONTAINS
.
-
inline void filter_location(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
location
.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
void filter_location(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by their
location
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
.
-
inline void filter_repo_id(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by
id
of the Repo they belong to.- Since
5.2
- Parameters:
pattern – A string the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_repo_id(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by
id
of the Repo they belong to.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GLOB
,NOT_GLOB
.
-
void filter_advisories(const libdnf5::advisory::AdvisoryQuery &advisory_query, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
Filter packages by advisories they are included in.
- Since
5.0
- Parameters:
advisory_query – AdvisoryQuery with Advisories that contain package lists the filter is matched against.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
.
-
void filter_latest_unresolved_advisories(const libdnf5::advisory::AdvisoryQuery &advisory_query, PackageQuery &installed, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::GTE)
Filter packages by the advisories they are included in, considering only the latest advisories that are not resolved in the currently installed package set.
- Since
5.0
- Parameters:
advisory_query – AdvisoryQuery with Advisories that contain package lists the filter is matched against.
installed – PackageQuery with currently installed packages.
cmp_type – A comparison (match) operator, defaults to
QueryCmp::EQ
. Supported values:EQ
,NEQ
,GT
,GTE
,LT
,LTE
.
-
void filter_installed()
Filter installed packages.
Removes from the query all packages that are not installed.
- Since
5.0
-
void filter_available()
Filter available packages.
Removes from the query all packages that are installed.
- Since
5.0
-
void filter_upgrades()
Filter available packages that are upgrades to installed packages.
Removes from the query all packages that are not upgrades to installed packages.
- Since
5.0
-
void filter_downgrades()
Filter available packages that are downgrades to installed packages.
Removes from the query all packages that are not downgrades to installed packages.
- Since
5.0
-
void filter_upgradable()
Filter installed packages for which there are available upgrades.
Only installed packages remain in the query, and only those for which upgrades are available.
- Since
5.0
-
void filter_downgradable()
Filter installed packages for which there are available downgrades.
Only installed packages remain in the query, and only those for which downgrades are available.
- Since
5.0
-
void filter_latest_evr(int limit = 1)
Group packages by
name
andarch
. Then within each group, keep packages that correspond with up tolimit
of (all but) latestevr
s in the group.- Since
5.0
- Parameters:
limit – If
limit
> 0, keeplimit
numberevr
s in each group. Iflimit
< 0, keep all butlimit
lastevr
s in each group.
-
void filter_latest_evr_any_arch(int limit = 1)
Group packages by
name
. Then within each group, keep packages that correspond with up tolimit
of (all but) latestevr
s in the group.- Since
5.2
- Parameters:
limit – If
limit
> 0, keeplimit
numberevr
s in each group. Iflimit
< 0, keep all butlimit
lastevr
s in each group.
-
void filter_earliest_evr(int limit = 1)
Group packages by
name
andarch
. Then within each group, keep packages that correspond with up tolimit
of (all but) earliestevr
s in the group.- Since
5.0
- Parameters:
limit – If
limit
> 0, keeplimit
numberevr
s in each group. Iflimit
< 0, keep all butlimit
lastevr
s in each group.
-
void filter_earliest_evr_any_arch(int limit = 1)
Group packages by
name
. Then within each group, keep packages that correspond with up tolimit
of (all but) earliestevr
s in the group.- Since
5.2
- Parameters:
limit – If
limit
> 0, keeplimit
numberevr
s in each group. Iflimit
< 0, keep all butlimit
lastevr
s in each group.
-
void filter_priority()
Group packages by
name
andarch
. Then within each group, keep packages that belong to a repo with the highest priority (the lowest number). The filter works only on available packages, installed packages are not affected.- Since
5.0
-
void filter_extras(const bool exact_evr = false)
Keep in the query only packages that are installed but not available in any enabled repository. Even excluded packages (e.g. using excludepkgs config option) are considered as available in repositories for the purpose of extras calculation. Those installed packages that are only part of non-active modules are also considered as extras.
- Parameters:
exact_evr – If false (default) extras calculation is based only on
name.arch
. That means package is not in extras if any version of the package exists in any of the enabled repositories. If true, filter_extras is more strict and returns each package which exact NEVRA is not present in any enabled repository.
-
void filter_recent(const time_t timestamp)
Keep in the query only recent packages - those with build time after given timestamp
- Parameters:
timestamp – Only packages built after this will pass
-
void filter_userinstalled()
Keep in the query only installed packages that are user-installed.
-
void filter_unneeded()
Filter unneeded packages. Unneeded packages are those which are installed as dependencies and are not required by any user-installed package any more.
-
std::pair<bool, libdnf5::rpm::Nevra> resolve_pkg_spec(const std::string &pkg_spec, const libdnf5::ResolveSpecSettings &settings, bool with_src)
Resolve spec according to provided settings. It tests whether spec is NEVRA type, provide, file or binary. It returns only the first match type. If spec has a match as NEVRA and provide type it only keeps matches with the first tested type (NEVRA).
-
void swap(PackageQuery &other) noexcept
-
void filter_duplicates()
Filter packages to keep only duplicates of installed packages. Packages are duplicate if they have the same
name
andarch
but differentevr
.
-
void filter_leaves()
Filter the leaf packages.
Leaf packages are installed packages that are not required as a dependency of another installed package. However, two or more installed packages might depend on each other in a dependency cycle. Packages in such cycles that are not required by any other installed package are also leaf.
-
void filter_reboot_suggested()
Filter packages whose installation or upgrade should cause a system reboot to be recommended. These are packages that either (1) belong to a hardcoded set of “core packages”, including the kernel and systemd, or (2) have an associated
reboot_suggested
advisory.
-
std::vector<std::vector<Package>> filter_leaves_groups()
Filter the leaf packages and return them grouped by their dependencies.
Leaf packages are installed packages that are not required as a dependency of another installed package. However, two or more installed packages might depend on each other in a dependency cycle. Packages in such cycles that are not required by any other installed package are also leaf. Packages in such cycles form a group of leaf packages.
- Returns:
Groups of one or more interdependent leaf packages.
-
void filter_installonly()
Filter installonly packages.
Filter packages that provide a capability that matches with any value in installonlypkgs configuration option.
-
void filter_versionlock()
Filter out versionlock excluded packages.
The packages versions excluded by versionlock are removed from the query.
- Since
5.1.13
-
using ExcludeFlags = libdnf5::sack::ExcludeFlags
-
class PackageSack
Public Functions
-
explicit PackageSack(const libdnf5::BaseWeakPtr &base)
-
explicit PackageSack(libdnf5::Base &base)
-
~PackageSack()
-
PackageSackWeakPtr get_weak_ptr()
Create WeakPtr to PackageSack.
-
libdnf5::BaseWeakPtr get_base() const
- Since
5.0
- Returns:
The
Base
object to which this object belongs.
-
int get_nsolvables() const noexcept
Returns number of solvables in pool.
-
void load_config_excludes_includes(bool only_main = false)
Loads excluded and included package sets from the configuration. Uses the
disable_excludes
,excludepkgs
, andincludepkgs
configuration options for calculation.- Since
5.0
- Parameters:
only_main – If
true
, the repository specific configurations are not used.
-
const PackageSet get_user_excludes()
Returns user excluded package set.
-
void add_user_excludes(const PackageSet &excludes)
Add package set to user excluded packages
- Since
5.0
- Parameters:
excludes – packages to add to excludes
-
void remove_user_excludes(const PackageSet &excludes)
Remove package set from user excluded packages
- Since
5.0
- Parameters:
excludes – packages to remove from excludes
-
void set_user_excludes(const PackageSet &excludes)
Resets user excluded packages to a new value
- Since
5.0
- Parameters:
excludes – packages to exclude
-
void clear_user_excludes()
Clear user excluded packages
- Since
5.0
-
const PackageSet get_user_includes()
Returns user included package set.
-
void add_user_includes(const PackageSet &includes)
Add package set to user included packages
- Since
5.0
- Parameters:
includes – packages to add to includes
-
void remove_user_includes(const PackageSet &includes)
Remove package set from user included packages
- Since
5.0
- Parameters:
includes – packages to remove from includes
-
void set_user_includes(const PackageSet &includes)
Resets user included packages to a new value
- Since
5.0
- Parameters:
includes – packages to include
-
void clear_user_includes()
Clear user included packages
- Since
5.0
-
VersionlockConfig get_versionlock_config() const
Returns versionlock configuration
- Since
5.1.13
-
const PackageSet get_versionlock_excludes()
Returns versionlock excluded package set
- Since
5.1.13
-
void add_versionlock_excludes(const PackageSet &excludes)
Add package set to versionlock excluded packages
- Since
5.1.13
- Parameters:
excludes – packages to add to excludes
-
void remove_versionlock_excludes(const PackageSet &excludes)
Remove package set from versionlock excluded packages
- Since
5.1.13
- Parameters:
excludes – packages to remove from excludes
-
void set_versionlock_excludes(const PackageSet &excludes)
Resets versionlock excluded packages to a new value
- Since
5.1.13
- Parameters:
excludes – packages to exclude
-
void clear_versionlock_excludes()
Clear versionlock excluded packages
- Since
5.1.13
Friends
- friend class repo::Repo
- friend class libdnf5::module::ModuleSack
-
explicit PackageSack(const libdnf5::BaseWeakPtr &base)
-
class PackageSet
Subclassed by libdnf5::rpm::PackageQuery
Public Types
-
using iterator = PackageSetIterator
Public Functions
-
explicit PackageSet(const libdnf5::BaseWeakPtr &base)
-
explicit PackageSet(libdnf5::Base &base)
-
PackageSet(const PackageSet &pset)
-
PackageSet(PackageSet &&pset) noexcept
-
~PackageSet()
-
PackageSet &operator=(const PackageSet &src)
-
PackageSet &operator=(PackageSet &&src)
-
PackageSet &operator|=(const PackageSet &other)
-
PackageSet &operator-=(const PackageSet &other)
-
PackageSet &operator&=(const PackageSet &other)
-
inline void update(const PackageSet &other)
Set union: elements that are in the current set or in the
other
set.- Since
5.0
- Parameters:
other – The set to unify with.
- Throws:
UsedDifferentSack – When the sets entering the operation do not share the same PackageSack.
-
inline void intersection(const PackageSet &other)
Set intersection: elements in the current set that are also in the
other
set.- Since
5.0
- Parameters:
other – The set to intersect with.
- Throws:
UsedDifferentSack – When the sets entering the operation do not share the same PackageSack.
-
inline void difference(const PackageSet &other)
Set difference: elements in the current set that are not in the
other
set.- Since
5.0
- Parameters:
other – The set to check for differences in.
- Throws:
UsedDifferentSack – When the sets entering the operation do not share the same PackageSack.
-
void clear() noexcept
Remove all packages from the set.
- Since
5.0
-
bool empty() const noexcept
- Since
5.0
- Returns:
true
if the set is empty,false
otherwise.
-
void add(const Package &pkg)
Add
pkg
to the set.- Since
5.0
- Parameters:
pkg – Package to be added to the set.
-
bool contains(const Package &pkg) const noexcept
- Since
5.0
- Parameters:
pkg – Package that is tested for presence.
- Returns:
true
if a package is in the set,false
otherwise.
-
void remove(const Package &pkg)
Remove
pkg
from the set.- Since
5.0
- Parameters:
pkg – Package to be removed from the set.
-
libdnf5::BaseWeakPtr get_base() const
-
size_t size() const noexcept
- Returns:
Number of elements in the set.
-
void swap(PackageSet &other) noexcept
Friends
- friend class libdnf5::base::Transaction
- friend class libdnf5::advisory::AdvisoryPackage
-
using iterator = PackageSetIterator
-
class PackageSetIterator
Public Types
-
using iterator_category = std::forward_iterator_tag
-
using difference_type = std::ptrdiff_t
-
using pointer = void
Public Functions
-
PackageSetIterator(const PackageSetIterator &other)
-
~PackageSetIterator()
-
PackageSetIterator &operator=(const PackageSetIterator &other)
-
PackageSetIterator &operator++()
-
PackageSetIterator operator++(int)
-
bool operator==(const PackageSetIterator &other) const
-
bool operator!=(const PackageSetIterator &other) const
-
void begin()
-
void end()
Public Static Functions
-
static PackageSetIterator begin(const PackageSet &package_set)
-
static PackageSetIterator end(const PackageSet &package_set)
-
using iterator_category = std::forward_iterator_tag
-
class Reldep
- #include <reldep.hpp>
Represent a relational dependency from libsolv.
Public Types
Public Functions
-
Reldep(const libdnf5::BaseWeakPtr &base, const std::string &reldep_string)
Creates a reldep from Char*. If parsing fails it raises std::runtime_error.
- Parameters:
base – Instance of Base class
reldep_string – String with the dependency
-
Reldep(libdnf5::Base &base, const std::string &reldep_string)
-
~Reldep()
-
const char *get_name() const
-
const char *get_relation() const
-
const char *get_version() const
-
std::string to_string() const
-
std::string to_string_description() const
Provide descriptive information about instance including string value and ID.
-
BaseWeakPtr get_base() const
Return weak pointer to base.
Public Static Functions
-
static bool is_rich_dependency(const std::string &pattern)
Test if pattern is rich dependency Return true if pattern start with “(”.
-
Reldep(const libdnf5::BaseWeakPtr &base, const std::string &reldep_string)
-
class ReldepList
Public Types
-
using iterator = ReldepListIterator
Public Functions
-
ReldepList(const ReldepList &src)
-
ReldepList(ReldepList &&src) noexcept
-
explicit ReldepList(const libdnf5::BaseWeakPtr &base)
-
explicit ReldepList(libdnf5::Base &base)
-
~ReldepList()
-
bool operator==(const ReldepList &other) const noexcept
-
bool operator!=(const ReldepList &other) const noexcept
-
ReldepList &operator=(const ReldepList &src)
-
ReldepList &operator=(ReldepList &&src) noexcept
-
bool add_reldep_with_glob(const std::string &reldep_str)
Adds a reldep from Char*. Only globs in name are processed. The process is slow therefore if reldepStr is not a glob please use addReldep() instead.
- Parameters:
reldep_str – p_reldepStr: Char*
- Returns:
bool - false if parsing or reldep creation fails
-
bool add_reldep(const std::string &reldep_str)
Adds a reldep from Char*. It does not support globs.
- Parameters:
reldep_str – p_reldepStr: Char*
- Returns:
bool false if parsing or reldep creation fails
-
void append(ReldepList &source)
-
int size() const noexcept
-
bool empty() const noexcept
Return true if container is empty.
-
void clear()
Remove all RelDeps.
-
libdnf5::BaseWeakPtr get_base() const
-
using iterator = ReldepListIterator
-
class ReldepListIterator
Public Types
-
using iterator_category = std::forward_iterator_tag
-
using difference_type = std::ptrdiff_t
-
using pointer = void
Public Functions
-
explicit ReldepListIterator(const ReldepList &reldep_list)
-
ReldepListIterator(const ReldepListIterator &other)
-
~ReldepListIterator()
-
ReldepListIterator &operator++()
-
ReldepListIterator operator++(int)
-
bool operator==(const ReldepListIterator &other) const
-
bool operator!=(const ReldepListIterator &other) const
-
void begin()
-
void end()
-
using iterator_category = std::forward_iterator_tag
-
class RpmSignature
Public Types
Public Functions
-
explicit RpmSignature(const libdnf5::BaseWeakPtr &base)
-
explicit RpmSignature(Base &base)
-
~RpmSignature()
-
RpmSignature(const RpmSignature &src)
-
RpmSignature &operator=(const RpmSignature &src)
-
RpmSignature(RpmSignature &&src) noexcept
-
RpmSignature &operator=(RpmSignature &&src) noexcept
-
CheckResult check_package_signature(const Package &pkg) const
Check signature of the
package
using public keys stored in rpm database. The method respects the repository’s pkg_gpgcheck option (or localpkg_gpgcheck for packages originating from the command line) and skips the check if these options are set tofalse
.- Parameters:
package – package to check.
- Returns:
CheckResult::OK - the check passed CheckResult::SKIPPED - the check was skipped CheckResult::FAILED_KEY_MISSING - no corresponding key found in rpmdb CheckResult::FAILED_NOT_TRUSTED - signature is valid but the key is not trusted CheckResult::FAILED_NOT_SIGNED - package is not signed but signature is required CheckResult::FAILED - check failed for another reason
-
CheckResult check_package_signature(const std::string &path) const
Check signature of rpm file in
path
location using public keys stored in rpm database.- Parameters:
package – package to check.
- Returns:
CheckResult::OK - the check passed CheckResult::FAILED_KEY_MISSING - no corresponding key found in rpmdb CheckResult::FAILED_NOT_TRUSTED - signature is valid but the key is not trusted CheckResult::FAILED_NOT_SIGNED - package is not signed but signature is required CheckResult::FAILED - check failed for another reason
Public Static Functions
-
static std::string check_result_to_string(CheckResult result)
Return string representation of the CheckResult enum.
-
explicit RpmSignature(const libdnf5::BaseWeakPtr &base)
-
class SignatureCheckError : public libdnf5::Error
Public Functions
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
inline virtual const char *get_domain_name() const noexcept override
-
class TransactionCallbacks
- #include <transaction_callbacks.hpp>
The base class for Transaction callbacks. User implements Transaction callbacks by inheriting this class and overriding its methods.
Typical order in which the transaction callbacks are called is:
before_begin
verification phase: verify_start, verify_progress, verify_stop
script_start, script_stop, script_error for pre transaction scriplets
preparation phase: transaction_start, transaction_progress, transaction_stop
install packages: elem_progress, install_start, install_progress, install_stop, with their scriptlets
remove packages: elem_progress, uninstall_start, uninstall_progress, uninstall_stop, with their scriptlets
script_start, script_stop, script_error for post transaction scriplets
after_complete
Public Types
-
enum class ScriptType
Scriptlet type.
Values:
-
enumerator UNKNOWN
-
enumerator PRE_INSTALL
-
enumerator POST_INSTALL
-
enumerator PRE_UNINSTALL
-
enumerator POST_UNINSTALL
-
enumerator PRE_TRANSACTION
-
enumerator POST_TRANSACTION
-
enumerator TRIGGER_PRE_INSTALL
-
enumerator TRIGGER_INSTALL
-
enumerator TRIGGER_UNINSTALL
-
enumerator TRIGGER_POST_UNINSTALL
-
enumerator UNKNOWN
Public Functions
-
explicit TransactionCallbacks()
-
TransactionCallbacks(const TransactionCallbacks&) = delete
-
TransactionCallbacks(TransactionCallbacks&&) = delete
-
virtual ~TransactionCallbacks()
-
TransactionCallbacks &operator=(const TransactionCallbacks&) = delete
-
TransactionCallbacks &operator=(TransactionCallbacks&&) = delete
-
virtual void before_begin(uint64_t total)
Called right before the rpm transaction is run
- Parameters:
total – Number of elements in the rpm transaction
-
virtual void after_complete(bool success)
Called after the transaction run finished
- Parameters:
success – Whether the rpm transaction was completed successfully
-
virtual void install_progress(const libdnf5::base::TransactionPackage &item, uint64_t amount, uint64_t total)
Report the package installation progress periodically.
- Parameters:
item – The TransactionPackage class instance for the package currently being installed
amount – The portion of the package already installed
total – The disk space used by the package after installation
-
virtual void install_start(const libdnf5::base::TransactionPackage &item, uint64_t total)
Installation of a package has started
- Parameters:
item – The TransactionPackage class instance for the package currently being installed
total – The disk space used by the package after installation
-
virtual void install_stop(const libdnf5::base::TransactionPackage &item, uint64_t amount, uint64_t total)
Installation of a package finished
- Parameters:
item – The TransactionPackage class instance for the package currently being installed
amount – The portion of the package that has been installed
total – The disk space used by the package after installation
-
virtual void transaction_progress(uint64_t amount, uint64_t total)
Preparation of a package has started.
- Parameters:
amount – Index of the package currently being prepared. Items are indexed starting from 0.
total – The total number of packages in the transaction
-
virtual void transaction_start(uint64_t total)
Preparation phase has started.
- Parameters:
total – The total number of packages in the transaction
-
virtual void transaction_stop(uint64_t total)
Preparation phase finished.
- Parameters:
total – The total number of packages in the transaction
-
virtual void uninstall_progress(const libdnf5::base::TransactionPackage &item, uint64_t amount, uint64_t total)
Report the package removal progress periodically.
- Parameters:
item – The TransactionPackage class instance for the package currently being removed
amount – The portion of the package already uninstalled
total – The disk space freed by the package after removal
-
virtual void uninstall_start(const libdnf5::base::TransactionPackage &item, uint64_t total)
Removal of a package has started
- Parameters:
item – The TransactionPackage class instance for the package currently being removed
total – The disk space freed by the package after removal
-
virtual void uninstall_stop(const libdnf5::base::TransactionPackage &item, uint64_t amount, uint64_t total)
Removal of a package finished
- Parameters:
item – The TransactionPackage class instance for the package currently being removed
amount – The portion of the package already uninstalled
total – The disk space freed by the package after removal
-
virtual void unpack_error(const libdnf5::base::TransactionPackage &item)
Unpacking of the package failed.
- Parameters:
item – The TransactionPackage class instance representing the package that failed to unpack
-
virtual void cpio_error(const libdnf5::base::TransactionPackage &item)
cpio error during the package installation. Currently not used by librpm.
- Parameters:
item – The TransactionPackage class instance representing the package that caused the error
-
virtual void script_error(const libdnf5::base::TransactionPackage *item, Nevra nevra, ScriptType type, uint64_t return_code)
Execution of the rpm scriptlet finished with error
- Parameters:
item – The TransactionPackage class instance for the package that owns the executed or triggered scriptlet. It can be
nullptr
if the scriptlet owner is not part of the transaction.nevra – Nevra of the package that owns the executed or triggered scriptlet.
type – Type of the scriptlet
return_code – The return code of the scriptlet execution
-
virtual void script_start(const libdnf5::base::TransactionPackage *item, Nevra nevra, ScriptType type)
Execution of the rpm scriptlet has started
- Parameters:
item – The TransactionPackage class instance for the package that owns the executed or triggered scriptlet. It can be
nullptr
if the scriptlet owner is not part of the transaction (e.g., a package installation triggered an update of the man database, owned by man-db package).nevra – Nevra of the package that owns the executed or triggered scriptlet.
type – Type of the scriptlet
-
virtual void script_stop(const libdnf5::base::TransactionPackage *item, Nevra nevra, ScriptType type, uint64_t return_code)
Execution of the rpm scriptlet finished without critical error
- Parameters:
item – The TransactionPackage class instance for the package that owns the executed or triggered scriptlet. It can be
nullptr
if the scriptlet owner is not part of the transaction.nevra – Nevra of the package that owns the executed or triggered scriptlet.
type – Type of the scriptlet
return_code – The return code of the scriptlet execution
-
virtual void elem_progress(const libdnf5::base::TransactionPackage &item, uint64_t amount, uint64_t total)
The installation/removal process for the item has started
- Parameters:
amount – Index of the package currently being processed. Items are indexed starting from 0.
total – The total number of packages in the transaction
-
virtual void verify_progress(uint64_t amount, uint64_t total)
Verification of a package files has started.
- Parameters:
amount – Index of the package currently being verified. Items are indexed starting from 0.
total – The total number of packages to verify
-
virtual void verify_start(uint64_t total)
Packages files verification phase has started. In this phase the signature of packages are verified.
- Parameters:
total – The total number of packages to verify
-
virtual void verify_stop(uint64_t total)
Packages files verification phase finished.
- Parameters:
total – The total number of packages to verify
Public Static Functions
-
static const char *script_type_to_string(ScriptType type) noexcept
- Parameters:
type – scriptlet type
- Returns:
string representation of the scriptlet type
-
class VersionlockCondition
- #include <versionlock_config.hpp>
A condition for the versionlock package. Each condition consist of three parts: key, comparison operator, and value. Key can be one of “epoch”, “evr”, “arch”. Supported comparison operators are “<”, “<=”, “=”, “>=”, “>”, “!=”.
- Since
5.1.13
Public Functions
-
VersionlockCondition(const std::string &key_str, const std::string &comparator_str, const std::string &value)
-
inline bool is_valid() const
Returns true if this configuration entry is valid - contains supported values in all three parts (key, operator, and value).
-
inline libdnf5::sack::QueryCmp get_comparator() const
Get the comparison operator.
-
inline std::string get_value() const
Get the value.
-
inline std::string get_key_str() const
Get the key as a string.
-
inline std::string get_comparator_str() const
Get the comparison operator as a string.
-
inline const std::vector<std::string> &get_errors() const
Get list of errors found during parsing the entry from configuration file.
-
std::string to_string(bool with_errors) const
Converts the condition to “key operator value” string usable for printing.
- Parameters:
with_errors – Include also error messages for invalid entries
-
class VersionlockConfig
- #include <versionlock_config.hpp>
Class contains parsed versionlock configuration file.
- Since
5.1.13
Public Functions
-
inline std::vector<VersionlockPackage> &get_packages()
Get list of configured versionlock entries.
-
void save()
Save configuration to the file specified in the constructor.
-
class VersionlockPackage
- #include <versionlock_config.hpp>
One versionlock configuration file entry. It consists of the package name and a set of conditions. All conditions must be true for package version to get locked.
- Since
5.1.13
Public Functions
-
VersionlockPackage(std::string_view name, std::vector<libdnf5::rpm::VersionlockCondition> &&conditions)
Creates an instance of
VersionlockPackage
class specifying the name of package.- Parameters:
name – Name of the package to be configured
-
inline bool is_valid() const
Returns true if this configuration entry is valid.
-
inline std::string get_name() const
Get the package name.
-
inline std::string get_comment() const
Get the comment for this entry.
-
inline const std::vector<VersionlockCondition> &get_conditions() const
Get the list of conditions configured for the package.
-
void add_condition(VersionlockCondition &&condition)
Add a new condition for the package.
-
inline const std::vector<std::string> &get_errors() const
Get list of errors found during parsing the entry from configuration file.
-
std::string to_string(bool with_errors, bool with_comment) const
Converts the package configuration to string usable for printing.
- Parameters:
with_errors – Include also error messages for invalid entries