xbps-dgraph: take into account virtual pkgs in fulldepgrah mode (-f).

This commit is contained in:
Juan RP 2014-11-20 19:49:57 +01:00
parent edb613f1d5
commit 7e6b38f951

View File

@ -84,6 +84,7 @@ struct pkgdep {
SLIST_ENTRY(pkgdep) pkgdep_entries; SLIST_ENTRY(pkgdep) pkgdep_entries;
unsigned int idx; unsigned int idx;
const char *pkgver; const char *pkgver;
xbps_array_t provides;
}; };
static xbps_dictionary_t confd; static xbps_dictionary_t confd;
@ -352,19 +353,20 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f,
} }
pkgidx++; 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) { if (repomode) {
rpkgd = xbps_rpool_get_pkg(xhp, pkgdep); rpkgd = xbps_rpool_get_pkg(xhp, pkgdep);
} else { } else {
rpkgd = xbps_pkgdb_get_pkg(xhp, pkgdep); rpkgd = xbps_pkgdb_get_pkg(xhp, pkgdep);
} }
assert(rpkgd); 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"); rpkgrdeps = xbps_dictionary_get(rpkgd, "run_depends");
for (x = 0; x < xbps_array_count(rpkgrdeps); x++) { for (x = 0; x < xbps_array_count(rpkgrdeps); x++) {
struct pkgdep *ppd; struct pkgdep *ppd;
@ -374,6 +376,9 @@ process_fulldeptree(struct xbps_handle *xhp, FILE *f,
SLIST_FOREACH(ppd, &pkgdep_list, pkgdep_entries) { SLIST_FOREACH(ppd, &pkgdep_list, pkgdep_entries) {
if (xbps_pkgpattern_match(ppd->pkgver, rpkgdep)) if (xbps_pkgpattern_match(ppd->pkgver, rpkgdep))
fprintf(f, "\t%u -> %u;\n", pkgidx, ppd->idx); 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); 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) { SLIST_FOREACH(pd, &pkgdep_list, pkgdep_entries) {
if (xbps_pkgpattern_match(pd->pkgver, rpkgdep)) if (xbps_pkgpattern_match(pd->pkgver, rpkgdep))
fprintf(f, "\t%u -> %u;\n", i, pd->idx); 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);
} }
} }
} }