void-packages/srcpkgs/xbps/patches/0004-xbps-query-fix-fulldep...

86 lines
2.6 KiB
Diff

commit 15943d990caf40a77c255ee5bc7e7935ebf0673d
Author: Juan RP <xtraeme@gmail.com>
Date: Wed Oct 29 09:46:54 2014 +0100
xbps-query: fix --fulldeptree with multiple pkgs using vpkgs and non vpkgs.
--- bin/xbps-query/show-deps.c 2014-09-29 15:54:15.000000000 +0200
+++ bin/xbps-query/show-deps.c 2014-10-29 09:56:03.142653297 +0100
@@ -43,6 +43,8 @@ struct pkgdep {
static SLIST_HEAD(pkgdep_head, pkgdep) pkgdep_list =
SLIST_HEAD_INITIALIZER(pkgdep_list);
+static xbps_dictionary_t pkgdep_pvmap;
+
static void
print_rdeps(struct xbps_handle *xhp, xbps_array_t rdeps, bool full, bool repo)
{
@@ -53,7 +55,6 @@ print_rdeps(struct xbps_handle *xhp, xbp
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
struct pkgdep *pd;
const char *pkgver;
- char *vpkg;
bool virtual = false, found = false;
xbps_array_get_cstring_nocopy(rdeps, i, &curdep);
@@ -83,16 +84,15 @@ print_rdeps(struct xbps_handle *xhp, xbp
p = xbps_pkg_name(curdep);
assert(p);
- vpkg = xbps_xasprintf("%s-%s", p, xbps_pkg_version(pkgver));
- assert(vpkg);
+ if (pkgdep_pvmap == NULL)
+ pkgdep_pvmap = xbps_dictionary_create();
+
+ xbps_dictionary_set_cstring_nocopy(pkgdep_pvmap, p, pkgver);
free(p);
}
/* uniquify dependencies, sorting will be done later */
SLIST_FOREACH(pd, &pkgdep_list, pkgdep_entries) {
- if (virtual && strcmp(pd->pkg, vpkg) == 0) {
- found = true;
- break;
- } else if (strcmp(pd->pkg, pkgver) == 0) {
+ if (strcmp(pd->pkg, pkgver) == 0) {
found = true;
break;
}
@@ -100,11 +100,7 @@ print_rdeps(struct xbps_handle *xhp, xbp
if (!found) {
pd = malloc(sizeof(*pd));
assert(pd);
- if (virtual)
- pd->pkg = vpkg;
- else
pd->pkg = pkgver;
-
pd->rdeps = xbps_array_copy(currdeps);
SLIST_INSERT_HEAD(&pkgdep_list, pd, pkgdep_entries);
//printf("Added %s into the slist\n", pd->pkg);
@@ -143,13 +139,21 @@ sort_rdeps(void)
char *pkgname;
xbps_array_get_cstring_nocopy(pd->rdeps, i, &pkgdep);
- pkgname = xbps_pkgpattern_name(pkgdep);
- if (pkgname == NULL)
+ if ((pkgname = xbps_pkgpattern_name(pkgdep)) == NULL)
pkgname = xbps_pkg_name(pkgdep);
- if (xbps_match_pkgname_in_array(result, pkgname))
+ assert(pkgname);
+ if (xbps_match_pkgname_in_array(result, pkgname)) {
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);
}
if (mdeps == rdeps) {