[devscripts] 07/07: who-uploads: Workaround gpg error with no ~/.gnupg

James McCoy jamessan at debian.org
Mon Feb 16 04:09:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit 356fc5401221e7ccab161d15c1ed36e7e3060537
Author: James McCoy <jamessan at debian.org>
Date:   Sun Feb 15 23:05:24 2015 -0500

    who-uploads: Workaround gpg error with no ~/.gnupg
    
    Without ~/.gnupg, “gpg --list-key” will error out which means the
    uploader information isn't displayed even if it is available in
    /usr/share/keyrings/.  Creating a temporary directory to use as
    $GNUPGHOME makes gpg work as expected.
    
    Closes: #776209
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog       | 2 ++
 scripts/who-uploads.sh | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 790d3ad..5f16fd4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ devscripts (2.15.1+exp1) UNRELEASED; urgency=medium
     a file is matched by multiple patterns.  (Closes: #776318)
   * who-uploads:
     + Fix extraction of uploader's key id.
+    * Create a temporary GNUPGHOME to avoid “gpg --list-key” erroring when no
+      ~/.gnupg exists.  (Closes: #776209)
 
   [ Johannes Schauer ]
   * chdist: Also set Apt::Architectures to prevent foreign architectures from
diff --git a/scripts/who-uploads.sh b/scripts/who-uploads.sh
index e851f29..b213ee5 100755
--- a/scripts/who-uploads.sh
+++ b/scripts/who-uploads.sh
@@ -186,9 +186,13 @@ done
 
 IFS="${OIFS:- 	}"
 
+GNUPGHOME=$(mktemp -d)
+trap 'rm -r "$GNUPGHOME"' HUP INT QUIT PIPE ALRM TERM
+export GNUPGHOME
+
 # Some useful abbreviations for gpg options
-GPG_NO_KEYRING="--no-options --no-auto-check-trustdb --no-default-keyring --keyring /dev/null"
 GPG_OPTIONS="--no-options --no-auto-check-trustdb --no-default-keyring"
+GPG_NO_KEYRING="$GPG_OPTIONS --keyring /dev/null"
 
 if [ $# -eq 0 ]; then
     usage;
@@ -241,4 +245,5 @@ for package; do
     test $# -eq 1 || echo
 done
 
+rm -r "$GNUPGHOME"
 exit 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list