From 56b134697a7d8fdc5e146dc9e544bdd7a8713ba5 Mon Sep 17 00:00:00 2001
From: merakor <cem@ckyln.com>
Date: Sun, 12 Dec 2021 21:57:57 +0000
Subject: cpt-install: print messages properly when target is a tarball

FossilOrigin-Name: da9d390eec590a0894658cf8dcfb82f9bc8b9bbd6ec2ba92d98ac4a0a81f00e0
---
 src/cpt-install | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'src')

diff --git a/src/cpt-install b/src/cpt-install
index b64d5a0..af8b7ff 100755
--- a/src/cpt-install
+++ b/src/cpt-install
@@ -28,6 +28,9 @@ log "Retrieving post-installation message queue"
 unset msg
 
 for pkg in $order; do
+    # Ensure that we use package names itself, and not the tarball name if given.
+    pkg=${pkg##*/} pkg=${pkg%#*}
+
     [ -f "$sys_db/$pkg/message" ] && {
         printf '\033[1m%s\n%s\n%s\033[m\n\n' \
                "$(_multiply_char '=' 60)" \
-- 
cgit v1.2.3


From 51a0ff5d04184a12a216a7d0b3bf05fab63890d0 Mon Sep 17 00:00:00 2001
From: merakor <cem@ckyln.com>
Date: Sun, 12 Dec 2021 21:58:53 +0000
Subject: cpt-install: print messages entirely on stderr

FossilOrigin-Name: 8c725549dac8deea7ef654abdf8b0caf4ed204eb8fd7baa343cdf383ef208a2f
---
 src/cpt-install | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/cpt-install b/src/cpt-install
index af8b7ff..78da9a8 100755
--- a/src/cpt-install
+++ b/src/cpt-install
@@ -36,8 +36,8 @@ for pkg in $order; do
                "$(_multiply_char '=' 60)" \
                "$pkg" \
                "$(_multiply_char '=' 60)"
-        cat "$sys_db/$pkg/message" >&2
+        cat "$sys_db/$pkg/message"
         msg=1
     }
-done
+done >&2
 [ "$msg" ] || log "No message in queue"
-- 
cgit v1.2.3


From 7dc51aeec441ed5392ce56ff415ebc59f0fe3ea5 Mon Sep 17 00:00:00 2001
From: merakor <cem@ckyln.com>
Date: Mon, 31 Jan 2022 17:06:58 +0000
Subject: pkg_tar(): read package version from the built package directory

instead of using pkg_find()


FossilOrigin-Name: 66363caaceb1691769982a134b3188efd538e08b2f6693c973b412fcb91fa4c5
---
 src/cpt-lib.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 96471c0..57c8e05 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1063,7 +1063,7 @@ pkg_tar() {
     log "$1" "Creating tarball"
 
     # Read the version information to name the package.
-    read -r version release < "$(pkg_find "$1")/version"
+    read -r version release < "$pkg_dir/$1/$pkg_db/$1/version"
 
     # Create a tarball from the contents of the built package.
     cd "$pkg_dir/$1"
-- 
cgit v1.2.3


From 4e92df1b2e1c18898a3438ff0b188bdfaba3664a Mon Sep 17 00:00:00 2001
From: merakor <cem@ckyln.com>
Date: Wed, 2 Feb 2022 09:41:23 +0000
Subject: pkg_verify(): fix checksum verification bug where extra sources could

get away with not being verified.


FossilOrigin-Name: 5cfeb17ba29e7948c744db229bca0284eebb3add0098ddda3eb072459cea5f2f
---
 src/cpt-lib.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 57c8e05..7659e39 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1294,7 +1294,7 @@ pkg_checksums() {
 pkg_verify() {
     # Verify all package checksums. This is achieved by generating a new set of
     # checksums and then comparing those with the old set.
-    vcmd="NR==FNR{a[\$1];next}/^git  .*/{next}!((\$1)in a){exit 1}"
+    vcmd="NR==FNR{a[\$1];next}/^git .*/{next}!((\$1)in a){exit 1}END{if(NR/2!=FNR)exit 1}"
 
     for pkg; do
         repo_dir=$(pkg_find "$pkg")
-- 
cgit v1.2.3