[devscripts] 01/03: uscan+uupdate: backport compatible via -b
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 05fa96533d4377bba2f402f10894740bc4bd5537
Author: Osamu Aoki <osamu at debian.org>
Date: Tue Sep 15 06:09:40 2015 +0000
uscan+uupdate: backport compatible via -b
When uscan is used for --download_version, or
--download_current_version, uupdate chokes. Also, uupdate starts
debchange which needs to be started with -b for these cases.
(Somehow, uscan had unused -b option. Now used.)
Emulate VCS case in test_uscan_mangle where the last source is now at
<pkg>/.
---
scripts/uscan.pl | 19 +++++++++++++++++--
scripts/uupdate.sh | 15 +++++++++++----
test/test_uscan | 1 +
test/test_uscan_mangle | 23 +++++++++++++++++++++--
4 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 54c4748..f316125 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -177,6 +177,7 @@ my $destdir = "..";
my $download = 1;
my $download_version;
my $force_download = 0;
+my $badversion = 0;
my $report = 0; # report even on up-to-date packages?
my $repack = 0; # repack .tar.bz2, .tar.lzma, .tar.xz or .zip to .tar.gz
my $default_compression = 'gzip' ;
@@ -361,7 +362,6 @@ $dehs = $opt_dehs if defined $opt_dehs;
$exclusion = $opt_exclusion if defined $opt_exclusion;
$copyright_file = $opt_copyright_file if defined $opt_copyright_file;
$user_agent_string = $opt_user_agent if defined $opt_user_agent;
-$download_version = $opt_download_version if defined $opt_download_version;
if (defined $opt_level) {
if ($opt_level =~ /^[012]$/) { $check_dirname_level = $opt_level; }
@@ -938,9 +938,19 @@ sub process_watchline ($$$$$$)
}
}
print STDERR "$progname debug: dversionmangled last version: $mangled_lastversion\n" if $debug;
- if($opt_download_current_version) {
+ if($opt_download_version) {
+ $download_version = $opt_download_version;
+ $force_download = 1;
+ $badversion = 1;
+ print STDERR "$progname debug: Force to download the specified version: $download_version\n" if $debug;
+ } elsif($opt_download_current_version) {
$download_version = $mangled_lastversion;
$force_download = 1;
+ $badversion = 1;
+ print STDERR "$progname debug: Force to download the current version: $download_version\n" if $debug;
+ } else {
+ # $download_version = undef;
+ print STDERR "$progname debug: Last pristine tarball version (dversionmangled): $mangled_lastversion\n" if $debug;
}
# Check all's OK
@@ -1066,6 +1076,7 @@ sub process_watchline ($$$$$$)
my @vhrefs = grep { $$_[0] eq $download_version } @hrefs;
if (@vhrefs) {
($newversion, $newfile) = @{$vhrefs[0]};
+ print STDERR "$progname debug: Found remote URL matiching the requested version.\n" if $debug;
} else {
uscan_warn "$progname warning: In $watchfile no matching hrefs for version $download_version"
. " in watch line\n $line\n";
@@ -1077,6 +1088,7 @@ sub process_watchline ($$$$$$)
}
} else {
uscan_warn "$progname warning: In $watchfile,\n no matching hrefs for watch line\n $line\n";
+ print STDERR "$progname debug: Picked URL matiching the newest version.\n" if $debug;
return 1;
}
}
@@ -1563,6 +1575,9 @@ EOF
if ($verbose) {
push @cmd, "--verbose";
}
+ if ($badversion) {
+ push @cmd, "-b";
+ }
}
if ($watch_version > 1) {
diff --git a/scripts/uupdate.sh b/scripts/uupdate.sh
index 6cd98ca..158480c 100755
--- a/scripts/uupdate.sh
+++ b/scripts/uupdate.sh
@@ -51,6 +51,9 @@ For a patch file:
Options are:
--upstream-version <version>, -v <version>
specify version number of upstream package
+ --force-bad-version, -b
+ Force a version number to be less than the current one
+ (e.g., when backporting).
--rootcmd <gain-root-command>, -r <gain-root-command>
which command to be used to become root
for package-building
@@ -100,6 +103,7 @@ mustsetvar () {
MPATTERN='^(?:[a-zA-Z][a-zA-Z0-9]*(?:-|_|\.))+(\d+\.(?:\d+\.)*\d+)$'
STATUS=0
+BADVERSION=""
# Boilerplate: set config variables
DEFAULT_UUPDATE_ROOTCMD=
@@ -171,6 +175,7 @@ fi
TEMP=$(getopt -s bash -o v:p:r:ubs \
--long upstream-version:,patch:,rootcmd: \
+ --long force-bad-version \
--long pristine,no-pristine,nopristine \
--long symlink,no-symlink,nosymlink \
--long no-conf,noconf \
@@ -182,6 +187,8 @@ eval set -- $TEMP
# Process Parameters
while [ "$1" ]; do
case $1 in
+ --force-bad-version|-b)
+ BADVERSION="-b" ;;
--upstream-version|-v)
shift; NEW_VERSION="$1" ;;
--patch|-p)
@@ -357,7 +364,7 @@ if [ "$PATCH" ]; then
fi
# Sanity check
- if dpkg --compare-versions "$NEW_VERSION-$SUFFIX" le "$VERSION"; then
+ if [ -z "$BADVERSION" ] && dpkg --compare-versions "$NEW_VERSION-$SUFFIX" le "$VERSION"; then
echo "$PROGNAME: new version $NEW_VERSION-$SUFFIX <= current version $VERSION; aborting!" >&2
exit 1
fi
@@ -480,7 +487,7 @@ if [ "$PATCH" ]; then
STATUS=1
fi
chmod a+x debian/rules
- debchange -v "$NEW_VERSION-$SUFFIX" "New upstream release"
+ debchange $BADVERSION -v "$NEW_VERSION-$SUFFIX" "New upstream release"
echo "Remember: Your current directory is the OLD sourcearchive!"
echo "Do a \"cd ../$PACKAGE-$SNEW_VERSION\" to see the new package"
exit
@@ -569,7 +576,7 @@ else
fi
# Sanity check
- if dpkg --compare-versions "$NEW_VERSION-$SUFFIX" le "$VERSION"; then
+ if [ -z "$BADVERSION" ] && dpkg --compare-versions "$NEW_VERSION-$SUFFIX" le "$VERSION"; then
echo "$PROGNAME: new version $NEW_VERSION-$SUFFIX <= current version $VERSION; aborting!" >&2
exit 1
fi
@@ -889,7 +896,7 @@ else
if [ -n "$UUPDATE_VERBOSE" ]; then
echo "-- New upstream release=$NEW_VERSION-$SUFFIX" >&2
fi
- debchange -v "$NEW_VERSION-$SUFFIX" "New upstream release"
+ debchange $BADVERSION -v "$NEW_VERSION-$SUFFIX" "New upstream release"
echo "Remember: Your current directory is the OLD sourcearchive!"
echo "Do a \"cd ../$PACKAGE-$SNEW_VERSION\" to see the new package"
fi
diff --git a/test/test_uscan b/test/test_uscan
index 97926eb..ea8e082 100755
--- a/test/test_uscan
+++ b/test/test_uscan
@@ -46,6 +46,7 @@ COMMANDDEHS="$COMMAND --dehs"
cleanup(){
kill -9 $(cat $TMPDIR/repo/pid)
rm -rf $TMPDIR
+ echo ""
}
spawnHttpServer(){
diff --git a/test/test_uscan_mangle b/test/test_uscan_mangle
index 90d5ec3..ca54801 100755
--- a/test/test_uscan_mangle
+++ b/test/test_uscan_mangle
@@ -55,7 +55,7 @@ DEBUGLSLR=":"
cleanup(){
kill -9 $(cat $TMPDIR/$REPOPATH/pid)
rm -rf $TMPDIR
- $DEBUGECHO " ***** ================================================ *****"
+ echo ""
}
spawnHttpServer(){
@@ -174,7 +174,8 @@ helperWatch() {
if [ -n "$PREFIX" ]; then
mv $TMPDIR/${PKG}-${VEROLD} $TMPDIR/${PKG}-${PREFIX}${VEROLD}
fi
- cd $TMPDIR/${PKG}-${PREFIX}${VEROLD}
+ mv $TMPDIR/${PKG}-${PREFIX}${VEROLD} $TMPDIR/${PKG}
+ cd $TMPDIR/${PKG}
if [ ! -d debian ]; then
makeDebianDir $PKG ${PREFIX}${VEROLD}-$SUFFIX
fi
@@ -378,6 +379,24 @@ testWatch3PrWebNonNative() {
helperWatch sitePrWebNonNative 1.0 2.0
}
+testWatch3WebNonNativeDlCurrent() {
+ PKG=foo
+ COMMANDOLD="$COMMAND"
+ COMMAND="$COMMAND --download-current-version"
+ WATCHVER="3"
+ WATCHLINE='@@@url@@@/ (?:.*)/'$PKG'-([\.\d]+).tar.gz debian uupdate'
+ helperWatch siteWebNonNative 1.0 1.0
+ COMMAND="$COMMANDOLD"
+}
+testWatch3WebNonNativeDlUversion() {
+ PKG=foo
+ COMMANDOLD="$COMMAND"
+ COMMAND="$COMMAND --download-version 0.0"
+ 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
--
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