aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-03-26 13:55:06 +0000
committermerakor <cem@ckyln.com>2021-03-26 13:55:06 +0000
commit481f73fb6e6ee3fccef88f8a27f13f3b390dc476 (patch)
tree9e72027fc05792036b04e889ece36e3722e840e3 /src
parente14c9753fd878fef8e7caa670cb2feae139ba417 (diff)
downloadcpt-481f73fb6e6ee3fccef88f8a27f13f3b390dc476.tar.gz
pkg_gentree(): pop package name from the list
FossilOrigin-Name: 75d3b93e2d6d4a8e7a5b0d5e36a68289c7923ecff4140784363a3e78a068ec02
Diffstat (limited to 'src')
-rw-r--r--src/cpt-lib.in13
1 files changed, 12 insertions, 1 deletions
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