Hi, On Sat, 2008-10-11 at 18:23 +0100, James Westby wrote: > My use case for uscan --download-version is to programatically retrieve > old versions of an upstream tarball. Currently this will give output > like this: [...] > Newest version on remote site is 0.81.5, local version is 0.82.0 > => remote site does not even have current version > > refusing to download the requested version. The problem is that the > "lastversion" variable is set to what you pass for --download-version > to make it download that version, but then this code checks that > against the current upstream version, and thinks that there is nothing > new to download. > > My patch skips this check if --download-version is specified, as for my > use case any checks like this make no sense. It gives output like:
The original use case for --download-version involved uscan being invoked with "--upstream-version 0"; in that case, everything just works [tm]. I agree it would be useful if your use case worked as well, however. One quick comment on the patch - I think the else block should be replicated so that "if uscan --download-version blah" does what one would expect (well, what I'd expect :)) - I'm therefore proposing applying the attached patch; comments welcome. Regards, Adam
Index: scripts/uscan.pl =================================================================== --- scripts/uscan.pl (revision 1655) +++ scripts/uscan.pl (working copy) @@ -1142,18 +1142,24 @@ # We use dpkg's rules to determine whether our current version # is newer or older than the remote version. - if (system("dpkg --compare-versions '$mangled_lastversion' gt '$newversion'") == 0) { - if ($verbose) { - print " => remote site does not even have current version\n"; - } elsif ($dehs) { - $dehs_tags{'status'} = "Debian version newer than remote site"; + if (!defined $download_version) { + if (system("dpkg --compare-versions '$mangled_lastversion' gt '$newversion'") == 0) { + if ($verbose) { + print " => remote site does not even have current version\n"; + } elsif ($dehs) { + $dehs_tags{'status'} = "Debian version newer than remote site"; + } else { + print "$pkg: remote site does not even have current version\n"; + } + return 0; } else { - print "$pkg: remote site does not even have current version\n"; + # There's a newer upstream version available, which may already + # be on our system or may not be + $found++; } - return 0; } else { - # There's a newer upstream version available, which may already - # be on our system or may not be + # Flag that we found a newer upstream version, so that the exit status + # is set correctly $found++; }