libdnf5::base

class LogEvent
#include <log_event.hpp>

Contain information, hint, or a problem created during libdnf5::Goal::resolve()

Public Functions

LogEvent(libdnf5::GoalAction action, libdnf5::GoalProblem problem, const std::set<std::string> &additional_data, const libdnf5::GoalJobSettings &settings, const libdnf5::transaction::TransactionItemType spec_type, const std::string &spec)

Public constructor.

LogEvent(libdnf5::GoalProblem problem, const SolverProblems &solver_problems)
~LogEvent()
LogEvent(const LogEvent &src)
LogEvent &operator=(const LogEvent &src)
LogEvent(LogEvent &&src) noexcept
LogEvent &operator=(LogEvent &&src) noexcept
libdnf5::GoalAction get_action() const
Returns:

GoalAction for which goal event was created

libdnf5::GoalProblem get_problem() const
Returns:

GoalProblem that specify the type of report

const std::set<std::string> &get_additional_data() const
Returns:

Additional information (internal), that are required for formatted string

const libdnf5::GoalJobSettings *get_job_settings() const
Returns:

GoalJobSetting if it is relevant for the particular GoalProblem

const std::string *get_spec() const
Returns:

SPEC if it is relevant for the particular GoalProblem

const SolverProblems *get_solver_problems() const
Returns:

SolverProblems if they are relevant for the particular GoalProblem

std::string to_string() const

Convert an element from resolve log to string;.

class SolverProblems
#include <solver_problems.hpp>

Represent problems detected by a RPM solver (libsolv)

Public Functions

SolverProblems(const std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> &problems)

Public constructor.

SolverProblems(const SolverProblems &src)
SolverProblems(SolverProblems &&src) noexcept
SolverProblems &operator=(const SolverProblems &src)
SolverProblems &operator=(SolverProblems &&src) noexcept
~SolverProblems()
std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> get_problems() const

Provide information about package solver problems in a vector. Each problem can be transformed to string by package_solver_problem_to_string or all problems to a string by all_package_solver_problems_to_string().

Returns:

Vector of problems encountered by the solver. Each problem is described by a vector of “rule breakages” (TODO(lukash) try to find a better name for this) stored in a std::pair<libdnf5::ProblemRules, std::vector<std::string>>, where the first of the pair is a rule breakage identifier and the second is a list of string identifiers which are the subjects of the rule breakage. These can be rendered into a string by the problem_to_string() method.

std::string to_string() const

Convert SolverProblems class to string representative;.

Public Static Functions

static std::string problem_to_string(const std::pair<libdnf5::ProblemRules, std::vector<std::string>> &raw)

Convert particular package solver problem to a string;.

class Transaction

Public Types

enum class TransactionRunResult

enum representing Transaction run result

Values:

enumerator SUCCESS
enumerator ERROR_RERUN
enumerator ERROR_RESOLVE
enumerator ERROR_LOCK
enumerator ERROR_CHECK
enumerator ERROR_RPM_RUN
enumerator ERROR_GPG_CHECK

Public Functions

Transaction(const Transaction &transaction)
Transaction(Transaction &&transaction)
~Transaction()
libdnf5::GoalProblem get_problems()

Return basic overview about result of resolving transaction. To get complete information, use get_resolve_logs().

const std::vector<libdnf5::base::LogEvent> &get_resolve_logs() const

Returns information about resolvement of Goal.

Returns:

A vector of LogEvent instances.

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

Returns information about resolvement of Goal as a list of printable messages

Returns:

A vector of string representations of problems.

std::vector<libdnf5::base::TransactionPackage> get_transaction_packages() const
Returns:

the transaction packages.

std::size_t get_transaction_packages_count() const
Returns:

the number of transaction packages.

std::vector<libdnf5::base::TransactionGroup> &get_transaction_groups() const
Returns:

the transaction groups.

std::vector<libdnf5::base::TransactionModule> &get_transaction_modules() const
Returns:

the transaction modules.

std::vector<libdnf5::base::TransactionEnvironment> &get_transaction_environments() const
Returns:

environmental groups that are part of the transaction.

std::vector<libdnf5::rpm::Package> get_broken_dependency_packages() const
Returns:

list of packages skipped due to broken dependencies

std::vector<libdnf5::rpm::Package> get_conflicting_packages() const
Returns:

list of packages skipped due to conflicts

bool empty() const
Returns:

true if the transaction is empty.

void download()

Download all inbound packages (packages that are being installed on the system). Fails immediately on the first package download failure. Will try to resume downloads of any partially-downloaded RPMs.

The destination directory for downloaded RPMs is taken from the destdir configuration option. If it’s not specified, the standard location of repo cachedir/packages is used.

TransactionRunResult test()

Check the transaction by running it with RPMTRANS_FLAG_TEST. The import of any necessary public keys will be requested, and transaction checks will be performed, but no changes to the installed package set will be made. These checks are performed automatically by run(); it is redundant to call test() before calling run().

Returns:

An enum describing the result of the transaction

TransactionRunResult run()

Prepare, check and run the transaction.

All the transaction metadata that was set (description, user_id or comment) is stored in the history database.

To watch progress or trigger actions during specific transactions events, setup the callbacks object.

After a successful transaction, any temporarily downloaded packages are removed if the ‘keepcache’ option is set to ‘false’ and the transaction involved an inbound action. Otherwise, the packages are preserved on the disk.

Returns:

An enum describing the result of running the transaction.

void set_callbacks(std::unique_ptr<libdnf5::rpm::TransactionCallbacks> &&callbacks)

Setup callbacks to be called during rpm transaction.

Parameters:

callbacks – Implemented callbacks object.

void set_description(const std::string &description)

Setup a description of the transaction.

Parameters:

description – Value could be the console command for CLI or verbose description for API usage.

void set_user_id(const uint32_t user_id)

Setup the id of the user that started the transaction. If not set, current login user UID is used.

Parameters:

user_id – UID value.

void set_comment(const std::string &comment)

Setup a comment to store in the history database along with the transaction.

Parameters:

comment – Any string value.

std::vector<std::string> get_transaction_problems() const noexcept

Retrieve list of problems that occurred during transaction run attempt.

bool check_gpg_signatures()

Check signatures of packages in the resolved transaction.

Returns:

True if all packages have correct signatures or checking is turned off with pkg_gpgcheck option, otherwise false. More info about occurred problems can be retrieved using the get_gpg_signature_problems method.

std::vector<std::string> get_gpg_signature_problems() const noexcept

Retrieve a list of the problems that occurred during check_gpg_signatures procedure.

std::string serialize(const std::filesystem::path &packages_path = "", const std::filesystem::path &comps_path = "") const

Warning

This method is experimental/unstable and should not be relied on. It may be removed without warning Serialize the transaction into a json data format which can be later loaded into a libdnf5::Goal and replayed. If packages_path is provided it is assumed all packages in this transaction are present there and the serialized transaction contains paths those packages. The same applies for comps paths (they can be stored using the store_comps method).

void store_comps(const std::filesystem::path &comps_path) const

Warning

This method is experimental/unstable and should not be relied on. It may be removed without warning Store each group and environment in this transaction as a separate xml file in the specified path.

void set_download_local_pkgs(bool value)

Set whether local packages should be copied to the destination directory during the download().

Default: false

bool get_download_local_pkgs() const noexcept
std::string get_last_script_output()

Retrieve output of the last executed rpm scriptlet.

std::vector<std::string> get_rpm_messages()

Retrieve captured RPM log messages.

Public Static Functions

static std::string transaction_result_to_string(const TransactionRunResult result)

Return string representation of the TransactionRunResult enum.

Friends

friend class libdnf5::Goal
friend class libdnf5::rpm::Transaction
class TransactionEnvironment

Public Types

using Reason = transaction::TransactionItemReason
using State = transaction::TransactionItemState
using Action = transaction::TransactionItemAction

Public Functions

libdnf5::comps::Environment get_environment() const
Returns:

the underlying environment.

Action get_action() const noexcept
Returns:

the action being performed on the transaction environment.

State get_state() const noexcept
Returns:

the state of the environment in the transaction.

Reason get_reason() const noexcept
Returns:

the reason of the action being performed on the transaction environment.

bool get_with_optional() const noexcept
Returns:

package types requested to be installed with the group.

~TransactionEnvironment()
TransactionEnvironment(const TransactionEnvironment &mpkg)
TransactionEnvironment &operator=(const TransactionEnvironment &mpkg)
TransactionEnvironment(TransactionEnvironment &&mpkg) noexcept
TransactionEnvironment &operator=(TransactionEnvironment &&mpkg) noexcept

Friends

friend class Transaction::Impl
class TransactionError : public libdnf5::Error
#include <transaction_errors.hpp>

Error related to processing transaction.

Public Functions

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

Error class’ domain name”

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

Error 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 TransactionGroup

Public Types

using Reason = transaction::TransactionItemReason
using State = transaction::TransactionItemState
using Action = transaction::TransactionItemAction
using PackageType = libdnf5::comps::PackageType

Public Functions

libdnf5::comps::Group get_group() const
Returns:

the underlying group.

Action get_action() const noexcept
Returns:

the action being performed on the transaction group.

State get_state() const noexcept
Returns:

the state of the group in the transaction.

Reason get_reason() const noexcept
Returns:

the reason of the action being performed on the transaction group.

PackageType get_package_types() const noexcept
Returns:

package types requested to be installed with the group.

~TransactionGroup()
TransactionGroup(const TransactionGroup &mpkg)
TransactionGroup &operator=(const TransactionGroup &mpkg)
TransactionGroup(TransactionGroup &&mpkg) noexcept
TransactionGroup &operator=(TransactionGroup &&mpkg) noexcept

Friends

friend class Transaction::Impl
class TransactionModule

Public Types

using Reason = transaction::TransactionItemReason
using State = transaction::TransactionItemState
using Action = transaction::TransactionItemAction

Public Functions

std::string get_module_name() const
Returns:

the module name.

std::string get_module_stream() const
Returns:

the module stream.

Action get_action() const noexcept
Returns:

the action being performed on the transaction module.

State get_state() const noexcept
Returns:

the state of the module item in the transaction.

Reason get_reason() const noexcept
Returns:

the reason of the action being performed on the transaction module.

std::vector<std::pair<std::string, std::string>> get_replaces() const noexcept
Returns:

module:stream pairs replaced by this transaction module.

const std::vector<std::pair<std::string, std::string>> &get_replaced_by() const noexcept
Returns:

module:stream pairs that replace this transaction module (for transaction modules that are leaving the system).

~TransactionModule()
TransactionModule(const TransactionModule &mpkg)
TransactionModule &operator=(const TransactionModule &mpkg)
TransactionModule(TransactionModule &&mpkg) noexcept
TransactionModule &operator=(TransactionModule &&mpkg) noexcept

Friends

friend class Transaction::Impl
class TransactionPackage
#include <transaction_package.hpp>

Describe transaction operation related to rpm Package.

Public Types

using Action = transaction::TransactionItemAction
using Reason = transaction::TransactionItemReason
using State = transaction::TransactionItemState

Public Functions

libdnf5::rpm::Package get_package() const
Returns:

the underlying package.

Action get_action() const noexcept
Returns:

the action being performed on the transaction package.

State get_state() const noexcept
Returns:

the state of the package in the transaction.

Reason get_reason() const noexcept
Returns:

the reason of the action being performed on the transaction package.

std::vector<rpm::Package> get_replaces() const noexcept
Returns:

packages replaced by this transaction package.

const std::vector<rpm::Package> &get_replaced_by() const noexcept
Returns:

packages that replace this transaction package (for transaction packages that are leaving the system).

const std::string *get_reason_change_group_id() const noexcept

The REASON_CHANGE action requires group id in case the reason is changed to GROUP

Returns:

id of group the package belongs to

~TransactionPackage()
TransactionPackage(const TransactionPackage &mpkg)
TransactionPackage &operator=(const TransactionPackage &mpkg)
TransactionPackage(TransactionPackage &&mpkg) noexcept
TransactionPackage &operator=(TransactionPackage &&mpkg) noexcept

Friends

friend class Transaction::Impl
friend class ::BaseGoalTest
friend class ::RpmTransactionTest