From 6475eb9133b8519359fd77d596c5be979082f3c3 Mon Sep 17 00:00:00 2001 From: merakor Date: Mon, 8 Nov 2021 18:09:31 +0000 Subject: pkg_swap(): properly log alternative swap for files that no longer exist. FossilOrigin-Name: 64599979a94e6e9578c6fe651ad18a8f41e9d1da768c966d16e55922783dc688 --- src/cpt-lib.in | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.3