diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-09-15 06:31:56 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-09-15 06:31:56 +0000 |
commit | 647b759c67d2a352fdc57160d595d7f7c84f2d06 (patch) | |
tree | ef2c26d11786683a211aebe3f223552ceaadc780 | |
parent | 0fb4795bd5b3f8ac754d6b39b5717e673304810e (diff) | |
download | cpt-647b759c67d2a352fdc57160d595d7f7c84f2d06.tar.gz |
kiss: add back argument ordering
FossilOrigin-Name: a64049effaad22c18d160e37793688f73ddc1057022f36214c617ddea5d6c6ea
-rwxr-xr-x | kiss | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -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" |