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

Eli Schwartz eschwartz at archlinux.org
Thu Jan 10 05:58:43 UTC 2019


Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---
 doc/makepkg.8.asciidoc                                | 2 +-
 scripts/libmakepkg/integrity/generate_signature.sh.in | 6 +++++-
 scripts/makepkg.sh.in                                 | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/makepkg.8.asciidoc b/doc/makepkg.8.asciidoc
index ec35ab04..dcd597c8 100644
--- a/doc/makepkg.8.asciidoc
+++ b/doc/makepkg.8.asciidoc
@@ -343,7 +343,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 1567ee89..786ca081 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
@@ -55,7 +57,9 @@ create_package_signatures() {
 
 	print_all_package_names | while read -r pkg_file; do
 		if [[ -f $pkg_file ]]; then
-			create_signature "$pkg_file"
+			create_signature "$pkg_file" || ret=$?
 		fi
 	done
+
+    return $ret
 }
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 66729584..fcc76e7f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1493,7 +1493,7 @@ else
 
 	enter_fakeroot
 
-	create_package_signatures
+	create_package_signatures || exit $E_PRETTY_BAD_PRIVACY
 fi
 
 # if inhibiting archive creation, go no further
-- 
2.20.1


More information about the pacman-dev mailing list