AdvisoryQuery

class AdvisoryQuery : public libdnf5::advisory::AdvisorySet

AdvisoryQuery is the only way how to access advisories. It is constructed using Base and filled with advisories from enabled repositories in its RepoSack.

Public Functions

explicit AdvisoryQuery(const libdnf5::BaseWeakPtr &base)

Create a new AdvisoryQuery instance.

Parameters:

base – A weak pointer to Base

explicit AdvisoryQuery(libdnf5::Base &base)

Create a new AdvisoryQuery instance.

Parameters:

base – Reference to Base

AdvisoryQuery(const AdvisoryQuery &src)
AdvisoryQuery &operator=(const AdvisoryQuery &src)
AdvisoryQuery(AdvisoryQuery &&src) noexcept
AdvisoryQuery &operator=(AdvisoryQuery &&src) noexcept
~AdvisoryQuery()
void filter_name(const std::string &pattern, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter Advisories by name.

Parameters:
  • pattern – Pattern used when matching against advisory names.

  • cmp_type – What comparator to use with pattern, allows: EQ, GLOB, IGLOB.

void filter_name(const std::vector<std::string> &patterns, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
void filter_type(const std::string &type, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::IEXACT)

Filter Advisories by type.

Parameters:
  • type – Possible types are: “security”, “bugfix”, “enhancement”, “newpackage”.

  • cmp_type – What comparator to use with type, allows: IEXACT (default), EQ.

void filter_type(const std::vector<std::string> &types, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::IEXACT)
void filter_reference(const std::string &pattern, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter Advisories by reference.

Parameters:
  • pattern – Pattern to match with reference id.

  • cmp_type – What comparator to use with pattern, allows: EQ, IEXACT, GLOB, IGLOB, CONTAINS, ICONTAINS.

  • type – Possible reference types are: “bugzilla”, “cve”, “vendor”. If none is specified it matches all.

void filter_reference(const std::string &pattern, const std::string &type, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
void filter_reference(const std::vector<std::string> &patterns, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
void filter_reference(const std::vector<std::string> &patterns, const std::string &type, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)
void filter_severity(const std::string &severity, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::IEXACT)

Filter Advisories by severity.

Parameters:
  • severity – Possible severities are: “critical”, “important”, “moderate”, “low”, “none”.

  • cmp_type – What comparator to use with severity, allows: IEXACT (default), EQ.

void filter_severity(const std::vector<std::string> &severities, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::IEXACT)
void filter_packages(const libdnf5::rpm::PackageSet &package_set, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter out advisories that don’t contain at least one AdvisoryPackage that has a counterpart Package in package_set such that they have matching name and architecture and also their epoch-version-release complies to cmp_type.

Parameters:
  • package_setlibdnf5::rpm::PackageSet used when filtering.

  • cmp_type – Condition to fulfill when comparing epoch-version-release of packages.

std::vector<AdvisoryPackage> get_advisory_packages_sorted(const libdnf5::rpm::PackageSet &package_set, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ) const

Get std::vector of AdvisoryPackages present in advisories from query. Each AdvisoryPackage is returned only if it has a counterpart Package in package_set such that they have matching name and architecture and also their epoch-version-release complies to cmp_type. AdvisoryPackages are sorted in the std::vector by Name, Arch and EVR.

Parameters:
  • package_setlibdnf5::rpm::PackageSet used when filtering.

  • cmp_type – Condition to fulfill when comparing epoch-version-release of packages.

Returns:

std::vector of AdvisoryPackages