From b00a7a92d336d0f119cb69d8fb663cb12542b481 Mon Sep 17 00:00:00 2001 From: merakor Date: Sun, 20 Jun 2021 22:41:43 +0000 Subject: pkg_conflicts(): Use a faster conflict detection method https://github.com/kiss-community/kiss/pull/35 FossilOrigin-Name: c107a07f6d31d9df0c96e66175e3936d6f90f4ac282250987c6518f680b0dc9c --- src/cpt-lib.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cpt-lib.in b/src/cpt-lib.in index 664daf4..d17954b 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -1338,13 +1338,14 @@ pkg_conflicts() { # 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. + sed '/\/$/d' "$@" | sort "$CPT_TMPDIR/$pid/manifest" - | uniq -d > "$CPT_TMPDIR/$pid/conflict" ||: "$grep" -Fxf "$CPT_TMPDIR/$pid/manifest" -- "$@" > "$CPT_TMPDIR/$pid/conflict" ||: # 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/cpt/installed'. - "$grep" -q ":/var/db/cpt/installed/" "$CPT_TMPDIR/$pid/conflict" || + "$grep" -q "/var/db/cpt/installed/" "$CPT_TMPDIR/$pid/conflict" || choice_auto=1 # Use 'grep' to list matching lines between the to @@ -1373,7 +1374,7 @@ pkg_conflicts() { # this work. # # Pretty nifty huh? - while IFS=: read -r _ con; do + while read -r con; do printf '%s\n' "Found conflict $con" # Create the "choices" directory inside of the tarball. -- cgit v1.2.3