diff options
author | merakor <cem@ckyln.com> | 2020-05-07 19:57:01 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-05-07 19:57:01 +0000 |
commit | 361019b749d59b1a8a637faba10d92ad70119084 (patch) | |
tree | c8b86fc11826070a2a24cc41f9cc0e8487d6ba6b | |
parent | 2d12d2ffb26d61d7ef10cf2b09da3012a4ef56ae (diff) | |
download | cpt-361019b749d59b1a8a637faba10d92ad70119084.tar.gz |
kiss: Faster conflict resolution.
FossilOrigin-Name: e9bc2c979beec4dd9e024989a834b1fe4f6de268a62762cf9c20f5890c824c23
-rwxr-xr-x | kiss | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -828,17 +828,21 @@ pkg_conflicts() { # with the installation. [ "$1" ] && [ -f "$1" ] || return 0 + # Store the list of found conflicts in a file as we will be using the + # information multiple times. Storing it in the cache dir allows us + # to be lazy as they'll be automatically removed on script end. + "$grep" -Fxf "$cac_dir/$pid-m" -- "$@" > "$cac_dir/$pid-c" ||: + + # Enable alternatives automatically if it is safe to do so. # This checks to see that the package that is about to be installed # doesn't overwrite anything it shouldn't in '/var/db/kiss/installed'. - "$grep" -Fxf "$cac_dir/$pid-m" -- "$@" | - "$grep" -q ":/var/db/kiss/installed/" || choice_auto=1 + "$grep" -q ":/var/db/kiss/installed/" "$cac_dir/$pid-c" || choice_auto=1 # Use 'grep' to list matching lines between the to # be installed package's manifest and the above filtered # list. if [ "$KISS_CHOICE" != 0 ] && [ "$choice_auto" = 1 ]; then - "$grep" -Fxf "$cac_dir/$pid-m" -- "$@" | # This is a novel way of offering an "alternatives" system. # It is entirely dynamic and all "choices" are created and @@ -883,13 +887,13 @@ pkg_conflicts() { log "this must be fixed in $p_name. Contact the maintainer" die "by checking 'git log' or by running 'kiss-maintainer'" } - done + done < "$cac_dir/$pid-c" # Rewrite the package's manifest to update its location # to its new spot (and name) in the choices directory. pkg_manifest "$p_name" "$tar_dir" 2>/dev/null - elif "$grep" -Fxf "$cac_dir/$pid-m" -- "$@"; then + elif [ -s "$cac_dir/$pid-c" ]; then log "Package '$p_name' conflicts with another package" "" "!>" log "Run 'KISS_CHOICE=1 kiss i $p_name' to add conflicts" "" "!>" die "as alternatives." |