diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-09-15 06:15:32 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-09-15 06:15:32 +0000 |
commit | 97e284cfc294541a68f6f5aa89bf79c07c69bbd1 (patch) | |
tree | 137dc8451bd6d9794292baf55d446619f4985c16 /kiss | |
parent | d10e723548b88c91c133ac81a9ecfd5594f35510 (diff) | |
download | cpt-97e284cfc294541a68f6f5aa89bf79c07c69bbd1.tar.gz |
kiss: even smarter dependency handling
FossilOrigin-Name: 7be6b22e30611d3646b7e3d824d8b06c04219c472c4e51e6423efeb783fd6789
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 40 |
1 files changed, 10 insertions, 30 deletions
@@ -179,6 +179,9 @@ pkg_depends() { # 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 and 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 @@ -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: $*" @@ -908,35 +901,22 @@ args() { ;; i|install) - # Create a list of each package's dependencies. - for pkg; do - case $pkg in - *.tar.gz) deps="$deps $pkg " ;; - *) pkg_depends "$pkg" - esac - done - - # Filter the list, only installing explicit packages. - # The purpose of these two loops is to order the - # argument list based on dependence. - for pkg in $deps; do - contains "$*" "$pkg" && pkg_install "$pkg" - done + for pkg; do pkg_install "$pkg"; done ;; r|remove) log "Removing packages" # Create a list of each package's dependencies. - for pkg; do pkg_depends "$pkg"; done + # for pkg; do pkg_depends "$pkg"; done # Reverse the list of dependencies filtering out anything # not explicitly set for removal. - for pkg in $deps; do - contains "$*" "$pkg" && remove_pkgs="$pkg $remove_pkgs" - done + # for pkg in $deps; do + # contains "$*" "$pkg" && remove_pkgs="$pkg $remove_pkgs" + # done - for pkg in $remove_pkgs; do + for pkg; do pkg_list "$pkg" >/dev/null || die "[$pkg] Not installed" |