XBPS Library API 20240111
The X Binary Package System
Functions
PropertyList generic functions

Functions

int xbps_array_foreach_cb (struct xbps_handle *xhp, xbps_array_t array, xbps_dictionary_t dict, int(*fn)(struct xbps_handle *, xbps_object_t obj, const char *, void *arg, bool *done), void *arg)
 
int xbps_array_foreach_cb_multi (struct xbps_handle *xhp, xbps_array_t array, xbps_dictionary_t dict, int(*fn)(struct xbps_handle *, xbps_object_t obj, const char *, void *arg, bool *done), void *arg)
 
bool xbps_match_virtual_pkg_in_array (xbps_array_t array, const char *str)
 
bool xbps_match_virtual_pkg_in_dict (xbps_dictionary_t pkgd, const char *str)
 
bool xbps_match_any_virtualpkg_in_rundeps (xbps_array_t rundeps, xbps_array_t provides)
 
bool xbps_match_pkgname_in_array (xbps_array_t array, const char *pkgname)
 
bool xbps_match_pkgver_in_array (xbps_array_t array, const char *pkgver)
 
bool xbps_match_pkgpattern_in_array (xbps_array_t array, const char *pattern)
 
bool xbps_match_pkgdep_in_array (xbps_array_t array, const char *pkgver)
 
bool xbps_match_string_in_array (xbps_array_t array, const char *val)
 
xbps_object_iterator_t xbps_array_iter_from_dict (xbps_dictionary_t dict, const char *key)
 

Detailed Description

These functions manipulate plist files and objects shared by almost all library functions.

Function Documentation

◆ xbps_array_foreach_cb()

int xbps_array_foreach_cb ( struct xbps_handle xhp,
xbps_array_t  array,
xbps_dictionary_t  dict,
int(*)(struct xbps_handle *, xbps_object_t obj, const char *, void *arg, bool *done)  fn,
void *  arg 
)

Executes a function callback (fn) per object in the proplib array array.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]arrayThe proplib array to traverse.
[in]dictThe dictionary associated with the array.
[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.

Referenced by xbps_pkgdb_foreach_cb().

Here is the caller graph for this function:

◆ xbps_array_foreach_cb_multi()

int xbps_array_foreach_cb_multi ( struct xbps_handle xhp,
xbps_array_t  array,
xbps_dictionary_t  dict,
int(*)(struct xbps_handle *, xbps_object_t obj, const char *, void *arg, bool *done)  fn,
void *  arg 
)

Executes a function callback (fn) per object in the proplib array array. This is a multithreaded implementation spawning a thread per core. Each thread processes a fraction of total objects in the array.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]arrayThe proplib array to traverse.
[in]dictThe dictionary associated with the array.
[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.

Referenced by xbps_pkgdb_foreach_cb_multi().

Here is the caller graph for this function:

◆ xbps_match_virtual_pkg_in_array()

bool xbps_match_virtual_pkg_in_array ( xbps_array_t  array,
const char *  str 
)

Match a virtual package name or pattern by looking at proplib array of strings.

Parameters
[in]arrayProplib array of strings.
[in]strVirtual package name or package pattern to match.
Returns
True if str matches a virtual package in array, false otherwise.

Definition at line 43 of file plist_match.c.

References xbps_match_pkgdep_in_array(), xbps_match_pkgname_in_array(), xbps_match_pkgpattern_in_array(), xbps_match_string_in_array(), xbps_pkg_version(), and xbps_pkgpattern_version().

Referenced by xbps_match_virtual_pkg_in_dict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_match_virtual_pkg_in_dict()

bool xbps_match_virtual_pkg_in_dict ( xbps_dictionary_t  pkgd,
const char *  str 
)

Match a virtual package name or pattern by looking at package's dictionary "provides" array object.

Parameters
[in]pkgdPackage dictionary.
[in]strVirtual package name or package pattern to match.
Returns
True if str matches a virtual package in pkgd, false otherwise.

Definition at line 58 of file plist_match.c.

References xbps_match_virtual_pkg_in_array().

Here is the call graph for this function:

◆ xbps_match_any_virtualpkg_in_rundeps()

bool xbps_match_any_virtualpkg_in_rundeps ( xbps_array_t  rundeps,
xbps_array_t  provides 
)

Match any virtual package from array provides in they array rundeps with dependencies.

Parameters
[in]rundepsProplib array with dependencies as strings, i.e foo>=2.0.
[in]providesProplib array of strings with virtual pkgdeps, i.e foo-1.0 blah-2.0.
Returns
True if any virtualpkg has been matched, false otherwise.

Definition at line 71 of file plist_match.c.

References xbps_pkgpattern_match().

Here is the call graph for this function:

◆ xbps_match_pkgname_in_array()

bool xbps_match_pkgname_in_array ( xbps_array_t  array,
const char *  pkgname 
)

Match a package name in the specified array of strings.

Parameters
[in]arrayThe proplib array to search on.
[in]pkgnameThe package name to match.
Returns
true on success, false otherwise and errno is set appropiately.

Definition at line 168 of file plist_match.c.

Referenced by xbps_match_virtual_pkg_in_array().

Here is the caller graph for this function:

◆ xbps_match_pkgver_in_array()

bool xbps_match_pkgver_in_array ( xbps_array_t  array,
const char *  pkgver 
)

Match a package name/version in the specified array of strings with pkgnames.

Parameters
[in]arrayThe proplib array to search on.
[in]pkgverThe package name/version to match.
Returns
true on success, false otherwise and errno is set appropiately.

Definition at line 174 of file plist_match.c.

Referenced by xbps_configure_packages().

Here is the caller graph for this function:

◆ xbps_match_pkgpattern_in_array()

bool xbps_match_pkgpattern_in_array ( xbps_array_t  array,
const char *  pattern 
)

Match a package pattern in the specified array of strings.

Parameters
[in]arrayThe proplib array to search on.
[in]patternThe package pattern to match, i.e ‘foo>=0’ or ‘foo<1’.
Returns
true on success, false otherwise and errno is set appropiately.

Definition at line 180 of file plist_match.c.

Referenced by xbps_match_virtual_pkg_in_array().

Here is the caller graph for this function:

◆ xbps_match_pkgdep_in_array()

bool xbps_match_pkgdep_in_array ( xbps_array_t  array,
const char *  pkgver 
)

Match a package dependency against any package pattern in the specified array of strings.

Parameters
[in]arrayThe proplib array to search on.
[in]pkgverThe package name-version to match, i.e ‘foo-1.0_1’.
Returns
true on success, false otherwise and errno is set appropiately.

Definition at line 186 of file plist_match.c.

Referenced by xbps_match_virtual_pkg_in_array().

Here is the caller graph for this function:

◆ xbps_match_string_in_array()

bool xbps_match_string_in_array ( xbps_array_t  array,
const char *  val 
)

Match a string (exact match) in the specified array of strings.

Parameters
[in]arrayThe proplib array to search on.
[in]valThe string to be matched.
Returns
true on success, false otherwise and errno is set appropiately.

Definition at line 162 of file plist_match.c.

Referenced by xbps_alternatives_register(), xbps_configure_packages(), xbps_match_virtual_pkg_in_array(), xbps_pkg_is_ignored(), and xbps_repo_store().

Here is the caller graph for this function:

◆ xbps_array_iter_from_dict()

xbps_object_iterator_t xbps_array_iter_from_dict ( xbps_dictionary_t  dict,
const char *  key 
)

Returns a proplib object iterator associated with an array, contained in a proplib dictionary matching the specified key.

Parameters
[in]dictProplib dictionary where to look for the array.
[in]keyKey associated with the array.
Returns
A proplib object iterator on success, NULL otherwise and errno is set appropiately.

Definition at line 202 of file plist.c.

Referenced by xbps_transaction_commit().

Here is the caller graph for this function: