kiss: Add back argument ordering for install/remove actions

This commit is contained in:
Dylan Araps 2020-10-03 08:14:39 +03:00
parent ad1e56de0b
commit 8d6c3b5a28
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

34
kiss
View File

@ -401,8 +401,16 @@ pkg_depends() {
while read -r dep _ || [ "$dep" ]; do while read -r dep _ || [ "$dep" ]; do
case $dep in case $dep in
[!#]*) [!#]*)
pkg_list "$dep" >/dev/null 2>&1 || case $2 in
pkg_depends "$dep" filter)
pkg_depends "$dep" "$2"
;;
*)
pkg_list "$dep" >/dev/null 2>&1 ||
pkg_depends "$dep"
;;
esac
;; ;;
esac esac
done < "$repo_dir/depends" done < "$repo_dir/depends"
@ -413,6 +421,20 @@ pkg_depends() {
} }
} }
pkg_order() {
# Sort a list of packages based on dependence.
for _pkg do
pkg_depends "$_pkg" filter
done
for _pkg in $deps; do
contains "$*" "$_pkg" &&
order="$order $_pkg" redro="$_pkg $redro"
done
deps=
}
pkg_strip() { pkg_strip() {
# Strip package binaries and libraries. This saves space on the system as # Strip package binaries and libraries. This saves space on the system as
# well as on the tarballs we ship for installation. # well as on the tarballs we ship for installation.
@ -1425,7 +1447,9 @@ args() {
;; ;;
i|install) i|install)
for pkg do pkg_order "$@"
for pkg in $order; do
pkg_install "$pkg" pkg_install "$pkg"
done done
;; ;;
@ -1443,7 +1467,9 @@ args() {
;; ;;
r|remove) r|remove)
for pkg do pkg_order "$@"
for pkg in $redro; do
pkg_remove "$pkg" pkg_remove "$pkg"
done done
;; ;;