[PATCH] pactree: Use full dep string when finding dependencies

Johannes Löthberg johannes at kyriasis.com
Wed Jun 20 16:01:38 UTC 2018


Otherwise we don't use the version requirements, leading us to sometimes
get the wrong results for lib32 .so deps.

Fixes FS#59072.

Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
 src/pactree.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/pactree.c b/src/pactree.c
index 45d6e50..4f6faa9 100644
--- a/src/pactree.c
+++ b/src/pactree.c
@@ -411,14 +411,14 @@ static void print_end(void)
 	}
 }
 
-static alpm_list_t *get_pkg_dep_names(alpm_pkg_t *pkg)
+static alpm_list_t *get_pkg_deps(alpm_pkg_t *pkg)
 {
-	alpm_list_t *i, *names = NULL;
+	alpm_list_t *i, *deps = NULL;
 	for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
 		alpm_depend_t *d = i->data;
-		names = alpm_list_add(names, d->name);
+		deps = alpm_list_add(deps, d);
 	}
-	return names;
+	return deps;
 }
 
 /**
@@ -437,11 +437,17 @@ static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, tdepth *depth, int r
 	if(rev) {
 		deps = alpm_pkg_compute_requiredby(pkg);
 	} else {
-		deps = get_pkg_dep_names(pkg);
+		deps = get_pkg_deps(pkg);
 	}
 
 	for(i = deps; i; i = alpm_list_next(i)) {
-		const char *pkgname = i->data;
+		char *pkgname = NULL;
+		if(rev) {
+			pkgname = i->data;
+		} else {
+			alpm_depend_t *dep = i->data;
+			pkgname = alpm_dep_compute_string(dep);
+		}
 		int last = alpm_list_next(i) ? 0 : 1;
 
 		alpm_pkg_t *dep_pkg = alpm_find_dbs_satisfier(handle, dblist, pkgname);
@@ -475,6 +481,10 @@ static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, tdepth *depth, int r
 				depth->next = NULL;
 			}
 		}
+
+		if(!rev) {
+			free(pkgname);
+		}
 	}
 
 	if(rev) {
-- 
2.17.1


More information about the pacman-contrib mailing list