Package: devscripts
Version: 2.9.20
Followup-For: Bug #364116

Hi,

I agree this would be good; for example many packages using
svn-buildpackage don't appear to include upstream tarballs.

Attached is a patch to implement --force-download.  Verbose output
would look similar to below

[EMAIL PROTECTED]:~/programs/pkg-bluetooth/gnome-bluetooth/trunk$ 
/tmp/devscripts-2.9.20/uscan.pl --verbose --force-download
-- Scanning for watchfiles in .
-- Found watchfile in ./debian
-- In debian/watch, processing watchfile line:
   
http://ftp.gnome.org/pub/gnome/sources/gnome-bluetooth/([\d\.]+)/gnome-bluetooth-([\d\.]+)\.tar\.gz
 debian
-- Found the following matching hrefs:
     gnome-bluetooth-0.7.0.tar.gz
Newest version on remote site is 0.7.0, local version is 0.7.0
 => Package is up to date
Newest version on remote site is 0.7.0, local version is 0.7.0
 => Forcing download as requested
-- Downloading updated package gnome-bluetooth-0.7.0.tar.gz
-- Successfully downloaded updated package gnome-bluetooth-0.7.0.tar.gz
    and symlinked gnome-bluetooth_0.7.0.orig.tar.gz to it
-- Scan finished

Thanks,

-i

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)

Versions of packages devscripts depends on:
ii  debianutils                   2.17       Miscellaneous utilities specific t
ii  dpkg-dev                      1.13.22    package building tools for Debian
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries
ii  perl                          5.8.8-6    Larry Wall's Practical Extraction 
ii  sed                           4.1.5-1    The GNU sed stream editor

Versions of packages devscripts recommends:
ii  fakeroot                      1.5.10     Gives a fake root environment

-- no debconf information
diff -u ./devscripts-2.9.20/uscan.1 ./devscripts-2.9.20-new/uscan.1
--- ./devscripts-2.9.20/uscan.1 2006-04-25 04:32:30.000000000 +1000
+++ ./devscripts-2.9.20-new/uscan.1     2006-08-08 11:23:49.000000000 +1000
@@ -327,6 +327,9 @@
 .B \-\-download
 Report and download.  (This is the default behaviour.)
 .TP
+.B \-\-force-download
+Download upstream even if up to date (will not overwrite local files, however)
+.TP
 .B \-\-pasv
 Force PASV mode for FTP connections.
 .TP
diff -u ./devscripts-2.9.20/uscan.pl ./devscripts-2.9.20-new/uscan.pl
--- ./devscripts-2.9.20/uscan.pl        2006-04-19 02:58:30.000000000 +1000
+++ ./devscripts-2.9.20-new/uscan.pl    2006-08-08 11:20:28.000000000 +1000
@@ -72,6 +72,8 @@
     --debug        Dump the downloaded web pages to stdout for debugging
                    your watch file.
     --download     Report on newer and absent versions, and download (default)
+    --force-download
+                   Always download the upstream release, even if up to date
     --no-download  Report on newer and absent versions, but don\'t download
     --pasv         Use PASV mode for FTP connections
     --no-pasv      Do not use PASV mode for FTP connections (default)
@@ -136,6 +138,7 @@
 # The next stuff is boilerplate
 
 my $download = 1;
+my $force_download = 0;
 my $report = 0; # report even on up-to-date packages?
 my $symlink = 'symlink';
 my $verbose = 0;
@@ -217,13 +220,14 @@
 
 # Now read the command line arguments
 my $debug = 0;
-my ($opt_h, $opt_v, $opt_download, $opt_report, $opt_passive, $opt_symlink);
+my ($opt_h, $opt_v, $opt_download, $opt_force_download, $opt_report, 
$opt_passive, $opt_symlink);
 my ($opt_verbose, $opt_ignore, $opt_level, $opt_regex, $opt_noconf);
 my ($opt_package, $opt_uversion, $opt_watchfile, $opt_dehs, $opt_timeout);
 
 GetOptions("help" => \$opt_h,
           "version" => \$opt_v,
           "download!" => \$opt_download,
+          "force-download" => \$opt_force_download,
           "report" => sub { $opt_download = 0; },
           "report-status" => sub { $opt_download = 0; $opt_report = 1; },
           "passive|pasv!" => \$opt_passive,
@@ -253,6 +257,7 @@
 # Now we can set the other variables according to the command line options
 
 $download = $opt_download if defined $opt_download;
+$force_download = $opt_force_download if defined $opt_force_download;
 $report = $opt_report if defined $opt_report;
 $passive = $opt_passive if defined $opt_passive;
 $timeout = $opt_timeout if defined $opt_timeout;
@@ -938,7 +943,11 @@
            print " => Package is up to date\n";
        }
        $dehs_tags{'status'} = "up to date";
-       return 0;
+       if (! $force_download) {
+           return 0;
+       } else {
+           $download = 1;
+       }
     }
 
     # In all other cases, we'll want to report information even with --report
@@ -984,7 +993,9 @@
        }
     }
 
-    if ($verbose) {
+    if ($force_download and $verbose) {
+       print " => Forcing download as requested\n";
+    } elsif ($verbose) {
        print " => Newer version available from\n";
        print "    $upstream_url\n";
     } elsif ($dehs) {

Reply via email to