From 57256c23282652451f89c1ab2c370dd1ef97f26c Mon Sep 17 00:00:00 2001 From: Duncaen Date: Sun, 30 Jun 2019 22:00:58 +0200 Subject: [PATCH] lib/package_fulldeptree.c: add items to result if they are found in the hashtable --- lib/package_fulldeptree.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/package_fulldeptree.c b/lib/package_fulldeptree.c index 07be8e93..a7f608ff 100644 --- a/lib/package_fulldeptree.c +++ b/lib/package_fulldeptree.c @@ -113,6 +113,24 @@ addDepn(struct item *item, struct item *xitem) xitem->dbase = depn; } +static void +add_deps_recursive(struct item *item) +{ + struct depn *dep; + xbps_string_t str; + + if (xbps_match_string_in_array(result, item->pkgver)) + return; + + for (dep = item->dbase; dep; dep = dep->dnext) + add_deps_recursive(dep->item); + + str = xbps_string_create_cstring(item->pkgver); + assert(str); + xbps_array_add_first(result, str); + xbps_object_release(str); +} + /* * Recursively calculate all dependencies. */ @@ -173,9 +191,11 @@ ordered_depends(struct xbps_handle *xhp, xbps_dictionary_t pkgd, bool rpool) continue; } xitem = lookupItem(curdepname); - if (xitem == NULL) - xitem = ordered_depends(xhp, curpkgd, rpool); - + if (xitem) { + add_deps_recursive(xitem); + continue; + } + xitem = ordered_depends(xhp, curpkgd, rpool); if (xitem == NULL) { /* package depends on missing dependencies */ xbps_dbg_printf(xhp, "%s: missing dependency '%s'\n", pkgver, curdep);