From 481f73fb6e6ee3fccef88f8a27f13f3b390dc476 Mon Sep 17 00:00:00 2001 From: merakor Date: Fri, 26 Mar 2021 13:55:06 +0000 Subject: pkg_gentree(): pop package name from the list FossilOrigin-Name: 75d3b93e2d6d4a8e7a5b0d5e36a68289c7923ecff4140784363a3e78a068ec02 --- src/cpt-lib.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cpt-lib.in b/src/cpt-lib.in index c6d3866..30b1f2b 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -1893,7 +1893,7 @@ pkg_gentree() ( deps='' reverse='' format='%s\n' make_deps=first for op in $(sepchar "$2"); do case "$op" in - b) deps="$(pkg_get_base nonl)" ;; + b) deps=$(pkg_get_base nonl) ;; f) make_deps='' ;; x) make_deps=first-nomake ;; r) reverse=1 ;; @@ -1902,6 +1902,17 @@ pkg_gentree() ( esac done pkg_depends "$1" tree "$make_deps" + + # Unless 'f' is given, pop the package from the list so that we don't list + # the package (for example if it's part of the base package list). Normally + # this should happen only when 'b' is used, so getting the package when no + # keys are supplied points to a circular dependency, which isn't supported + # by the package manager. + # + # Word splitting is intentional. + # shellcheck disable=2086 + [ -z "${2##*f*}" ] || deps=$(pop "$1" from $deps) + eval set -- "$deps" pkg_order "$@" if [ "$reverse" ]; then eval set -- "$redro"; else eval set -- "$order"; fi -- cgit v1.2.3