[devscripts] 04/05: uscan: Honor declared options when downloading the PGP signature

James McCoy jamessan at debian.org
Wed Jan 15 02:31:20 UTC 2014


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

jamessan pushed a commit to branch master
in repository devscripts.

commit 44b7b9ee1ab2f48e4f5c802c4fbdd4dfdccd0bf6
Author: James McCoy <jamessan at debian.org>
Date:   Tue Jan 14 21:18:21 2014 -0500

    uscan: Honor declared options when downloading the PGP signature
    
    Closes: #735085
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog |  5 ++-
 scripts/uscan.pl | 92 +++++++++++++++++++++++++++-----------------------------
 2 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b3d0ab0..6f15a4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-devscripts (2.13.10) UNRELEASED; urgency=low
+devscripts (2.14.1) UNRELEASED; urgency=low
 
   [ Jakub Wilk ]
   * Add sadt, a simple implementation of DEP-8 test runner (closes: #712095).
@@ -10,6 +10,9 @@ devscripts (2.13.10) UNRELEASED; urgency=low
     + Ensure the tag/dist description order is stable.  (Closes: #735286)
     + Automatically determine what the ignore tag means, instead of
       hard-coding dist names.
+  * uscan:
+    + Honor declared options when downloading the PGP signature.  (Closes:
+      #735085)
 
  -- Jakub Wilk <jwilk at debian.org>  Fri, 27 Dec 2013 18:39:11 +0100
 
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 433f5e2..038c29e 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1350,60 +1350,58 @@ EOF
         print "Package directory '$destdir to store downloaded file is not existing\n";
         return 1;
     }
-    # Download newer package
-    if ($upstream_url =~ m%^http(s)?://%) {
-	if (defined($1) and !$haveSSL) {
-	    uscan_die "$progname: you must have the liblwp-protocol-https-perl package installed\nto use https URLs\n";
-	}
-	# substitute HTML entities
-	# Is anything else than "&" required?  I doubt it.
-	print STDERR "$progname debug: requesting URL $upstream_url\n" if $debug;
-	my $headers = HTTP::Headers->new;
-	$headers->header('Accept' => '*/*');
-	$request = HTTP::Request->new('GET', $upstream_url, $headers);
-	$response = $user_agent->request($request, "$destdir/$newfile_base");
-	if (! $response->is_success) {
-	    if (defined $pkg_dir) {
-		uscan_warn "$progname warning: In directory $pkg_dir, downloading\n  $upstream_url failed: " . $response->status_line . "\n";
-	    } else {
-		uscan_warn "$progname warning: Downloading\n $upstream_url failed:\n" . $response->status_line . "\n";
+    my $downloader = sub {
+	my ($url, $fname) = @_;
+	if ($url =~ m%^http(s)?://%) {
+	    if (defined($1) and !$haveSSL) {
+		uscan_die "$progname: you must have the liblwp-protocol-https-perl package installed\nto use https URLs\n";
+	    }
+	    # substitute HTML entities
+	    # Is anything else than "&" required?  I doubt it.
+	    print STDERR "$progname debug: requesting URL $url\n" if $debug;
+	    my $headers = HTTP::Headers->new;
+	    $headers->header('Accept' => '*/*');
+	    $request = HTTP::Request->new('GET', $url, $headers);
+	    $response = $user_agent->request($request, $fname);
+	    if (! $response->is_success) {
+		if (defined $pkg_dir) {
+		    uscan_warn "$progname warning: In directory $pkg_dir, downloading\n  $url failed: " . $response->status_line . "\n";
+		} else {
+		    uscan_warn "$progname warning: Downloading\n $url failed:\n" . $response->status_line . "\n";
+		}
+		return 0;
 	    }
-	    return 1;
-	}
-    }
-    else {
-	# FTP site
-	if (exists $options{'pasv'}) {
-	    $ENV{'FTP_PASSIVE'}=$options{'pasv'};
-	}
-	print STDERR "$progname debug: requesting URL $upstream_url\n" if $debug;
-	$request = HTTP::Request->new('GET', "$upstream_url");
-	$response = $user_agent->request($request, "$destdir/$newfile_base");
-	if (exists $options{'pasv'}) {
-	    if (defined $passive) { $ENV{'FTP_PASSIVE'}=$passive; }
-	    else { delete $ENV{'FTP_PASSIVE'}; }
 	}
-	if (! $response->is_success) {
-	    if (defined $pkg_dir) {
-		uscan_warn "$progname warning: In directory $pkg_dir, downloading\n  $upstream_url failed: " . $response->status_line . "\n";
-	    } else {
-		uscan_warn "$progname warning: Downloading\n $upstream_url failed:\n" . $response->status_line . "\n";
+	else {
+	    # FTP site
+	    if (exists $options{'pasv'}) {
+		$ENV{'FTP_PASSIVE'}=$options{'pasv'};
+	    }
+	    print STDERR "$progname debug: requesting URL $url\n" if $debug;
+	    $request = HTTP::Request->new('GET', "$url");
+	    $response = $user_agent->request($request, $fname);
+	    if (exists $options{'pasv'}) {
+		if (defined $passive) { $ENV{'FTP_PASSIVE'}=$passive; }
+		else { delete $ENV{'FTP_PASSIVE'}; }
+	    }
+	    if (! $response->is_success) {
+		if (defined $pkg_dir) {
+		    uscan_warn "$progname warning: In directory $pkg_dir, downloading\n  $url failed: " . $response->status_line . "\n";
+		} else {
+		    uscan_warn "$progname warning: Downloading\n $url failed:\n" . $response->status_line . "\n";
+		}
+		return 0;
 	    }
-	    return 1;
 	}
+	return 1;
+    };
+    # Download newer package
+    if (!$downloader->($upstream_url, "$destdir/$newfile_base")) {
+	return 1;
     }
-
     if (defined $pgpsig_url) {
 	print "-- Downloading OpenPGP signature for package as $newfile_base.pgp\n" if $verbose;
-	my $sigrequest = HTTP::Request->new('GET', "$pgpsig_url");
-	my $sigresponse = $user_agent->request($sigrequest, "$destdir/$newfile_base.pgp");
-
-	if (! $sigresponse->is_success) {
-	    if (defined $pkg_dir) {
-		uscan_warn "$progname warning: In directory $pkg_dir, downloading OpenPGP signature\n  $upstream_url failed: " . $sigresponse->status_line . "\n";
-	    } else {
-		uscan_warn "$progname warning: Downloading OpenPGP signature\n $pgpsig_url failed:\n" . $sigresponse->status_line . "\n";
-	    }
+	if (!$downloader->($pgpsig_url, "$destdir/$newfile_base.pgp")) {
 	    return 1;
 	}
 

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