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:
@ -47,23 +47,23 @@ struct thread_data {
|
||||
static void *
|
||||
pkgdb_thread_worker(void *arg)
|
||||
{
|
||||
prop_dictionary_t pkgd;
|
||||
prop_array_t array;
|
||||
prop_object_t obj;
|
||||
xbps_dictionary_t pkgd;
|
||||
xbps_array_t array;
|
||||
xbps_object_t obj;
|
||||
struct thread_data *thd = arg;
|
||||
const char *pkgver;
|
||||
char *pkgname;
|
||||
unsigned int i;
|
||||
int rv;
|
||||
|
||||
array = prop_dictionary_all_keys(thd->xhp->pkgdb);
|
||||
array = xbps_dictionary_all_keys(thd->xhp->pkgdb);
|
||||
assert(array);
|
||||
|
||||
/* process pkgs from start until end */
|
||||
for (i = thd->start; i < thd->end; i++) {
|
||||
obj = prop_array_get(array, i);
|
||||
pkgd = prop_dictionary_get_keysym(thd->xhp->pkgdb, obj);
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
||||
obj = xbps_array_get(array, i);
|
||||
pkgd = xbps_dictionary_get_keysym(thd->xhp->pkgdb, obj);
|
||||
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
||||
if (thd->xhp->flags & XBPS_FLAG_VERBOSE)
|
||||
printf("Checking %s ...\n", pkgver);
|
||||
|
||||
@ -75,7 +75,7 @@ pkgdb_thread_worker(void *arg)
|
||||
fprintf(stderr, "pkgdb[%d] failed for %s: %s\n",
|
||||
thd->thread_num, pkgver, strerror(rv));
|
||||
}
|
||||
prop_object_release(array);
|
||||
xbps_object_release(array);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -94,7 +94,7 @@ check_pkg_integrity_all(struct xbps_handle *xhp)
|
||||
thd = calloc(maxthreads, sizeof(*thd));
|
||||
assert(thd);
|
||||
|
||||
slicecount = prop_dictionary_count(xhp->pkgdb) / maxthreads;
|
||||
slicecount = xbps_dictionary_count(xhp->pkgdb) / maxthreads;
|
||||
pkgcount = 0;
|
||||
|
||||
for (i = 0; i < maxthreads; i++) {
|
||||
@ -102,7 +102,7 @@ check_pkg_integrity_all(struct xbps_handle *xhp)
|
||||
thd[i].xhp = xhp;
|
||||
thd[i].start = pkgcount;
|
||||
if (i + 1 >= maxthreads)
|
||||
thd[i].end = prop_dictionary_count(xhp->pkgdb);
|
||||
thd[i].end = xbps_dictionary_count(xhp->pkgdb);
|
||||
else
|
||||
thd[i].end = pkgcount + slicecount;
|
||||
pthread_create(&thd[i].thread, NULL,
|
||||
@ -124,10 +124,10 @@ check_pkg_integrity_all(struct xbps_handle *xhp)
|
||||
|
||||
int
|
||||
check_pkg_integrity(struct xbps_handle *xhp,
|
||||
prop_dictionary_t pkgd,
|
||||
xbps_dictionary_t pkgd,
|
||||
const char *pkgname)
|
||||
{
|
||||
prop_dictionary_t opkgd, propsd;
|
||||
xbps_dictionary_t opkgd, propsd;
|
||||
const char *sha256;
|
||||
char *buf;
|
||||
int rv = 0;
|
||||
@ -147,27 +147,27 @@ check_pkg_integrity(struct xbps_handle *xhp,
|
||||
* Check for props.plist metadata file.
|
||||
*/
|
||||
buf = xbps_xasprintf("%s/.%s.plist", xhp->metadir, pkgname);
|
||||
propsd = prop_dictionary_internalize_from_file(buf);
|
||||
propsd = xbps_dictionary_internalize_from_file(buf);
|
||||
free(buf);
|
||||
if (propsd == NULL) {
|
||||
xbps_error_printf("%s: unexistent metafile!\n", pkgname);
|
||||
return EINVAL;
|
||||
} else if (prop_dictionary_count(propsd) == 0) {
|
||||
} else if (xbps_dictionary_count(propsd) == 0) {
|
||||
xbps_error_printf("%s: incomplete metadata file.\n", pkgname);
|
||||
prop_object_release(propsd);
|
||||
xbps_object_release(propsd);
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* Check pkg metadata signature.
|
||||
*/
|
||||
prop_dictionary_get_cstring_nocopy(opkgd, "metafile-sha256", &sha256);
|
||||
xbps_dictionary_get_cstring_nocopy(opkgd, "metafile-sha256", &sha256);
|
||||
if (sha256 != NULL) {
|
||||
buf = xbps_xasprintf("%s/.%s.plist",
|
||||
xhp->metadir, pkgname);
|
||||
rv = xbps_file_hash_check(buf, sha256);
|
||||
free(buf);
|
||||
if (rv == ERANGE) {
|
||||
prop_object_release(propsd);
|
||||
xbps_object_release(propsd);
|
||||
fprintf(stderr, "%s: metadata file has been "
|
||||
"modified!\n", pkgname);
|
||||
return 1;
|
||||
@ -190,7 +190,7 @@ do { \
|
||||
RUN_PKG_CHECK(xhp, rundeps, propsd);
|
||||
RUN_PKG_CHECK(xhp, unneeded, opkgd);
|
||||
|
||||
prop_object_release(propsd);
|
||||
xbps_object_release(propsd);
|
||||
|
||||
#undef RUN_PKG_CHECK
|
||||
|
||||
|
@ -48,25 +48,25 @@
|
||||
int
|
||||
check_pkg_files(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
{
|
||||
prop_array_t array;
|
||||
prop_object_t obj;
|
||||
prop_object_iterator_t iter;
|
||||
prop_dictionary_t pkg_filesd = arg;
|
||||
xbps_array_t array;
|
||||
xbps_object_t obj;
|
||||
xbps_object_iterator_t iter;
|
||||
xbps_dictionary_t pkg_filesd = arg;
|
||||
const char *file, *sha256;
|
||||
char *path;
|
||||
bool mutable, broken = false, test_broken = false;
|
||||
int rv;
|
||||
|
||||
array = prop_dictionary_get(pkg_filesd, "files");
|
||||
if (array != NULL && prop_array_count(array) > 0) {
|
||||
array = xbps_dictionary_get(pkg_filesd, "files");
|
||||
if (array != NULL && xbps_array_count(array) > 0) {
|
||||
iter = xbps_array_iter_from_dict(pkg_filesd, "files");
|
||||
if (iter == NULL)
|
||||
return -1;
|
||||
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
while ((obj = xbps_object_iterator_next(iter))) {
|
||||
xbps_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
path = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
prop_dictionary_get_cstring_nocopy(obj,
|
||||
xbps_dictionary_get_cstring_nocopy(obj,
|
||||
"sha256", &sha256);
|
||||
rv = xbps_file_hash_check(path, sha256);
|
||||
free(path);
|
||||
@ -80,7 +80,7 @@ check_pkg_files(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
break;
|
||||
case ERANGE:
|
||||
mutable = false;
|
||||
prop_dictionary_get_bool(obj,
|
||||
xbps_dictionary_get_bool(obj,
|
||||
"mutable", &mutable);
|
||||
if (!mutable) {
|
||||
xbps_error_printf("%s: hash mismatch "
|
||||
@ -95,7 +95,7 @@ check_pkg_files(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
xbps_object_iterator_release(iter);
|
||||
}
|
||||
if (test_broken) {
|
||||
xbps_error_printf("%s: files check FAILED.\n", pkgname);
|
||||
@ -106,14 +106,14 @@ check_pkg_files(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
/*
|
||||
* Check for missing configuration files.
|
||||
*/
|
||||
array = prop_dictionary_get(pkg_filesd, "conf_files");
|
||||
if (array != NULL && prop_array_count(array) > 0) {
|
||||
array = xbps_dictionary_get(pkg_filesd, "conf_files");
|
||||
if (array != NULL && xbps_array_count(array) > 0) {
|
||||
iter = xbps_array_iter_from_dict(pkg_filesd, "conf_files");
|
||||
if (iter == NULL)
|
||||
return -1;
|
||||
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
while ((obj = xbps_object_iterator_next(iter))) {
|
||||
xbps_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
path = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
if (access(path, R_OK) == -1) {
|
||||
if (errno == ENOENT) {
|
||||
@ -129,7 +129,7 @@ check_pkg_files(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
}
|
||||
free(path);
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
xbps_object_iterator_release(iter);
|
||||
}
|
||||
if (test_broken) {
|
||||
xbps_error_printf("%s: conf files check FAILED.\n", pkgname);
|
||||
|
@ -47,8 +47,8 @@
|
||||
int
|
||||
check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
{
|
||||
prop_dictionary_t pkg_propsd = arg;
|
||||
prop_array_t array;
|
||||
xbps_dictionary_t pkg_propsd = arg;
|
||||
xbps_array_t array;
|
||||
unsigned int i;
|
||||
const char *reqpkg;
|
||||
bool test_broken = false;
|
||||
@ -56,9 +56,9 @@ check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
if (!xbps_pkg_has_rundeps(pkg_propsd))
|
||||
return 0;
|
||||
|
||||
array = prop_dictionary_get(pkg_propsd, "run_depends");
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
prop_array_get_cstring_nocopy(array, i, &reqpkg);
|
||||
array = xbps_dictionary_get(pkg_propsd, "run_depends");
|
||||
for (i = 0; i < xbps_array_count(array); i++) {
|
||||
xbps_array_get_cstring_nocopy(array, i, &reqpkg);
|
||||
if (xbps_pkg_is_installed(xhp, reqpkg) <= 0) {
|
||||
xbps_error_printf("%s: dependency not satisfied: %s\n",
|
||||
pkgname, reqpkg);
|
||||
|
@ -74,27 +74,27 @@ symlink_target(const char *pkgname, const char *path)
|
||||
int
|
||||
check_pkg_symlinks(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
{
|
||||
prop_array_t array;
|
||||
prop_object_t obj;
|
||||
prop_dictionary_t filesd = arg;
|
||||
xbps_array_t array;
|
||||
xbps_object_t obj;
|
||||
xbps_dictionary_t filesd = arg;
|
||||
unsigned int i;
|
||||
const char *file, *tgt = NULL;
|
||||
char *path, *p, *buf, *buf2, *lnk, *dname, *tgt_path;
|
||||
int rv;
|
||||
bool broken = false;
|
||||
|
||||
array = prop_dictionary_get(filesd, "links");
|
||||
array = xbps_dictionary_get(filesd, "links");
|
||||
if (array == NULL)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
obj = prop_array_get(array, i);
|
||||
if (!prop_dictionary_get_cstring_nocopy(obj, "target", &tgt)) {
|
||||
for (i = 0; i < xbps_array_count(array); i++) {
|
||||
obj = xbps_array_get(array, i);
|
||||
if (!xbps_dictionary_get_cstring_nocopy(obj, "target", &tgt)) {
|
||||
xbps_warn_printf("%s: `%s' symlink with "
|
||||
"empty target object!\n", pkgname, file);
|
||||
continue;
|
||||
}
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
xbps_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
if (strcmp(tgt, "") == 0) {
|
||||
xbps_warn_printf("%s: `%s' symlink with "
|
||||
"empty target object!\n", pkgname, file);
|
||||
|
@ -45,19 +45,19 @@
|
||||
int
|
||||
check_pkg_unneeded(struct xbps_handle *xhp, const char *pkgname, void *arg)
|
||||
{
|
||||
prop_dictionary_t pkgd = arg;
|
||||
xbps_dictionary_t pkgd = arg;
|
||||
|
||||
(void)xhp;
|
||||
(void)pkgname;
|
||||
|
||||
if (prop_dictionary_get(pkgd, "remove-and-update"))
|
||||
prop_dictionary_remove(pkgd, "remove-and-update");
|
||||
if (xbps_dictionary_get(pkgd, "remove-and-update"))
|
||||
xbps_dictionary_remove(pkgd, "remove-and-update");
|
||||
|
||||
if (prop_dictionary_get(pkgd, "transaction"))
|
||||
prop_dictionary_remove(pkgd, "transaction");
|
||||
if (xbps_dictionary_get(pkgd, "transaction"))
|
||||
xbps_dictionary_remove(pkgd, "transaction");
|
||||
|
||||
if (prop_dictionary_get(pkgd, "skip-obsoletes"))
|
||||
prop_dictionary_remove(pkgd, "skip-obsoletes");
|
||||
if (xbps_dictionary_get(pkgd, "skip-obsoletes"))
|
||||
xbps_dictionary_remove(pkgd, "skip-obsoletes");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,8 +44,8 @@
|
||||
static void
|
||||
pkgdb_format_021(struct xbps_handle *xhp, const char *plist_new)
|
||||
{
|
||||
prop_array_t array, rdeps;
|
||||
prop_dictionary_t pkgdb, pkgd;
|
||||
xbps_array_t array, rdeps;
|
||||
xbps_dictionary_t pkgdb, pkgd;
|
||||
unsigned int i;
|
||||
char *pkgname, *plist;
|
||||
|
||||
@ -61,45 +61,45 @@ pkgdb_format_021(struct xbps_handle *xhp, const char *plist_new)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
array = prop_array_internalize_from_zfile(plist);
|
||||
if (prop_object_type(array) != PROP_TYPE_ARRAY) {
|
||||
array = xbps_array_internalize_from_zfile(plist);
|
||||
if (xbps_object_type(array) != XBPS_TYPE_ARRAY) {
|
||||
xbps_error_printf("unknown object type for %s\n",
|
||||
plist, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
pkgdb = prop_dictionary_create();
|
||||
pkgdb = xbps_dictionary_create();
|
||||
assert(pkgdb);
|
||||
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
pkgd = prop_array_get(array, i);
|
||||
prop_dictionary_get_cstring(pkgd, "pkgname", &pkgname);
|
||||
rdeps = prop_dictionary_get(pkgd, "run_depends");
|
||||
for (i = 0; i < xbps_array_count(array); i++) {
|
||||
pkgd = xbps_array_get(array, i);
|
||||
xbps_dictionary_get_cstring(pkgd, "pkgname", &pkgname);
|
||||
rdeps = xbps_dictionary_get(pkgd, "run_depends");
|
||||
/* remove unneeded objs */
|
||||
prop_dictionary_remove(pkgd, "pkgname");
|
||||
prop_dictionary_remove(pkgd, "version");
|
||||
if (prop_array_count(rdeps) == 0)
|
||||
prop_dictionary_remove(pkgd, "run_depends");
|
||||
xbps_dictionary_remove(pkgd, "pkgname");
|
||||
xbps_dictionary_remove(pkgd, "version");
|
||||
if (xbps_array_count(rdeps) == 0)
|
||||
xbps_dictionary_remove(pkgd, "run_depends");
|
||||
|
||||
prop_dictionary_set(pkgdb, pkgname, pkgd);
|
||||
xbps_dictionary_set(pkgdb, pkgname, pkgd);
|
||||
free(pkgname);
|
||||
}
|
||||
|
||||
if (prop_array_count(array) != prop_dictionary_count(pkgdb)) {
|
||||
if (xbps_array_count(array) != xbps_dictionary_count(pkgdb)) {
|
||||
xbps_error_printf("failed conversion! unmatched obj count "
|
||||
"(got %zu, need %zu)\n", prop_dictionary_count(pkgdb),
|
||||
prop_array_count(array));
|
||||
"(got %zu, need %zu)\n", xbps_dictionary_count(pkgdb),
|
||||
xbps_array_count(array));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!prop_dictionary_externalize_to_file(pkgdb, plist_new)) {
|
||||
if (!xbps_dictionary_externalize_to_file(pkgdb, plist_new)) {
|
||||
xbps_error_printf("failed to write %s: %s\n",
|
||||
plist_new, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
prop_object_release(array);
|
||||
prop_object_release(pkgdb);
|
||||
xbps_object_release(array);
|
||||
xbps_object_release(pkgdb);
|
||||
free(plist);
|
||||
|
||||
printf("Conversion to 0.21 pkgdb format successfully\n");
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <xbps_api.h>
|
||||
|
||||
/* from check.c */
|
||||
int check_pkg_integrity(struct xbps_handle *, prop_dictionary_t, const char *);
|
||||
int check_pkg_integrity(struct xbps_handle *, xbps_dictionary_t, const char *);
|
||||
int check_pkg_integrity_all(struct xbps_handle *);
|
||||
|
||||
#define CHECK_PKG_DECL(type) \
|
||||
|
@ -57,7 +57,7 @@ change_pkg_instmode(struct xbps_handle *xhp,
|
||||
const char *pkgname,
|
||||
const char *modestr)
|
||||
{
|
||||
prop_dictionary_t pkgd;
|
||||
xbps_dictionary_t pkgd;
|
||||
bool mode = false;
|
||||
|
||||
pkgd = xbps_pkgdb_get_pkg(xhp, pkgname);
|
||||
@ -67,7 +67,7 @@ change_pkg_instmode(struct xbps_handle *xhp,
|
||||
if (strcmp(modestr, "auto") == 0)
|
||||
mode = true;
|
||||
|
||||
prop_dictionary_set_bool(pkgd, "automatic-install", mode);
|
||||
xbps_dictionary_set_bool(pkgd, "automatic-install", mode);
|
||||
return xbps_pkgdb_update(xhp, true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user