PackageQuery

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 the package_set.

Since

5.0

Parameters:
  • package_setPackageSet 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 and arch based on names and arches of the packages in the package_set.

Since

5.0

Parameters:
  • package_setPackageSet 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 and arch attributes from the nevra 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 the package_set. Only packages whose name.arch is present in the package_set are taken into account. Their epoch:version-release are then compared according to the value of cmp_type with those in package_set. Only the matching packages are kept in the query. In case NOT is used in cmp_type, the matching packages are removed from the query.

Since

5.0

Parameters:
  • package_setPackageSet 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 with NOT.

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 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_description(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.

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_setPackageSet 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_setPackageSet 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_setPackageSet 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_setPackageSet 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_setPackageSet 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_setPackageSet 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_setPackageSet 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.

  • installedPackageQuery 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()
void filter_available()
void filter_upgrades()
void filter_downgrades()
void filter_upgradable()
void filter_downgradable()
void filter_latest_evr(int limit = 1)

Group packages by name and arch. Then within each group, keep packages that correspond with up to limit of (all but) latest evrs in the group.

Since

5.0

Parameters:

limit – If limit > 0, keep limit number evrs in each group. If limit < 0, keep all but limit last evrs 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 to limit of (all but) latest evrs in the group.

Since

5.2

Parameters:

limit – If limit > 0, keep limit number evrs in each group. If limit < 0, keep all but limit last evrs in each group.

void filter_earliest_evr(int limit = 1)

Group packages by name and arch. Then within each group, keep packages that correspond with up to limit of (all but) earliest evrs in the group.

Since

5.0

Parameters:

limit – If limit > 0, keep limit number evrs in each group. If limit < 0, keep all but limit last evrs 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 to limit of (all but) earliest evrs in the group.

Since

5.2

Parameters:

limit – If limit > 0, keep limit number evrs in each group. If limit < 0, keep all but limit last evrs in each group.

void filter_priority()

Group packages by name and arch. 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 and arch but different evr.

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