XBPS Library API  0.19
The X Binary Package System
Functions
Transaction handling functions

Functions

int xbps_transaction_autoremove_pkgs (struct xbps_handle *xhp)
 
int xbps_transaction_commit (struct xbps_handle *xhp)
 
int xbps_transaction_install_pkg (struct xbps_handle *xhp, const char *pkg, bool reinstall)
 
int xbps_transaction_prepare (struct xbps_handle *xhp)
 
int xbps_transaction_remove_pkg (struct xbps_handle *xhp, const char *pkgname, bool recursive)
 
int xbps_transaction_update_packages (struct xbps_handle *xhp)
 
int xbps_transaction_update_pkg (struct xbps_handle *xhp, const char *pkgname)
 

Detailed Description

The following image shows off the full transaction dictionary returned by xbps_transaction_prepare().

xbps_transaction_dictionary.png

Legend:

Text inside of white boxes are the key associated with the object, its data type is specified on its edge, i.e string, array, integer, dictionary.

Function Documentation

int xbps_transaction_autoremove_pkgs ( struct xbps_handle xhp)

Finds all package orphans currently installed and adds them into the transaction dictionary.

Parameters
[in]xhpPointer to the xbps_handle struct.
Return values
0success.
ENOENTNo package orphans were found.
ENXIO
EINVALA problem ocurred in the process.

Definition at line 320 of file transaction_ops.c.

References xbps_handle::transd, and xbps_find_pkg_orphans().

+ Here is the call graph for this function:

int xbps_transaction_commit ( struct xbps_handle xhp)

Commit a transaction. The transaction dictionary in xhp->transd contains all steps to be executed in the transaction, as prepared by xbps_transaction_prepare().

Parameters
[in]xhpPointer to the xbps_handle struct.
Returns
0 on success, otherwise an errno value.

Definition at line 198 of file transaction_commit.c.

References xbps_handle::transd, xbps_array_iter_from_dict(), xbps_configure_pkg(), xbps_register_pkg(), and xbps_remove_pkg().

+ Here is the call graph for this function:

int xbps_transaction_install_pkg ( struct xbps_handle xhp,
const char *  pkg,
bool  reinstall 
)

Finds a package by name or by pattern and enqueues it into the transaction dictionary for future use. If pkg is a pkgname, the best package version in repository pool will be queued, otherwise the first repository matching the package pattern wins.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]pkgPackage name, package/version or package pattern to match, i.e `foo', `foo-1.0' or `foo>=1.2'.
[in]reinstallIf true, package will be queued (if str matches) even if package is already installed.
Returns
0 on success, otherwise an errno value.
Return values
EEXISTPackage is already installed (reinstall wasn't enabled).
ENOENTPackage not matched in repository pool.
ENOTSUPNo repositories are available.
EINVALAny other error ocurred in the process.

Definition at line 230 of file transaction_ops.c.

References xbps_pkg_state_dictionary(), xbps_pkgdb_get_pkg(), and xbps_pkgdb_get_virtualpkg().

+ Here is the call graph for this function:

int xbps_transaction_prepare ( struct xbps_handle xhp)

Returns the transaction dictionary, as shown above in the image. Before returning the package list is sorted in the correct order and total installed/download size for the transaction is computed.

Parameters
[in]xhpPointer to the xbps_handle struct.
Return values
0success.
ENXIOif transaction dictionary and missing deps array were not created, due to xbps_transaction_install_pkg() or xbps_transaction_update_pkg() not previously called.
ENODEVif there are missing dependencies in transaction ("missing_deps" array of strings object in xhp->transd dictionary).
EAGAINif there are package conflicts in transaction ("conflicts" array of strings object in xhp->transd dictionary).
EINVALThere was an error sorting packages or computing the transaction sizes.

Definition at line 233 of file transaction_dictionary.c.

References xbps_handle::transd.

int xbps_transaction_remove_pkg ( struct xbps_handle xhp,
const char *  pkgname,
bool  recursive 
)

Removes a package currently installed. The package dictionary will be added into the transaction dictionary.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]pkgnamePackage name to be removed.
[in]recursiveIf true, all packages that are currently depending on the package to be removed, and if they are orphans, will be added.
Return values
0success.
ENOENTPackage is not installed.
EEXISTPackage has reverse dependencies.
EINVAL
ENXIOA problem ocurred in the process.

Definition at line 250 of file transaction_ops.c.

References xbps_handle::transd, xbps_find_pkg_orphans(), xbps_pkgdb_get_pkg(), and xbps_pkgdb_get_pkg_revdeps().

+ Here is the call graph for this function:

int xbps_transaction_update_packages ( struct xbps_handle xhp)

Finds newer versions for all installed packages by looking at the repository pool. If a newer version exists, package will be enqueued into the transaction dictionary.

Parameters
[in]xhpPointer to the xbps_handle struct.
Returns
0 on success, otherwise an errno value.

Definition at line 175 of file transaction_ops.c.

int xbps_transaction_update_pkg ( struct xbps_handle xhp,
const char *  pkgname 
)

Marks a package as "going to be updated" in the transaction dictionary. All repositories in the pool will be used, and newest version available will be enqueued if it's greater than current installed version.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]pkgnameThe package name to update.
Returns
0 on success, otherwise an errno value.

Definition at line 224 of file transaction_ops.c.