Fix binpkg dependency installation with new code.
--HG-- extra : convert_revision : fc6c3fd108caf4cedec0edd3b813edbdfb6bd8be
This commit is contained in:
parent
126928ca8d
commit
1eb9ea591a
|
@ -27,7 +27,7 @@
|
|||
#define _XBPS_INSTALL_H_
|
||||
|
||||
/* From lib/install.c, lib/depends.c and lib/unpack.c */
|
||||
int xbps_install_pkg_deps(prop_dictionary_t);
|
||||
int xbps_install_pkg_deps(prop_dictionary_t, const char *);
|
||||
int xbps_install_binary_pkg(const char *, const char *);
|
||||
int xbps_install_binary_pkg_fini(prop_dictionary_t, prop_dictionary_t,
|
||||
const char *);
|
||||
|
|
|
@ -116,7 +116,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
|||
uint32_t prio = 0;
|
||||
size_t len = 0;
|
||||
const char *pkgname, *version, *reqbyname, *reqbyver;
|
||||
const char *repoloc, *binfile, *array_key = NULL, *originpkg;
|
||||
const char *repoloc, *binfile, *array_key, *originpkg, *short_desc;
|
||||
char *reqby;
|
||||
int rv = 0;
|
||||
|
||||
|
@ -130,6 +130,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
|||
prop_dictionary_get_cstring_nocopy(depd, "pkgname", &pkgname);
|
||||
prop_dictionary_get_cstring_nocopy(depd, "version", &version);
|
||||
prop_dictionary_get_cstring_nocopy(depd, "filename", &binfile);
|
||||
prop_dictionary_get_cstring_nocopy(depd, "short_desc", &short_desc);
|
||||
prop_dictionary_get_uint32(depd, "priority", &prio);
|
||||
prop_dictionary_get_cstring_nocopy(origind, "pkgname", &reqbyname);
|
||||
prop_dictionary_get_cstring_nocopy(origind, "version", &reqbyver);
|
||||
|
@ -221,6 +222,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
|||
prop_dictionary_set_cstring(dict, "repository", repoloc);
|
||||
prop_dictionary_set_cstring(dict, "filename", binfile);
|
||||
prop_dictionary_set_uint32(dict, "priority", prio);
|
||||
prop_dictionary_set_cstring(dict, "short_desc", short_desc);
|
||||
}
|
||||
/*
|
||||
* Add the dictionary into the array.
|
||||
|
@ -406,7 +408,7 @@ out:
|
|||
}
|
||||
|
||||
int
|
||||
xbps_install_pkg_deps(prop_dictionary_t pkg)
|
||||
xbps_install_pkg_deps(prop_dictionary_t pkg, const char *destdir)
|
||||
{
|
||||
prop_array_t array, installed, direct, indirect;
|
||||
prop_dictionary_t dict;
|
||||
|
@ -414,7 +416,7 @@ xbps_install_pkg_deps(prop_dictionary_t pkg)
|
|||
prop_object_iterator_t iter;
|
||||
uint32_t maxprio = 0, prio = 0;
|
||||
size_t curidx = 0, idx = 0;
|
||||
const char *array_key, *reqby, *curname;
|
||||
const char *array_key, *reqby, *curname, *curver;
|
||||
int rv = 0;
|
||||
|
||||
assert(pkg != NULL);
|
||||
|
@ -447,7 +449,10 @@ xbps_install_pkg_deps(prop_dictionary_t pkg)
|
|||
|
||||
again:
|
||||
array = prop_dictionary_get(chaindeps, array_key);
|
||||
if (array == NULL || prop_array_count(array) == 0) {
|
||||
if (array && prop_array_count(array) == 0) {
|
||||
rv = 0;
|
||||
goto out;
|
||||
} else if (array == NULL || prop_array_count(array) == 0) {
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
@ -475,8 +480,17 @@ again:
|
|||
}
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(dict, "pkgname", &curname);
|
||||
prop_dictionary_get_cstring_nocopy(dict, "version", &curver);
|
||||
prop_dictionary_get_cstring_nocopy(dict, "requiredby", &reqby);
|
||||
|
||||
printf("Installing %s-%s required by %s...\n", curname, curver, reqby);
|
||||
rv = xbps_install_binary_pkg_fini(NULL, dict, destdir);
|
||||
if (rv != 0) {
|
||||
printf("Error while installing %s-%s (%s)\n", curname, curver,
|
||||
strerror(rv));
|
||||
goto out;
|
||||
}
|
||||
|
||||
prop_array_remove(array, curidx);
|
||||
if (prop_array_count(array) > 0) {
|
||||
prio = maxprio = 0;
|
||||
|
@ -491,7 +505,6 @@ again:
|
|||
|
||||
out:
|
||||
prop_object_release(chaindeps);
|
||||
exit(0);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ xbps_install_binary_pkg(const char *pkgname, const char *destdir)
|
|||
/*
|
||||
* Install all required dependencies and the package itself.
|
||||
*/
|
||||
rv = xbps_install_pkg_deps(pkgrd);
|
||||
rv = xbps_install_pkg_deps(pkgrd, destdir);
|
||||
if (rv == 0) {
|
||||
rv = xbps_install_binary_pkg_fini(repod, pkgrd,
|
||||
destdir);
|
||||
|
|
19
lib/unpack.c
19
lib/unpack.c
|
@ -37,6 +37,19 @@
|
|||
static int unpack_archive_init(prop_dictionary_t, const char *, const char *);
|
||||
static int unpack_archive_fini(struct archive *, const char *,
|
||||
prop_dictionary_t);
|
||||
static void unpack_defcb_print(prop_dictionary_t);
|
||||
|
||||
static void
|
||||
unpack_defcb_print(prop_dictionary_t pkg)
|
||||
{
|
||||
const char *pkgname, *version;
|
||||
assert(pkg != NULL);
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname);
|
||||
prop_dictionary_get_cstring_nocopy(pkg, "version", &version);
|
||||
|
||||
printf(" Unpacking %s-%s...\n", pkgname, version);
|
||||
}
|
||||
|
||||
int
|
||||
xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg,
|
||||
|
@ -54,7 +67,7 @@ xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg,
|
|||
if (repo)
|
||||
repoloc = prop_dictionary_get(repo, "location-local");
|
||||
else
|
||||
repoloc = prop_dictionary_get(pkg, "location-local");
|
||||
repoloc = prop_dictionary_get(pkg, "repository");
|
||||
|
||||
binfile = xbps_append_full_path(false,
|
||||
prop_string_cstring_nocopy(repoloc),
|
||||
|
@ -62,7 +75,9 @@ xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg,
|
|||
if (binfile == NULL)
|
||||
return EINVAL;
|
||||
|
||||
if (cb_print)
|
||||
if (!cb_print)
|
||||
unpack_defcb_print(pkg);
|
||||
else
|
||||
(*cb_print)(pkg);
|
||||
|
||||
rv = unpack_archive_init(pkg, destdir, binfile);
|
||||
|
|
Loading…
Reference in New Issue