[pacman-dev] [PATCH v2] makepkg: propagate error codes when package failed to sign correctly

Eli Schwartz eschwartz at archlinux.org
Tue Apr 16 17:36:12 UTC 2019


Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---

v2: apply patch on top of master, not another pending patch

 doc/makepkg.8.asciidoc                                | 2 +-
 scripts/libmakepkg/integrity/generate_signature.sh.in | 8 ++++++--
 scripts/makepkg.sh.in                                 | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/doc/makepkg.8.asciidoc b/doc/makepkg.8.asciidoc
index b15e3a67..544659fc 100644
--- a/doc/makepkg.8.asciidoc
+++ b/doc/makepkg.8.asciidoc
@@ -340,7 +340,7 @@ On exit, makepkg will return one of the following error codes.
 	Programs necessary to run makepkg are missing.
 
 16::
-	Specified GPG key does not exist.
+	Specified GPG key does not exist or failed to sign package.
 
 See Also
 --------
diff --git a/scripts/libmakepkg/integrity/generate_signature.sh.in b/scripts/libmakepkg/integrity/generate_signature.sh.in
index e6ff3b1b..b6138824 100644
--- a/scripts/libmakepkg/integrity/generate_signature.sh.in
+++ b/scripts/libmakepkg/integrity/generate_signature.sh.in
@@ -47,6 +47,8 @@ create_signature() {
 }
 
 create_package_signatures() {
+	local ret=0
+
 	if [[ $SIGNPKG != 'y' ]]; then
 		return 0
 	fi
@@ -59,7 +61,7 @@ create_package_signatures() {
 		pkgarch=$(get_pkg_arch $pkg)
 		pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
 
-		create_signature "$pkg_file"
+		create_signature "$pkg_file" || ret=$?
 	done
 
 	# check if debug package needs a signature
@@ -68,7 +70,9 @@ create_package_signatures() {
 		pkgarch=$(get_pkg_arch)
 		pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
 		if [[ -f $pkg_file ]]; then
-			create_signature "$pkg_file"
+			create_signature "$pkg_file" || ret=$?
 		fi
 	fi
+
+	return $ret
 }
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 4f096a36..351f120e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1480,7 +1480,7 @@ else
 
 	enter_fakeroot
 
-	create_package_signatures
+	create_package_signatures || exit $E_PRETTY_BAD_PRIVACY
 fi
 
 # if inhibiting archive creation, go no further
-- 
2.21.0


More information about the pacman-dev mailing list