aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-11-08 18:09:31 +0000
committermerakor <cem@ckyln.com>2021-11-08 18:09:31 +0000
commit6475eb9133b8519359fd77d596c5be979082f3c3 (patch)
tree2280d32dda2b11250f4a688b039ff452652b6fd7
parent6a942f462d754c2165150c4f3e31f4bacd0d77ab (diff)
downloadcpt-6475eb9133b8519359fd77d596c5be979082f3c3.tar.gz
pkg_swap(): properly log alternative swap for files that no longer exist.
FossilOrigin-Name: 64599979a94e6e9578c6fe651ad18a8f41e9d1da768c966d16e55922783dc688
-rw-r--r--src/cpt-lib.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 58c9a0f..41b0a14 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1465,6 +1465,13 @@ pkg_swap() {
sed "s#^$(regesc "$2")\$#${PWD#$CPT_ROOT}/$pkg_owns>${alt#*>}#" \
"../installed/$pkg_owns/manifest" |
sort -r -o "../installed/$pkg_owns/manifest"
+ else
+ # If the file doesn't exist, we assume that there was a previous owner,
+ # but the package was then removed. We want the message to be short
+ # and clear, I thought of writing "Swapping [...] from 'null' to '$1'",
+ # but that would probably sound more like a package manager bug. Instead
+ # we are printing the message below which should be informative enough.
+ log "Installing '$2' from '$1'"
fi
# Convert the desired alternative to a real file and rewrite