From c8b0d5e3cf3c751224ba3bc993ee3decf9ae355d Mon Sep 17 00:00:00 2001
From: Levente Polyak <anthraxx@archlinux.org>
Date: Sat, 2 Dec 2023 19:16:51 +0100
Subject: [PATCH] chore(test): replace usage of gnupg with sequoia

---
 test/Dockerfile      | 17 +++++------------
 test/lib/common.bash |  3 +--
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/test/Dockerfile b/test/Dockerfile
index 97e8be4..59005af 100644
--- a/test/Dockerfile
+++ b/test/Dockerfile
@@ -14,7 +14,8 @@ RUN pacman -Syu --noconfirm --needed \
 		binutils \
 		git \
 		parallel \
-		coreutils
+		coreutils \
+		sequoia-sq
 
 RUN pacman-key --init && \
 	echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel && \
@@ -60,18 +61,10 @@ RUN sed 's/libexec/lib/g' -i /usr/lib/bats/* && \
 
 USER tester
 
-RUN echo -e "\
-Key-Type: RSA\n\
-Key-Length: 1024\n\
-Key-Usage: sign\n\
-Name-Real: Bob Tester\n\
-Name-Email: tester@localhost\n\
-Expire-Date: 0\n\
-%no-protection\n\
-%commit\n"\
-| gpg --quiet --batch --no-tty --no-permission-warning --gen-key && \
-	gpg --export | sudo pacman-key -a - && \
+RUN sq key generate --userid "Bob Tester <tester@localhost>" --output /build/private.key && \
+	sq export --keyring /build/private.key | sudo pacman-key -a - && \
 	sudo pacman-key --lsign-key tester@localhost && \
+	gpg --import /build/private.key && \
 	gpgconf --kill gpg-agent && \
 	gpgconf --kill keyboxd && \
 	mkdir -p \
diff --git a/test/lib/common.bash b/test/lib/common.bash
index b42a706..9b7366c 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -131,8 +131,7 @@ __buildPackage() {
 	done
 
 	for p in ${pkgfiles[@]}; do
-		# Manually sign packages as "makepkg --sign" is buggy
-		gpg -v --detach-sign --no-armor --use-agent ${p}
+		sq sign --detached --binary --signer-file /build/private.key --output "${p}.sig" "${p}"
 
 		if [[ -n ${BUILDDIR} ]]; then
 			cp -Lv ${p}{,.sig} ${cache}/
-- 
GitLab