XBPS Library API 20240111
The X Binary Package System
|
Functions | |
int | xbps_pkgdb_lock (struct xbps_handle *xhp) |
void | xbps_pkgdb_unlock (struct xbps_handle *xhp) |
int | xbps_pkgdb_foreach_cb (struct xbps_handle *xhp, int(*fn)(struct xbps_handle *, xbps_object_t, const char *, void *, bool *), void *arg) |
int | xbps_pkgdb_foreach_cb_multi (struct xbps_handle *xhp, int(*fn)(struct xbps_handle *, xbps_object_t, const char *, void *, bool *), void *arg) |
xbps_dictionary_t | xbps_pkgdb_get_pkg (struct xbps_handle *xhp, const char *pkg) |
xbps_dictionary_t | xbps_pkgdb_get_virtualpkg (struct xbps_handle *xhp, const char *pkg) |
xbps_dictionary_t | xbps_pkgdb_get_pkg_files (struct xbps_handle *xhp, const char *pkg) |
xbps_array_t | xbps_pkgdb_get_pkg_revdeps (struct xbps_handle *xhp, const char *pkg) |
xbps_array_t | xbps_pkgdb_get_pkg_fulldeptree (struct xbps_handle *xhp, const char *pkg) |
int | xbps_pkgdb_update (struct xbps_handle *xhp, bool flush, bool update) |
int | xbps_pkg_exec_buffer (struct xbps_handle *xhp, const void *blob, const size_t blobsiz, const char *pkgver, const char *action, bool update) |
int | xbps_pkg_exec_script (struct xbps_handle *xhp, xbps_dictionary_t d, const char *script, const char *action, bool update) |
Functions to manipulate the main package database plist file (pkgdb).
The following image shown below shows the proplib structure used by the main package database plist:
Legend:
Text inside of white boxes are the key associated with the object, its data type is specified on its edge, i.e array, bool, integer, string, dictionary.
int xbps_pkgdb_lock | ( | struct xbps_handle * | xhp | ) |
Locks the pkgdb to allow a write transaction.
This routine should be called before a write transaction is the target: install, remove or update.
[in] | xhp | The pointer to the xbps_handle struct. |
Definition at line 67 of file pkgdb.c.
References xbps_handle::metadir, xbps_handle::pkgdb, xbps_handle::pkgdb_plist, xbps_handle::rootdir, xbps_mkpath(), and xbps_xasprintf().
void xbps_pkgdb_unlock | ( | struct xbps_handle * | xhp | ) |
Unlocks the pkgdb after a write transaction.
[in] | xhp | The pointer to the xbps_handle struct. |
int xbps_pkgdb_foreach_cb | ( | struct xbps_handle * | xhp, |
int(*)(struct xbps_handle *, xbps_object_t, const char *, void *, bool *) | fn, | ||
void * | arg | ||
) |
Executes a function callback per a package dictionary registered in the package database (pkgdb) plist.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | fn | Function callback to run for any pkg dictionary. |
[in] | arg | Argument to be passed to the function callback. |
Definition at line 343 of file pkgdb.c.
References xbps_handle::pkgdb, and xbps_array_foreach_cb().
int xbps_pkgdb_foreach_cb_multi | ( | struct xbps_handle * | xhp, |
int(*)(struct xbps_handle *, xbps_object_t, const char *, void *, bool *) | fn, | ||
void * | arg | ||
) |
Executes a function callback per a package dictionary registered in the package database (pkgdb) plist.
This is a multithreaded implementation spawning a thread per core. Each thread processes a fraction of total objects in the pkgdb dictionary.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | fn | Function callback to run for any pkg dictionary. |
[in] | arg | Argument to be passed to the function callback. |
Definition at line 361 of file pkgdb.c.
References xbps_handle::pkgdb, and xbps_array_foreach_cb_multi().
xbps_dictionary_t xbps_pkgdb_get_pkg | ( | struct xbps_handle * | xhp, |
const char * | pkg | ||
) |
Returns a package dictionary from the package database (pkgdb), matching pkgname or pkgver object in pkg.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | pkg | Package name or name-version to match. |
Definition at line 379 of file pkgdb.c.
References xbps_handle::pkgdb.
Referenced by xbps_alternatives_set(), xbps_configure_pkg(), xbps_find_pkg_orphans(), xbps_pkg_is_installed(), xbps_pkg_state_installed(), xbps_pkgdb_get_pkg_files(), xbps_pkgdb_get_pkg_revdeps(), xbps_set_pkg_state_installed(), xbps_transaction_commit(), and xbps_transaction_remove_pkg().
xbps_dictionary_t xbps_pkgdb_get_virtualpkg | ( | struct xbps_handle * | xhp, |
const char * | pkg | ||
) |
Returns a package dictionary from the package database (pkgdb), matching virtual pkgname or pkgver object in pkg.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | pkg | Package name or name-version to match. |
Definition at line 388 of file pkgdb.c.
References xbps_handle::pkgdb.
Referenced by xbps_pkg_is_installed().
xbps_dictionary_t xbps_pkgdb_get_pkg_files | ( | struct xbps_handle * | xhp, |
const char * | pkg | ||
) |
Returns the package dictionary with all files for pkg.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | pkg | Package expression to match. |
Definition at line 482 of file pkgdb.c.
References xbps_handle::metadir, xbps_pkg_name(), xbps_pkgdb_get_pkg(), and xbps_plist_dictionary_from_file().
xbps_array_t xbps_pkgdb_get_pkg_revdeps | ( | struct xbps_handle * | xhp, |
const char * | pkg | ||
) |
Returns a proplib array of strings with reverse dependencies for pkg. The array is generated dynamically based on the list of packages currently installed.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | pkg | Package expression to match. |
Definition at line 458 of file pkgdb.c.
References xbps_pkg_name(), and xbps_pkgdb_get_pkg().
Referenced by xbps_find_pkg_orphans(), xbps_transaction_install_pkg(), and xbps_transaction_update_pkg().
xbps_array_t xbps_pkgdb_get_pkg_fulldeptree | ( | struct xbps_handle * | xhp, |
const char * | pkg | ||
) |
Returns a proplib array of strings with a proper sorted list of packages of a full dependency graph for pkg.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | pkg | Package expression to match. |
Definition at line 476 of file pkgdb.c.
Referenced by xbps_find_pkg_orphans().
int xbps_pkgdb_update | ( | struct xbps_handle * | xhp, |
bool | flush, | ||
bool | update | ||
) |
Updates the package database (pkgdb) with new contents from the cached memory copy to disk.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | flush | If true the pkgdb plist contents in memory will be flushed atomically to storage. |
[in] | update | If true, the pkgdb plist stored on disk will be re-read and the in memory copy will be refreshed. |
Definition at line 282 of file pkgdb.c.
References xbps_handle::pkgdb, and xbps_handle::pkgdb_plist.
Referenced by xbps_transaction_commit().
int xbps_pkg_exec_buffer | ( | struct xbps_handle * | xhp, |
const void * | blob, | ||
const size_t | blobsiz, | ||
const char * | pkgver, | ||
const char * | action, | ||
bool | update | ||
) |
Creates a temporary file and executes it in rootdir.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | blob | The buffer pointer where the data is stored. |
[in] | blobsiz | The size of the buffer data. |
[in] | pkgver | The package name/version associated. |
[in] | action | The action to execute on the temporary file. |
[in] | update | Set to true if package is being updated. |
Definition at line 39 of file package_script.c.
References xbps_handle::native_arch, xbps_handle::rootdir, xbps_handle::target_arch, xbps_pkg_name(), xbps_pkg_version(), and xbps_xasprintf().
Referenced by xbps_pkg_exec_script().
int xbps_pkg_exec_script | ( | struct xbps_handle * | xhp, |
xbps_dictionary_t | d, | ||
const char * | script, | ||
const char * | action, | ||
bool | update | ||
) |
Creates a temporary file and executes it in rootdir.
[in] | xhp | The pointer to the xbps_handle struct. |
[in] | d | Package dictionary where the script data is stored. |
[in] | script | Key associated with the script in dictionary. |
[in] | action | The action to execute on the temporary file. |
[in] | update | Set to true if package is being updated. |
Definition at line 144 of file package_script.c.
References xbps_pkg_exec_buffer().
Referenced by xbps_configure_pkg(), and xbps_transaction_commit().