Get rid of libfetch and proplib external dependencies.

The list of required external deps is now confuse, libarchive and openssl.

libxbps now includes a wrapper for proplib prefixed with xbps_ rather than prop_.
This commit is contained in:
Juan RP
2013-06-20 10:26:12 +02:00
parent 31efece727
commit 42c0766c00
67 changed files with 3004 additions and 1487 deletions

View File

@@ -37,19 +37,19 @@
static pthread_mutex_t cfg_mtx = PTHREAD_MUTEX_INITIALIZER;
static bool cfg_vpkgs_init;
static prop_dictionary_t
get_pkg_in_array(prop_array_t array, const char *str, bool virtual)
static xbps_dictionary_t
get_pkg_in_array(xbps_array_t array, const char *str, bool virtual)
{
prop_object_t obj = NULL;
prop_object_iterator_t iter;
xbps_object_t obj = NULL;
xbps_object_iterator_t iter;
const char *pkgver;
char *dpkgn;
bool found = false;
iter = prop_array_iterator(array);
iter = xbps_array_iterator(array);
assert(iter);
while ((obj = prop_object_iterator_next(iter))) {
while ((obj = xbps_object_iterator_next(iter))) {
if (virtual) {
/*
* Check if package pattern matches
@@ -64,7 +64,7 @@ get_pkg_in_array(prop_array_t array, const char *str, bool virtual)
break;
} else if (xbps_pkgpattern_version(str)) {
/* ,atch by pattern against pkgver */
if (!prop_dictionary_get_cstring_nocopy(obj,
if (!xbps_dictionary_get_cstring_nocopy(obj,
"pkgver", &pkgver))
continue;
if (xbps_pkgpattern_match(pkgver, str)) {
@@ -73,7 +73,7 @@ get_pkg_in_array(prop_array_t array, const char *str, bool virtual)
}
} else if (xbps_pkg_version(str)) {
/* match by exact pkgver */
if (!prop_dictionary_get_cstring_nocopy(obj,
if (!xbps_dictionary_get_cstring_nocopy(obj,
"pkgver", &pkgver))
continue;
if (strcmp(str, pkgver) == 0) {
@@ -82,7 +82,7 @@ get_pkg_in_array(prop_array_t array, const char *str, bool virtual)
}
} else {
/* match by pkgname */
if (!prop_dictionary_get_cstring_nocopy(obj,
if (!xbps_dictionary_get_cstring_nocopy(obj,
"pkgver", &pkgver))
continue;
dpkgn = xbps_pkg_name(pkgver);
@@ -95,31 +95,31 @@ get_pkg_in_array(prop_array_t array, const char *str, bool virtual)
free(dpkgn);
}
}
prop_object_iterator_release(iter);
xbps_object_iterator_release(iter);
return found ? obj : NULL;
}
prop_dictionary_t HIDDEN
xbps_find_pkg_in_array(prop_array_t a, const char *s)
xbps_dictionary_t HIDDEN
xbps_find_pkg_in_array(xbps_array_t a, const char *s)
{
assert(prop_object_type(a) == PROP_TYPE_ARRAY);
assert(xbps_object_type(a) == XBPS_TYPE_ARRAY);
assert(s);
return get_pkg_in_array(a, s, false);
}
prop_dictionary_t HIDDEN
xbps_dictionary_t HIDDEN
xbps_find_virtualpkg_in_array(struct xbps_handle *x,
prop_array_t a,
xbps_array_t a,
const char *s)
{
prop_dictionary_t pkgd;
xbps_dictionary_t pkgd;
const char *vpkg;
bool bypattern = false;
assert(x);
assert(prop_object_type(a) == PROP_TYPE_ARRAY);
assert(xbps_object_type(a) == XBPS_TYPE_ARRAY);
assert(s);
if (xbps_pkgpattern_version(s))
@@ -133,10 +133,10 @@ xbps_find_virtualpkg_in_array(struct xbps_handle *x,
return get_pkg_in_array(a, s, true);
}
static prop_dictionary_t
match_pkg_by_pkgver(prop_dictionary_t repod, const char *p)
static xbps_dictionary_t
match_pkg_by_pkgver(xbps_dictionary_t repod, const char *p)
{
prop_dictionary_t d = NULL;
xbps_dictionary_t d = NULL;
const char *pkgver;
char *pkgname;
@@ -144,9 +144,9 @@ match_pkg_by_pkgver(prop_dictionary_t repod, const char *p)
if ((pkgname = xbps_pkg_name(p)) == NULL)
return NULL;
d = prop_dictionary_get(repod, pkgname);
d = xbps_dictionary_get(repod, pkgname);
if (d) {
prop_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
if (strcmp(pkgver, p))
d = NULL;
}
@@ -155,10 +155,10 @@ match_pkg_by_pkgver(prop_dictionary_t repod, const char *p)
return d;
}
static prop_dictionary_t
match_pkg_by_pattern(prop_dictionary_t repod, const char *p)
static xbps_dictionary_t
match_pkg_by_pattern(xbps_dictionary_t repod, const char *p)
{
prop_dictionary_t d = NULL;
xbps_dictionary_t d = NULL;
const char *pkgver;
char *pkgname;
@@ -170,9 +170,9 @@ match_pkg_by_pattern(prop_dictionary_t repod, const char *p)
return NULL;
}
d = prop_dictionary_get(repod, pkgname);
d = xbps_dictionary_get(repod, pkgname);
if (d) {
prop_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
assert(pkgver);
if (!xbps_pkgpattern_match(pkgver, p))
d = NULL;
@@ -289,14 +289,14 @@ vpkg_user_conf(struct xbps_handle *xhp,
return pkg;
}
prop_dictionary_t
xbps_dictionary_t
xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
prop_dictionary_t d,
xbps_dictionary_t d,
const char *pkg)
{
prop_object_t obj;
prop_object_iterator_t iter;
prop_dictionary_t pkgd = NULL;
xbps_object_t obj;
xbps_object_iterator_t iter;
xbps_dictionary_t pkgd = NULL;
const char *vpkg;
bool found = false, bypattern = false;
@@ -311,7 +311,7 @@ xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
else if (xbps_pkg_version(vpkg))
pkgd = match_pkg_by_pkgver(d, vpkg);
else
pkgd = prop_dictionary_get(d, vpkg);
pkgd = xbps_dictionary_get(d, vpkg);
if (pkgd) {
found = true;
@@ -320,17 +320,17 @@ xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
}
/* ... otherwise match the first one in dictionary */
iter = prop_dictionary_iterator(d);
iter = xbps_dictionary_iterator(d);
assert(iter);
while ((obj = prop_object_iterator_next(iter))) {
pkgd = prop_dictionary_get_keysym(d, obj);
while ((obj = xbps_object_iterator_next(iter))) {
pkgd = xbps_dictionary_get_keysym(d, obj);
if (xbps_match_virtual_pkg_in_dict(pkgd, pkg, bypattern)) {
found = true;
break;
}
}
prop_object_iterator_release(iter);
xbps_object_iterator_release(iter);
out:
if (found)
@@ -339,17 +339,17 @@ out:
return NULL;
}
prop_dictionary_t
xbps_find_pkg_in_dict(prop_dictionary_t d, const char *pkg)
xbps_dictionary_t
xbps_find_pkg_in_dict(xbps_dictionary_t d, const char *pkg)
{
prop_dictionary_t pkgd = NULL;
xbps_dictionary_t pkgd = NULL;
if (xbps_pkgpattern_version(pkg))
pkgd = match_pkg_by_pattern(d, pkg);
else if (xbps_pkg_version(pkg))
pkgd = match_pkg_by_pkgver(d, pkg);
else
pkgd = prop_dictionary_get(d, pkg);
pkgd = xbps_dictionary_get(d, pkg);
return pkgd;
}