[devscripts] 01/03: uscan: add pgpmode=auto support

Osamu Aoki osamu at moszumanska.debian.org
Thu Nov 12 14:33:16 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 d7d50fe71d4ae04cafbfe4471c731c7acdaabd4e
Author: Osamu Aoki <osamu at debian.org>
Date:   Thu Nov 12 22:23:29 2015 +0900

    uscan: add pgpmode=auto support
    
    pgpmode=auto autogenerates pgpsigurlmangle rles
---
 scripts/uscan.pl | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index dc81b4d..9f5e3eb 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -334,7 +334,12 @@ Set the pgp/gpg signature verification I<mode>.
 
 =over
 
-=item B<mangle>
+=item B<auto>
+
+B<uscan> checks possible URLs for the signature file and autogenerates
+B<pgpsigurlmangle> rule to use it.
+
+=item B<default>
 
 Use B<pgpsigurlmangle=>I<rules> to generate the candidate upstream signature
 file URL string from the upstream tarball URL. (default)
@@ -342,6 +347,11 @@ file URL string from the upstream tarball URL. (default)
 If actual B<pgpsigurlmangle> is missing, B<uscan> checks possible URLs for the
 signature file and suggests to add B<pgpsigurlmangle> rule.
 
+=item B<mangle>
+
+Use B<pgpsigurlmangle=>I<rules> to generate the candidate upstream signature
+file URL string from the upstream tarball URL.
+
 =item B<next>
 
 Verify this downloaded tarball file with the signature file specified in the
@@ -2544,7 +2554,14 @@ sub process_watchline ($$$$$$)
 
 	# Allow 2 char shorthands for opts="pgpmode=..." and check
 	my $needkeyring;
-	if ($options{'pgpmode'} =~ m/^ma/) {
+	if ($options{'pgpmode'} =~ m/^au/) {
+	    $options{'pgpmode'} = 'auto';
+	    $needkeyring = 1;
+	    if (defined $options{'pgpsigurlmangle'}) {
+		uscan_warn "Ignore pgpsigurlmangle because pgpmode=auto\n";
+		delete $options{'pgpsigurlmangle'};
+	    }
+	} elsif ($options{'pgpmode'} =~ m/^ma/) {
 	    $options{'pgpmode'} = 'mangle';
 	    $needkeyring = 1;
 	    if (not defined $options{'pgpsigurlmangle'}) {
@@ -3320,19 +3337,26 @@ EOF
     my $pgpsig_url;
     my $sigfile;
     my $signature_available;
-    if ($options{'pgpmode'} eq 'default') {
+    if ($options{'pgpmode'} eq 'default' or $options{'pgpmode'} eq 'auto') {
 	uscan_msg "Start checking for common possible upstream OpenPGP signature files\n";
 	foreach my $suffix (qw(asc gpg pgp sig)) {
 	    my $sigrequest = HTTP::Request->new('HEAD' => "$upstream_url.$suffix");
 	    my $sigresponse = $user_agent->request($sigrequest);
 	    if ($sigresponse->is_success()) {
-		uscan_msg "Possible OpenPGP signature found at:\n   $upstream_url.$suffix.\n   Please consider adding opts=pgpsigurlmangle=s/\$/.$suffix/\n   to debian/watch.  see uscan(1) for more details.\n";
+		if ($options{'pgpmode'} eq 'default') {
+		    uscan_msg "Possible OpenPGP signature found at:\n   $upstream_url.$suffix.\n   Please consider adding opts=pgpsigurlmangle=s/\$/.$suffix/\n   to debian/watch.  see uscan(1) for more details.\n";
+		    $options{'pgpmode'} = 'none';
+		} else {
+		    $options{'pgpmode'} = 'mangle';
+		    $options{'pgpsigurlmangle'} = [ 's/$/.' . $suffix . '/', ];
+		}
 		last;
 	    }
 	}
 	uscan_msg "End checking for common possible upstream OpenPGP signature files\n";
 	$signature_available = 0;
-    } elsif ($options{'pgpmode'} eq 'mangle') {
+    }
+    if ($options{'pgpmode'} eq 'mangle') {
 	$pgpsig_url = $upstream_url;
 	foreach my $pat (@{$options{'pgpsigurlmangle'}}) {
 	    uscan_verbose "pgpsigurlmangle rule $pat\n";

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