32#include "xbps_api_impl.h"
60 xbps_array_t provides;
62 assert(xbps_object_type(d) == XBPS_TYPE_DICTIONARY);
64 if ((provides = xbps_dictionary_get(d,
"provides")))
72 xbps_array_t provides)
74 xbps_object_t obj, obj2;
75 xbps_object_iterator_t iter, iter2;
76 const char *vpkgver, *pkgpattern;
78 iter = xbps_array_iterator(provides);
81 while ((obj = xbps_object_iterator_next(iter))) {
82 vpkgver = xbps_string_cstring_nocopy(obj);
83 iter2 = xbps_array_iterator(rundeps);
85 while ((obj2 = xbps_object_iterator_next(iter2))) {
86 pkgpattern = xbps_string_cstring_nocopy(obj2);
88 xbps_object_iterator_release(iter2);
89 xbps_object_iterator_release(iter);
93 xbps_object_iterator_release(iter2);
95 xbps_object_iterator_release(iter);
101match_string_in_array(xbps_array_t array,
const char *str,
int mode)
103 xbps_object_iterator_t iter;
106 char pkgname[XBPS_NAME_SIZE];
109 assert(xbps_object_type(array) == XBPS_TYPE_ARRAY);
112 iter = xbps_array_iterator(array);
115 while ((obj = xbps_object_iterator_next(iter))) {
118 if (xbps_string_equals_cstring(obj, str)) {
122 }
else if (mode == 1) {
124 pkgdep = xbps_string_cstring_nocopy(obj);
127 if (strcmp(pkgname, str) == 0) {
131 }
else if (mode == 2) {
133 pkgdep = xbps_string_cstring_nocopy(obj);
136 if (strcmp(pkgname, pkgdep) == 0) {
140 }
else if (mode == 3) {
142 pkgdep = xbps_string_cstring_nocopy(obj);
147 }
else if (mode == 4) {
149 pkgdep = xbps_string_cstring_nocopy(obj);
156 xbps_object_iterator_release(iter);
164 return match_string_in_array(array, str, 0);
170 return match_string_in_array(array, pkgname, 1);
176 return match_string_in_array(array, pkgver, 2);
182 return match_string_in_array(array, pattern, 3);
188 return match_string_in_array(array, pkgver, 4);
bool xbps_match_pkgver_in_array(xbps_array_t array, const char *pkgver)
bool xbps_match_pkgname_in_array(xbps_array_t array, const char *pkgname)
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 *str)
bool xbps_match_virtual_pkg_in_dict(xbps_dictionary_t d, const char *str)
bool xbps_match_virtual_pkg_in_array(xbps_array_t a, const char *str)
bool xbps_match_any_virtualpkg_in_rundeps(xbps_array_t rundeps, xbps_array_t provides)
bool xbps_match_pkgpattern_in_array(xbps_array_t array, const char *pattern)
const char * xbps_pkgpattern_version(const char *pattern)
bool xbps_pkg_name(char *dst, size_t len, const char *pkg)
int xbps_pkgpattern_match(const char *pkgver, const char *pattern)
const char * xbps_pkg_version(const char *pkg)