XBPS Library API 20240111
The X Binary Package System
Enumerations | Functions
Transaction handling functions

Enumerations

enum  xbps_trans_type_t
 

Functions

int xbps_transaction_install_pkg (struct xbps_handle *xhp, const char *pkg, bool force)
 
int xbps_transaction_update_pkg (struct xbps_handle *xhp, const char *pkgname, bool force)
 
int xbps_transaction_update_packages (struct xbps_handle *xhp)
 
int xbps_transaction_remove_pkg (struct xbps_handle *xhp, const char *pkgname, bool recursive)
 
int xbps_transaction_autoremove_pkgs (struct xbps_handle *xhp)
 
int xbps_transaction_prepare (struct xbps_handle *xhp)
 
int xbps_transaction_commit (struct xbps_handle *xhp)
 
xbps_trans_type_t xbps_transaction_pkg_type (xbps_dictionary_t pkg_repod)
 
bool xbps_transaction_pkg_type_set (xbps_dictionary_t pkg_repod, xbps_trans_type_t type)
 

Detailed Description

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

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.

Enumeration Type Documentation

◆ xbps_trans_type_t

uint8_t representing the pkg transaction type in transaction dictionary.

  • XBPS_TRANS_UNKNOWN: Unknown type
  • XBPS_TRANS_INSTALL: pkg will be installed
  • XBPS_TRANS_REINSTALL: pkg will be reinstalled
  • XBPS_TRANS_UPDATE: pkg will be updated
  • XBPS_TRANS_CONFIGURE: pkg will be configured
  • XBPS_TRANS_REMOVE: pkg will be removed
  • XBPS_TRANS_HOLD: pkg won't be updated (on hold mode)
  • XBPS_TRANS_DOWNLOAD: pkg will be downloaded

Definition at line 1320 of file xbps.h.

Function Documentation

◆ xbps_transaction_install_pkg()

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

Finds a package by name or by pattern and enqueues it into the transaction dictionary for future use. The first repository matching pkg 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_1’ or ‘foo>=1.2’.
[in]forceIf true, package will be queued (if str matches) even if package is already installed or in hold mode.
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.
ENXIOPackage depends on invalid dependencies.
EINVALAny other error ocurred in the process.
EBUSYThe xbps package must be updated.

Definition at line 404 of file transaction_ops.c.

References xbps_handle::flags, xbps_repo::idx, xbps_pkg_name(), xbps_pkgdb_get_pkg_revdeps(), and xbps_repo::xhp.

Here is the call graph for this function:

◆ xbps_transaction_update_pkg()

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

Marks a package as "going to be updated" in the transaction dictionary. The first repository that contains an updated version wins.

If bestmaching is enabled (see XBPS_FLAG_BESTMATCH), 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.
[in]forceIf true, package will be queued (if str matches) even if package is already installed or in hold mode.
Returns
0 on success, otherwise an errno value.
Return values
EEXISTPackage is already up-to-date.
ENOENTPackage not matched in repository pool.
ENOTSUPNo repositories are available.
ENXIOPackage depends on invalid dependencies.
EINVALAny other error ocurred in the process.
EBUSYThe xbps package must be updated.

Definition at line 353 of file transaction_ops.c.

References xbps_handle::flags, xbps_repo::idx, xbps_pkg_name(), xbps_pkgdb_get_pkg_revdeps(), and xbps_repo::xhp.

Here is the call graph for this function:

◆ xbps_transaction_update_packages()

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.
Return values
EBUSYThe xbps package must be updated.
EEXISTAll installed packages are already up-to-date.
ENOENTNo packages currently register.
ENOTSUPNo repositories currently installed.
EINVALAny other error ocurred in the process.

Definition at line 300 of file transaction_ops.c.

References xbps_repo::idx, xbps_handle::pkgdb, xbps_pkg_name(), and xbps_repo::xhp.

Here is the call graph for this function:

◆ xbps_transaction_remove_pkg()

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 453 of file transaction_ops.c.

References xbps_repo::idx, xbps_handle::transd, xbps_find_pkg_orphans(), xbps_pkgdb_get_pkg(), xbps_transaction_pkg_type_set(), and xbps_repo::xhp.

Here is the call graph for this function:

◆ xbps_transaction_autoremove_pkgs()

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 514 of file transaction_ops.c.

References xbps_repo::idx, xbps_handle::transd, xbps_find_pkg_orphans(), xbps_transaction_pkg_type_set(), and xbps_repo::xhp.

Here is the call graph for this function:

◆ xbps_transaction_prepare()

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).
ENOEXECif there are unresolved shared libraries in transaction ("missing_shlibs" array of strings object in xhp->transd dictionary).
EAGAINif there are package conflicts in transaction ("conflicts" array of strings object in xhp->transd dictionary).
ENOSPCNot enough free space on target rootdir to continue with the transaction.
EINVALThere was an error sorting packages or computing the transaction sizes.

Definition at line 279 of file transaction_prepare.c.

References xbps_handle::flags, xbps_handle::transd, and xbps_transaction_pkg_type().

Here is the call graph for this function:

◆ xbps_transaction_commit()

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 106 of file transaction_commit.c.

References xbps_handle::cachedir, xbps_handle::flags, xbps_handle::native_arch, xbps_handle::rootdir, xbps_handle::target_arch, xbps_handle::transd, xbps_array_iter_from_dict(), xbps_configure_pkg(), xbps_mkpath(), xbps_pkg_exec_script(), xbps_pkgdb_get_pkg(), xbps_pkgdb_update(), and xbps_transaction_pkg_type().

Here is the call graph for this function:

◆ xbps_transaction_pkg_type()

xbps_trans_type_t xbps_transaction_pkg_type ( xbps_dictionary_t  pkg_repod)

Returns the transaction type associated with pkg_repod.

See xbps_trans_type_t for possible values.

Parameters
[in]pkg_repodPackage dictionary stored in a repository.
Returns
The transaction type associated.

Definition at line 551 of file transaction_ops.c.

References xbps_repo::idx.

Referenced by xbps_transaction_commit(), and xbps_transaction_prepare().

Here is the caller graph for this function:

◆ xbps_transaction_pkg_type_set()

bool xbps_transaction_pkg_type_set ( xbps_dictionary_t  pkg_repod,
xbps_trans_type_t  type 
)

Sets the transaction type associated with pkg_repod.

See xbps_trans_type_t for possible values.

Parameters
[in]pkg_repodPackage dictionary stored in a repository.
[in]typeThe transaction type to set.
Returns
Returns true on success, false otherwise.

Definition at line 565 of file transaction_ops.c.

References xbps_repo::idx.

Referenced by xbps_transaction_autoremove_pkgs(), and xbps_transaction_remove_pkg().

Here is the caller graph for this function: