aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-06-20 22:41:43 +0000
committermerakor <cem@ckyln.com>2021-06-20 22:41:43 +0000
commitb00a7a92d336d0f119cb69d8fb663cb12542b481 (patch)
tree7cef69445e609bad952608bda66054ae234ec762
parentca1e9e0da2aa0a7ef82da7076a6ba323eafe8287 (diff)
downloadcpt-b00a7a92d336d0f119cb69d8fb663cb12542b481.tar.gz
pkg_conflicts(): Use a faster conflict detection method https://github.com/kiss-community/kiss/pull/35
FossilOrigin-Name: c107a07f6d31d9df0c96e66175e3936d6f90f4ac282250987c6518f680b0dc9c
-rw-r--r--src/cpt-lib.in5
1 files changed, 3 insertions, 2 deletions
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.