libxbps: add xbps_find_virtualpkg_in_array_by_{name,pattern} and use it.
This commit is contained in:
parent
33d6d2e166
commit
17829cd6b4
@ -667,6 +667,29 @@ prop_dictionary_t xbps_find_pkg_in_array_by_name(prop_array_t array,
|
||||
prop_dictionary_t xbps_find_pkg_in_array_by_pattern(prop_array_t array,
|
||||
const char *pattern);
|
||||
|
||||
/**
|
||||
* Finds a virtual package dictionary in a proplib array by matching a
|
||||
* package name.
|
||||
*
|
||||
* @param[in] array The proplib array where to look for.
|
||||
* @param[in] name The virtual package name to match.
|
||||
*
|
||||
* @return true on success, false otherwise and errno is set appropiately.
|
||||
*/
|
||||
prop_dictionary_t xbps_find_virtualpkg_in_array_by_name(prop_array_t array,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Finds a virtual package dictionary in a proplib array by matching a
|
||||
* package pattern.
|
||||
*
|
||||
* @param[in] array The proplib array where to look for.
|
||||
* @param[in] pattern The virtual package pattern to match.
|
||||
*
|
||||
* @return true on success, false otherwise and errno is set appropiately.
|
||||
*/
|
||||
prop_dictionary_t xbps_find_virtualpkg_in_array_by_pattern(prop_array_t array,
|
||||
const char *pattern);
|
||||
/**
|
||||
* Match a package name in the specified array of strings.
|
||||
*
|
||||
|
@ -168,7 +168,7 @@ xbps_requiredby_pkg_add(prop_array_t pkgs_array, prop_dictionary_t pkgd)
|
||||
break;
|
||||
}
|
||||
pkgd_regpkgdb =
|
||||
xbps_find_pkg_in_array_by_pattern(pkgs_array, str);
|
||||
xbps_find_virtualpkg_in_array_by_pattern(pkgs_array, str);
|
||||
if (pkgd_regpkgdb == NULL)
|
||||
return EINVAL;
|
||||
|
||||
|
@ -121,6 +121,18 @@ xbps_find_pkg_in_array_by_pattern(prop_array_t array, const char *pattern)
|
||||
return find_pkg_in_array(array, pattern, true, false);
|
||||
}
|
||||
|
||||
prop_dictionary_t
|
||||
xbps_find_virtualpkg_in_array_by_name(prop_array_t array, const char *name)
|
||||
{
|
||||
return find_pkg_in_array(array, name, false, true);
|
||||
}
|
||||
|
||||
prop_dictionary_t
|
||||
xbps_find_virtualpkg_in_array_by_pattern(prop_array_t array, const char *pattern)
|
||||
{
|
||||
return find_pkg_in_array(array, pattern, true, true);
|
||||
}
|
||||
|
||||
static const char *
|
||||
find_virtualpkg_user_in_conf(const char *vpkg, bool bypattern)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user