Package: devscripts
Version: 2.11.3
uscan uses dpkg --compare-versions to compare upstream versions.
But this command takes debian versions, which means it produces wrong
results if the upstream version contains colons or minus signs.
For example 3-1-1-3 > 3-1-4 (as 'upstream' is 3-1-1 vs. 3-1)
To work around this attached patch compares versions after prefixing
them with a fake epoch an suffixing them with a fake revision.
Bernhard R. Link
>From 1b0c6ac85a5e1732016fcd36b0de38e8151e75a9 Mon Sep 17 00:00:00 2001
From: "Bernhard R. Link" <[email protected]>
Date: Tue, 7 Feb 2012 10:53:12 +0100
Subject: [PATCH] uscan: properly cope with colons and minus signs in upstream
versions
uscan uses dpkg --compare-versions to compare upstream versions.
But this command takes debian versions, which means it produces wrong
results if the upstream version contains colons or minus signs.
To work around this compare the upstream versions with a epoch before
and a revision afterwards, so that dpkg --compare-versions treats
remaining colons or minus signs as part of the upstream version.
For example 3-1-1-3 > 3-1-4 (as 'upstream' is 3-1-1 vs. 3-1)
but 3-1-1-3-1 < 3-1-4-1 (as 'upstream' is 3-1-1-3 vs. 3-1-4)
Signed-off-by: Bernhard R. Link <[email protected]>
---
scripts/uscan.pl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 3b325a5..2018172 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1204,7 +1204,7 @@ EOF
# Can't just use $lastversion eq $newversion, as then 0.01 and 0.1
# compare different, whereas they are treated as equal by dpkg
- if (system("dpkg", "--compare-versions", "$mangled_lastversion", "eq", "$newversion") == 0) {
+ if (system("dpkg", "--compare-versions", "1:${mangled_lastversion}-0", "eq", "1:${newversion}-0") == 0) {
if ($verbose or ($download == 0 and $report and ! $dehs)) {
print $pkg_report_header;
$pkg_report_header = '';
@@ -1231,7 +1231,7 @@ EOF
# We use dpkg's rules to determine whether our current version
# is newer or older than the remote version.
if (!defined $download_version) {
- if (system("dpkg", "--compare-versions", "$mangled_lastversion", "gt", "$newversion") == 0) {
+ if (system("dpkg", "--compare-versions", "1:${mangled_lastversion}-0", "gt", "1:${newversion}-0") == 0) {
if ($verbose) {
print " => remote site does not even have current version\n";
} elsif ($dehs) {
--
1.7.9