libdnf5

enum class libdnf5::ProblemRules

Define a type of a broken solver rule.

Values:

enumerator RULE_DISTUPGRADE
enumerator RULE_INFARCH
enumerator RULE_UPDATE
enumerator RULE_JOB
enumerator RULE_JOB_UNSUPPORTED
enumerator RULE_JOB_NOTHING_PROVIDES_DEP
enumerator RULE_JOB_UNKNOWN_PACKAGE
enumerator RULE_JOB_PROVIDED_BY_SYSTEM
enumerator RULE_PKG
enumerator RULE_BEST_1
enumerator RULE_BEST_2
enumerator RULE_PKG_NOT_INSTALLABLE_1
enumerator RULE_PKG_NOT_INSTALLABLE_2
enumerator RULE_PKG_NOT_INSTALLABLE_3
enumerator RULE_PKG_NOT_INSTALLABLE_4
enumerator RULE_PKG_NOTHING_PROVIDES_DEP
enumerator RULE_PKG_SAME_NAME
enumerator RULE_PKG_CONFLICTS
enumerator RULE_PKG_OBSOLETES
enumerator RULE_PKG_INSTALLED_OBSOLETES
enumerator RULE_PKG_IMPLICIT_OBSOLETES
enumerator RULE_PKG_REQUIRES
enumerator RULE_PKG_SELF_CONFLICT
enumerator RULE_YUMOBS
enumerator RULE_UNKNOWN
enumerator RULE_PKG_REMOVAL_OF_PROTECTED
enumerator RULE_PKG_REMOVAL_OF_RUNNING_KERNEL
enumerator RULE_MODULE_DISTUPGRADE
enumerator RULE_MODULE_INFARCH
enumerator RULE_MODULE_UPDATE
enumerator RULE_MODULE_JOB
enumerator RULE_MODULE_JOB_UNSUPPORTED
enumerator RULE_MODULE_JOB_NOTHING_PROVIDES_DEP
enumerator RULE_MODULE_JOB_UNKNOWN_PACKAGE
enumerator RULE_MODULE_JOB_PROVIDED_BY_SYSTEM
enumerator RULE_MODULE_PKG
enumerator RULE_MODULE_BEST_1
enumerator RULE_MODULE_BEST_2
enumerator RULE_MODULE_PKG_NOT_INSTALLABLE_1
enumerator RULE_MODULE_PKG_NOT_INSTALLABLE_2
enumerator RULE_MODULE_PKG_NOT_INSTALLABLE_3
enumerator RULE_MODULE_PKG_NOT_INSTALLABLE_4
enumerator RULE_MODULE_PKG_NOTHING_PROVIDES_DEP
enumerator RULE_MODULE_PKG_SAME_NAME
enumerator RULE_MODULE_PKG_CONFLICTS
enumerator RULE_MODULE_PKG_OBSOLETES
enumerator RULE_MODULE_PKG_INSTALLED_OBSOLETES
enumerator RULE_MODULE_PKG_IMPLICIT_OBSOLETES
enumerator RULE_MODULE_PKG_REQUIRES
enumerator RULE_MODULE_PKG_SELF_CONFLICT
enumerator RULE_MODULE_YUMOBS
enumerator RULE_MODULE_UNKNOWN
enumerator RULE_PKG_INSTALLED_CONFLICTS
enumerator RULE_PKG_INSTALLED_REQUIRES
enum class libdnf5::GoalProblem : uint32_t

Define a type of information, hint, or problem gathered during libdnf5::Goal::resolve()

Values:

enumerator NO_PROBLEM
enumerator SOLVER_ERROR
enumerator NOT_FOUND
enumerator EXCLUDED
enumerator ONLY_SRC
enumerator NOT_FOUND_IN_REPOSITORIES
enumerator NOT_INSTALLED
enumerator NOT_INSTALLED_FOR_ARCHITECTURE
enumerator HINT_ICASE
enumerator HINT_ALTERNATIVES
enumerator INSTALLED_LOWEST_VERSION
enumerator INSTALLED_IN_DIFFERENT_VERSION
enumerator NOT_AVAILABLE
enumerator ALREADY_INSTALLED
enumerator SOLVER_PROBLEM_STRICT_RESOLVEMENT
enumerator WRITE_DEBUG
enumerator UNSUPPORTED_ACTION
enumerator MULTIPLE_STREAMS
enumerator EXCLUDED_VERSIONLOCK
enumerator MODULE_SOLVER_ERROR_DEFAULTS

Error in module defaults detected during resolvement of module dependencies.

enumerator MODULE_SOLVER_ERROR_LATEST

Problem with latest modules during resolvement of module dependencies.

enumerator MODULE_SOLVER_ERROR

Error detected during resolvement of module dependencies.

enumerator MODULE_CANNOT_SWITH_STREAMS
enumerator EXTRA

Error when transaction contains additional unexpected elements. Used when replaying transactions.

enumerator MALFORMED
enumerator NOT_FOUND_DEBUGINFO
enumerator NOT_FOUND_DEBUGSOURCE
enumerator MERGE_ERROR
enum class libdnf5::GoalAction

Types of Goal actions.

Values:

enumerator INSTALL
enumerator INSTALL_OR_REINSTALL
enumerator INSTALL_VIA_PROVIDE
enumerator INSTALL_BY_COMPS
enumerator REINSTALL
enumerator UPGRADE
enumerator UPGRADE_MINIMAL
enumerator UPGRADE_ALL
enumerator UPGRADE_ALL_MINIMAL
enumerator DISTRO_SYNC
enumerator DISTRO_SYNC_ALL
enumerator DOWNGRADE
enumerator REMOVE
enumerator RESOLVE
enumerator REASON_CHANGE
enumerator ENABLE
enumerator DISABLE
enumerator RESET
enumerator REPLAY_PARSE
enumerator REPLAY_INSTALL
enumerator REPLAY_REMOVE
enumerator REPLAY_UPGRADE
enumerator REPLAY_REINSTALL
enumerator REPLAY_REASON_CHANGE
enumerator REPLAY_REASON_OVERRIDE
enumerator REVERT_COMPS_UPGRADE
enumerator INSTALL_DEBUG
enumerator MERGE
enum class libdnf5::GoalSetting

Settings for GoalJobSettings.

Values:

enumerator AUTO
enumerator SET_TRUE
enumerator SET_FALSE
enum class libdnf5::GoalUsedSetting

Unresolved or resolved values based on GoalSetting.

Values:

enumerator UNUSED
enumerator USED_TRUE
enumerator USED_FALSE
enum libdnf5::FormatDetailLevel

Values:

enumerator Plain
enumerator WithName
enumerator WithDomainAndName
using libdnf5::LogRouterWeakPtr = WeakPtr<LogRouter, false>
using libdnf5::VarsWeakPtr = WeakPtr<Vars, false>
using libdnf5::BaseWeakPtr = WeakPtr<Base, false>
using libdnf5::OptionStringList = OptionStringContainer<std::vector<std::string>>
using libdnf5::OptionStringSet = OptionStringContainer<std::set<std::string>>
using libdnf5::OptionStringAppendList = OptionStringContainer<std::vector<std::string>, true>
using libdnf5::OptionStringAppendSet = OptionStringContainer<std::set<std::string>, true>
constexpr uid_t libdnf5::INVALID_UID = static_cast<uid_t>(-1)
constexpr const char *libdnf5::PERSISTDIR = "/var/lib/dnf"
constexpr const char *libdnf5::SYSTEM_STATE_DIR = "/usr/lib/sysimage/libdnf5"
constexpr const char *libdnf5::SYSTEM_CACHEDIR = "/var/cache/libdnf5"
constexpr const char *libdnf5::CONF_FILENAME = "/etc/dnf/dnf.conf"
constexpr const char *libdnf5::CONF_DIRECTORY = "/etc/dnf/libdnf5.conf.d"
constexpr const char *libdnf5::VERSIONLOCK_CONF_FILENAME = "/etc/dnf/versionlock.toml"
constexpr const char *libdnf5::PLUGINS_CONF_DIR = "/etc/dnf/libdnf5-plugins"
const std::vector<std::string> libdnf5::REPOSITORY_CONF_DIRS{"/etc/yum.repos.d", "/etc/distro.repos.d", "/usr/share/dnf5/repos.d"}
constexpr const char *libdnf5::REPOS_OVERRIDE_DIR = "/etc/dnf/repos.override.d"
constexpr const char *libdnf5::TRANSACTION_LOCK_FILEPATH = "/run/dnf/rpmtransaction.lock"
const std::vector<std::string> libdnf5::VARS_DIRS = {"/usr/share/dnf5/vars.d", "/etc/dnf/vars"}
const std::vector<std::string> libdnf5::GROUP_PACKAGE_TYPES = {"mandatory", "default", "conditional"}
const std::vector<std::string> libdnf5::INSTALLONLYPKGS{"kernel", "kernel-PAE", "installonlypkg(kernel)", "installonlypkg(kernel-module)", "installonlypkg(vm)", "multiversion(kernel)"}
constexpr const char *libdnf5::BUGTRACKER = "https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=dnf"
constexpr const char *libdnf5::METADATA_TYPE_COMPS = "comps"
constexpr const char *libdnf5::METADATA_TYPE_FILELISTS = "filelists"
constexpr const char *libdnf5::METADATA_TYPE_OTHER = "other"
constexpr const char *libdnf5::METADATA_TYPE_PRESTO = "presto"
constexpr const char *libdnf5::METADATA_TYPE_UPDATEINFO = "updateinfo"
constexpr const char *libdnf5::METADATA_TYPE_ALL = "all"
constexpr const char *libdnf5::METADATA_TYPE_APPSTREAM = "appstream"
const std::set<std::string> libdnf5::OPTIONAL_METADATA_TYPES{METADATA_TYPE_COMPS, METADATA_TYPE_FILELISTS, METADATA_TYPE_OTHER, METADATA_TYPE_PRESTO, METADATA_TYPE_UPDATEINFO, METADATA_TYPE_APPSTREAM}
static constexpr PluginAPIVersion libdnf5::PLUGIN_API_VERSION   = {.major = 2, .minor = 2}
LIBDNF_API std::string libdnf5::goal_action_to_string (GoalAction action)

Convert GoalAction enum to user-readable string.

LIBDNF_API bool libdnf5::goal_action_is_replay (GoalAction action)

Check whether the action is a replay action.

inline GoalProblem libdnf5::operator|(GoalProblem lhs, GoalProblem rhs)
inline GoalProblem libdnf5::operator|=(GoalProblem &lhs, GoalProblem rhs)
inline GoalProblem libdnf5::operator&(GoalProblem lhs, GoalProblem rhs)
template<typename TException>
inline void libdnf5::throw_with_nested(TException &&ex)

Throws an exception that also stores the currently active exception.

It does the same thing as std::throw_with_nested(TException && ex), except that instead of an unspecified type that is publicly derived from both std::nested_exception and std::decay<TException>::type, it throws a type **NestedException<std::decay<TException>::type>** that is publicly derived from both std::nested_exception and std::decay<TException>::type.

In other words, it replaces the unspecified type (the type defined by the implementation in the standard library) with our specification. Knowing the type can simplify exception handling in some cases. For example, avoiding the need to define another type for SWIG.

LIBDNF_API std::string libdnf5::format (const std::exception &e, FormatDetailLevel detail)

Formats the error message of an exception. If the exception is nested, recurses to format the message of the exception it holds.

LIBDNF_API uid_t libdnf5::read_login_uid_from_proc (pid_t pid) noexcept

Read the process owner login uid from the “/proc/<pid>/loginuid”.

Since

5.0

Parameters:

pid – process id

Returns:

libdnf5::INVALID_UID if fails, login uid otherwise

LIBDNF_API uid_t libdnf5::get_login_uid () noexcept

Return the current user login uid, if available. The getuid() is returned instead if there was a problem. The value is cached.

Since

5.0

template<typename T>
inline Set<T> libdnf5::operator|(const Set<T> &lhs, const Set<T> &rhs)
template<typename T>
inline Set<T> libdnf5::operator&(const Set<T> &lhs, const Set<T> &rhs)
template<typename T>
inline Set<T> libdnf5::operator-(const Set<T> &lhs, const Set<T> &rhs)
template<typename T>
inline Set<T> libdnf5::operator^(const Set<T> &lhs, const Set<T> &rhs)
LIBDNF_API std::unique_ptr< libdnf5::Logger > libdnf5::create_file_logger (libdnf5::Base &base, const std::string &filename)

Helper method for creating a file logger in logdir location with given file name.

Parameters:
  • base – Reference to Base for loading the configured logger path.

  • filename – Name of the log file.

Returns:

Instance of a new file logger.

LIBDNF_API std::unique_ptr< libdnf5::Logger > libdnf5::create_rotating_file_logger (libdnf5::Base &base, const std::string &filename)

Helper method for creating a rotating file logger in logdir location with given file name.

Parameters:
  • base – Reference to Base for loading the configured parameters.

  • filename – Name of the log file.

Returns:

Instance of a new rotating file logger.

LIBDNF_API LibraryVersion libdnf5::get_library_version () noexcept

Since

5.0

Returns:

Library version

LIBDNF_API PluginAPIVersion libdnf5::get_plugin_api_version () noexcept

Since

5.0

Returns:

Plugin API version implemented in the library

class AssertionError : public std::logic_error
#include <exception.hpp>

An AssertionError is a fault in the program logic, it is thrown when an incorrect sequence of actions has led to an invalid state in which it is impossible to continue running the program.

Public Functions

explicit AssertionError(const char *assertion, const SourceLocation &location, const std::string &message)
const char *what() const noexcept override
inline const char *assertion() const noexcept
inline const char *file_name() const noexcept
inline unsigned int source_line() const noexcept
inline const char *function_name() const noexcept
inline const char *message() const noexcept
class Base
#include <base.hpp>

Instances of :class:libdnf5::Base are the central point of functionality supplied by libdnf5. An application will typically create a single instance of this class which it will keep for the run-time needed to accomplish its packaging tasks. :class:.Base instances are stateful objects owning various data.

Public Functions

Base(std::vector<std::unique_ptr<Logger>> &&loggers = {})

Constructs a new Base instance and sets the destination loggers.

~Base()
void set_download_callbacks(std::unique_ptr<repo::DownloadCallbacks> &&download_callbacks)
repo::DownloadCallbacks *get_download_callbacks()
void lock()

Sets the pointer to the locked instance “Base” to “this” instance. Blocks if the pointer is already set. Pointer to a locked “Base” instance can be obtained using “get_locked_base()”.

void unlock()

Resets the pointer to a locked “Base” instance to “nullptr”. Throws an exception if another or no instance is locked.

void load_config()

Loads main configuration. The file defined in the current configuration and files in the drop-in directories are used.

ConfigMain &get_config()
Returns:

a reference to configuration

LogRouterWeakPtr get_logger()
comps::CompsSackWeakPtr get_comps_sack()
repo::RepoSackWeakPtr get_repo_sack()
rpm::PackageSackWeakPtr get_rpm_package_sack()
module::ModuleSackWeakPtr get_module_sack()

Throws libdnf5::AssertionError when used with libdnf5 compiled without modules enabled.

void enable_disable_plugins(const std::vector<std::string> &plugin_names, bool enable)

Adds a request to enable/disable plugins that match the names (glob patterns) in the list. Can be called multiple times. Requests (plugin_names and enable state) are queued. The enable state of a plugin is set according to the last matching request. Must be called before the Base::setup.

Parameters:
  • plugin_names – Plugin names (glob patterns) to enable/disable

  • enable – Request: true - enable plugins, false - disable plugins

Throws:

libdnf5::UserAssertionError – When called after Base::setup

const std::vector<plugin::PluginInfo> &get_plugins_info() const
Throws:

libdnf5::UserAssertionError – When called before Base::setup

Returns:

a list of information about plugins found during Base::setup

void setup()

Loads libdnf plugins, vars from environment, varsdirs and installroot (releasever, arch) and resolves configuration of protected_packages (glob:). To prevent differences between configuration and internal Base settings, following configurations will be locked: installroot, varsdir. The method is supposed to be called after configuration and vars are updated, application plugins applied their pre configuration modification in configuration, but before repositories are loaded or any Package or Advisory query created. The method is recommended to be called before loading repositories, because not all variables for substitutions might be available. Caution - modification of vars after this call might be problematic, because architecture is already fixed for our solver. Calling the method for the second time result in throwing an exception

bool is_initialized()

Returns true when setup() (mandatory method in many workflows) was already called.

void notify_repos_configured()

Notifies the libdnf5 library that the repositories are configured. It can be called before load_repos. The libdnf5 library can then call plugins that can make final adjustments to the repositories configuration. In the case that it has not been called, it is called automatically at the beginning of the load_repos method. Calling the method for the second time result in throwing an exception.

bool are_repos_configured() const noexcept

Returns true when notify_repos_configured() was already called (by user or automatically)

transaction::TransactionHistoryWeakPtr get_transaction_history()

Warning

This method is experimental/unstable and should not be relied on. It may be removed without warning

VarsWeakPtr get_vars()

Gets base variables. They can be used in configuration files. Syntax in the config - ${var_name} or $var_name.

libdnf5::BaseWeakPtr get_weak_ptr()

Public Static Functions

static Base *get_locked_base() noexcept

Returns a pointer to a locked “Base” instance or “nullptr” if no instance is locked.

Friends

friend class libdnf5::InternalBaseUser
friend class libdnf5::base::Transaction
friend class libdnf5::Goal
friend class libdnf5::rpm::Package
friend class libdnf5::comps::Group
friend class libdnf5::comps::Environment
friend class libdnf5::advisory::AdvisoryQuery
friend class libdnf5::module::ModuleDB
friend class libdnf5::module::ModuleSack
friend class libdnf5::repo::RepoSack
friend class libdnf5::repo::SolvRepo
class Config
#include <config.hpp>

Base class for configurations objects.

Subclassed by libdnf5::ConfigMain, libdnf5::repo::ConfigRepo

Public Functions

OptionBinds &opt_binds() noexcept
Config()
virtual ~Config()
virtual void load_from_parser(const ConfigParser &parser, const std::string &section, const Vars &vars, Logger &logger, Option::Priority priority)
class ConfigMain : public libdnf5::Config
#include <config_main.hpp>

Holds global configuration.

Public Functions

ConfigMain()
~ConfigMain()
OptionNumber<std::int32_t> &get_debuglevel_option()
const OptionNumber<std::int32_t> &get_debuglevel_option() const
OptionNumber<std::int32_t> &get_errorlevel_option()

Deprecated:

The option does nothing

const OptionNumber<std::int32_t> &get_errorlevel_option() const

Deprecated:

The option does nothing

OptionPath &get_installroot_option()
const OptionPath &get_installroot_option() const
OptionPath &get_config_file_path_option()
const OptionPath &get_config_file_path_option() const
OptionBool &get_plugins_option()
const OptionBool &get_plugins_option() const
OptionPath &get_pluginpath_option()
const OptionPath &get_pluginpath_option() const
OptionPath &get_pluginconfpath_option()
const OptionPath &get_pluginconfpath_option() const
OptionPath &get_persistdir_option()
const OptionPath &get_persistdir_option() const
OptionPath &get_system_state_dir_option()
const OptionPath &get_system_state_dir_option() const
OptionPath &get_transaction_history_dir_option()
const OptionPath &get_transaction_history_dir_option() const
OptionBool &get_transformdb_option()
const OptionBool &get_transformdb_option() const
OptionNumber<std::int32_t> &get_recent_option()
const OptionNumber<std::int32_t> &get_recent_option() const
OptionBool &get_reset_nice_option()
const OptionBool &get_reset_nice_option() const
OptionPath &get_system_cachedir_option()
const OptionPath &get_system_cachedir_option() const
OptionEnum &get_cacheonly_option()
const OptionEnum &get_cacheonly_option() const
OptionBool &get_keepcache_option()
const OptionBool &get_keepcache_option() const
OptionPath &get_logdir_option()
const OptionPath &get_logdir_option() const
OptionNumber<std::int32_t> &get_log_size_option()
const OptionNumber<std::int32_t> &get_log_size_option() const
OptionNumber<std::int32_t> &get_log_rotate_option()
const OptionNumber<std::int32_t> &get_log_rotate_option() const
OptionPath &get_debugdir_option()
const OptionPath &get_debugdir_option() const
OptionStringList &get_varsdir_option()
const OptionStringList &get_varsdir_option() const
OptionStringList &get_reposdir_option()
const OptionStringList &get_reposdir_option() const
OptionBool &get_debug_solver_option()
const OptionBool &get_debug_solver_option() const
OptionStringAppendList &get_installonlypkgs_option()
const OptionStringAppendList &get_installonlypkgs_option() const
OptionStringList &get_group_package_types_option()
const OptionStringList &get_group_package_types_option() const
OptionStringAppendSet &get_optional_metadata_types_option()
const OptionStringAppendSet &get_optional_metadata_types_option() const
OptionBool &get_use_host_config_option()
const OptionBool &get_use_host_config_option() const
OptionNumber<std::uint32_t> &get_installonly_limit_option()
const OptionNumber<std::uint32_t> &get_installonly_limit_option() const
OptionStringAppendList &get_tsflags_option()
const OptionStringAppendList &get_tsflags_option() const
OptionBool &get_assumeyes_option()
const OptionBool &get_assumeyes_option() const
OptionBool &get_assumeno_option()
const OptionBool &get_assumeno_option() const
OptionBool &get_check_config_file_age_option()
const OptionBool &get_check_config_file_age_option() const
OptionBool &get_defaultyes_option()
const OptionBool &get_defaultyes_option() const
OptionBool &get_diskspacecheck_option()
const OptionBool &get_diskspacecheck_option() const
OptionBool &get_localpkg_gpgcheck_option()
const OptionBool &get_localpkg_gpgcheck_option() const
OptionBool &get_gpgkey_dns_verification_option()
const OptionBool &get_gpgkey_dns_verification_option() const
OptionBool &get_obsoletes_option()
const OptionBool &get_obsoletes_option() const
OptionBool &get_exit_on_lock_option()
const OptionBool &get_exit_on_lock_option() const
OptionBool &get_allow_vendor_change_option()
const OptionBool &get_allow_vendor_change_option() const
OptionSeconds &get_metadata_timer_sync_option()

Deprecated:

The metadata_timer_sync option does nothing

const OptionSeconds &get_metadata_timer_sync_option() const

Deprecated:

The metadata_timer_sync option does nothing

OptionStringList &get_disable_excludes_option()
const OptionStringList &get_disable_excludes_option() const
OptionEnum &get_multilib_policy_option()
const OptionEnum &get_multilib_policy_option() const
OptionBool &get_best_option()
const OptionBool &get_best_option() const
OptionBool &get_install_weak_deps_option()
const OptionBool &get_install_weak_deps_option() const
OptionBool &get_allow_downgrade_option()
const OptionBool &get_allow_downgrade_option() const
OptionString &get_bugtracker_url_option()
const OptionString &get_bugtracker_url_option() const
OptionBool &get_zchunk_option()
const OptionBool &get_zchunk_option() const
OptionEnum &get_color_option()
const OptionEnum &get_color_option() const
OptionString &get_color_list_installed_older_option()
const OptionString &get_color_list_installed_older_option() const
OptionString &get_color_list_installed_newer_option()
const OptionString &get_color_list_installed_newer_option() const
OptionString &get_color_list_installed_reinstall_option()
const OptionString &get_color_list_installed_reinstall_option() const
OptionString &get_color_list_installed_extra_option()
const OptionString &get_color_list_installed_extra_option() const
OptionString &get_color_list_available_upgrade_option()
const OptionString &get_color_list_available_upgrade_option() const
OptionString &get_color_list_available_downgrade_option()
const OptionString &get_color_list_available_downgrade_option() const
OptionString &get_color_list_available_reinstall_option()
const OptionString &get_color_list_available_reinstall_option() const
OptionString &get_color_list_available_install_option()
const OptionString &get_color_list_available_install_option() const
OptionString &get_color_update_installed_option()
const OptionString &get_color_update_installed_option() const
OptionString &get_color_update_local_option()
const OptionString &get_color_update_local_option() const
OptionString &get_color_update_remote_option()
const OptionString &get_color_update_remote_option() const
OptionString &get_color_search_match_option()
const OptionString &get_color_search_match_option() const
OptionBool &get_history_record_option()
const OptionBool &get_history_record_option() const
OptionStringList &get_history_record_packages_option()
const OptionStringList &get_history_record_packages_option() const
OptionString &get_rpmverbosity_option()
const OptionString &get_rpmverbosity_option() const
OptionBool &get_strict_option()

Deprecated:

Use get_skip_broken_option() and get_skip_unavailable_option()

const OptionBool &get_strict_option() const

Deprecated:

Use get_skip_broken_option() const and get_skip_unavailable_option() const

OptionBool &get_skip_broken_option()

Solver is allowed to skip transaction packages with broken dependencies.

const OptionBool &get_skip_broken_option() const
OptionBool &get_skip_unavailable_option()

Solver is allowed to skip packages that are not available in repositories.

const OptionBool &get_skip_unavailable_option() const
OptionBool &get_autocheck_running_kernel_option()
const OptionBool &get_autocheck_running_kernel_option() const
OptionBool &get_clean_requirements_on_remove_option()
const OptionBool &get_clean_requirements_on_remove_option() const
OptionEnum &get_history_list_view_option()
const OptionEnum &get_history_list_view_option() const
OptionBool &get_upgrade_group_objects_upgrade_option()
const OptionBool &get_upgrade_group_objects_upgrade_option() const
OptionPath &get_destdir_option()
const OptionPath &get_destdir_option() const
OptionString &get_comment_option()
const OptionString &get_comment_option() const
OptionBool &get_downloadonly_option()
const OptionBool &get_downloadonly_option() const
OptionBool &get_ignorearch_option()
const OptionBool &get_ignorearch_option() const
OptionString &get_module_platform_id_option()
const OptionString &get_module_platform_id_option() const
OptionBool &get_module_stream_switch_option()
const OptionBool &get_module_stream_switch_option() const
OptionBool &get_module_obsoletes_option()
const OptionBool &get_module_obsoletes_option() const
OptionString &get_user_agent_option()
const OptionString &get_user_agent_option() const
OptionBool &get_countme_option()
const OptionBool &get_countme_option() const
OptionBool &get_protect_running_kernel_option()
const OptionBool &get_protect_running_kernel_option() const
OptionBool &get_build_cache_option()
const OptionBool &get_build_cache_option() const
OptionNumber<std::uint32_t> &get_retries_option()
const OptionNumber<std::uint32_t> &get_retries_option() const
OptionPath &get_cachedir_option()
const OptionPath &get_cachedir_option() const
OptionBool &get_fastestmirror_option()
const OptionBool &get_fastestmirror_option() const
OptionStringAppendList &get_excludeenvs_option()
const OptionStringAppendList &get_excludeenvs_option() const
OptionStringAppendList &get_excludegroups_option()
const OptionStringAppendList &get_excludegroups_option() const
OptionStringAppendList &get_excludepkgs_option()
const OptionStringAppendList &get_excludepkgs_option() const
OptionStringAppendList &get_includepkgs_option()
const OptionStringAppendList &get_includepkgs_option() const
OptionStringAppendList &get_exclude_from_weak_option()
const OptionStringAppendList &get_exclude_from_weak_option() const
OptionBool &get_exclude_from_weak_autodetect_option()
const OptionBool &get_exclude_from_weak_autodetect_option() const
OptionString &get_proxy_option()
const OptionString &get_proxy_option() const
OptionString &get_proxy_username_option()
const OptionString &get_proxy_username_option() const
OptionString &get_proxy_password_option()
const OptionString &get_proxy_password_option() const
OptionStringSet &get_proxy_auth_method_option()
const OptionStringSet &get_proxy_auth_method_option() const
OptionStringAppendList &get_protected_packages_option()
const OptionStringAppendList &get_protected_packages_option() const
OptionString &get_username_option()
const OptionString &get_username_option() const
OptionString &get_password_option()
const OptionString &get_password_option() const
OptionBool &get_gpgcheck_option()

Deprecated:

Use get_pkg_gpgcheck_option()

const OptionBool &get_gpgcheck_option() const

Deprecated:

Use get_pkg_gpgcheck_option() const

OptionBool &get_pkg_gpgcheck_option()
const OptionBool &get_pkg_gpgcheck_option() const
OptionBool &get_repo_gpgcheck_option()
const OptionBool &get_repo_gpgcheck_option() const
OptionBool &get_enabled_option()
const OptionBool &get_enabled_option() const
OptionBool &get_enablegroups_option()
const OptionBool &get_enablegroups_option() const
OptionNumber<std::uint32_t> &get_bandwidth_option()
const OptionNumber<std::uint32_t> &get_bandwidth_option() const
OptionNumber<std::uint32_t> &get_minrate_option()
const OptionNumber<std::uint32_t> &get_minrate_option() const
OptionEnum &get_ip_resolve_option()
const OptionEnum &get_ip_resolve_option() const
OptionNumber<float> &get_throttle_option()
const OptionNumber<float> &get_throttle_option() const
OptionSeconds &get_timeout_option()
const OptionSeconds &get_timeout_option() const
OptionNumber<std::uint32_t> &get_max_parallel_downloads_option()
const OptionNumber<std::uint32_t> &get_max_parallel_downloads_option() const
OptionSeconds &get_metadata_expire_option()
const OptionSeconds &get_metadata_expire_option() const
OptionString &get_sslcacert_option()
const OptionString &get_sslcacert_option() const
OptionBool &get_sslverify_option()
const OptionBool &get_sslverify_option() const
OptionString &get_sslclientcert_option()
const OptionString &get_sslclientcert_option() const
OptionString &get_sslclientkey_option()
const OptionString &get_sslclientkey_option() const
OptionString &get_proxy_sslcacert_option()
const OptionString &get_proxy_sslcacert_option() const
OptionBool &get_proxy_sslverify_option()
const OptionBool &get_proxy_sslverify_option() const
OptionString &get_proxy_sslclientcert_option()
const OptionString &get_proxy_sslclientcert_option() const
OptionString &get_proxy_sslclientkey_option()
const OptionString &get_proxy_sslclientkey_option() const
OptionBool &get_deltarpm_option()
const OptionBool &get_deltarpm_option() const
OptionNumber<std::uint32_t> &get_deltarpm_percentage_option()
const OptionNumber<std::uint32_t> &get_deltarpm_percentage_option() const
OptionBool &get_skip_if_unavailable_option()
const OptionBool &get_skip_if_unavailable_option() const
virtual void load_from_parser(const libdnf5::ConfigParser &parser, const std::string &section, const libdnf5::Vars &vars, libdnf5::Logger &logger, Option::Priority priority = Option::Priority::MAINCONFIG) override
class ConfigParser
#include <config_parser.hpp>

Class for parsing dnf/yum .ini configuration files.

ConfigParser is used for parsing files. User can get both substituted and original parsed values. The parsed items are stored into the PreserveOrderMap. ConfigParser preserve order of items. Comments and empty lines are kept.

Public Types

using Container = PreserveOrderMap<std::string, PreserveOrderMap<std::string, std::string>>

Public Functions

ConfigParser()
~ConfigParser()
ConfigParser(const ConfigParser &src)
ConfigParser &operator=(const ConfigParser &src)
ConfigParser(ConfigParser &&src) noexcept
ConfigParser &operator=(ConfigParser &&src) noexcept
void read(const std::string &file_path)

Reads/parse one INI file.

Can be called repeately for reading/merge more INI files.

Parameters:

file_path – Name (with path) of file to read

void write(const std::string &file_path, bool append) const

Writes all data (all sections) to INI file.

Parameters:
  • file_path – Name (with path) of file to write

  • append – If true, existent file will be appended, otherwise overwritten

void write(const std::string &file_path, bool append, const std::string &section) const

Writes one section data to INI file.

Parameters:
  • file_path – Name (with path) of file to write

  • append – If true, existent file will be appended, otherwise overwritten

  • section – Section to write

bool add_section(const std::string &section, const std::string &raw_line)
bool add_section(const std::string &section)
bool add_section(std::string &&section, std::string &&raw_line)
bool add_section(std::string &&section)
bool has_section(const std::string &section) const noexcept
bool has_option(const std::string &section, const std::string &key) const noexcept
void set_value(const std::string &section, const std::string &key, const std::string &value, const std::string &raw_item)
void set_value(const std::string &section, const std::string &key, const std::string &value)
void set_value(const std::string &section, std::string &&key, std::string &&value, std::string &&raw_item)
void set_value(const std::string &section, std::string &&key, std::string &&value)
bool remove_section(const std::string &section)
bool remove_option(const std::string &section, const std::string &key)
void add_comment_line(const std::string &section, const std::string &comment)
void add_comment_line(const std::string &section, std::string &&comment)
const std::string &get_value(const std::string &section, const std::string &key) const
const std::string &get_header() const noexcept
std::string &get_header() noexcept
const Container &get_data() const noexcept
Container &get_data() noexcept
class ConfigParserError : public libdnf5::Error

Subclassed by libdnf5::ConfigParserOptionNotFoundError, libdnf5::ConfigParserSectionNotFoundError

Public Functions

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.

template<AllowedErrorArgTypes... Args>
inline explicit Error(BgettextMessage format, Args... args)

A constructor that supports formatting the error message.

Parameters:
  • format – The format string for the message.

  • args – The format arguments.

Error(const Error &e) noexcept
class ConfigParserOptionNotFoundError : public libdnf5::ConfigParserError

Public Functions

explicit ConfigParserOptionNotFoundError(const std::string &section, const std::string &option)
inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class ConfigParserSectionNotFoundError : public libdnf5::ConfigParserError

Public Functions

explicit ConfigParserSectionNotFoundError(const std::string &section)
inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class EmptyMessage : public libdnf5::Message
#include <message.hpp>

Class for passing an empty message.

Public Functions

EmptyMessage()
EmptyMessage(const EmptyMessage &src)
EmptyMessage(EmptyMessage &&src) noexcept
~EmptyMessage() override
EmptyMessage &operator=(const EmptyMessage &src)
EmptyMessage &operator=(EmptyMessage &&src) noexcept
virtual std::string format(bool translate, const libdnf5::utils::Locale *locale = nullptr) const override

Returns empty string

Parameters:
  • translate – ignored

  • locale – ignored

Returns:

empty string object

class Error : public std::runtime_error
#include <exception.hpp>

Base class for libdnf exceptions. Virtual methods get_name() and get_domain_name() should always return the exception’s class name and its namespace (including enclosing class names in case the exception is nested in other classes) respectively.

Subclassed by libdnf5::ConfigParserError, libdnf5::FileSystemError, libdnf5::InaccessibleConfigError, libdnf5::InvalidConfigError, libdnf5::MissingConfigError, libdnf5::OptionBindsError, libdnf5::OptionError, libdnf5::ReadOnlyVariableError, libdnf5::RuntimeError, libdnf5::SystemError, libdnf5::base::TransactionError, libdnf5::cli::Error, libdnf5::comps::InvalidPackageType, libdnf5::module::InvalidModuleStatus, libdnf5::module::ModuleError, libdnf5::repo::FileDownloadError, libdnf5::repo::PackageDownloadError, libdnf5::repo::RepoCacheError, libdnf5::repo::RepoError, libdnf5::rpm::KeyImportError, libdnf5::rpm::NevraIncorrectInputError, libdnf5::rpm::SignatureCheckError, libdnf5::transaction::InvalidTransactionItemAction, libdnf5::transaction::InvalidTransactionItemReason, libdnf5::transaction::InvalidTransactionItemState, libdnf5::transaction::InvalidTransactionItemType, libdnf5::transaction::InvalidTransactionState

Public Functions

template<AllowedErrorArgTypes... Args>
inline explicit Error(BgettextMessage format, Args... args)

A constructor that supports formatting the error message.

Parameters:
  • format – The format string for the message.

  • args – The format arguments.

Error(const Error &e) noexcept
Error &operator=(const Error &e) noexcept
const char *what() const noexcept override
inline virtual const char *get_name() const noexcept
Returns:

The exception class name.

inline virtual const char *get_domain_name() const noexcept
Returns:

The domain name (namespace and enclosing class names) of the exception.

class FileSystemError : public libdnf5::Error
#include <exception.hpp>

An exception class for file system errors represented by the errno error code and a path.

Public Functions

template<AllowedErrorArgTypes... Args>
inline explicit FileSystemError(int error_code, std::filesystem::path path, BgettextMessage format, Args... args)

Constructs the error from the errno error code, filesystem path and a formatted message. The formatted message is prepended to the generated system error message.

Parameters:
  • error_code – The errno of the error.

  • filesystem::path – The path to the file.

  • format – The format string for the message.

  • args – The format arguments.

const char *what() const noexcept override
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.

inline int get_error_code() const noexcept
Returns:

The error code (errno) of the error.

class GlobalLogger
#include <global_logger.hpp>

GlobalLogger contains methods for setting the target (logger) for global messages - messages that are generated by libraries (eg librepo) without binding to the Base object.

Public Functions

explicit GlobalLogger()
~GlobalLogger()
GlobalLogger(const GlobalLogger&) = delete
GlobalLogger(GlobalLogger&&) = delete
GlobalLogger &operator=(const GlobalLogger&) = delete
GlobalLogger &operator=(GlobalLogger&&) = delete

Public Static Functions

static void set(Logger &destination, Logger::Level verbosity)
static void unset() noexcept
class Goal
#include <goal.hpp>

Centralized point to perform operations with RPMs, Comps groups, and Modules.

Public Functions

explicit Goal(const libdnf5::BaseWeakPtr &base)
explicit Goal(libdnf5::Base &base)
~Goal()
void add_module_enable(const std::string &spec, const libdnf5::GoalJobSettings &settings)

Add module enable request to the goal. Throws libdnf5::AssertionError when used with libdnf5 compiled without modules enabled.

Parameters:
  • spec – A string with module spec to enable.

  • settings – A structure to override default goal settings.

void add_module_disable(const std::string &spec, const libdnf5::GoalJobSettings &settings)

Add module disable request to the goal. Throws libdnf5::AssertionError when used with libdnf5 compiled without modules enabled.

Parameters:
  • spec – A string with module spec to disable.

  • settings – A structure to override default goal settings.

void add_module_reset(const std::string &spec, const libdnf5::GoalJobSettings &settings)

Add module reset request to the goal. Throws libdnf5::AssertionError when used with libdnf5 compiled without modules enabled.

Parameters:
  • spec – A string with module spec to reset.

  • settings – A structure to override default goal settings.

void add_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

High level API for an artifact installation. A spec can be either a package specification matched against NEVRA, provides, and file provides, or it can be a path to local rpm file, or URL of rpm to be installed. By using @ prefix you can also specify a group, environmental group, or a module to be installed.

Parameters:
  • spec – A string with installation spec

  • settings – A structure to override default goal settings.

void add_debug_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Process spec to install related debug info and debug source packages

Parameters:
  • spec – A string with installation spec

  • settings – A structure to override default goal settings.

void add_upgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)

High level API for an artifact upgrade. See add_install() for details.

Parameters:
  • spec – A string with upgrade spec

  • settings – A structure to override default goal settings.

  • minimal – Whether to do smallest possible upgrade

void add_downgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

High level API for an artifact downgrade. See add_install() for details.

Parameters:
  • spec – A string with upgrade spec

  • settings – A structure to override default goal settings.

void add_reinstall(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

High level API for an artifact reinstall. See add_install() for details.

Parameters:
  • spec – A string with reinstall spec

  • settings – A structure to override default goal settings.

void add_remove(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

High level API for an artifact removal. See add_install() for details.

Parameters:
  • spec – A string with reinstall spec

  • settings – A structure to override default goal settings.

void add_rpm_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add install request to the goal. The spec will be resolved to packages in the resolve() call. The operation will not result in a reinstall if the requested package is already installed. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • spec – A string describing the Goal install request.

  • settings – A structure to override default goal settings. The value from_repo_ids is not used.

void add_rpm_install(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add install request to the goal. The operation will not result in a reinstall when requested package with the same NEVRA is already installed. By default uses clean_requirements_on_remove set to false.

Parameters:
  • rpm_package – A package to be installed.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove are used.

void add_rpm_install(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add install request to the goal. The operation will not result in a reinstall when requested package with the same NEVRA is already installed. By default uses clean_requirements_on_remove set to false.

Parameters:
  • package_set – A package_set containing candidates for the install action.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove are used.

void add_rpm_install_or_reinstall(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add install or reinstall request to the goal. By default uses clean_requirements_on_remove set to false.

Parameters:
  • rpm_package – A package to be installed or reinstalled.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove are used.

void add_rpm_install_or_reinstall(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add install or reinstall request to the goal. By default uses clean_requirements_on_remove set to false.

Parameters:
  • package_set – A package_set containing candidates for the install or reinstall action.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove are used.

void add_rpm_reinstall(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add reinstall request to the goal. The spec will be resolved to packages in the resolve() call. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • spec – A string describing the Goal reinstall request.

  • settings – A structure to override default goal settings. The value from_repo_ids is not used (not implemented yet).

void add_rpm_reinstall(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add reinstall request to the goal. By default uses clean_requirements_on_remove set to false.

Parameters:
  • rpm_package – A package to be reinstalled.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove are used.

void add_rpm_remove(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add remove request to the goal. The spec will be resolved to packages in the resolve() call. By default uses clean_requirements_on_remove according to ConfigMain, which can be overridden in settings.

Parameters:
  • spec – A string describing the Goal remove request.

  • settings – A structure to override default goal settings. Values strict and best are not used.

void add_rpm_remove(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add remove request to the goal. By default uses clean_requirements_on_remove value from ConfigMain, which can be overridden in settings.

Parameters:
  • rpm_package – A package to be removed.

  • settings – A structure to override default goal settings. Only clean_requirements_on_remove is used.

void add_rpm_remove(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add remove request to the goal. By default uses clean_requirements_on_remove value from ConfigMain, which can be overridden in settings.

Parameters:
  • package_set – A package_set containing packages that will be removed

  • settings – A structure to override default goal settings. Only clean_requirements_on_remove is used.

void add_rpm_upgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)

Add upgrade request to the goal. The spec will be resolved to packages in the resolve() call. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • spec – A string describing the Goal upgrade request.

  • settings – A structure to override default goal settings. Values from_repo_ids and strict are not used.

  • minimal – Whether to do smallest possible upgrade

void add_rpm_upgrade(const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)

Add upgrade job of all installed packages to the goal if not limited in settings. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • settings – A structure to override default goal settings. Values from_repo_ids and strict are not used.

  • minimal – Whether to do smallest possible upgrade

void add_rpm_upgrade(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)

Add upgrade request to the goal. By default uses clean_requirements_on_remove set to false, which can be overridden in settings. Supports obsoletes and architecture change to/from “noarch”.

Parameters:
  • rpm_package – A package that will be used as candidate for the upgrade action.

  • settings – A structure to override default goal settings. Only clean_requirements_on_remove and best values are used.

  • minimal – Whether to do smallest possible upgrade

void add_rpm_upgrade(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)

Add upgrade request to the goal. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • package_set – A package_set containing candidates for the upgrade action.

  • settings – A structure to override default goal settings. Only clean_requirements_on_remove and best values are used.

  • minimal – Whether to do smallest possible upgrade

void add_rpm_downgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add downgrade request to the goal. The spec will be resolved to packages in the resolve() call. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • spec – A string describing the Goal downgrade request.

  • settings – A structure to override default goal settings. The value from_repo_ids is not used.

void add_rpm_downgrade(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add downgrade request to the goal. By default uses clean_requirements_on_remove set to false, which can be overridden in settings. Ignores obsoletes. Only installed packages with the same name, architecture and higher version can be downgraded. Skips package if the same or lower version is installed.

Parameters:
  • rpm_package – A package that will be used as candidate for the downgrade action.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove are used.

void add_rpm_distro_sync(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add distrosync request to the goal. The spec will be resolved to packages in the resolve() call. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • spec – A string describing the Goal distrosync request.

  • settings – A structure to override default goal settings. The value from_repo_ids is not used.

void add_rpm_distro_sync(const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add distrosync job of all installed packages to the goal if not limited in settings. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:

settings – A structure to override default goal settings. Values from_repo_ids is not used.

void add_rpm_distro_sync(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add distrosync request to the goal. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • rpm_package – A package hat will be used as candidate for the distrosync action.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove values are used.

void add_rpm_distro_sync(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add distrosync request to the goal. By default uses clean_requirements_on_remove set to false, which can be overridden in settings.

Parameters:
  • package_set – A package_set containing candidates for the distrosync action.

  • settings – A structure to override default goal settings. Only strict, best, and clean_requirements_on_remove values are used.

void add_rpm_reason_change(const std::string &spec, const libdnf5::transaction::TransactionItemReason reason, const std::string &group_id = {}, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add reason change request to the goal.

Parameters:
  • spec – A string describing the requested package

  • reason – New reason for the package

  • group_id – Id of group the package belongs to (only relevant in case the reason is GROUP)

  • settings – A structure to override default goal settings. Only ResolveSpecSettings values are used

void add_group_install(const std::string &spec, const libdnf5::transaction::TransactionItemReason reason, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add group install request to the goal. The spec will be resolved to groups in the resolve() call. Also packages of the types specified in setting.group_package_types be installed.

Parameters:
  • spec – A string describing the Goal group install request.

  • reason – Reason why the group is installed (USER/DEPENDENCY)

  • settings – A structure to override default goal settings.

void add_group_remove(const std::string &spec, const libdnf5::transaction::TransactionItemReason reason, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add group remove request to the goal. The spec will be resolved to groups in the resolve() call. Also packages not belonging to another group and not explicitly user-installed will get removed.

Parameters:
  • spec – A string describing the Goal group remove request.

  • reason – Reason why the group is removed.

  • settings – A structure to override default goal settings.

void add_group_upgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Add group upgrade request to the goal. Upgrades the packages from the group and upgrades the group itself. The latter comprises of installing packages that were added to the group by the distribution and removing packages that got removed from the group as far as they were not installed explicitly by the user and are not required by any other installed package.

Parameters:
  • spec – A string with group specification

  • settings – A structure to override default goal settings.

void add_provide_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Request to install providers of the spec. Useful to install package using rich dependencies. The spec (e.g. “(depA and depB)”) is not parsed but directly passed to the solver to install package(s) which provide the spec. Solver then creates a job like: “job install provides depA and depB”.

Parameters:
  • spec – A string with libsolv relational dependency.

  • settings – A structure to override default goal settings. The value from_repo_ids is not used.

void add_serialized_transaction(const std::filesystem::path &transaction_path, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Warning

This method is experimental/unstable and should not be relied on. It may be removed without warning Add serialized transaction request to the goal. Only one serialized transaction can be added per goal.

Parameters:
  • transaction_path – A path to JSON serialized transaction.

  • settings – A structure to override default goal settings. the packages and comps have relative paths in trans file.

void add_revert_transactions(const std::vector<libdnf5::transaction::Transaction> &transactions, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Warning

This method is experimental/unstable and should not be relied on. It may be removed without warning Add revert request of history transactions to the goal. Can be called only once per Goal.

Parameters:
  • transactions – A vector of history transactions to be reverted.

  • settings – A structure to override default goal settings.

void add_redo_transaction(const libdnf5::transaction::Transaction &transaction, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())

Warning

This method is experimental/unstable and should not be relied on. It may be removed without warning Add redo request of history transaction to the goal. Can be called only once per Goal.

Parameters:
  • transaction – A history transaction to be repeated.

  • settings – A structure to override default goal settings.

void set_allow_erasing(bool value)

When true it allows to remove installed packages to resolve dependency problems.

bool get_allow_erasing() const

Return the currets setting of allow_erasing.

base::Transaction resolve()

Resolve all jobs and return a transaction object. Every time it resolves specs (strings) to packages

Returns:

transaction object

void reset()

Clean all request from the Goal instance.

libdnf5::BaseWeakPtr get_base() const

Since

5.0

Returns:

The Base object to which this object belongs.

struct GoalJobSettings : public libdnf5::ResolveSpecSettings

Public Functions

GoalJobSettings()
~GoalJobSettings()
GoalJobSettings(const GoalJobSettings &src)
GoalJobSettings(GoalJobSettings &&src) noexcept
GoalJobSettings &operator=(const GoalJobSettings &src)
GoalJobSettings &operator=(GoalJobSettings &&src) noexcept
GoalUsedSetting get_used_skip_broken() const

Return used value for skip_broken.

GoalUsedSetting get_used_skip_unavailable() const

Return used value for skip_unavailable.

GoalUsedSetting get_used_best() const

Return used value for best.

GoalUsedSetting get_used_clean_requirements_on_remove() const

Return used value for clean_requirements_on_remove.

void set_advisory_filter(const libdnf5::advisory::AdvisoryQuery &filter)

Optionally set AdvisoryQuery that is used to filter packages (used for upgrade). Upgrades considers only packages that resolve some advisory in specified AdvisoryQuery.

By default is is empty and no packages are filtered.

const libdnf5::advisory::AdvisoryQuery *get_advisory_filter() const
void set_group_package_types(libdnf5::comps::PackageType type)

Which types of group packages are going to be installed with the group.

Default is taken from ConfigMain.group_package_types

const libdnf5::comps::PackageType *get_group_package_types() const
void set_group_no_packages(bool group_no_packages)

If set to true, group operations (install / remove / upgrade) will only work with the group itself, but will not add to the transaction any packages.

Default: false

bool get_group_no_packages() const
void set_environment_no_groups(bool environment_no_groups)

If set to true, environments operations (install / remove / upgrade) will only work with the environment itself, but will not add to any groups to the transaction.

Default: false

bool get_environment_no_groups() const
void set_report_hint(bool report_hint)

Set whether to report packages providing alternatives (alternative-for(..) provide) and packages with different letter capitalization when no matches are found.

Default: true

bool get_report_hint() const
void set_skip_broken(GoalSetting skip_broken)

Resolve any dependency problems by removing packages that are causing problems from the transaction.

By default the value is taken from skip_broken configuration option.

GoalSetting get_skip_broken() const
void set_skip_unavailable(GoalSetting skip_unavailable)

Allow skipping packages that are unavailable.

By default the value is taken from a configuration option skip_unavailable except for remove action which defaults to true.

GoalSetting get_skip_unavailable() const
void set_best(GoalSetting best)

Try the best available package versions in transactions.

By default the value is taken from best configuration option.

GoalSetting get_best() const
void set_clean_requirements_on_remove(GoalSetting clean_requirements_on_remove)

Remove dependencies that are no longer used during dnf remove.

By default the value is false except for remove action which defaults to value from clean_requirements_on_remove configuration option.

GoalSetting get_clean_requirements_on_remove() const
void set_from_repo_ids(std::vector<std::string> from_repo_ids)

Not implemented yet.

std::vector<std::string> get_from_repo_ids() const
void set_to_repo_ids(std::vector<std::string> to_repo_ids)

Limit available packages to specified repositories.

Empty by default.

std::vector<std::string> get_to_repo_ids() const
void set_ignore_extras(bool ignore_extras)

If set to true, after resolving serialized, reverted or redo transactions don’t check for extra packages pulled into the transaction.

Default: false

bool get_ignore_extras() const
void set_ignore_installed(bool ignore_installed)

If set to true, after resolving serialized, reverted or redo transactions don’t check for installed packages matching those in the transactions.

Default: false

bool get_ignore_installed() const
void set_override_reasons(bool override_reasons)

If set to true, after resolving serialized, reverted or redo transactions override reasons of already installed packages. This option only has an effect if ignore_installed is set otherwise the transaction fails when it contains already installed packages.

Default: false

bool get_override_reasons() const
template<class T>
class ImplPtr

Public Functions

constexpr ImplPtr() noexcept = default

Constructs an ImplPtr that owns nothing.

inline explicit constexpr ImplPtr(T *ptr) noexcept

Constructs an ImplPtr that takes ownership of ptr.

inline ImplPtr(const ImplPtr &src)

Constructs an ImplPtr that owns newly created instance value initialized from src or owns nothing if src owns nothing.

inline constexpr ImplPtr(ImplPtr &&src) noexcept

Constructs an ImplPtr by transferring ownership from src to *this and stores the null pointer in src.

inline ImplPtr &operator=(const ImplPtr &src)

Copies the value pointed to by src, not the pointer itself. If the destination owns nothing and src points to a value, a new instance of the value initialized from src is created. Does not do anything if both of them own nothing.

inline ImplPtr &operator=(ImplPtr &&src) noexcept

Transfers ownership from src to *this and stores the null pointer in src.

inline ~ImplPtr()
inline constexpr T *operator->() noexcept
inline constexpr const T *operator->() const noexcept
inline constexpr T &operator*() noexcept
inline constexpr const T &operator*() const noexcept
inline constexpr T *get() noexcept
inline constexpr const T *get() const noexcept
class InaccessibleConfigError : public libdnf5::Error
#include <config_parser_errors.hpp>

Error accessing config file other than ENOENT; e.g. we don’t have read permission.

Public Functions

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.

template<AllowedErrorArgTypes... Args>
inline explicit Error(BgettextMessage format, Args... args)

A constructor that supports formatting the error message.

Parameters:
  • format – The format string for the message.

  • args – The format arguments.

Error(const Error &e) noexcept
class InvalidConfigError : public libdnf5::Error
#include <config_parser_errors.hpp>

Configuration file is invalid.

Public Functions

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.

template<AllowedErrorArgTypes... Args>
inline explicit Error(BgettextMessage format, Args... args)

A constructor that supports formatting the error message.

Parameters:
  • format – The format string for the message.

  • args – The format arguments.

Error(const Error &e) noexcept
struct LibraryVersion
#include <version.hpp>

Library version

Since

5.0 PRIME version - completely changing API and everything in dnf (hopefully stays as a 5 for the foreseeable future) MAJOR version - incompatible API changes MINOR version - add functionality in a backward compatible manner MICRO version - make backward compatible bug fixes

Public Members

std::uint16_t prime
std::uint16_t major
std::uint16_t minor
std::uint16_t micro
class Logger
#include <logger.hpp>

Logger is an abstract interface used for logging. An implementation (inherited class) can call callbacks, log the messages to memory, file, or somewhere else.

Subclassed by libdnf5::LogRouter, libdnf5::MemoryBufferLogger, libdnf5::NullLogger, libdnf5::StringLogger

Public Types

enum class Level : unsigned int

Values:

enumerator CRITICAL
enumerator ERROR
enumerator WARNING
enumerator NOTICE
enumerator INFO
enumerator DEBUG
enumerator TRACE

Public Functions

explicit Logger()
Logger(const Logger&) = delete
Logger(Logger&&) = delete
Logger &operator=(const Logger&) = delete
Logger &operator=(Logger&&) = delete
virtual ~Logger()
template<typename ...Ss>
inline void critical(std::string_view format, Ss&&... args)
template<typename ...Ss>
inline void error(std::string_view format, Ss&&... args)
template<typename ...Ss>
inline void warning(std::string_view format, Ss&&... args)
template<typename ...Ss>
inline void notice(std::string_view format, Ss&&... args)
template<typename ...Ss>
inline void info(std::string_view format, Ss&&... args)
template<typename ...Ss>
inline void debug(std::string_view format, Ss&&... args)
template<typename ...Ss>
inline void trace(std::string_view format, Ss&&... args)
template<typename ...Ss>
inline void log(Level level, std::string_view format, Ss&&... args)
virtual void log_line(Level level, const std::string &message) noexcept
virtual void write(const std::chrono::time_point<std::chrono::system_clock> &time, pid_t pid, Level level, const std::string &message) noexcept = 0

Public Static Functions

static const char *level_to_cstr(Level level) noexcept
class LogRouter : public libdnf5::Logger
#include <log_router.hpp>

LogRouter is an implementation of logging class that forwards incoming logging messages to several other loggers. Loggers can be addressed via index. Index is serial number of the logger starting from zero.

Public Functions

explicit LogRouter()

Constructs a new LogRouter instance with an empty set of destination loggers.

~LogRouter()
explicit LogRouter(std::vector<std::unique_ptr<Logger>> &&loggers)

Constructs a new LogRouter instance and sets the destination loggers.

void add_logger(std::unique_ptr<Logger> &&logger)

Moves (registers) the “logger” into the log router. It gets next free index number.

Logger *get_logger(size_t index)

Returns pointer to the logger at the “index” position.

std::unique_ptr<Logger> release_logger(size_t index)

Removes logger at the “index” position from LogRouter. The array of the loggers is squeezed. Index of the loggers behind removed logger is decreased by one.

void swap_logger(std::unique_ptr<Logger> &logger, size_t index)

Swaps the logger at the “index” position with another “logger”.

size_t get_loggers_count() const noexcept

Returns number of loggers registered in LogRouter.

virtual void log_line(Level level, const std::string &message) noexcept override
virtual void write(const std::chrono::time_point<std::chrono::system_clock> &time, pid_t pid, Level level, const std::string &message) noexcept override
class MemoryBufferLogger : public libdnf5::Logger
#include <memory_buffer_logger.hpp>

MemoryBufferLogger is an implementation of logging class that stores incoming logging messages into memory buffer. It is usually used as temporary logger until a final logger is configured.

Public Functions

explicit MemoryBufferLogger(std::size_t max_items_to_keep, std::size_t reserve = 0)
~MemoryBufferLogger()
virtual void write(const std::chrono::time_point<std::chrono::system_clock> &time, pid_t pid, Level level, const std::string &message) noexcept override
std::size_t get_items_count() const
const Item &get_item(std::size_t item_idx) const
void clear() noexcept
void write_to_logger(Logger &logger)
struct Item

Public Members

std::chrono::time_point<std::chrono::system_clock> time
pid_t pid
Level level
std::string message
class Message
#include <message.hpp>

A base class for passing a message whose formatting, including localization (translation, argument format) is done at the destination. Usage: The user creates a child of this class and implements the format method.

Subclassed by libdnf5::EmptyMessage

Public Functions

Message()
Message(const Message &src)
Message(Message &&src) noexcept
virtual ~Message()
Message &operator=(const Message &src)
Message &operator=(Message &&src) noexcept
virtual std::string format(bool translate, const libdnf5::utils::Locale *locale = nullptr) const = 0

Formats the contained message according to the specified arguments and returns the result as a string.

Parameters:
  • translate – If true, it will attempt to translate the message to the requested locale.

  • locale – requested locale for translation and argument formating, nullptr = use global/thread locale

Returns:

A string object holding the formatted result.

class MissingConfigError : public libdnf5::Error
#include <config_parser_errors.hpp>

Configuration file is missing.

Public Functions

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.

template<AllowedErrorArgTypes... Args>
inline explicit Error(BgettextMessage format, Args... args)

A constructor that supports formatting the error message.

Parameters:
  • format – The format string for the message.

  • args – The format arguments.

Error(const Error &e) noexcept
template<typename TException>
class NestedException : public TException, public std::nested_exception
#include <exception.hpp>

A template of the NestedException class that is thrown by the throw_with_nested function.

Public Functions

inline explicit NestedException(const TException &ex)
inline explicit NestedException(TException &&ex)
class NullLogger : public libdnf5::Logger
#include <null_logger.hpp>

NullLogger is an implementation of logging class that discards all incoming logging messages. It can be used in case when no logs are needed.

Public Functions

explicit NullLogger()
~NullLogger() override
virtual void log_line(Level level, const std::string &message) noexcept override
virtual void write(const std::chrono::time_point<std::chrono::system_clock> &time, pid_t pid, Level level, const std::string &message) noexcept override
class Option
#include <option.hpp>

Option class is an abstract class. Parent of all options. Options are used to store a configuration.

Subclassed by libdnf5::OptionNumber< std::int32_t >, libdnf5::OptionBool, libdnf5::OptionChild< ParentOptionType, Enable >, libdnf5::OptionChild< ParentOptionType, typename std::enable_if< std::is_same< typename ParentOptionType::ValueType, std::string >::value >::type >, libdnf5::OptionEnum, libdnf5::OptionNumber< T >, libdnf5::OptionString, libdnf5::OptionStringContainer< T, IsAppend >

Public Types

enum class Priority

Values:

enumerator EMPTY
enumerator DEFAULT
enumerator MAINCONFIG
enumerator AUTOMATICCONFIG
enumerator REPOCONFIG
enumerator INSTALLROOT
enumerator PLUGINDEFAULT
enumerator PLUGINCONFIG
enumerator COMMANDLINE
enumerator RUNTIME

Public Functions

explicit Option(Priority priority = Priority::EMPTY)
Option(const Option &src)
virtual ~Option()
virtual Option *clone() const = 0

Makes copy (clone) of this object.

virtual Priority get_priority() const

Returns priority (source) of the stored value.

virtual void set(Priority priority, const std::string &value) = 0

Parses input string and sets new value and priority (source). The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) = 0

Parses input string and sets new value and runtime priority.

virtual std::string get_value_string() const = 0

Gets a string representation of the stored value.

virtual bool empty() const noexcept

Checks if the option is empty (has no stored value).

void lock(const std::string &first_comment)

Locks the option. The locked option is read-only. Its value cannot be changed.

Since

1.0

Parameters:

first_comment – The comment will be saved when lock() is first called

bool is_locked() const noexcept

Checks if the option is locked.

Since

1.0

Returns:

‘true’ if the option is locked

void assert_not_locked() const

Asserts the option is not locked and throws a libdnf5::UserAssertionError in case it is.

Since

1.0

class OptionBinds
#include <option_binds.hpp>

Maps the options names (text names read from config file, command line, …) to options objects. Supports user defined functions for processing new value and converting value to string.

Public Types

using Container = std::map<std::string, Item>
using iterator = Container::iterator
using const_iterator = Container::const_iterator

Public Functions

OptionBinds()
OptionBinds(const OptionBinds &src)
~OptionBinds()
Item &add(std::string id, Option &option, Item::NewStringFunc new_string_func, Item::GetValueStringFunc get_value_string_func, bool add_value)
Item &add(std::string id, Option &option)
Item &at(const std::string &id)
const Item &at(const std::string &id) const
bool empty() const noexcept
std::size_t size() const noexcept
iterator begin() noexcept
const_iterator begin() const noexcept
const_iterator cbegin() const noexcept
iterator end() noexcept
const_iterator end() const noexcept
const_iterator cend() const noexcept
iterator find(const std::string &id)
const_iterator find(const std::string &id) const
class Item
#include <option_binds.hpp>

Extends the option with user-defined functions for processing a new value and converting value to a string. It is used as additional level of processing when the option is accessed by its text name.

Public Types

using NewStringFunc = std::function<void(Option::Priority, const std::string&)>
using GetValueStringFunc = std::function<const std::string&()>

Public Functions

~Item()
Option::Priority get_priority() const
void new_string(Option::Priority priority, const std::string &value)
std::string get_value_string() const
bool get_is_append_option() const
class OptionBindsError : public libdnf5::Error

Subclassed by libdnf5::OptionBindsOptionAlreadyExistsError, libdnf5::OptionBindsOptionNotFoundError

class OptionBindsOptionAlreadyExistsError : public libdnf5::OptionBindsError

Public Functions

explicit OptionBindsOptionAlreadyExistsError(const std::string &id)
inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class OptionBindsOptionNotFoundError : public libdnf5::OptionBindsError

Public Functions

explicit OptionBindsOptionNotFoundError(const std::string &id)
inline virtual const char *get_name() const noexcept override
Returns:

The exception class name.

class OptionBool : public libdnf5::Option
#include <option_bool.hpp>

Option that stores boolean value. Supports default value. Conversion from string to bool is done according to vectors which contains strings of true and false values. Conversion is case insensitive for input. Values must be lower case in vectors.

Public Types

using ValueType = bool

Public Functions

explicit OptionBool(bool default_value)

Constructor that sets default value.

OptionBool(bool default_value, std::vector<std::string> true_vals, std::vector<std::string> false_vals)

Constructor that sets default value and vectors for conversion from string.

OptionBool(const OptionBool &src)
~OptionBool() override
virtual OptionBool *clone() const override

Makes copy (clone) of this object.

void set(Priority priority, bool value)

Sets new value and priority (source). The value and priority are stored only if the new priority is equal to or higher than the stored priority.

void set(bool value)

Sets new value with the runtime priority.

virtual void set(Priority priority, const std::string &value) override

Parses input string and sets new value and priority. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Parses input string and sets new value and runtime priority.

bool get_value() const noexcept

Gets the stored value.

bool get_default_value() const noexcept

Gets the default value. Default value is used until it is replaced by set() method.

virtual std::string get_value_string() const override

Gets a string representation of the stored value.

const std::vector<std::string> &get_true_values() const noexcept

Returns vector with strings used for conversion from string to “true” bool value.

const std::vector<std::string> &get_false_values() const noexcept

Returns vector with strings used for conversion from string to “false” bool value.

void test(bool) const

Does nothing. But it must be present for compatibility with other option types.

bool from_string(const std::string &value) const

Parses input string and returns result.

std::string to_string(bool value) const

Converts input value to the string.

Public Static Functions

static const std::vector<std::string> &get_default_true_values() noexcept

Returns vector with default strings used for conversion from string to “true” bool value.

static const std::vector<std::string> &get_default_false_values() noexcept

Returns vector with default strings used for conversion from string to “false” bool value.

template<class ParentOptionType, class Enable = void>
class OptionChild : public libdnf5::Option
#include <option_child.hpp>

Option that links option to another option. It uses default value and parameters from linked option. If it is empty (has no stored value), uses value from the linked option (parent). Parent option type is template parameter.

Public Functions

inline explicit OptionChild(const ParentOptionType &parent)

Constructor takes reference to parent option.

inline virtual OptionChild *clone() const override

Makes copy (clone) of this object.

inline virtual Priority get_priority() const override

Returns priority (source) of the stored value. If no value is stored, priority from the parent is returned.

inline void set(Priority priority, const typename ParentOptionType::ValueType &value)

Sets new value and priority (source). The value and priority are stored only if the new priority is equal to or higher than the stored priority.

inline void set(const typename ParentOptionType::ValueType &value)

Sets new value and runtime priority.

inline virtual void set(Priority priority, const std::string &value) override

Sets new value and priority (source). The value and priority are stored only if the new priority is equal to or higher than the stored priority.

inline virtual void set(const std::string &value) override

Sets new value and runtime priority.

inline ParentOptionType::ValueType get_value() const

Gets the stored value. If no value is stored, value from the parent is returned.

inline ParentOptionType::ValueType get_default_value() const

Gets the default value from parent. Default value is used until it is replaced by set() method.

inline virtual std::string get_value_string() const override

Gets a string representation of the stored value. If no value is stored, value from the parent is returned.

inline virtual bool empty() const noexcept override

Checks if the option is empty (has no stored value). If it is empty, checks status of the parent.

template<class ParentOptionType>
class OptionChild<ParentOptionType, typename std::enable_if<std::is_same<typename ParentOptionType::ValueType, std::string>::value>::type> : public libdnf5::Option
#include <option_child.hpp>

Option that links option to another option. It uses default value and parameters from linked option. If it is empty (has no stored value), uses value from the linked option (parent). Parent option type is template parameter. This is specialization for parent with std::string ValueType.

Public Functions

explicit OptionChild(const ParentOptionType &parent)

Constructor takes reference to parent option.

virtual OptionChild *clone() const override

Makes copy (clone) of this object.

virtual Priority get_priority() const override

Returns priority (source) of the stored value. If no value is stored, priority from the parent is returned.

virtual void set(Priority priority, const std::string &value) override

Sets new value and priority (source). The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Sets new value and runtime priority.

const std::string &get_value() const

Gets the stored value. If no value is stored, value from the parent is returned.

const std::string &get_default_value() const

Gets the default value from parent. Default value is used until it is replaced by set() method.

virtual std::string get_value_string() const override

Gets a string representation of the stored value. If no value is stored, value from the parent is returned.

virtual bool empty() const noexcept override

Checks if the option is empty (has no stored value). If it is empty, checks status of the parent.

class OptionEnum : public libdnf5::Option
#include <option_enum.hpp>

Option that stores value from enumeration of strings. It supports default value. It supports user defined function for conversion from string.

Public Types

using ValueType = std::string
using FromStringFunc = std::function<std::string(const std::string&)>

Public Functions

OptionEnum(std::string default_value, std::vector<std::string> enum_vals)
OptionEnum(std::string default_value, std::vector<std::string> enum_vals, FromStringFunc &&from_string_func)
~OptionEnum() override
virtual OptionEnum *clone() const override

Makes copy (clone) of this object.

virtual void set(Priority priority, const std::string &value) override

Parses input string and sets new value and priority. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Parses input string and sets new value and runtime priority.

const std::string &get_value() const

Gets the stored value.

const std::string &get_default_value() const

Gets the default value. Default value is used until it is replaced by set() method.

virtual std::string get_value_string() const override

Gets a string representation of the stored value.

void test(const std::string &value) const

Tests input value and throws exception if the value is not allowed.

std::string from_string(const std::string &value) const

Parses input string and returns result.

class OptionError : public libdnf5::Error
#include <option_errors.hpp>

Option exception.

Subclassed by libdnf5::OptionInvalidValueError, libdnf5::OptionValueNotSetError

Public Functions

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.

template<AllowedErrorArgTypes... Args>
inline explicit Error(BgettextMessage format, Args... args)

A constructor that supports formatting the error message.

Parameters:
  • format – The format string for the message.

  • args – The format arguments.

Error(const Error &e) noexcept
class OptionInvalidValueError : public libdnf5::OptionError
#include <option_errors.hpp>

Exception that is generated when an invalid input value is detected.

Subclassed by libdnf5::OptionValueNotAllowedError

Public Functions

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

The exception class name.

template<typename T>
class OptionNumber : public libdnf5::Option
#include <option_number.hpp>

Option that stores numerical value. The type of value is template parameter. Support default value, minimal and maximal values, user defined function for conversion from string.

Public Types

using ValueType = T
using FromStringFunc = std::function<ValueType(const std::string&)>

Public Functions

OptionNumber(T default_value, T min, T max)

Constructor that sets default value and limits for min and max values.

OptionNumber(T default_value, T min)

Constructor that sets default value and limit for min value.

explicit OptionNumber(T default_value)

Constructor that sets default value.

OptionNumber(T default_value, T min, T max, FromStringFunc &&from_string_func)

Constructor that sets default value and limits for min and max values and input parsing function.

OptionNumber(T default_value, T min, FromStringFunc &&from_string_func)

Constructor that sets default value and limit for min value and input parsing function.

OptionNumber(T default_value, FromStringFunc &&from_string_func)

Constructor that sets default value and input parsing function.

OptionNumber(const OptionNumber &src)
~OptionNumber() override
virtual OptionNumber *clone() const override

Makes copy (clone) of this object.

void set(Priority priority, ValueType value)

Sets new value and priority (source). The value and priority are stored only if the new priority is equal to or higher than the stored priority.

void set(ValueType value)

Sets new value and runtime priority.

virtual void set(Priority priority, const std::string &value) override

Parses input string and sets new value and priority. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Parses input string and sets new value and runtime priority.

T get_value() const

Gets the stored value.

T get_default_value() const

Gets the default value. Default value is used until it is replaced by set() method.

virtual std::string get_value_string() const override

Gets a string representation of the stored value.

void test(ValueType value) const

Tests input value and throws exception if the value is not allowed.

T from_string(const std::string &value) const

Parses input string and returns result.

std::string to_string(ValueType value) const

Converts input value to the string.

class OptionPath : public libdnf5::OptionString
#include <option_path.hpp>

Option that stores file/directory path. Support default value, and path verification (absolute, existence).

Public Functions

explicit OptionPath(std::string default_value, bool exists = false, bool abs_path = false)

Constructor sets default value and conditions.

explicit OptionPath(const char *default_value, bool exists = false, bool abs_path = false)

Constructor sets default value and conditions.

OptionPath(std::string default_value, std::string regex, bool icase, bool exists = false, bool abs_path = false)

Constructor sets default value and conditions.

~OptionPath()
OptionPath(const OptionPath &src)
OptionPath(const char *default_value, std::string regex, bool icase, bool exists = false, bool abs_path = false)

Constructor sets default value and conditions.

virtual OptionPath *clone() const override

Makes copy (clone) of this object.

virtual void set(Priority priority, const std::string &value) override

Parses input string and sets new value and priority. According setting passed in constructor it can verify that the path is absolute, exists and match regex. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Parses input string and sets new value and runtime priority.

void test(const std::string &value) const

Tests input value and throws exception if the value is not allowed.

class OptionPathNotFoundError : public libdnf5::OptionValueNotAllowedError
#include <option_path_errors.hpp>

Exception that is generated when input path does not exist.

Public Functions

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

The exception class name.

class OptionSeconds : public libdnf5::OptionNumber<std::int32_t>
#include <option_seconds.hpp>

Option that stores an integer value of seconds. Support default value, minimal and maximal values.

Public Functions

OptionSeconds(ValueType default_value, ValueType min, ValueType max)
OptionSeconds(ValueType default_value, ValueType min)
explicit OptionSeconds(ValueType default_value)
inline virtual OptionSeconds *clone() const override

Makes copy (clone) of this object.

virtual void set(Priority priority, const std::string &value) override

Parses input string and sets new value and priority. Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never. Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Parses input string and sets new value and runtime priority.

ValueType from_string(const std::string &value) const

Parses input string and returns result.

class OptionString : public libdnf5::Option
#include <option_string.hpp>

Option that stores string value. Support default value, and check of an input value using the regular expression

Subclassed by libdnf5::OptionPath

Public Types

using ValueType = std::string

Public Functions

explicit OptionString(std::string default_value)
explicit OptionString(const char *default_value)
OptionString(std::string default_value, std::string regex, bool icase)
OptionString(const char *default_value, std::string regex, bool icase)
~OptionString()
OptionString(const OptionString &src)
virtual OptionString *clone() const override

Makes copy (clone) of this object.

virtual void set(Priority priority, const std::string &value) override

Sets new value and priority. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Sets new value and runtime priority.

const std::string &get_value() const

Gets the stored value.

const std::string &get_default_value() const noexcept

Gets the default value. Default value is used until it is replaced by set() method.

virtual std::string get_value_string() const override

Gets a string representation of the stored value.

void test(const std::string &value) const

Tests input value and throws exception if the value is not allowed.

std::string from_string(const std::string &value) const

Returns copy of input string. Must be present for compatibility with other option types.

template<typename T, bool IsAppend = false>
class OptionStringContainer : public libdnf5::Option
#include <option_string_list.hpp>

Option that stores a container of strings. The type of the container is a template parameter. Non-type IsAppend template parameter is used to distinguish between regular list-like options (e.g. OptionStringList, OptionStringSet) and append options (e.g. OptionStringAppendList, OptionStringAppendSet). Support default value, and check of an input value using the regular expression.

Public Types

using ValueType = T

Public Functions

explicit OptionStringContainer(ValueType default_value)
OptionStringContainer(ValueType default_value, std::string regex, bool icase)
explicit OptionStringContainer(const std::string &default_value)
OptionStringContainer(const std::string &default_value, std::string regex, bool icase)
OptionStringContainer(ValueType default_value, std::string regex, bool icase, std::string delimiters)
OptionStringContainer(const OptionStringContainer &src)
~OptionStringContainer() override
virtual OptionStringContainer *clone() const override

Makes copy (clone) of this object.

virtual void set(Priority priority, const ValueType &value)

Sets new value and priority (source). The value and priority are stored only if the new priority is equal to or higher than the stored priority.

void set(const ValueType &value)

Sets new value and runtime priority.

virtual void set(Priority priority, const std::string &value) override

Parses input string and sets new value and priority. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

virtual void set(const std::string &value) override

Parses input string and sets new value and runtime priority.

void add(Priority priority, const ValueType &items)

Adds items from an another container. New items are stored in the container value

void add(Priority priority, const std::string &value)

Parses input string and adds new values and priority. The value and priority are stored only if the new priority is equal to or higher than the stored priority.

void add_item(Priority priority, const std::string &item)

Adds new item to the container. New item is stored in the container value

const ValueType &get_value() const

Gets the stored value.

const ValueType &get_default_value() const

Gets the default value. Default value is used until it is replaced by set() method.

virtual std::string get_value_string() const override

Gets a string representation of the stored value.

void test(const ValueType &value) const

Tests input value and throws exception if the value is not allowed.

ValueType from_string(std::string value) const

Parses input string and returns result.

std::string to_string(const ValueType &value) const

Converts input value to the string.

const char *get_delimiters() const noexcept

Return delimiters of this OptionStringList.

Public Static Functions

static const char *get_default_delimiters() noexcept

Returns the default delimiters.

class OptionValueNotAllowedError : public libdnf5::OptionInvalidValueError
#include <option_errors.hpp>

Exception that is generated when not allowed input value is detected.

Subclassed by libdnf5::OptionPathNotFoundError

Public Functions

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

The exception class name.

class OptionValueNotSetError : public libdnf5::OptionError
#include <option_errors.hpp>

Exception that is generated during read an empty Option.

Public Functions

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

The exception class name.

struct PluginAPIVersion
#include <version.hpp>

Plugin API version

Since

5.0

Public Members

std::uint16_t major
std::uint16_t minor
template<typename Key, typename T, class KeyEqual = std::equal_to<Key>>
class PreserveOrderMap
#include <preserve_order_map.hpp>

PreserveOrderMap is an associative container that contains key-value pairs with unique unique keys. It is similar to standard std::map. But it preserves the order of items and the complexity is linear.

Public Types

using key_type = Key
using mapped_type = T
using key_equal = KeyEqual
using value_type = std::pair<const Key, T>
using container_type = std::vector<std::pair<Key, T>>
using size_type = typename container_type::size_type
using iterator = BidirIterator<value_type, typename container_type::iterator>
using const_iterator = BidirIterator<const value_type, typename container_type::const_iterator>
using reverse_iterator = BidirIterator<value_type, typename container_type::reverse_iterator>
using const_reverse_iterator = BidirIterator<const value_type, typename container_type::const_reverse_iterator>

Public Functions

inline bool empty() const noexcept
inline size_type size() const noexcept
inline size_type max_size() const noexcept
inline void reserve(size_type new_capacity)
inline size_type capacity() const noexcept
inline void shrink_to_fit()
inline iterator begin() noexcept
inline const_iterator begin() const noexcept
inline const_iterator cbegin() const noexcept
inline iterator end() noexcept
inline const_iterator end() const noexcept
inline const_iterator cend() const noexcept
inline reverse_iterator rbegin() noexcept
inline const_reverse_iterator rbegin() const noexcept
inline const_reverse_iterator crbegin() const noexcept
inline reverse_iterator rend() noexcept
inline const_reverse_iterator rend() const noexcept
inline const_reverse_iterator crend() const noexcept
inline void clear() noexcept
inline std::pair<iterator, bool> insert(const value_type &value)
inline iterator erase(const_iterator pos)
inline iterator erase(iterator pos)
inline iterator erase(const_iterator first, const_iterator last)
inline size_type erase(const Key &key)
inline size_type count(const Key &key) const
inline iterator find(const Key &key)
inline const_iterator find(const Key &key) const
inline T &operator[](const Key &key)
inline T &operator[](Key &&key)
inline T &at(const Key &key)
inline const T &at(const Key &key) const
template<typename valueType, typename ContainerTypeIterator>
struct BidirIterator

Public Types

using iterator_category = std::bidirectional_iterator_tag
using value_type = typename PreserveOrderMap::value_type
using difference_type = ptrdiff_t
using pointer = valueType*
using reference = valueType&

Public Functions

explicit BidirIterator() = default
inline explicit BidirIterator(ContainerTypeIterator ci)
template<typename CItType = ContainerTypeIterator>
inline BidirIterator(const BidirIterator<value_type, typename container_type::iterator> &src, typename std::enable_if<std::is_same<CItType, typename container_type::const_iterator>::value>::type* = 0)
template<typename CItType = ContainerTypeIterator>
inline BidirIterator(const BidirIterator<value_type, typename container_type::reverse_iterator> &src, typename std::enable_if<std::is_same<CItType, typename container_type::const_reverse_iterator>::value>::type* = 0)
inline reference operator*() const
inline pointer operator->() const
inline BidirIterator &operator++()
inline BidirIterator operator++(int)
inline BidirIterator &operator--()
inline BidirIterator operator--(int)
inline bool operator==(const BidirIterator &other) const
inline bool operator!=(const BidirIterator &other) const
class ReadOnlyVariableError : public libdnf5::Error
struct ResolveSpecSettings
#include <goal_elements.hpp>

Configure SPEC resolving. Important for queries that resolve SPEC.

Subclassed by libdnf5::GoalJobSettings

Public Functions

ResolveSpecSettings()
~ResolveSpecSettings()
ResolveSpecSettings(const ResolveSpecSettings &src)
ResolveSpecSettings &operator=(const ResolveSpecSettings &src)
ResolveSpecSettings(ResolveSpecSettings &&src) noexcept
ResolveSpecSettings &operator=(ResolveSpecSettings &&src) noexcept
void set_ignore_case(bool ignore_case)

Set whether to match case-insensitively

Default: false

bool get_ignore_case() const
void set_with_nevra(bool with_nevra)

Set whether packages’ nevras should be considered during SPEC matching

Default: true

bool get_with_nevra() const
void set_with_provides(bool with_provides)

Set whether packages’ provides should be considered during SPEC matching

Default: true

bool get_with_provides() const
void set_with_filenames(bool with_filenames)

Set whether package’s files should be considered during SPEC matching It will check if SPEC starts with “/” or “*&zwj;/” and if it matches any file in a package

Default: true

bool get_with_filenames() const
void set_with_binaries(bool with_binaries)

Set whether package’s binaries should be considered during SPEC matching It will check whether SPEC is a binary -> /usr/(s)bin/<SPEC>

Default: true

bool get_with_binaries() const
void set_expand_globs(bool expand_globs)

Set whether to expand globs in package specs using fnmatch

Default: true

bool get_expand_globs() const
void set_nevra_forms(std::vector<libdnf5::rpm::Nevra::Form> nevra_forms)

When matching packages’ nevras is enabled specify allowed nevra forms.

The default can be obtained from libdnf5::rpm::Nevra::get_default_pkg_spec_forms().

std::vector<libdnf5::rpm::Nevra::Form> get_nevra_forms() const
void set_group_with_id(bool group_with_id)

Set whether groups’ ids should be considered during group SPEC matching

Default: true

bool get_group_with_id() const
void set_group_with_name(bool group_with_name)

Set whether groups’ names should be considered during group SPEC matching

Default: false

bool get_group_with_name() const
void set_group_search_groups(bool search_groups)

Configure whether to search in groups when matching SPEC in group ids or names. Historically group SPEC could also mean an environment. These flags configure in which entities the spec is searched for.

Default: true

bool get_group_search_groups() const
void set_group_search_environments(bool search_environments)

Configure whether to search in environments when matching SPEC in group ids or names.

Default: true

bool get_group_search_environments() const
class RotatingFileLogger : public libdnf5::StringLogger
#include <rotating_file_logger.hpp>

RotatingFileLogger is an implementation of a rotating file logger. It can be used simultaneously in multiple processes and threads.

Public Functions

explicit RotatingFileLogger(const std::filesystem::path &base_file_path, std::size_t max_bytes, std::size_t backup_count)

Construct a new instance of the RotatingFileLogger class.

It immediately opens (creates) base_file_path to detect problems before logging starts.

When max_bytes is non-zero and backup_count is non-zero, rotation is enabled. For example, with backup_count of 5 and a base_file_path of “app.log”, we would get “app.log”, “app.log.1”, “app.log.2” through “app.log.5”. The file written to is always “app.log”. If the message being written does not fit into the file (the size of the resulting file would be greater than max_bytes), it is closed and renamed to “app.log.1”, and if there are files “app.log.1”, “app.log.2”, etc., then they are renamed on “app.log.2”, “app.log.3” etc. Writing is done to a new “app.log” file. Note: The message being written is not split into multiple files. -> The log file can be larger than max_bytes if the message being written is larger than max_bytes. The file then only contains this message.

Parameters:
  • base_file_path – path to the file where log messages are written

  • max_bytes – max log file size; 0 - means unlimited; at least one full message can always be written

  • backup_count – maximum number of backup files; 0 - means rotation is disabled

~RotatingFileLogger()
virtual void write(const char *line) noexcept override
virtual void write(const std::chrono::time_point<std::chrono::system_clock> &time, pid_t pid, Level level, const std::string &message) noexcept override
virtual void write(const char *line) noexcept = 0
class RuntimeError : public libdnf5::Error

Public Functions

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

The exception class name.

virtual const char *get_description() const noexcept
template<AllowedErrorArgTypes... Args>
inline explicit Error(BgettextMessage format, Args... args)

A constructor that supports formatting the error message.

Parameters:
  • format – The format string for the message.

  • args – The format arguments.

Error(const Error &e) noexcept
template<typename T>
class Set
#include <set.hpp>

Set represents set of objects (e.g. repositories, or groups) and implements set operations such as unions or differences.

Subclassed by libdnf5::sack::Query< Environment >, libdnf5::sack::Query< Group >, libdnf5::sack::Query< ModuleItem >, libdnf5::sack::Query< RepoWeakPtr >, libdnf5::sack::Query< T >

Public Types

using key_type = T
using value_type = T
using size_type = std::size_t
using iterator = SetConstIterator<T>
using const_iterator = SetConstIterator<T>

Public Functions

Set() = default
inline Set(const Set<T> &other)
inline Set(Set<T> &&other)
inline Set(std::initializer_list<T> ilist)
~Set() = default
inline bool empty() const noexcept
inline size_type size() const noexcept
inline void clear() noexcept
inline bool add(const T &obj)
inline bool add(T &&obj)
inline bool remove(const T &obj)
inline const_iterator find(const T &obj) const
inline bool contains(const T &obj) const
inline Set<T> &operator=(const Set<T> &other)
inline Set<T> &operator=(Set<T> &&other) noexcept
inline Set<T> &operator=(std::initializer_list<T> ilist)
inline Set<T> &operator|=(const Set<T> &other)
inline Set<T> &operator&=(const Set<T> &other)
inline Set<T> &operator-=(const Set<T> &other)
inline Set<T> &operator^=(const Set<T> &other)
inline void update(const Set<T> &other)
inline void intersection(const Set<T> &other)
inline void difference(const Set<T> &other)
inline void symmetric_difference(const Set<T> &other)
inline bool is_subset(const Set<T> &other) const
inline bool is_superset(const Set<T> &other) const
inline void swap(Set<T> &other) noexcept
inline const std::set<T> &get_data() const noexcept

Return reference to underlying std::set.

inline std::set<T> &get_data() noexcept
inline const_iterator begin() const
inline const_iterator end() const
template<typename T>
class SetConstIterator

Public Types

using iterator_category = std::bidirectional_iterator_tag
using difference_type = std::ptrdiff_t
using value_type = T
using pointer = const T*
using reference = const T&

Public Functions

inline reference operator*() const noexcept
inline pointer operator->() const noexcept
inline SetConstIterator &operator++() noexcept
inline SetConstIterator operator++(int) noexcept
inline SetConstIterator &operator--() noexcept
inline SetConstIterator operator--(int) noexcept
inline bool operator==(const SetConstIterator &other) const
inline bool operator!=(const SetConstIterator &other) const
struct SourceLocation
#include <exception.hpp>

The source_location structure represents location information in the source code. Specifically, the file name, line number, and function name.

Public Members

const char *file_name
unsigned int source_line
const char *function_name
class StdCStreamLogger : public libdnf5::StringLogger
#include <stream_logger.hpp>

Logger that logs to a stream stored as a reference, meant to be used with std::cerr and std::cout.

Public Functions

explicit StdCStreamLogger(std::ostream &log_stream)
~StdCStreamLogger() override
virtual void write(const char *line) noexcept override
class StreamLogger : public libdnf5::StringLogger
#include <stream_logger.hpp>

StreamLogger is an implementation of logging class that writes messages into a stream.

Public Functions

explicit StreamLogger(std::unique_ptr<std::ostream> &&log_stream)
~StreamLogger() override
virtual void write(const char *line) noexcept override
class StringLogger : public libdnf5::Logger

Subclassed by libdnf5::RotatingFileLogger, libdnf5::StdCStreamLogger, libdnf5::StreamLogger

Public Functions

explicit StringLogger()
~StringLogger() override
virtual void write(const std::chrono::time_point<std::chrono::system_clock> &time, pid_t pid, Level level, const std::string &message) noexcept override
virtual void write(const char *line) noexcept = 0
class SystemError : public libdnf5::Error
#include <exception.hpp>

An exception class for system errors represented by the errno error code.

Public Functions

explicit SystemError(int error_code)

Constructs the error from the errno error code and generates the message from the system error description.

Parameters:

error_code – The errno of the error.

template<AllowedErrorArgTypes... Args>
inline explicit SystemError(int error_code, BgettextMessage format, Args... args)

Constructs the error from the errno error code and a formatted message. The formatted message is prepended to the generated system error message.

Parameters:
  • error_code – The errno of the error.

  • format – The format string for the message.

  • args – The format arguments.

const char *what() const noexcept override
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.

inline int get_error_code() const noexcept
Returns:

The error code (errno) of the error.

std::string get_error_message() const
Returns:

The system error message associated with the error code.

class UserAssertionError : public std::logic_error
#include <exception.hpp>

A UserAssertionError is an error which is thrown when the libdnf public API is used in an unexpected way and continuing would led to an invalid state. For the bindings users, this exception is intended to be translated into a standard runtime exception which could be handled, whereas with the previous AssertionError exception the process is terminated and the system state is captured for debugging purposes.

Public Functions

explicit UserAssertionError(const char *assertion, const SourceLocation &location, const std::string &message)
const char *what() const noexcept override
inline const char *assertion() const noexcept
inline const char *file_name() const noexcept
inline unsigned int source_line() const noexcept
inline const char *function_name() const noexcept
inline const char *message() const noexcept
class Vars
#include <vars.hpp>

Class for reading and substituting DNF vars (arch, releasever, etc.).

The class loads the variables from the environment as well as from a list of directories.

Public Types

enum class Priority

Values:

enumerator DEFAULT
enumerator AUTO
enumerator VARSDIR
enumerator PLUGIN
enumerator ENVIRONMENT
enumerator COMMANDLINE
enumerator RUNTIME

Public Functions

Vars(const libdnf5::BaseWeakPtr &base)
Vars(libdnf5::Base &base)
~Vars()
std::string substitute(const std::string &text) const

Substitute DNF vars in the input text.

Parameters:

text – The text for substitution

Returns:

The substituted text

const std::map<std::string, Variable> &get_variables() const
void set(const std::string &name, const std::string &value, Priority prio = Priority::RUNTIME)

Set particular variable to a value.

Parameters:
  • name – Name of the variable

  • value – Value to be stored in variable

  • prio – Source/Priority of the value

Throws:

ReadOnlyVariableError – if the variable is read-only

bool unset(const std::string &name, Priority prio = Priority::RUNTIME)

Unset particular variable.

Parameters:
  • name – Name of the variable

  • prio – Source/Priority of the request

Throws:

ReadOnlyVariableError – if the variable is read-only

Returns:

false if the variable exists after the function returns (insufficient request priority)

bool is_read_only(const std::string &name) const

Checks whether a variable is read-only.

Parameters:

name – Name of the variable

Returns:

true if the variable is read-only, false if it is writable

bool contains(const std::string &name) const

Checks if there is an variable with name equivalent to name in the container.

Parameters:

name – Name of the variable

Returns:

true if there is such an element, otherwise false

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

Get value of particular variable.

Parameters:

name – Name of the variable

const Variable &get(const std::string &name) const

Get particular variable.

Parameters:

name – Name of the variable

Public Static Functions

static std::unique_ptr<std::string> detect_release(const BaseWeakPtr &base, const std::string &install_root_path)
struct Variable

Public Members

std::string value
Priority priority
template<typename TPtr, bool ptr_owner>
struct WeakPtr
#include <weak_ptr.hpp>

WeakPtr is a “smart” pointer. It contains a pointer to resource and to guard of resource. WeakPtr pointer can be owner of the resource. However, the resource itself may depend on another resource. WeakPtr registers/unregisters itself at the guard of resource. And the resource guard invalidates the registered WeakPtrs when the resource is unusable (eg. its dependecny was released). Note on thread safety: It is safe to create, access and destroy WeakPtrs in multiple threads simultaneously.

Public Types

using TWeakPtrGuard = WeakPtrGuard<TPtr, ptr_owner>

Public Functions

inline WeakPtr()
inline WeakPtr(TPtr *ptr, TWeakPtrGuard *guard)
inline WeakPtr(const WeakPtr &src)
template<typename T = TPtr, typename std::enable_if<sizeof(T) && ptr_owner, int>::type = 0>
inline WeakPtr(WeakPtr &&src)
inline ~WeakPtr()
inline WeakPtr &operator=(const WeakPtr &src)
template<typename T = TPtr, typename std::enable_if<sizeof(T) && ptr_owner, int>::type = 0>
inline WeakPtr &operator=(WeakPtr &&src)
inline TPtr *operator->() const

Provides access to the managed object. Generates exception if object is not valid.

inline TPtr *get() const

Returns a pointer to the managed object. Generates exception if object is not valid.

inline bool is_valid() const noexcept

Checks if managed object is valid.

inline bool has_same_guard(const WeakPtr &other) const noexcept

Checks if the other WeakPtr instance has the same WeakPtrGuard.

inline TPtr &operator*() const
inline bool operator==(const WeakPtr &other) const
inline bool operator!=(const WeakPtr &other) const
inline bool operator<(const WeakPtr &other) const
inline bool operator>(const WeakPtr &other) const
inline bool operator<=(const WeakPtr &other) const
inline bool operator>=(const WeakPtr &other) const
template<typename TPtr, bool weak_ptr_is_owner>
struct WeakPtrGuard
#include <weak_ptr.hpp>

WeakPtrGuard is a resource guard. WeakPtr instances register itself to the resource guard. And the resource guard invalidates the registered WeakPtrs when the resource is unusable (eg. its dependecny was released). Note on thread safety: Destroying the WeakPtrGuard while simultaneously using its WeakPtrs in another thread is not safe and can still trigger a race condition.

Public Types

using TWeakPtr = WeakPtr<TPtr, weak_ptr_is_owner>

Public Functions

WeakPtrGuard() = default
WeakPtrGuard(const WeakPtrGuard&) = delete
WeakPtrGuard(WeakPtrGuard &&src) noexcept = delete
inline ~WeakPtrGuard()
WeakPtrGuard &operator=(const WeakPtrGuard &src) = delete
WeakPtrGuard &operator=(WeakPtrGuard &&src) noexcept = delete
inline bool empty() const noexcept

Returns true if the guard is empty, false otherwise.

inline size_t size() const noexcept

Returns the number of registered weak pointers.

inline void clear() noexcept

Deregisters and invalidates all registered weak pointers. After this call, size() returns zero.