From 97e284cfc294541a68f6f5aa89bf79c07c69bbd1 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 15 Sep 2019 06:15:32 +0000 Subject: kiss: even smarter dependency handling FossilOrigin-Name: 7be6b22e30611d3646b7e3d824d8b06c04219c472c4e51e6423efeb783fd6789 --- kiss | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'kiss') diff --git a/kiss b/kiss index 3d8226d..53691e9 100755 --- a/kiss +++ b/kiss @@ -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" -- cgit v1.2.3 From 0fb4795bd5b3f8ac754d6b39b5717e673304810e Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 15 Sep 2019 06:16:38 +0000 Subject: kiss: even smarter dependency handling FossilOrigin-Name: e80db81cc74c852bd63ff09ee9d8ea941fdd9fe52024f8022ad64fc8809370b8 --- kiss | 9 --------- 1 file changed, 9 deletions(-) (limited to 'kiss') diff --git a/kiss b/kiss index 53691e9..3a7dd3f 100755 --- a/kiss +++ b/kiss @@ -907,15 +907,6 @@ args() { r|remove) log "Removing packages" - # Create a list of each package's dependencies. - # 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; do pkg_list "$pkg" >/dev/null || die "[$pkg] Not installed" -- cgit v1.2.3 From 647b759c67d2a352fdc57160d595d7f7c84f2d06 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 15 Sep 2019 06:31:56 +0000 Subject: kiss: add back argument ordering FossilOrigin-Name: a64049effaad22c18d160e37793688f73ddc1057022f36214c617ddea5d6c6ea --- kiss | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'kiss') diff --git a/kiss b/kiss index 3a7dd3f..ec7f366 100755 --- a/kiss +++ b/kiss @@ -172,7 +172,7 @@ 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") @@ -190,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 " } } @@ -901,13 +901,35 @@ args() { ;; i|install) - for pkg; do pkg_install "$pkg"; done + # Create a list of each package's dependencies. + for pkg; do + case $pkg in + *.tar.gz) deps="$deps $pkg " ;; + *) pkg_depends "$pkg" install + 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 ;; r|remove) log "Removing packages" - for pkg; do + # Create a list of each package's dependencies. + for pkg; do pkg_depends "$pkg" remove; 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 $remove_pkgs; do pkg_list "$pkg" >/dev/null || die "[$pkg] Not installed" -- cgit v1.2.3 From 9deed25d2efe6b698c976329690bde72f5fd8dff Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 15 Sep 2019 06:39:39 +0000 Subject: kiss: fix comment FossilOrigin-Name: cbd0748064045c744f879e2797d15eeadbd9419dc0b52ec6f019e257d19afb09 --- kiss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kiss') diff --git a/kiss b/kiss index ec7f366..ab66e23 100755 --- a/kiss +++ b/kiss @@ -179,7 +179,7 @@ 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. + # Filter out non-explicit, aleady installed dependencies. [ -z "$2" ] && (pkg_list "$1" >/dev/null) && return # Recurse through the dependencies of the child -- cgit v1.2.3