[devscripts] 02/03: uscan: support --download-debversion
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 8e5561ef29a44f36b626df0611714c5b789ef0cf
Author: Osamu Aoki <osamu at debian.org>
Date: Thu Sep 10 08:06:19 2015 +0000
uscan: support --download-debversion
https://bugs.debian.org/755754
[uscan] support downloading upstream version by Debian mangled version string
* support downloading upstream version by specifying the Debian version.
The specified Debian version is dversionmangled tand it is ompared to the
uversionmangled upstream version.
---
scripts/uscan.pl | 21 +++++++++++++++++++--
test/test_uscan_mangle | 19 ++++++++++++++++---
2 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index f316125..ba3a251 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -121,6 +121,11 @@ Options:
Specify the version which the upstream release must
match in order to be considered, rather than using the
release with the highest version
+ --download-debversion VERSION
+ Specify the Debian package version to download the
+ corresponding upstream release version. The
+ dversionmangle and uversionmangle rules are
+ considered.
--download-current-version
Download the currently packaged version
--package PACKAGE
@@ -286,7 +291,7 @@ my ($opt_h, $opt_v, $opt_destdir, $opt_download, $opt_force_download,
$opt_repack_compression, $opt_exclusion, $opt_copyright_file);
my ($opt_verbose, $opt_level, $opt_regex, $opt_noconf);
my ($opt_package, $opt_uversion, $opt_watchfile, $opt_dehs, $opt_timeout);
-my $opt_download_version;
+my ($opt_download_version, $opt_download_debversion);
my $opt_user_agent;
my $opt_download_current_version;
@@ -295,6 +300,7 @@ GetOptions("help" => \$opt_h,
"destdir=s" => \$opt_destdir,
"download!" => \$opt_download,
"download-version=s" => \$opt_download_version,
+ "download-debversion=s" => \$opt_download_debversion,
"force-download" => \$opt_force_download,
"report" => sub { $opt_download = 0; },
"report-status" => sub { $opt_download = 0; $opt_report = 1; },
@@ -914,7 +920,6 @@ sub process_watchline ($$$$$$)
$basedir =~ s%^\w+://[^/]+/%/%;
$pattern = "(?:(?:$site)?" . quotemeta($basedir) . ")?$filepattern";
}
-
if (! defined $lastversion or $lastversion eq 'debian') {
if (defined $pkg_version) {
$lastversion=$pkg_version;
@@ -923,6 +928,14 @@ sub process_watchline ($$$$$$)
return 1;
}
}
+ if (defined $opt_download_debversion) {
+ $lastversion = $opt_download_debversion;
+ $lastversion =~ s/-[^-]+$//; # revision
+ $lastversion =~ s/^\d+://; # epoch
+ print STDERR "$progname debug: specified debversion to download: $lastversion\n" if $debug;
+ } else {
+ print STDERR "$progname debug: last pristine tarball version: $lastversion\n" if $debug;
+ }
# And mangle it if requested
my $mangled_lastversion;
$mangled_lastversion = $lastversion;
@@ -943,6 +956,10 @@ sub process_watchline ($$$$$$)
$force_download = 1;
$badversion = 1;
print STDERR "$progname debug: Force to download the specified version: $download_version\n" if $debug;
+ } elsif (defined $opt_download_debversion) {
+ $download_version = $mangled_lastversion;
+ $force_download = 1;
+ print STDERR "$progname debug: Force to download the specified debversion (dversionmangled): $download_version\n" if $debug;
} elsif($opt_download_current_version) {
$download_version = $mangled_lastversion;
$force_download = 1;
diff --git a/test/test_uscan_mangle b/test/test_uscan_mangle
index ca54801..bb49825 100755
--- a/test/test_uscan_mangle
+++ b/test/test_uscan_mangle
@@ -397,11 +397,22 @@ testWatch3WebNonNativeDlUversion() {
helperWatch siteWebNonNative 1.0 0.0
COMMAND="$COMMANDOLD"
}
+testWatch3WebNonNativeDlDversion() {
+ PKG=foo
+ COMMANDOLD="$COMMAND"
+ COMMAND="$COMMAND --download-debversion 0.0-1"
+ WATCHVER="3"
+ WATCHLINE='@@@url@@@/ (?:.*)/'$PKG'-([\.\d]+).tar.gz debian uupdate'
+ helperWatch siteWebNonNative 1.0 0.0
+ COMMAND="$COMMANDOLD"
+}
## Debian version is 0.19990101 for future proof while upstream is 19990101
#testWatch3WebNonNativeLarge() {
# PKG=foo
# WATCHVER="3"
-# WATCHLINE='opts=" dversionmangle = s/0\.(.*)/$1/ , oversionmangle = s/(.*)/0.$1/" @@@url@@@ (?:.*)/'$PKG'-([\.\d]+).tar.gz debian uupdate'
+# WATCHLINE='opts=" dversionmangle = s/0\.(.*)/$1/ , \
+# oversionmangle = s/(.*)/0.$1/" \
+# @@@url@@@ (?:.*)/'$PKG'-([\.\d]+).tar.gz debian uupdate'
# helperWatch siteWebNonNativeLarge 20000101 20010101 0.
#}
#
@@ -409,8 +420,10 @@ testWatch3WebNonNativeDlUversion() {
#testWatch3XmlNonNative() {
# PKG=foo
# WATCHVER="3"
-# WATCHLINE='opts="pagemangle=s%<Key>([^<]*)</Key>%<Key><a href="$1">$1</a></Key>%g" @@@url@@@/ (?:.*)/'$PKG'-([\d\.]+).tar.gz debian uupdate'
+# WATCHLINE='opts="pagemangle = \
+# s%<Key>([^<]*)</Key>%<Key><a href=\"$1\">$1</a></Key>%g" \
+# @@@url@@@/ (?:.*)/'$PKG'-([\d\.]+).tar.gz debian uupdate'
# helperWatch siteXmlNonNative 1.0 2.0
#}
-#
+
. shunit2
--
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