[devscripts] 03/03: uscan: allow spaces in opts=" ... "

Osamu Aoki osamu at moszumanska.debian.org
Tue Sep 15 14:57:05 UTC 2015


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

osamu pushed a commit to branch master
in repository devscripts.

commit 056a270f7e53be0fc9b0e16d96dffb57fd90bda4
Author: Osamu Aoki <osamu at debian.org>
Date:   Sun Sep 13 22:00:34 2015 +0900

    uscan: allow spaces in opts=" ... "
    
    Now opts="umangle = s/a/b/; dmangle = s/c/d/" is legal
    which is more readable.
    
    test_uscan_mangle updated to test a watch file with more spaces
---
 scripts/uscan.pl       | 30 ++++++++++++++++++------------
 test/test_uscan_mangle |  5 ++++-
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index ba3a251..658e210 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -808,33 +808,39 @@ sub process_watchline ($$$$$$)
 
 	    my @opts = split /,/, $opts;
 	    foreach my $opt (@opts) {
-		if ($opt eq 'pasv' or $opt eq 'passive') {
+		if ($opt =~ /^\s*pasv\s*$/ or $opt =~ /^\s*passive\s*$/) {
 		    $options{'pasv'}=1;
 		}
-		elsif ($opt eq 'active' or $opt eq 'nopasv'
-		       or $opt eq 'nopassive') {
+		elsif ($opt =~ /^\s*active\s*$/ or $opt =~ /^\s*nopasv\s*$/
+		       or $opt =~ /^s*nopassive\s*$/) {
 		    $options{'pasv'}=0;
 		}
-		elsif ($opt =~ /^repacksuffix\s*=\s*(.+)/) {
+		elsif ($opt =~ /^\s*repacksuffix\s*=\s*(.+?)\s*$/) {
 		    $options{'repacksuffix'} = $1;
 		}
-		elsif ($opt =~ /^uversionmangle\s*=\s*(.+)/) {
+		elsif ($opt =~ /^\s*uversionmangle\s*=\s*(.+?)\s*$/) {
 		    @{$options{'uversionmangle'}} = split /;/, $1;
 		}
-		elsif ($opt =~ /^dversionmangle\s*=\s*(.+)/) {
+		elsif ($opt =~ /^\s*dversionmangle\s*=\s*(.+?)\s*$/) {
 		    @{$options{'dversionmangle'}} = split /;/, $1;
 		}
-		elsif ($opt =~ /^versionmangle\s*=\s*(.+)/) {
+		elsif ($opt =~ /^\s*versionmangle\s*=\s*(.+?)\s*$/) {
 		    @{$options{'uversionmangle'}} = split /;/, $1;
 		    @{$options{'dversionmangle'}} = split /;/, $1;
 		}
-		elsif ($opt =~ /^filenamemangle\s*=\s*(.+)/) {
+		elsif ($opt =~ /^\s*pagemangle\s*=\s*(.+?)\s*$/) {
+		    @{$options{'pagemangle'}} = split /;/, $1;
+		}
+		elsif ($opt =~ /^\s*filenamemangle\s*=\s*(.+?)\s*$/) {
 		    @{$options{'filenamemangle'}} = split /;/, $1;
 		}
-		elsif ($opt =~ /^downloadurlmangle\s*=\s*(.+)/) {
+		elsif ($opt =~ /^\s*oversionmangle\s*=\s*(.+?)\s*$/) {
+		    @{$options{'oversionmangle'}} = split /;/, $1;
+		}
+		elsif ($opt =~ /^\s*downloadurlmangle\s*=\s*(.+?)\s*$/) {
 		    @{$options{'downloadurlmangle'}} = split /;/, $1;
 		}
-		elsif ($opt =~ /^pgpsigurlmangle\s*=\s*(.+)/) {
+		elsif ($opt =~ /^\s*pgpsigurlmangle\s*=\s*(.+?)\s*$/) {
 		    @{$options{'pgpsigurlmangle'}} = split /;/, $1;
 		}
 		else {
@@ -937,6 +943,7 @@ sub process_watchline ($$$$$$)
 	print STDERR "$progname debug: last pristine tarball version: $lastversion\n" if $debug;
     }
     # And mangle it if requested
+    print STDERR "$progname debug: last pristine tarball version: $lastversion\n" if $debug;
     my $mangled_lastversion;
     $mangled_lastversion = $lastversion;
     foreach my $pat (@{$options{'dversionmangle'}}) {
@@ -997,8 +1004,7 @@ sub process_watchline ($$$$$$)
 
 	@redirections = @{$user_agent->get_redirections};
 
-	print STDERR "$progname debug: redirections: @redirections\n"
-	    if $debug;
+	print STDERR "$progname debug: redirections: @redirections\n" if ($debug and  @redirections);
 
 	foreach my $_redir (@redirections) {
 	    my $base_dir = $_redir;
diff --git a/test/test_uscan_mangle b/test/test_uscan_mangle
index bb49825..4e2cc11 100755
--- a/test/test_uscan_mangle
+++ b/test/test_uscan_mangle
@@ -375,7 +375,10 @@ testWatch3WebNonNativeR() {
 testWatch3PrWebNonNative() {
     PKG=foo
     WATCHVER="3"
-    WATCHLINE='opts="downloadurlmangle=s%boo/xxx%foo/ooo%;s%boo-%foo-%,filenamemangle=s%.*boo-(.*)%foo-$1% " @@@url@@@/ (?:.*)/boo-([\d\.]+).tar.gz debian uupdate'
+    WATCHLINE='opts="downloadurlmangle = s%boo/xxx%foo/ooo% ; s%boo-%foo-%, \
+                     filenamemangle    = s%.*boo-(.*)%foo-$1% " \
+    @@@url@@@/ (?:.*)/boo-([\d\.]+).tar.gz \
+    debian uupdate'
     helperWatch sitePrWebNonNative 1.0 2.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