From 647b759c67d2a352fdc57160d595d7f7c84f2d06 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 15 Sep 2019 06:31:56 +0000 Subject: kiss: add back argument ordering FossilOrigin-Name: a64049effaad22c18d160e37793688f73ddc1057022f36214c617ddea5d6c6ea --- kiss | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'kiss') diff --git a/kiss b/kiss index 3a7dd3f..ec7f366 100755 --- a/kiss +++ b/kiss @@ -172,7 +172,7 @@ pkg_extract() { } pkg_depends() { - # Resolve all dependencies and install them in the right order. + # Resolve all dependencies and generate an ordered list. repo_dir=$(pkg_find "$1") @@ -190,7 +190,7 @@ pkg_depends() { # After child dependencies are added to the list, # add the package which depends on them. - [ "$2" ] || deps="$deps $1 " + [ "$2" = explicit ] || deps="$deps $1 " } } @@ -901,13 +901,35 @@ args() { ;; i|install) - for pkg; do pkg_install "$pkg"; done + # Create a list of each package's dependencies. + for pkg; do + case $pkg in + *.tar.gz) deps="$deps $pkg " ;; + *) pkg_depends "$pkg" install + esac + done + + # Filter the list, only installing explicit packages. + # The purpose of these two loops is to order the + # argument list based on dependence. + for pkg in $deps; do + contains "$*" "$pkg" && pkg_install "$pkg" + done ;; r|remove) log "Removing packages" - for pkg; do + # Create a list of each package's dependencies. + for pkg; do pkg_depends "$pkg" remove; done + + # Reverse the list of dependencies filtering out anything + # not explicitly set for removal. + for pkg in $deps; do + contains "$*" "$pkg" && remove_pkgs="$pkg $remove_pkgs" + done + + for pkg in $remove_pkgs; do pkg_list "$pkg" >/dev/null || die "[$pkg] Not installed" -- cgit v1.2.3