libdnf5.transaction

class libdnf5.transaction.CompsEnvironment(*args)

CompsEnvironment contains a copy of important data from comps::CompsEnvironment that is used to perform comps transaction and then stored in the transaction (history) database.

thisown
to_string()

Get string representation of the object, which equals to environment_id

class libdnf5.transaction.CompsEnvironmentGroup(*args)
thisown
class libdnf5.transaction.CompsGroup(*args)

CompsGroup contains a copy of important data from comps::CompsGroup that is used to perform comps transaction and then stored in the transaction (history) database.

get_package_types()

Get types of the packages to be installed with the group (related xml elements: <comps><group><packagelist><packagereq type=”VALUE” …>)

thisown
to_string()

Get string representation of the object, which equals to group_id

class libdnf5.transaction.CompsGroupPackage(*args)

CompsGroupPackage represents a package associated with a comps group

thisown
class libdnf5.transaction.Package(*args)

Package contains a copy of important data from rpm::Package that is used to perform rpm transaction and then stored in the transaction (history) database.

get_arch()

Get package arch

get_epoch()

Get package epoch

get_name()

Get package name

get_release()

Get package release

get_version()

Get package version

thisown
to_string()

Get string representation of the object, which equals to package NEVRA

class libdnf5.transaction.SwigPyIterator(*args, **kwargs)
advance(n)
copy()
decr(n=1)
distance(x)
equal(x)
incr(n=1)
next()
previous()
thisown
value()
class libdnf5.transaction.Transaction(*args)

Transaction holds information about a transaction. It contains transaction items such as packages, comps groups and environments. Transaction object are used to retrieve information about past transactions from the transaction history database as well as for performing a transaction to change packages on disk.

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

A Base object to which the transaction belongs.

get_comment()

Get a user-specified comment describing the transaction

get_comps_environments()

Return all comps environments associated with the transaction

get_comps_groups()

Return all comps groups associated with the transaction

get_description()

Get the description of the transaction (e.g. the CLI command that was executed)

get_dt_end()

Get date and time of the transaction end

get_dt_start()

Get date and time of the transaction start

get_id()

Get Transaction database id (primary key) Return 0 if the id wasn’t set yet

get_packages()

Return all rpm packages associated with the transaction

get_releasever()

Get $releasever variable value that was used during the transaction

get_rpmdb_version_begin()

Get RPM database version before the transaction Format: <rpm_count>:<sha1 of sorted SHA1HEADER fields of installed RPMs>

get_rpmdb_version_end()

Get RPM database version after the transaction Format: <rpm_count>:<sha1 of sorted SHA1HEADER fields of installed RPMs>

get_state()

Get transaction state

get_user_id()

Get UID of a user that started the transaction

serialize()

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.

thisown
class libdnf5.transaction.TransactionHistory(*args)

A class for working with transactions recorded in the transaction history database.

filter_transactions_by_pkg_names(transactions, pkg_names)

Filter out transactions that don’t contain any rpm with matching name

Parameters:
  • transactions (std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >) – Vector of Transactions to filter

  • pkg_names (std::vector< std::string,std::allocator< std::string > >) – Vector of rpm package names to match

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

The Base object to which this object belongs.

Since: 5.0

get_transaction_item_counts(transactions)

Get counts of transaction items for specified transactions. It gets the counts in a single db query.

Parameters:

transactions (std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >) – Get counts for these transactions.

Return type:

std::unordered_map< int64_t,int64_t >

Returns:

Mapped transaction id -> count.

get_weak_ptr()
list_all_transactions()

Lists all transactions from the transaction history.

Return type:

std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >

Returns:

The listed transactions.

list_transaction_ids()

Lists all transaction IDs from the transaction history database. The result is sorted in ascending order.

Return type:

std::vector< int64_t,std::allocator< int64_t > >

Returns:

The list of transaction IDs.

list_transactions(*args)

Overload 1: Lists transactions from the transaction history for transaction ids in ids.

Parameters:

ids (std::vector< int64_t,std::allocator< int64_t > >) – The ids to list.

Return type:

std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >

Returns:

The listed transactions.


Overload 2: Lists transactions from the transaction history for transaction ids within the [start, end] range (inclusive).

Parameters:
  • start (int) – The first id of the range to be listed.

  • end (int) – The last id of the range to be listed.

Return type:

std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >

Returns:

The listed transactions.

thisown
transaction_item_reason_at(name, arch, transaction_id_point)

Get reason for package specified by name and arch at a point in history specified by transaction id.

Parameters:
  • name (string) – Name of rpm package

  • arch (string) – Arch of rpm package

  • transaction_id_point (int) – Id of a history transaction (can be obtained from libdnf5::transaction::TransactionHistory)

Return type:

int

Returns:

Reason of the last transaction item before transaction_id_point that has an rpm with matching name and arch.

class libdnf5.transaction.TransactionHistoryWeakPtr(*args)

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.

filter_transactions_by_pkg_names(transactions, pkg_names)

Filter out transactions that don’t contain any rpm with matching name

Parameters:
  • transactions (std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >) – Vector of Transactions to filter

  • pkg_names (std::vector< std::string,std::allocator< std::string > >) – Vector of rpm package names to match

get()

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

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

The Base object to which this object belongs.

Since: 5.0

get_transaction_item_counts(transactions)

Get counts of transaction items for specified transactions. It gets the counts in a single db query.

Parameters:

transactions (std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >) – Get counts for these transactions.

Return type:

std::unordered_map< int64_t,int64_t >

Returns:

Mapped transaction id -> count.

get_weak_ptr()
has_same_guard(other)

Checks if the other WeakPtr instance has the same WeakPtrGuard.

is_valid()

Checks if managed object is valid.

list_all_transactions()

Lists all transactions from the transaction history.

Return type:

std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >

Returns:

The listed transactions.

list_transaction_ids()

Lists all transaction IDs from the transaction history database. The result is sorted in ascending order.

Return type:

std::vector< int64_t,std::allocator< int64_t > >

Returns:

The list of transaction IDs.

list_transactions(*args)

Overload 1: Lists transactions from the transaction history for transaction ids in ids.

Parameters:

ids (std::vector< int64_t,std::allocator< int64_t > >) – The ids to list.

Return type:

std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >

Returns:

The listed transactions.


Overload 2: Lists transactions from the transaction history for transaction ids within the [start, end] range (inclusive).

Parameters:
  • start (int) – The first id of the range to be listed.

  • end (int) – The last id of the range to be listed.

Return type:

std::vector< libdnf5::transaction::Transaction,std::allocator< libdnf5::transaction::Transaction > >

Returns:

The listed transactions.

thisown
transaction_item_reason_at(name, arch, transaction_id_point)

Get reason for package specified by name and arch at a point in history specified by transaction id.

Parameters:
  • name (string) – Name of rpm package

  • arch (string) – Arch of rpm package

  • transaction_id_point (int) – Id of a history transaction (can be obtained from libdnf5::transaction::TransactionHistory)

Return type:

int

Returns:

Reason of the last transaction item before transaction_id_point that has an rpm with matching name and arch.

class libdnf5.transaction.TransactionItem(*args)
get_action()

Get action associated with the transaction item in the transaction

get_reason()

Get reason of the action associated with the transaction item in the transaction

get_repoid()

Get transaction item repoid (text identifier of a repository)

get_state()

Get transaction item state

thisown
libdnf5.transaction.TransactionItemAction_DISABLE
libdnf5.transaction.TransactionItemAction_DOWNGRADE
libdnf5.transaction.TransactionItemAction_ENABLE
libdnf5.transaction.TransactionItemAction_INSTALL
libdnf5.transaction.TransactionItemAction_REASON_CHANGE
libdnf5.transaction.TransactionItemAction_REINSTALL
libdnf5.transaction.TransactionItemAction_REMOVE
libdnf5.transaction.TransactionItemAction_REPLACED
libdnf5.transaction.TransactionItemAction_RESET
libdnf5.transaction.TransactionItemAction_SWITCH
libdnf5.transaction.TransactionItemAction_UPGRADE
libdnf5.transaction.TransactionItemReason_CLEAN
libdnf5.transaction.TransactionItemReason_DEPENDENCY
libdnf5.transaction.TransactionItemReason_EXTERNAL_USER
libdnf5.transaction.TransactionItemReason_GROUP
libdnf5.transaction.TransactionItemReason_NONE
libdnf5.transaction.TransactionItemReason_USER
libdnf5.transaction.TransactionItemReason_WEAK_DEPENDENCY
libdnf5.transaction.TransactionItemState_ERROR
libdnf5.transaction.TransactionItemState_OK
libdnf5.transaction.TransactionItemState_STARTED
libdnf5.transaction.TransactionState_ERROR
libdnf5.transaction.TransactionState_OK
libdnf5.transaction.TransactionState_STARTED
class libdnf5.transaction.VectorTransaction(*args)
append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
size()
swap(v)
thisown
class libdnf5.transaction.VectorTransactionPackage(*args)
append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
size()
swap(v)
thisown
libdnf5.transaction.transaction_item_action_from_string(action)
libdnf5.transaction.transaction_item_action_is_inbound(action)
libdnf5.transaction.transaction_item_action_is_outbound(action)
libdnf5.transaction.transaction_item_action_to_letter(action)
libdnf5.transaction.transaction_item_action_to_string(action)
libdnf5.transaction.transaction_item_reason_compare(lhs, rhs)

Compare transaction items and return: -1 if lhs < rhs 1 if lhs > rhs 0 if lhs == rhs Higher number means a better (or a stronger) reason.

libdnf5.transaction.transaction_item_reason_from_string(reason)
libdnf5.transaction.transaction_item_reason_to_string(reason)
libdnf5.transaction.transaction_item_state_from_string(state)
libdnf5.transaction.transaction_item_state_to_string(state)
libdnf5.transaction.transaction_state_from_string(state)
libdnf5.transaction.transaction_state_to_string(state)