[devscripts] 07/07: enable both gpg and gpg2

Osamu Aoki osamu at moszumanska.debian.org
Thu Oct 1 14:13:06 UTC 2015


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

osamu pushed a commit to branch multitar
in repository devscripts.

commit 9fbeb8fc451660454f7961262caf72e1d95ae70c
Author: Osamu Aoki <osamu at debian.org>
Date:   Thu Oct 1 23:00:44 2015 +0900

    enable both gpg and gpg2
    
    This is continuation of fixing: #788414
---
 scripts/debsign.1             |  1 +
 scripts/debsign.sh            |  2 ++
 scripts/dscverify.1           |  1 +
 scripts/dscverify.pl          |  3 ++-
 scripts/who-permits-upload.pl |  4 ++--
 scripts/who-uploads.1         |  2 +-
 scripts/who-uploads.sh        | 14 ++++++++++++--
 7 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/scripts/debsign.1 b/scripts/debsign.1
index c6d1c50..58ae301 100644
--- a/scripts/debsign.1
+++ b/scripts/debsign.1
@@ -137,6 +137,7 @@ the option.
 .BR dpkg-architecture (1),
 .BR dpkg-buildpackage (1),
 .BR gpg (1),
+.BR gpg2 (1),
 .BR md5sum (1),
 .BR sha1sum (1),
 .BR sha256sum (1),
diff --git a/scripts/debsign.sh b/scripts/debsign.sh
index 8bd5559..403bb4c 100755
--- a/scripts/debsign.sh
+++ b/scripts/debsign.sh
@@ -305,6 +305,8 @@ if [ -n "$DEBSIGN_PROGRAM" ]; then
 else
     if command -v gpg > /dev/null 2>&1; then
 	signcommand=gpg
+    elif command -v gpg2 > /dev/null 2>&1; then
+	signcommand=gpg2
     fi
 fi
 
diff --git a/scripts/dscverify.1 b/scripts/dscverify.1
index 834d062..48b41a2 100644
--- a/scripts/dscverify.1
+++ b/scripts/dscverify.1
@@ -74,6 +74,7 @@ locations:
 - /usr/share/keyrings/debian-maintainers.gpg
 .SH "SEE ALSO"
 .BR gpg (1),
+.BR gpg2 (1),
 .BR devscripts.conf (5)
 
 .SH AUTHOR
diff --git a/scripts/dscverify.pl b/scripts/dscverify.pl
index ff2436e..dd6f979 100755
--- a/scripts/dscverify.pl
+++ b/scripts/dscverify.pl
@@ -51,6 +51,7 @@ my $start_dir = cwd;
 my $verify_sigs = 1;
 my $use_default_keyrings = 1;
 my $verbose = 0;
+my $havegpg = first { -x $_ } qw(/usr/bin/gpg2 /usr/bin/gpg);
 
 sub usage {
     print <<"EOF";
@@ -129,7 +130,7 @@ sub check_signature($\@;\$) {
 
     my $fd = fileno $fh;
     my @cmd;
-    push @cmd, qw(gpg --status-fd), $fd,
+    push @cmd, $havegpg, "--status-fd", $fd,
 	       qw(--batch --no-options --no-default-keyring --always-trust);
     foreach (@$rings) { push @cmd, '--keyring'; push @cmd, $_; }
 
diff --git a/scripts/who-permits-upload.pl b/scripts/who-permits-upload.pl
index 7b9ab54..fc802f0 100755
--- a/scripts/who-permits-upload.pl
+++ b/scripts/who-permits-upload.pl
@@ -30,7 +30,7 @@ use constant {SPONSOR_FINGERPRINT => 0, SPONSOR_NAME => 1};
 our $DM_URL = "https://ftp-master.debian.org/dm.txt";
 our $KEYRING = "/usr/share/keyrings/debian-keyring.gpg:/usr/share/keyrings/debian-maintainers.gpg";
 our $TYPE = "package";
-our $GPG = "/usr/bin/gpg";
+our $GPG = first { -x $_ } qw(/usr/bin/gpg2 /usr/bin/gpg);
 our ($HELP, @ARGUMENTS, @DM_DATA, %GPG_CACHE);
 
 binmode STDIN, ':encoding(console_in)';
@@ -160,7 +160,7 @@ under the terms of the General Public License (GPL) version 2 or later.
 
 =head1 SEE ALSO
 
-B<gpg>(1), B<who-uploads>(1)
+B<gpg>(1), B<gpg2>(1), B<who-uploads>(1)
 
 S<I<https://lists.debian.org/debian-devel-announce/2012/09/msg00008.html>>
 
diff --git a/scripts/who-uploads.1 b/scripts/who-uploads.1
index d070c81..b29d839 100644
--- a/scripts/who-uploads.1
+++ b/scripts/who-uploads.1
@@ -7,7 +7,7 @@ who-uploads \- identify the uploaders of Debian source packages
 \fBwho\-uploads\fR uses the Package Tracking System (PTS) to identify
 the uploaders of the three most recent versions of the given source
 packages.  Note that the uploaders are identified using their
-\fBgpg\fR(1) keys; installing a recent version of the
+\fBgpg\fR(1) or \fBgpg2\fR(1) keys; installing a recent version of the
 \fIdebian-keyring\fR package should provide most of the required keys.
 .PP
 Note that because the PTS uses source packages, you must give the
diff --git a/scripts/who-uploads.sh b/scripts/who-uploads.sh
index 3dab43f..14618b5 100755
--- a/scripts/who-uploads.sh
+++ b/scripts/who-uploads.sh
@@ -69,6 +69,16 @@ DEFAULT_WHOUPLOADS_MAXUPLOADS=3
 DEFAULT_WHOUPLOADS_DATE=no
 VARS="WHOUPLOADS_KEYRINGS WHOUPLOADS_MAXUPLOADS WHOUPLOADS_DATE"
 
+GPG=/usr/bin/gpg
+if [ ! -x $GPG ];then
+    echo "$GPG missing"
+    GPG=/usr/bin/gpg2
+    if [ ! -x $GPG ];then
+	echo "$GPG missing"
+	exit 1
+    fi
+fi
+
 if [ "$1" = "--no-conf" -o "$1" = "--noconf" ]; then
     shift
     MODIFIED_CONF_MSG="$MODIFIED_CONF_MSG
@@ -226,10 +236,10 @@ for package; do
 	    DATE=$(echo "$HTML_TEXT" |  sed -ne 's%<li><em>Date</em>: \(.*\)</li>%\1%p')
 	fi
 
-	GPG_ID=$(echo "$GPG_TEXT" | LC_ALL=C gpg $GPG_NO_KEYRING --keyid-format long --verify 2>&1 |
+	GPG_ID=$(echo "$GPG_TEXT" | LC_ALL=C $GPG $GPG_NO_KEYRING --keyid-format long --verify 2>&1 |
 	         sed -rne 's/.*using [^ ]* key ([0-9A-Z]+).*/\1/p')
 
-	UPLOADER=$(gpg $GPG_OPTIONS \
+	UPLOADER=$($GPG $GPG_OPTIONS \
 	           "${GPG_DEFAULT_KEYRINGS[@]}" "${GPG_KEYRINGS[@]}" \
 	           --list-key --with-colons $GPG_ID 2>/dev/null |
 	           awk  -F: '/@debian\.org>/ { a = $10; exit} /^pub/ { a = $10 } END { print a }' )

-- 
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