[devscripts] 02/06: uscan: No more .download hack

Osamu Aoki osamu at moszumanska.debian.org
Sun Nov 8 14:49:49 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 3656a1109de1792abf2e972bec27235a2ede1a1a
Author: Osamu Aoki <osamu at debian.org>
Date:   Sat Nov 7 23:54:02 2015 +0900

    uscan: No more .download hack
    
    Fix #804239: Failure when basename is in query string
    
    If upstream tarball is not basename of URL, filenamemangle is required.
    Np more .download hack which breaks mk-origtargz
    
    If filenamemangle is used and upstream version is undefined, generate
    version from the filename generated by the filenamemangle.
    
    $filepattern is not NULL string so not to worry anymore (simplify)
---
 scripts/uscan.pl | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index dce03ba..e40fcb0 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -2327,7 +2327,7 @@ sub process_watchline ($$$$$$)
 	$pattern = $filepattern;
 
 	# Check $filepattern is OK
-	if (not $filepattern or $filepattern !~ /\(.*\)/) {
+	if ($filepattern !~ /\(.*\)/) {
 	    uscan_warn "Filename pattern missing version delimiters ()\n  in $watchfile, skipping:\n  $line\n";
 	    return 1;
 	}
@@ -2465,8 +2465,9 @@ sub process_watchline ($$$$$$)
 	}
 
 	# Check $filepattern is OK
-	if (not $filepattern or $filepattern !~ /\(.*\)/) {
-	    uscan_warn "Filename pattern missing version delimiters ()\n  in $watchfile, skipping:\n  $line\n";
+	if ( $filepattern !~ /\(.*\)/ and
+		not exists $options{'filenamemangle'}) {
+	    uscan_warn "Filename pattern missing version delimiters () without filenamemangle\n  in $watchfile, skipping:\n  $line\n";
 	    return 1;
 	}
 
@@ -2957,11 +2958,8 @@ EOF
 	}
     }
     # $newversion = version used for pkg-ver.tar.gz and version comparison
-    uscan_verbose "Newest upstream tarball version selected for download (uversionmangled): $newversion\n";
+    uscan_verbose "Newest upstream tarball version selected for download (uversionmangled): $newversion\n" if defined $newversion;
     uscan_verbose "Download filename (fullpath, pre-filenamemangle): $newfile\n";
-    unless (defined $common_newversion) {
-	$common_newversion = $newversion;
-    }
 
     my $newfile_base;
     if (exists $options{'filenamemangle'}) {
@@ -2977,6 +2975,16 @@ EOF
 	    return 1;
 	    }
 	}
+	unless ($newversion) {
+	    # uversionmangles version not exist
+	    $newfile_base =~ m/^.+[-_]([^-_]+)(?:\.tar\.(gz|bz2|xz)|\.zip)$/i;
+	    $newversion = $1;
+	    unless ($newversion) {
+		uscan_warn "Fix filenamemangle to produce a filename with the correct version\n";
+		return 1;
+	    }
+	    uscan_verbose "Newest upstream tarball version from the filenamemangled filename: $newversion\n";
+	}
     } else {
 	$newfile_base = basename($newfile);
 	# Remove HTTP header trash
@@ -2984,12 +2992,15 @@ EOF
 	    $newfile_base =~ s/[\?#].*$//; # PiPy
 	    # just in case this leaves us with nothing
 	    if ($newfile_base eq '') {
-		$newfile_base = "$pkg-$newversion.download";
 		uscan_warn "No good upstream filename found after removing tailing ?... and #....\n   Use filenamemangle to fix this.\n";
+		return 1;
 	    }
 	}
     }
     uscan_verbose "Download filename (filenamemangled): $newfile_base\n";
+    unless (defined $common_newversion) {
+	$common_newversion = $newversion;
+    }
 
     # Determin download URL for tarball or signature
     my $upstream_url;

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