From 20f3f66ec8207da6eba70d749495a1f8a172cae6 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Fri, 13 Sep 2019 18:25:33 +0000 Subject: kiss: handle dependencies 'smarter' FossilOrigin-Name: 8fbe60ea5fd04526e7fe405b9fcf1731a51396e33510ef4b0e631aea4435bdc1 --- kiss | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/kiss b/kiss index 0142d9b..abb553c 100755 --- a/kiss +++ b/kiss @@ -187,7 +187,7 @@ pkg_depends() { # After child dependencies are added to the list, # add the package which depends on them. - deps="$deps $1 " + [ "$2" ] || deps="$deps $1 " ;; esac } @@ -341,23 +341,30 @@ pkg_build() { # also checks checksums, downloads sources and ensure all dependencies # are installed. - log "Resolving dependencies" - for pkg; do pkg_depends "$pkg"; done - # Store the explicit packages so we can handle them differently # below. Dependencies are automatically installed but packages # passed to KISS aren't. explicit=" $* " + explicit_build=" $* " + + log "Resolving dependencies" + for pkg; do pkg_depends "$pkg" explicit; done + + for pkg; do + case $deps in + *" $pkg "*) explicit=$(echo "$explicit" | sed "s/ $pkg / /g") + esac + done # Set the resolved dependency list as the function's arguments. - set -- $deps + set -- $deps $explicit # The dependency solver always lists all dependencies regardless of # whether or not they are installed. Ensure that all explicit packages # are included and ensure that all installed packages are excluded. for pkg; do - case $explicit in - *" $pkg "*) ;; + case $explicit_build in + *" $pkg "*|-) ;; *) pkg_list "$pkg" >/dev/null && continue ;; esac @@ -387,7 +394,7 @@ pkg_build() { for pkg; do # Don't check for a pre-built package if it was passed to KISS # directly. - case $explicit in + case $explicit_build in *" $pkg "*) shift set -- "$@" "$pkg" -- cgit v1.2.3