Transaction
-
class Transaction
Public Types
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
orcomment
) 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 theget_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 thestore_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
-
Transaction(const Transaction &transaction)
-
class TransactionError : public libdnf5::Error
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”
-
inline virtual const char *get_domain_name() const noexcept override