libdnf5::module

enum class libdnf5::module::ModuleStatus

Values:

enumerator AVAILABLE
enumerator ENABLED
enumerator DISABLED
using libdnf5::module::ModuleSackWeakPtr = WeakPtr<ModuleSack, false>
LIBDNF_API std::string libdnf5::module::module_status_to_string (ModuleStatus status)
LIBDNF_API ModuleStatus libdnf5::module::module_status_from_string (const std::string &status)
class EnabledStreamError : public libdnf5::module::ModuleError

Public Functions

inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class EnableMultipleStreamsError : public libdnf5::module::ModuleError

Public Functions

inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class InvalidModuleStatus : public libdnf5::Error

Public Functions

InvalidModuleStatus(const std::string &status)
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.

class ModuleConflictError : public libdnf5::module::ModuleError

Public Functions

inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class ModuleDependency

Public Functions

ModuleDependency(const std::string &module_name, const std::vector<std::string> &streams)
ModuleDependency(std::string &&module_name, std::vector<std::string> &&streams)
~ModuleDependency()
ModuleDependency(const ModuleDependency &src)
ModuleDependency &operator=(const ModuleDependency &src)
ModuleDependency(ModuleDependency &&src) noexcept
ModuleDependency &operator=(ModuleDependency &&src) noexcept
const std::string &get_module_name() const

Since

5.0

Returns:

Name of the required module.

const std::vector<std::string> &get_streams() const

Since

5.0

Returns:

Vector of streams. Prefix ‘-’ denotes conflicting stream, otherwise, the stream is one of required. If there are no other streams, any active stream of the module can satisfy the require.

std::string to_string()
class ModuleError : public libdnf5::Error

Subclassed by libdnf5::module::EnableMultipleStreamsError, libdnf5::module::EnabledStreamError, libdnf5::module::ModuleConflictError, libdnf5::module::ModuleResolveError, libdnf5::module::NoModuleError, libdnf5::module::NoStreamError

class ModuleItem

Public Functions

bool operator==(const ModuleItem &rhs) const noexcept
bool operator!=(const ModuleItem &rhs) const noexcept
bool operator<(const ModuleItem &rhs) const noexcept
~ModuleItem()
std::string get_name() const

Since

5.0

Returns:

The module name.

std::string get_stream() const

Since

5.0

Returns:

The stream name.

long long get_version() const

Since

5.0

Returns:

The version.

std::string get_version_str() const
std::string get_context() const

Since

5.0

Returns:

The context.

std::string get_arch() const

Since

5.0

Returns:

The arch.

std::string get_full_identifier() const

Since

5.0

Returns:

The “name:stream:version:context:arch” string.

std::string get_summary() const

Since

5.0

Returns:

The summary of this ModuleItem.

std::string get_description() const

Since

5.0

Returns:

The description of this ModuleItem.

std::vector<std::string> get_artifacts() const

Since

5.0

Returns:

The list of RPM NEVRAs in this module.

std::vector<std::string> get_demodularized_rpms() const
Returns:

Sorted list of RPM names that are demodularized.

std::vector<ModuleProfile> get_profiles(const std::string &name) const

Since

5.0

Returns:

The list of ModuleProfiles matched by name (possibly a globby pattern).

std::vector<ModuleProfile> get_profiles() const
std::vector<std::string> get_default_profiles() const
Returns:

The default profiles.

bool get_static_context() const

Get the static_context value (needed for proper behaviour of modular solver).

Since

5.0

Returns:

The value of the static_context flag in modulemd. If true, the context string is static and represents a build and runtime configuration for this stream.

std::vector<ModuleDependency> get_module_dependencies(bool remove_platform = false) const

Since

5.0

Returns:

Module dependencies.

const std::string &get_repo_id() const

Since

5.0

Returns:

The repo id.

ModuleItemId get_id() const
std::string get_yaml() const
bool is_active() const

Return true if module_item belongs to enabled or default module stream and it is applicable forcurrent system. The decision is performed by a modular solver.

ModuleStatus get_status() const

Since

5.1.5

Returns:

The status of this ModuleItem.

bool is_default() const

Since

5.1.5

Returns:

Whether this ModuleItem is the default stream of the module.

ModuleItem(const ModuleItem &mpkg)
ModuleItem &operator=(const ModuleItem &mpkg)
ModuleItem(ModuleItem &&mpkg) noexcept
ModuleItem &operator=(ModuleItem &&mpkg) noexcept
struct ModuleItemId

Public Functions

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

Public Members

int id = {0}
class ModuleProfile

Public Functions

std::string get_name() const

Since

5.0

Returns:

The profile name.

std::string get_description() const

Since

5.0

Returns:

The profile description.

std::vector<std::string> get_rpms() const

Since

5.0

Returns:

The list of RPMs.

bool is_default() const

Since

5.0

Returns:

true if the profile is default for the associated stream.

ModuleProfile(const ModuleProfile &src)
ModuleProfile &operator=(const ModuleProfile &src)
ModuleProfile(ModuleProfile &&src) noexcept
ModuleProfile &operator=(ModuleProfile &&src) noexcept
~ModuleProfile()
class ModuleQuery : public libdnf5::sack::Query<ModuleItem>

Public Functions

explicit ModuleQuery(const libdnf5::BaseWeakPtr &base, bool empty = false)

Create a new ModuleQuery instance.

Parameters:
  • base – A weak pointer to Base

  • emptytrue to create empty query, false to create query with all modules

~ModuleQuery()
ModuleQuery(const ModuleQuery &src)
ModuleQuery &operator=(const ModuleQuery &src)
ModuleQuery(ModuleQuery &&src) noexcept
ModuleQuery &operator=(ModuleQuery &&src) noexcept
explicit ModuleQuery(libdnf5::Base &base, bool empty = false)

Create a new ModuleQuery instance.

Parameters:
  • base – Reference to Base

  • emptytrue to create empty query, false to create query with all modules

libdnf5::BaseWeakPtr get_base()

Since

5.0

Returns:

Weak pointer to the Base object.

void filter_name(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems 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 ModuleItems 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_stream(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems by their stream.

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_stream(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems by their stream.

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_version(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems by their version.

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_version(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems 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, GLOB, NOT_GLOB, IEXACT, NOT_IEXACT, ICONTAINS, NOT_ICONTAINS, IGLOB, NOT_IGLOB, CONTAINS, NOT_CONTAINS.

void filter_context(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems by their context.

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_context(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems by their context.

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_arch(const std::string &pattern, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems by their arch.

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_arch(const std::vector<std::string> &patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems 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, IEXACT, NOT_IEXACT, ICONTAINS, NOT_ICONTAINS, IGLOB, NOT_IGLOB, CONTAINS, NOT_CONTAINS.

void filter_latest(int limit = 1)

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

Since

5.0.4

Parameters:

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

void filter_nsvca(const Nsvcap &nsvcap, libdnf5::sack::QueryCmp cmp = libdnf5::sack::QueryCmp::EQ)

Filter ModuleItems by Nsvcap object.

Since

5.0.6

Parameters:
  • nsvcap – A Nsvcap 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, ICONTAINS, NOT_ICONTAINS, IGLOB, NOT_IGLOB, CONTAINS, NOT_CONTAINS.

void filter_enabled()

Filter ModuleItems with ModuleStatus::ENABLED.

Since

5.1.5

void filter_disabled()

Filter ModuleItems with ModuleStatus::DISABLED.

Since

5.1.5

std::pair<bool, Nsvcap> resolve_module_spec(const std::string &module_spec)

Filter ModuleItems by module_spec.

Since

5.0.6

Parameters:

module_spec – A module_spec the filter is matched against.

Returns:

true and matched Nsvcap if the module_spec was parsed successfully, false and empty Nsvcap otherwise.

class ModuleResolveError : public libdnf5::module::ModuleError

Public Functions

inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class ModuleSack
#include <module_sack.hpp>

Container with data and methods related to modules.

Public Functions

~ModuleSack()
ModuleSackWeakPtr get_weak_ptr()
const std::vector<std::unique_ptr<ModuleItem>> &get_modules()

Since

5.0

Returns:

All module items.

std::vector<ModuleItem*> get_active_modules()

Since

5.0

Returns:

Active module items. I.e. module items whose RPMs are included in the set of available packages.

const std::string &get_default_stream(const std::string &name) const

Since

5.0

Returns:

Default stream for given module.

std::vector<std::string> get_default_profiles(std::string module_name, std::string module_stream)

Since

5.0

Returns:

List of all default profiles for given module stream.

std::pair<base::SolverProblems, GoalProblem> resolve_active_module_items()

Resolve which module items are active. This means requesting all enabled streams or default streams (default streams only from not-enabled non-disabled modules), while excluding all disabled module streams.

Since

5.0

Returns:

A pair of problems in resolving to report and GoalProblem.

Friends

friend class libdnf5::Base
friend class libdnf5::Goal
friend class libdnf5::base::Transaction
friend class libdnf5::repo::Repo
friend class libdnf5::repo::RepoSack
class NoModuleError : public libdnf5::module::ModuleError

Public Functions

inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class NoStreamError : public libdnf5::module::ModuleError

Public Functions

inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class Nsvcap

Public Types

enum class Form

Values:

enumerator NSVCAP
enumerator NSVCA
enumerator NSVAP
enumerator NSVA
enumerator NSAP
enumerator NSA
enumerator NSVCP
enumerator NSVP
enumerator NSVC
enumerator NSV
enumerator NSP
enumerator NS
enumerator NAP
enumerator NA
enumerator NP
enumerator N
enumerator NSCP
enumerator NSC

Public Functions

Nsvcap()
~Nsvcap()
Nsvcap(const Nsvcap &src)
Nsvcap &operator=(const Nsvcap &src)
Nsvcap(Nsvcap &&src) noexcept
Nsvcap &operator=(Nsvcap &&src) noexcept
bool parse(const std::string &nsvcap_str, Form form)

Parse a string in a given form. If the parsing is successful, the attributes of this class are set accordingly, otherwise, they are left unchanged.

Since

5.0.6

Parameters:
  • nsvcap_str – A string to parse.

  • form – A module form in which the string should be.

Returns:

true if the pattern matched the form, false otherwise.

void clear()

Clear the attributes of this class - set them to empty strings.

Since

5.0.6

const std::string &get_name() const noexcept
const std::string &get_stream() const noexcept
const std::string &get_version() const noexcept
const std::string &get_context() const noexcept
const std::string &get_arch() const noexcept
const std::string &get_profile() const noexcept
void set_name(const std::string &name)
void set_stream(const std::string &stream)
void set_version(const std::string &version)
void set_context(const std::string &context)
void set_arch(const std::string &arch)
void set_profile(const std::string &profile)
void set_name(std::string &&name)
void set_stream(std::string &&stream)
void set_version(std::string &&version)
void set_context(std::string &&context)
void set_arch(std::string &&arch)
void set_profile(std::string &&profile)

Public Static Functions

static const std::vector<Form> &get_default_module_spec_forms()

The default forms and their order determine module_spec matching.

static std::vector<Nsvcap> parse(const std::string &pattern, const std::vector<Form> &forms)

Parse a string in one of the given forms. If the parsing is successful, the attributes of this class are set accordingly, otherwise, they are left unchanged.

Since

5.0.6

Parameters:
  • pattern – A string to parse.

  • forms – Module forms in one of which the string should be.

Returns:

true if the nsvcap_str matched one of the forms, false otherwise.

static std::vector<Nsvcap> parse(const std::string &pattern)

Parse a string. If the parsing is successful, the attributes of this class are set accordingly, otherwise, they are left unchanged.

Since

5.0.6

Parameters:

pattern – A string to parse.

Returns:

true if the nsvcap_str matched any form, false otherwise.