XBPS Library API 20240111
The X Binary Package System
|
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) |
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.
enum xbps_trans_type_t |
uint8_t representing the pkg transaction type in transaction dictionary.
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.
[in] | xhp | Pointer to the xbps_handle struct. |
[in] | pkg | Package name, package/version or package pattern to match, i.e ‘foo’, ‘foo-1.0_1’ or ‘foo>=1.2’. |
[in] | force | If true, package will be queued (if str matches) even if package is already installed or in hold mode. |
EEXIST | Package is already installed (reinstall wasn't enabled). |
ENOENT | Package not matched in repository pool. |
ENOTSUP | No repositories are available. |
ENXIO | Package depends on invalid dependencies. |
EINVAL | Any other error ocurred in the process. |
EBUSY | The 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.
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.
[in] | xhp | Pointer to the xbps_handle struct. |
[in] | pkgname | The package name to update. |
[in] | force | If true, package will be queued (if str matches) even if package is already installed or in hold mode. |
EEXIST | Package is already up-to-date. |
ENOENT | Package not matched in repository pool. |
ENOTSUP | No repositories are available. |
ENXIO | Package depends on invalid dependencies. |
EINVAL | Any other error ocurred in the process. |
EBUSY | The 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.
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.
[in] | xhp | Pointer to the xbps_handle struct. |
EBUSY | The xbps package must be updated. |
EEXIST | All installed packages are already up-to-date. |
ENOENT | No packages currently register. |
ENOTSUP | No repositories currently installed. |
EINVAL | Any 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.
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.
[in] | xhp | Pointer to the xbps_handle struct. |
[in] | pkgname | Package name to be removed. |
[in] | recursive | If true, all packages that are currently depending on the package to be removed, and if they are orphans, will be added. |
0 | success. |
ENOENT | Package is not installed. |
EEXIST | Package has reverse dependencies. |
EINVAL | |
ENXIO | A 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.
int xbps_transaction_autoremove_pkgs | ( | struct xbps_handle * | xhp | ) |
Finds all package orphans currently installed and adds them into the transaction dictionary.
[in] | xhp | Pointer to the xbps_handle struct. |
0 | success. |
ENOENT | No package orphans were found. |
ENXIO | |
EINVAL | A 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.
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.
[in] | xhp | Pointer to the xbps_handle struct. |
0 | success. |
ENXIO | if transaction dictionary and missing deps array were not created, due to xbps_transaction_install_pkg() or xbps_transaction_update_pkg() not previously called. |
ENODEV | if there are missing dependencies in transaction ("missing_deps" array of strings object in xhp->transd dictionary). |
ENOEXEC | if there are unresolved shared libraries in transaction ("missing_shlibs" array of strings object in xhp->transd dictionary). |
EAGAIN | if there are package conflicts in transaction ("conflicts" array of strings object in xhp->transd dictionary). |
ENOSPC | Not enough free space on target rootdir to continue with the transaction. |
EINVAL | There 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().
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().
[in] | xhp | Pointer to the xbps_handle struct. |
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().
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.
[in] | pkg_repod | Package dictionary stored in a repository. |
Definition at line 551 of file transaction_ops.c.
References xbps_repo::idx.
Referenced by xbps_transaction_commit(), and xbps_transaction_prepare().
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.
[in] | pkg_repod | Package dictionary stored in a repository. |
[in] | type | The transaction type to set. |
Definition at line 565 of file transaction_ops.c.
References xbps_repo::idx.
Referenced by xbps_transaction_autoremove_pkgs(), and xbps_transaction_remove_pkg().