PackageQuery

class PackageQuery : public libdnf::rpm::PackageSet

Public Functions

void filter_name(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their name.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – 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, libdnf::sack::QueryCmp cmp_type = libdnf::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 – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_epoch(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their epoch.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_epoch(const std::vector<unsigned long> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their epoch.

Since

5.0

Parameters
  • patterns – A vector of numbers the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GT, GTE, LT, LTE.

void filter_version(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their version.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – 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, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their release.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GT, GTE, LT, LTE, GLOB, NOT_GLOB.

void filter_arch(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their arch.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_name_arch(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::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 – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_evr(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::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 – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, GT, LT, GTE, LTE, EQ.

void filter_nevra(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::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 – 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 libdnf::rpm::Nevra &nevra, libdnf::sack::QueryCmp cmp_type = libdnf::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 – 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, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their name-[epoch:]version-release.arch attributes of the packages in the package_set.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_sourcerpm(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their sourcerpm.

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_url(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their url.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – 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, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their summary.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – 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, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their summary.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – 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, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their provides.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_provides(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their provides.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_requires(const ReldepList &reldep_list, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their requires.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_requires(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their requires.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_requires(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their requires.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_conflicts(const ReldepList &reldep_list, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their conflicts.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_conflicts(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their conflicts.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_conflicts(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their conflicts.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_obsoletes(const ReldepList &reldep_list, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their obsoletes.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_obsoletes(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their obsoletes.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_obsoletes(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their obsoletes.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_recommends(const ReldepList &reldep_list, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their recommends.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_recommends(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their recommends.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_recommends(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their recommends.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_suggests(const ReldepList &reldep_list, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their suggests.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_suggests(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their suggests.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_suggests(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their suggests.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_enhances(const ReldepList &reldep_list, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their enhances.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_enhances(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their enhances.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_enhances(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their enhances.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_supplements(const ReldepList &reldep_list, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their supplements.

Since

5.0

Parameters
  • reldep_list – ReldepList with RelDep objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_supplements(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their supplements.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_supplements(const PackageSet &package_set, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their supplements.

Since

5.0

Parameters
  • package_setPackageSet with Package objects the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_file(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by files they contain.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – 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_location(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::sack::QueryCmp::EQ)

Filter packages by their location.

Since

5.0

Parameters
  • patterns – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ.

void filter_repo_id(const std::vector<std::string> &patterns, libdnf::sack::QueryCmp cmp_type = libdnf::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 – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GLOB, NOT_GLOB.

void filter_advisories(const libdnf::advisory::AdvisoryQuery &advisory_query, libdnf::sack::QueryCmp cmp_type = libdnf::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 – A comparison (match) operator, defaults to QueryCmp::EQ. Supported values: EQ, NEQ, GT, GTE, LT, LTE.

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_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_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