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

Functions

prop_object_iterator_t xbps_array_iter_from_dict (prop_dictionary_t dict, const char *key)
 
int xbps_callback_array_iter (struct xbps_handle *xhp, prop_array_t array, int(*fn)(struct xbps_handle *, prop_object_t, void *, bool *), void *arg)
 
int xbps_callback_array_iter_in_dict (struct xbps_handle *xhp, prop_dictionary_t dict, const char *key, int(*fn)(struct xbps_handle *, prop_object_t, void *, bool *), void *arg)
 
int xbps_callback_array_iter_reverse (struct xbps_handle *xhp, prop_array_t array, int(*fn)(struct xbps_handle *, prop_object_t, void *, bool *), void *arg)
 
int xbps_callback_array_iter_reverse_in_dict (struct xbps_handle *xhp, prop_dictionary_t dict, const char *key, int(*fn)(struct xbps_handle *, prop_object_t, void *, bool *), void *arg)
 
bool xbps_match_any_virtualpkg_in_rundeps (prop_array_t rundeps, prop_array_t provides)
 
bool xbps_match_pkgdep_in_array (prop_array_t array, const char *pkgver)
 
bool xbps_match_pkgname_in_array (prop_array_t array, const char *pkgname)
 
bool xbps_match_pkgpattern_in_array (prop_array_t array, const char *pattern)
 
bool xbps_match_string_in_array (prop_array_t array, const char *val)
 
bool xbps_match_virtual_pkg_in_dict (prop_dictionary_t pkgd, const char *str, bool bypattern)
 

Detailed Description

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

Function Documentation

prop_object_iterator_t xbps_array_iter_from_dict ( prop_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 192 of file plist.c.

Referenced by xbps_remove_pkg_files(), and xbps_transaction_commit().

+ Here is the caller graph for this function:

int xbps_callback_array_iter ( struct xbps_handle xhp,
prop_array_t  array,
int(*)(struct xbps_handle *, prop_object_t, void *, bool *)  fn,
void *  arg 
)

Executes a function callback specified in fn with arg passed as its argument into they array array.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]arrayProplib array to iterate.
[in]fnFunction callback to run on every object in the array. While running the function callback, the hird parameter (a pointer to a boolean) can be set to true to stop immediately the loop.
[in]argArgument to be passed to the function callback.
Returns
0 on success, otherwise the value returned by the function callback.

Definition at line 77 of file plist.c.

int xbps_callback_array_iter_in_dict ( struct xbps_handle xhp,
prop_dictionary_t  dict,
const char *  key,
int(*)(struct xbps_handle *, prop_object_t, void *, bool *)  fn,
void *  arg 
)

Executes a function callback into the array associated with key key, contained in a proplib dictionary.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]dictProplib dictionary where the array resides.
[in]keyKey associated with array.
[in]fnFunction callback to run on every object in the array. While running the function callback, the third parameter (a pointer to a boolean) can be set to true to stop immediately the loop.
[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 105 of file plist.c.

int xbps_callback_array_iter_reverse ( struct xbps_handle xhp,
prop_array_t  array,
int(*)(struct xbps_handle *, prop_object_t, void *, bool *)  fn,
void *  arg 
)

Executes a function callback specified in fn with arg passed as its argument into they array array in reverse order (upwards).

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]arrayProplib array to iterate.
[in]fnFunction callback to run on every object in the array. While running the function callback, the hird parameter (a pointer to a boolean) can be set to true to stop immediately the loop.
[in]argArgument to be passed to the function callback.
Returns
0 on success, otherwise the value returned by the function callback.

Definition at line 139 of file plist.c.

Referenced by xbps_callback_array_iter_reverse_in_dict().

+ Here is the caller graph for this function:

int xbps_callback_array_iter_reverse_in_dict ( struct xbps_handle xhp,
prop_dictionary_t  dict,
const char *  key,
int(*)(struct xbps_handle *, prop_object_t, void *, bool *)  fn,
void *  arg 
)

Executes a function callback (in reverse order) into the array associated with key key, contained in a proplib dictionary.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]dictProplib dictionary where the array resides.
[in]keyKey associated with array.
[in]fnFunction callback to run on every object in the array. While running the function callback, the third parameter (a pointer to a boolean) can be set to true to stop immediately the loop.
[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 169 of file plist.c.

References xbps_callback_array_iter_reverse().

+ Here is the call graph for this function:

bool xbps_match_any_virtualpkg_in_rundeps ( prop_array_t  rundeps,
prop_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 62 of file plist_match.c.

References xbps_pkgpattern_match(), and xbps_xasprintf().

+ Here is the call graph for this function:

bool xbps_match_pkgdep_in_array ( prop_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'.
Returns
true on success, false otherwise and errno is set appropiately.

Definition at line 200 of file plist_match.c.

bool xbps_match_pkgname_in_array ( prop_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 188 of file plist_match.c.

Referenced by xbps_match_virtual_pkg_in_dict().

+ Here is the caller graph for this function:

bool xbps_match_pkgpattern_in_array ( prop_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 194 of file plist_match.c.

Referenced by xbps_match_virtual_pkg_in_dict().

+ Here is the caller graph for this function:

bool xbps_match_string_in_array ( prop_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 182 of file plist_match.c.

bool xbps_match_virtual_pkg_in_dict ( prop_dictionary_t  pkgd,
const char *  str,
bool  bypattern 
)

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.
[in]bypatternIf true, str should be a package name, otherwise it should be a package pattern, i.e `foo>=0' or `foo<1'.
Returns
True if str matches a virtual package in pkgd, false otherwise.

Definition at line 43 of file plist_match.c.

References xbps_match_pkgname_in_array(), and xbps_match_pkgpattern_in_array().

Referenced by xbps_rindex_get_virtualpkg().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: