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

30
kiss
View File

@ -401,10 +401,18 @@ pkg_depends() {
while read -r dep _ || [ "$dep" ]; do
case $dep in
[!#]*)
case $2 in
filter)
pkg_depends "$dep" "$2"
;;
*)
pkg_list "$dep" >/dev/null 2>&1 ||
pkg_depends "$dep"
;;
esac
;;
esac
done < "$repo_dir/depends"
# After child dependencies are added to the list,
@ -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() {
# Strip package binaries and libraries. This saves space on the system as
# well as on the tarballs we ship for installation.
@ -1425,7 +1447,9 @@ args() {
;;
i|install)
for pkg do
pkg_order "$@"
for pkg in $order; do
pkg_install "$pkg"
done
;;
@ -1443,7 +1467,9 @@ args() {
;;
r|remove)
for pkg do
pkg_order "$@"
for pkg in $redro; do
pkg_remove "$pkg"
done
;;