cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 795c8e0f3c74dc1c2e368b61766563a2d97a6562
parent eaac35f98c1dfeb9958fc56c759f375f64e3ab11
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Sun, 21 Jul 2019 17:27:48 +0300

kiss: Filter arguments for install/remove

Diffstat:
Mkiss | 33+++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/kiss b/kiss @@ -866,6 +866,18 @@ args() { shift [ "$1" ] || die "'kiss install' requires an argument." root_check + + # Create a list of each package's dependencies. + for pkg; do pkg_depends "$pkg"; done + + # Filter the list, only including explicit packages. + for pkg in $missing_deps; do + case " $* " in + *" $pkg "*) install_pkgs="$install_pkgs $pkg " ;; + esac + done + + set -- $install_pkgs pkg_install "$@" ;; @@ -875,7 +887,24 @@ args() { [ "$1" ] || die "'kiss remove' requires an argument." root_check log "Removing packages..." - for pkg; do pkg_remove "$pkg" check; done + + # Create a list of each package's dependencies. + for pkg; do pkg_depends "$pkg"; done + + # Reverse the list of dependencies filtering out anything + # not explicitly set for removal. + for pkg in $missing_deps; do + case " $* " in + *" $pkg "*) remove_pkgs="$pkg $remove_pkgs" ;; + esac + done + + for pkg in $remove_pkgs; do + pkg_list "$pkg" >/dev/null || + die "[$pkg]: Not installed." + + pkg_remove "$pkg" check + done ;; # List installed packages. @@ -898,7 +927,7 @@ args() { # Print version and exit. v*) - log "kiss 0.5.2" + log "kiss 0.5.3" ;; # Catch all invalid arguments as well as