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

Functions

int xbps_pkg_exec_buffer (struct xbps_handle *xhp, const void *blob, const size_t blobsiz, const char *pkgname, const char *version, const char *action, bool update)
 
int xbps_pkg_exec_script (struct xbps_handle *xhp, prop_dictionary_t d, const char *script, const char *action, bool update)
 
int xbps_pkgdb_foreach_cb (struct xbps_handle *xhp, int(*fn)(struct xbps_handle *, prop_object_t, void *, bool *), void *arg)
 
int xbps_pkgdb_foreach_reverse_cb (struct xbps_handle *xhp, int(*fn)(struct xbps_handle *, prop_object_t, void *, bool *), void *arg)
 
prop_dictionary_t xbps_pkgdb_get_pkg (struct xbps_handle *xhp, const char *pkg)
 
prop_dictionary_t xbps_pkgdb_get_pkg_metadata (struct xbps_handle *xhp, const char *pkg)
 
prop_array_t xbps_pkgdb_get_pkg_revdeps (struct xbps_handle *xhp, const char *pkg)
 
prop_dictionary_t xbps_pkgdb_get_virtualpkg (struct xbps_handle *xhp, const char *pkg)
 
bool xbps_pkgdb_remove_pkg (struct xbps_handle *xhp, const char *pkg, bool flush)
 
bool xbps_pkgdb_replace_pkg (struct xbps_handle *xhp, prop_dictionary_t pkgd, const char *pkg, bool flush)
 
int xbps_pkgdb_update (struct xbps_handle *xhp, bool flush)
 

Detailed Description

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:

xbps_pkgdb_array.png

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.

Function Documentation

int xbps_pkg_exec_buffer ( struct xbps_handle xhp,
const void *  blob,
const size_t  blobsiz,
const char *  pkgname,
const char *  version,
const char *  action,
bool  update 
)

Creates a temporary file and executes it in rootdir.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]blobThe buffer pointer where the data is stored.
[in]blobsizThe size of the buffer data.
[in]pkgnameThe package name associated.
[in]versionThe package version associated.
[in]actionThe action to execute on the temporary file.
[in]updateSet to true if package is being updated.
Returns
0 on success, or an errno value otherwise.

Definition at line 35 of file package_script.c.

References xbps_handle::conffile, xbps_handle::rootdir, and xbps_xasprintf().

Referenced by xbps_pkg_exec_script().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int xbps_pkg_exec_script ( struct xbps_handle xhp,
prop_dictionary_t  d,
const char *  script,
const char *  action,
bool  update 
)

Creates a temporary file and executes it in rootdir.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]dPackage dictionary where the script data is stored.
[in]scriptKey associated with the script in dictionary.
[in]actionThe action to execute on the temporary file.
[in]updateSet to true if package is being updated.
Returns
0 on success, or an errno value otherwise.

Definition at line 101 of file package_script.c.

References xbps_pkg_exec_buffer().

Referenced by xbps_configure_pkg(), and xbps_remove_pkg().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int xbps_pkgdb_foreach_cb ( struct xbps_handle xhp,
int(*)(struct xbps_handle *, prop_object_t, void *, bool *)  fn,
void *  arg 
)

Executes a function callback per a package dictionary registered in master package database (pkgdb) plist (downwards).

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]fnFunction callback to run for any pkg dictionary.
[in]argArgument to be passed to the function callback.
Returns
0 on success (all objects were processed), otherwise the value returned by the function callback.

Definition at line 164 of file pkgdb.c.

int xbps_pkgdb_foreach_reverse_cb ( struct xbps_handle xhp,
int(*)(struct xbps_handle *, prop_object_t, void *, bool *)  fn,
void *  arg 
)

Executes a function callback per a package dictionary registered in master package database (pkgdb) plist, in reverse order (upwards).

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]fnFunction callback to run for any pkg dictionary.
[in]argArgument to be passed to the function callback.
Returns
0 on success (all objects were processed), otherwise the value returned by the funcion callback.

Definition at line 156 of file pkgdb.c.

Referenced by xbps_find_pkg_orphans().

+ Here is the caller graph for this function:

prop_dictionary_t xbps_pkgdb_get_pkg ( struct xbps_handle xhp,
const char *  pkg 
)

Returns a package dictionary from master package database (pkgdb) plist, matching pkgname or pkgver object in pkg.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]pkgPackage name or name-version to match.
Returns
The matching proplib package dictionary, NULL otherwise.

Definition at line 172 of file pkgdb.c.

Referenced by xbps_configure_pkg(), xbps_pkg_is_installed(), xbps_pkg_state_installed(), xbps_pkgdb_get_pkg_metadata(), xbps_pkgdb_get_pkg_revdeps(), xbps_register_pkg(), xbps_set_pkg_state_installed(), xbps_transaction_install_pkg(), and xbps_transaction_remove_pkg().

+ Here is the caller graph for this function:

prop_dictionary_t xbps_pkgdb_get_pkg_metadata ( struct xbps_handle xhp,
const char *  pkg 
)

Returns the package dictionary with all metadata info for pkg.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]pkgPackage expression to match.
Returns
The matching package metadata dictionary, NULL otherwise.

Definition at line 297 of file pkgdb.c.

References xbps_pkgdb_get_pkg().

+ Here is the call graph for this function:

prop_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.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]pkgPackage expression to match.
Returns
A proplib array of strings with reverse dependencies for pkg.

Definition at line 282 of file pkgdb.c.

References xbps_pkgdb_get_pkg().

Referenced by xbps_transaction_remove_pkg().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

prop_dictionary_t xbps_pkgdb_get_virtualpkg ( struct xbps_handle xhp,
const char *  pkg 
)

Returns a package dictionary from master package database (pkgdb) plist, matching virtual pkgname or pkgver object in pkg.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]pkgPackage name or name-version to match.
Returns
The matching proplib package dictionary, NULL otherwise.

Definition at line 181 of file pkgdb.c.

Referenced by xbps_pkg_is_installed(), and xbps_transaction_install_pkg().

+ Here is the caller graph for this function:

bool xbps_pkgdb_remove_pkg ( struct xbps_handle xhp,
const char *  pkg,
bool  flush 
)

Removes a package dictionary from master package database (pkgdb) plist, matching pkgname or pkgver object in pkg.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]pkgPackage name or pattern to match in a package dictionary.
[in]flushIf true, after successful replace the pkgdb contents in memory will be flushed atomically to storage.
Returns
true on success, false otherwise.

Definition at line 309 of file pkgdb.c.

References xbps_pkg_version(), xbps_pkgdb_update(), and xbps_pkgpattern_version().

Referenced by xbps_unregister_pkg().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool xbps_pkgdb_replace_pkg ( struct xbps_handle xhp,
prop_dictionary_t  pkgd,
const char *  pkg,
bool  flush 
)

Replaces a package dictionary with dict in the master package database (pkgdb) plist, matching pkgname or pkgver object.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]pkgdProplib dictionary to be added into pkgdb.
[in]pkgPackage name or pattern to match in a package dictionary.
[in]flushIf true, after successful replace the pkgdb contents in memory will be flushed atomically to storage.
Returns
true on success, false otherwise.

Definition at line 333 of file pkgdb.c.

References xbps_pkgdb_update(), and xbps_pkgpattern_version().

Referenced by xbps_register_pkg().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int xbps_pkgdb_update ( struct xbps_handle xhp,
bool  flush 
)

Updates the master package database (pkgdb) plist with new contents from disk to the cached copy in memory.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]flushIf true the pkgdb plist contents in memory will be flushed atomically to storage.
Returns
0 on success, otherwise an errno value.

Definition at line 80 of file pkgdb.c.

References xbps_handle::metadir, and xbps_xasprintf().

Referenced by xbps_configure_packages(), xbps_configure_pkg(), xbps_pkgdb_remove_pkg(), and xbps_pkgdb_replace_pkg().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: