libdnf5::advisory

class Advisory
#include <advisory.hpp>

An advisory, represents advisory used to track security updates.

Public Functions

Advisory(const Advisory &src)
Advisory &operator=(const Advisory &src)
Advisory(Advisory &&src) noexcept
Advisory &operator=(Advisory &&src) noexcept
bool operator==(const Advisory &other) const noexcept
bool operator!=(const Advisory &other) const noexcept
~Advisory()

Destroy the Advisory object.

std::string get_name() const

Get name of this advisory.

Returns:

Name of this advisory as std::string.

std::string get_severity() const

Get severity of this advisory.

Returns:

Severity of this advisory as std::string.

std::string get_type() const

Get type of this advisory. Possible types are: “security”, “bugfix”, “enhancement”, “newpackage”.

Returns:

type of this advisory as std::string.

unsigned long long get_buildtime() const

Get buildtime of this advisory. Libsolv combines issued and updated dates into buildtime by always using the newer one.

Returns:

buildtime of this advisory.

std::string get_vendor() const

Get vendor of this advisory.

Returns:

Vendor of this advisory as std::string.

std::string get_description() const

Get description of this advisory.

Returns:

Description of this advisory as std::string.

std::string get_title() const

Get title of this advisory.

Returns:

Title of this advisory as std::string.

std::string get_status() const

Get status of this advisory.

Returns:

Status of this advisory as std::string.

std::string get_rights() const

Get rights of this advisory.

Returns:

Rights of this advisory as std::string.

std::string get_message() const

Get message of this advisory.

Returns:

Message of this advisory as std::string.

AdvisoryId get_id() const

Get AdvisoryId.

Returns:

AdvisoryId of this advisory.

std::vector<AdvisoryReference> get_references(std::vector<std::string> types = {}) const

Get all references of specified type from this advisory. Possible refenrece types are: “bugzilla”, “cve”, “vendor”.

Parameters:

types – What types of references to get. If not specified gets all types.

Returns:

Vector of AdvisoryReference objects.

std::vector<AdvisoryCollection> get_collections() const

Get all collections from this advisory.

Returns:

Vector of AdvisoryCollection objects.

bool is_applicable() const

Check whether at least one collection from this advisory is applicable.

Returns:

True if applicable, False otherwise.

class AdvisoryCollection

Public Functions

AdvisoryCollection(const AdvisoryCollection &src)
AdvisoryCollection &operator=(const AdvisoryCollection &src)
AdvisoryCollection(AdvisoryCollection &&src) noexcept
AdvisoryCollection &operator=(AdvisoryCollection &&src) noexcept
~AdvisoryCollection()
bool is_applicable() const

Whether this AdvisoryCollection is applicable. True when at least one AdvisoryModule in this AdvisoryCollection is active on the system, False otherwise.

AdvisoryId get_advisory_id() const

Get AdvisoryId of Advisory this AdvisoryCollection belongs to.

Returns:

AdvisoryId of this AdvisoryCollection.

std::vector<AdvisoryPackage> get_packages()

Get all AdvisoryPackages stored in this AdvisoryCollection

Returns:

std::vector of AdvisorPackages used as output.

std::vector<AdvisoryModule> get_modules()

Get all AdvisoryModules stored in this AdvisoryCollection

Returns:

std::vector of AdvisorModules.

Advisory get_advisory() const

Get Advisory this AdvisoryCollection belongs to.

Returns:

newly construted Advisory object of this AdvisoryCollection.

struct AdvisoryId

Public Functions

AdvisoryId() = default
inline explicit AdvisoryId(int id)
inline bool operator==(const AdvisoryId &other) const noexcept
inline bool operator!=(const AdvisoryId &other) const noexcept

Public Members

int id = {0}
class AdvisoryModule

Public Functions

AdvisoryModule(const AdvisoryModule &src)
AdvisoryModule(AdvisoryModule &&src) noexcept
AdvisoryModule &operator=(const AdvisoryModule &src)
AdvisoryModule &operator=(AdvisoryModule &&src) noexcept
~AdvisoryModule()
std::string get_name() const

Get name of this AdvisoryModule.

Returns:

Name of this AdvisoryModule as std::string.

std::string get_stream() const

Get stream of this AdvisoryModule.

Returns:

Stream of this AdvisoryModule as std::string.

std::string get_version() const

Get version of this AdvisoryModule.

Returns:

Version of this AdvisoryModule as std::string.

std::string get_context() const

Get context of this AdvisoryModule.

Returns:

Context of this AdvisoryModule as std::string.

std::string get_arch() const

Get arch of this AdvisoryModule.

Returns:

Arch of this AdvisoryModule as std::string.

std::string get_nsvca() const

Get NSVCA of this AdvisoryModule.

Returns:

NSVCA of this AdvisoryModule as std::string.

AdvisoryId get_advisory_id() const

Get AdvisoryId of Advisory this AdvisoryModule belongs to.

Returns:

AdvisoryId of this AdvisoryModule.

Advisory get_advisory() const

Get Advisory this AdvisoryModule belongs to.

Returns:

newly construted Advisory object of this AdvisoryModule.

AdvisoryCollection get_advisory_collection() const

Get AdvisoryCollection this AdvisoryModule belongs to.

Returns:

newly construted AdvisoryCollection object of this AdvisoryModule.

class AdvisoryPackage

Public Functions

AdvisoryPackage(const AdvisoryPackage &src)
AdvisoryPackage(AdvisoryPackage &&src) noexcept
AdvisoryPackage &operator=(const AdvisoryPackage &src)
AdvisoryPackage &operator=(AdvisoryPackage &&src) noexcept
~AdvisoryPackage()
std::string get_name() const

Get name of this AdvisoryPackage.

Returns:

Name of this AdvisoryPackage as std::string.

std::string get_epoch() const

Get epoch of this AdvisoryPackage.

Returns:

Epoch of this AdvisoryPackage as std::string.

std::string get_version() const

Get version of this AdvisoryPackage.

Returns:

Version of this AdvisoryPackage as std::string.

std::string get_release() const

Get release version of this AdvisoryPackage.

Returns:

Release of this AdvisoryPackage as std::string.

std::string get_evr() const

Get evr of this AdvisoryPackage.

Returns:

Evr of this AdvisoryPackage as std::string.

std::string get_arch() const

Get arch of this AdvisoryPackage.

Returns:

Arch of this AdvisoryPackage as std::string.

std::string get_nevra() const

Get NEVRA of this AdvisoryPackage.

Returns:

NEVRA of this AdvisoryPackage as std::string.

AdvisoryId get_advisory_id() const

Get AdvisoryId of Advisory this AdvisoryPackage belongs to.

Returns:

AdvisoryId of this AdvisoryPackage.

bool get_reboot_suggested() const

Get bool value whether reboot is suggested

Returns:

Reboot suggestion of this advisory package as bool

bool get_restart_suggested() const

Get bool value whether restart is suggested

Returns:

Restart suggestion of this advisory package as bool

bool get_relogin_suggested() const

Get bool value whether relogin is suggested

Returns:

Relogin suggestion of this advisory package as bool

Advisory get_advisory() const

Get Advisory this AdvisoryPackage belongs to.

Returns:

newly construted Advisory object of this AdvisoryPackage.

AdvisoryCollection get_advisory_collection() const

Get AdvisoryCollection this AdvisoryPackage belongs to.

Returns:

newly construted AdvisoryCollection object of this AdvisoryPackage.

Friends

friend class libdnf5::rpm::PackageQuery
friend class libdnf5::Goal
class AdvisoryQuery : public libdnf5::advisory::AdvisorySet
#include <advisory_query.hpp>

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

class AdvisoryReference

Public Functions

AdvisoryReference(const AdvisoryReference &src)
AdvisoryReference &operator=(const AdvisoryReference &src)
AdvisoryReference(AdvisoryReference &&src) noexcept
AdvisoryReference &operator=(AdvisoryReference &&src) noexcept
~AdvisoryReference()
std::string get_id() const

Get id of this advisory reference, this id is like a name of this reference (it is not libsolv id).

Returns:

id of this reference as std::string.

std::string get_type() const

Get type of this reference. Possible reference types are: “bugzilla”, “cve”, “vendor”.

Returns:

type of this reference as std::string.

const char *get_type_cstring() const

Get type of this reference.

Returns:

Type of this reference as const char* !! (temporal value)

std::string get_title() const

Get title of this reference.

Returns:

Title of this reference.

std::string get_url() const

Get url of this reference.

Returns:

Url of this reference.

class AdvisorySet

Subclassed by libdnf5::advisory::AdvisoryQuery

Public Types

using iterator = AdvisorySetIterator

Public Functions

explicit AdvisorySet(const libdnf5::BaseWeakPtr &base)
explicit AdvisorySet(libdnf5::Base &base)
AdvisorySet(const AdvisorySet &aset)
AdvisorySet(AdvisorySet &&aset) noexcept
~AdvisorySet()
AdvisorySet &operator=(const AdvisorySet &src)
AdvisorySet &operator=(AdvisorySet &&src)
inline iterator begin() const
inline iterator end() const
AdvisorySet &operator|=(const AdvisorySet &other)
AdvisorySet &operator-=(const AdvisorySet &other)
AdvisorySet &operator&=(const AdvisorySet &other)
inline void update(const AdvisorySet &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 AdvisorySack.

inline void intersection(const AdvisorySet &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 AdvisorySack.

inline void difference(const AdvisorySet &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 AdvisorySack.

void clear() noexcept

Remove all advisories 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 Advisory &adv)

Add adv to the set.

Since

5.0

Parameters:

advAdvisory to be added to the set.

bool contains(const Advisory &adv) const noexcept

Since

5.0

Parameters:

advAdvisory that is tested for presence.

Returns:

true if an advisory is in the set, false otherwise.

void remove(const Advisory &adv)

Remove adv from the set.

Since

5.0

Parameters:

advAdvisory 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(AdvisorySet &other) noexcept
std::vector<AdvisoryPackage> get_advisory_packages_sorted_by_name_arch_evr(bool only_applicable = false) const

Gather AdvisoryPackages for each Advisory in the set. The AdvisoryPackages are sorted by libsolv ids of name, arch and evr. This is a different sorting than sorting by the strings of AdvisoryPackages names, architectures and evrs.

Since

5.0

Parameters:

only_applicable – Whether to return only AdvisoryPackages from applicable AdvisoryCollections.

class AdvisorySetIterator

Public Types

using iterator_category = std::forward_iterator_tag
using difference_type = std::ptrdiff_t
using value_type = Advisory
using pointer = void
using reference = Advisory

Public Functions

AdvisorySetIterator(const AdvisorySetIterator &other)
~AdvisorySetIterator()
AdvisorySetIterator &operator=(const AdvisorySetIterator &other)
Advisory operator*()
AdvisorySetIterator &operator++()
AdvisorySetIterator operator++(int)
bool operator==(const AdvisorySetIterator &other) const
bool operator!=(const AdvisorySetIterator &other) const
void begin()
void end()

Public Static Functions

static AdvisorySetIterator begin(const AdvisorySet &advisory_set)
static AdvisorySetIterator end(const AdvisorySet &advisory_set)