xbps-query: fix --fulldeptree with multiple pkgs using vpkgs and non vpkgs.
This commit is contained in:
parent
5dba1108d1
commit
15943d990c
@ -43,6 +43,8 @@ struct pkgdep {
|
|||||||
static SLIST_HEAD(pkgdep_head, pkgdep) pkgdep_list =
|
static SLIST_HEAD(pkgdep_head, pkgdep) pkgdep_list =
|
||||||
SLIST_HEAD_INITIALIZER(pkgdep_list);
|
SLIST_HEAD_INITIALIZER(pkgdep_list);
|
||||||
|
|
||||||
|
static xbps_dictionary_t pkgdep_pvmap;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_rdeps(struct xbps_handle *xhp, xbps_array_t rdeps, bool full, bool repo)
|
print_rdeps(struct xbps_handle *xhp, xbps_array_t rdeps, bool full, bool repo)
|
||||||
{
|
{
|
||||||
@ -53,7 +55,6 @@ print_rdeps(struct xbps_handle *xhp, xbps_array_t rdeps, bool full, bool repo)
|
|||||||
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
|
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
|
||||||
struct pkgdep *pd;
|
struct pkgdep *pd;
|
||||||
const char *pkgver;
|
const char *pkgver;
|
||||||
char *vpkg = NULL;
|
|
||||||
bool virtual = false, found = false;
|
bool virtual = false, found = false;
|
||||||
|
|
||||||
xbps_array_get_cstring_nocopy(rdeps, i, &curdep);
|
xbps_array_get_cstring_nocopy(rdeps, i, &curdep);
|
||||||
@ -83,16 +84,15 @@ print_rdeps(struct xbps_handle *xhp, xbps_array_t rdeps, bool full, bool repo)
|
|||||||
p = xbps_pkg_name(curdep);
|
p = xbps_pkg_name(curdep);
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
vpkg = xbps_xasprintf("%s-%s", p, xbps_pkg_version(pkgver));
|
if (pkgdep_pvmap == NULL)
|
||||||
assert(vpkg);
|
pkgdep_pvmap = xbps_dictionary_create();
|
||||||
|
|
||||||
|
xbps_dictionary_set_cstring_nocopy(pkgdep_pvmap, p, pkgver);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
/* uniquify dependencies, sorting will be done later */
|
/* uniquify dependencies, sorting will be done later */
|
||||||
SLIST_FOREACH(pd, &pkgdep_list, pkgdep_entries) {
|
SLIST_FOREACH(pd, &pkgdep_list, pkgdep_entries) {
|
||||||
if (virtual && strcmp(pd->pkg, vpkg) == 0) {
|
if (strcmp(pd->pkg, pkgver) == 0) {
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
} else if (strcmp(pd->pkg, pkgver) == 0) {
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -100,11 +100,7 @@ print_rdeps(struct xbps_handle *xhp, xbps_array_t rdeps, bool full, bool repo)
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
pd = malloc(sizeof(*pd));
|
pd = malloc(sizeof(*pd));
|
||||||
assert(pd);
|
assert(pd);
|
||||||
if (virtual)
|
pd->pkg = pkgver;
|
||||||
pd->pkg = vpkg;
|
|
||||||
else
|
|
||||||
pd->pkg = pkgver;
|
|
||||||
|
|
||||||
pd->rdeps = xbps_array_copy(currdeps);
|
pd->rdeps = xbps_array_copy(currdeps);
|
||||||
SLIST_INSERT_HEAD(&pkgdep_list, pd, pkgdep_entries);
|
SLIST_INSERT_HEAD(&pkgdep_list, pd, pkgdep_entries);
|
||||||
//printf("Added %s into the slist\n", pd->pkg);
|
//printf("Added %s into the slist\n", pd->pkg);
|
||||||
@ -143,13 +139,21 @@ sort_rdeps(void)
|
|||||||
char *pkgname;
|
char *pkgname;
|
||||||
|
|
||||||
xbps_array_get_cstring_nocopy(pd->rdeps, i, &pkgdep);
|
xbps_array_get_cstring_nocopy(pd->rdeps, i, &pkgdep);
|
||||||
pkgname = xbps_pkgpattern_name(pkgdep);
|
if ((pkgname = xbps_pkgpattern_name(pkgdep)) == NULL)
|
||||||
if (pkgname == NULL)
|
|
||||||
pkgname = xbps_pkg_name(pkgdep);
|
pkgname = xbps_pkg_name(pkgdep);
|
||||||
|
|
||||||
if (xbps_match_pkgname_in_array(result, pkgname))
|
assert(pkgname);
|
||||||
|
if (xbps_match_pkgname_in_array(result, pkgname)) {
|
||||||
mdeps++;
|
mdeps++;
|
||||||
|
free(pkgname);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (xbps_dictionary_get(pkgdep_pvmap, pkgname)) {
|
||||||
|
mdeps++;
|
||||||
|
free(pkgname);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//printf("%s: missing dep %s\n", pd->pkg, pkgdep);
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
}
|
}
|
||||||
if (mdeps == rdeps) {
|
if (mdeps == rdeps) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user