kiss: simplify pkg_depends

This commit is contained in:
Dylan Araps 2020-09-14 12:05:11 +03:00
parent f2f27166d3
commit 1e0c80493a
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 3 additions and 15 deletions

18
kiss
View File

@ -172,8 +172,6 @@ pkg_list() {
printf '%s\n' "$_pkg $version" printf '%s\n' "$_pkg $version"
done done
cd "$OLDPWD"
} }
pkg_cache() { pkg_cache() {
@ -360,24 +358,14 @@ pkg_depends() {
# Resolve all dependencies and generate an ordered list. The deepest # Resolve all dependencies and generate an ordered list. The deepest
# dependencies are listed first and then the parents in reverse order. # dependencies are listed first and then the parents in reverse order.
contains "$deps" "$1" || { contains "$deps" "$1" || {
# Filter out non-explicit, aleady installed dependencies. pkg_list "$1" >/dev/null 2>&1 && return 0
case $3-$2 in
*?-) pkg_list "$1" >/dev/null 2>&1 && return 0
esac
pkg_find "$1" pkg_find "$1"
# Recurse through the dependencies of the child packages. # Recurse through the dependencies of the child packages.
[ -f "$repo_dir/depends" ] && { [ -f "$repo_dir/depends" ] && {
while read -r dep _ || [ "$dep" ]; do while read -r dep _ || [ "$dep" ]; do
case $dep in case $dep in
\#*|'') [!\#]*) pkg_depends "$dep" ;;
# Comments and blank lines.
;;
*)
pkg_depends "$dep" '' "$3"
;;
esac esac
done < "$repo_dir/depends" done < "$repo_dir/depends"
} }
@ -572,7 +560,7 @@ pkg_build() {
# Any duplicates are also filtered out. # Any duplicates are also filtered out.
for pkg do for pkg do
contains "$explicit" "$pkg" || { contains "$explicit" "$pkg" || {
pkg_depends "$pkg" explicit filter pkg_depends "$pkg" explicit
explicit="$explicit $pkg " explicit="$explicit $pkg "
} }
done done