From 7e6b38f951a47d795eb6a59dede69600b3a8bf57 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 20 Nov 2014 19:49:57 +0100 Subject: [PATCH] xbps-dgraph: take into account virtual pkgs in fulldepgrah mode (-f). --- bin/xbps-dgraph/main.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/bin/xbps-dgraph/main.c b/bin/xbps-dgraph/main.c index 59860a0c..1da67fa7 100644 --- a/bin/xbps-dgraph/main.c +++ b/bin/xbps-dgraph/main.c @@ -84,6 +84,7 @@ struct pkgdep { SLIST_ENTRY(pkgdep) pkgdep_entries; unsigned int idx; const char *pkgver; + xbps_array_t provides; }; static xbps_dictionary_t confd; @@ -352,19 +353,20 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f, } pkgidx++; } - if (!found) { - pd = malloc(sizeof(*pd)); - assert(pd); - pd->idx = pkgidx; - pd->pkgver = pkgdep; - SLIST_INSERT_HEAD(&pkgdep_list, pd, pkgdep_entries); - } if (repomode) { rpkgd = xbps_rpool_get_pkg(xhp, pkgdep); } else { rpkgd = xbps_pkgdb_get_pkg(xhp, pkgdep); } assert(rpkgd); + if (!found) { + pd = malloc(sizeof(*pd)); + assert(pd); + pd->idx = pkgidx; + pd->pkgver = pkgdep; + pd->provides = xbps_dictionary_get(rpkgd, "provides"); + SLIST_INSERT_HEAD(&pkgdep_list, pd, pkgdep_entries); + } rpkgrdeps = xbps_dictionary_get(rpkgd, "run_depends"); for (x = 0; x < xbps_array_count(rpkgrdeps); x++) { struct pkgdep *ppd; @@ -374,6 +376,9 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f, SLIST_FOREACH(ppd, &pkgdep_list, pkgdep_entries) { if (xbps_pkgpattern_match(ppd->pkgver, rpkgdep)) fprintf(f, "\t%u -> %u;\n", pkgidx, ppd->idx); + else if (ppd->provides && + xbps_match_virtual_pkg_in_array(ppd->provides, rpkgdep)) + fprintf(f, "\t%u -> %u;\n", pkgidx, ppd->idx); } } fprintf(f, "\t%u [label=\"%s\"", pkgidx, pkgdep); @@ -395,6 +400,9 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f, SLIST_FOREACH(pd, &pkgdep_list, pkgdep_entries) { if (xbps_pkgpattern_match(pd->pkgver, rpkgdep)) fprintf(f, "\t%u -> %u;\n", i, pd->idx); + else if (pd->provides && + xbps_match_virtual_pkg_in_array(pd->provides, rpkgdep)) + fprintf(f, "\t%u -> %u;\n", i, pd->idx); } } }