diff options
-rwxr-xr-x | kiss | 23 |
1 files changed, 8 insertions, 15 deletions
@@ -172,13 +172,16 @@ pkg_extract() { } pkg_depends() { - # Resolve all dependencies and install them in the right order. + # Resolve all dependencies and generate an ordered list. repo_dir=$(pkg_find "$1") # This does a depth-first search. The deepest dependencies are # listed first and then the parents in reverse order. contains "$deps" "$1" || { + # Filter out non-explicit, aleady installed dependencies. + [ -z "$2" ] && (pkg_list "$1" >/dev/null) && return + # Recurse through the dependencies of the child # packages. Keep doing this. while read -r dep _; do @@ -187,7 +190,7 @@ pkg_depends() { # After child dependencies are added to the list, # add the package which depends on them. - [ "$2" ] || deps="$deps $1 " + [ "$2" = explicit ] || deps="$deps $1 " } } @@ -364,17 +367,7 @@ pkg_build() { explicit=$(echo "$explicit" | sed "s/ $pkg / /g") done - # The dependency solver always lists all dependencies regardless of - # whether or not they are installed. Filter out installed dependencies. - for pkg in $deps $explicit; do - contains "$explicit_build" "$pkg" || { - pkg_list "$pkg" >/dev/null && continue - } - - build="$build$pkg " - done - - set -- $build + set -- $deps $explicit log "Building: $*" @@ -912,7 +905,7 @@ args() { for pkg; do case $pkg in *.tar.gz) deps="$deps $pkg " ;; - *) pkg_depends "$pkg" + *) pkg_depends "$pkg" install esac done @@ -928,7 +921,7 @@ args() { log "Removing packages" # Create a list of each package's dependencies. - for pkg; do pkg_depends "$pkg"; done + for pkg; do pkg_depends "$pkg" remove; done # Reverse the list of dependencies filtering out anything # not explicitly set for removal. |