Package: lintian
Version: 2.5.13 
Tags: patch
X-Debbugs-Cc: p...@packages.debian.org

The fix for #708178 brought epochs into data/fields/perl-provides,
triggering a false positive for libversion-perl_1:0.9902-1 

 W: libversion-perl: package-superseded-by-perl with 1:0.8800

The attached patch should fix this.
-- 
Niko Tyni   nt...@debian.org
>From 0ea0730e0d2df850bdc385180fad12298bb24931 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Mon, 3 Jun 2013 16:22:59 +0300
Subject: [PATCH] Fix 'package-superseded-by-perl' epoch handling

The perl-provides data now includes epochs, so we have
to take those into account when comparing the package version
to the one in the Perl core.

The test relies on the fact that libversion-perl currently has an epoch
in the Debian archive. The old code would strip the test package epoch
before the comparison, so 9:999 was falsely smaller than 1:0.8800.
---
 checks/fields                                         |    5 +++--
 t/tests/fields-perl-provides/debian/debian/control.in |   10 ++++++++++
 t/tests/fields-perl-provides/debian/debian/rules      |    8 ++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100755 t/tests/fields-perl-provides/debian/debian/rules

diff --git a/checks/fields b/checks/fields
index 81f83a2..5fe8691 100644
--- a/checks/fields
+++ b/checks/fields
@@ -239,7 +239,8 @@ if (not defined $info->field('version')) {
     my $dversion = Dpkg::Version->new($version);
 
     if ($dversion->is_valid) {
-        my ($upstream, $debian) = ($dversion->version, $dversion->revision);
+        my ($epoch, $upstream, $debian) =
+            ($dversion->epoch, $dversion->version, $dversion->revision);
         if ($upstream !~ /^\d/i) {
             tag 'upstream-version-not-numeric', $version;
         }
@@ -294,7 +295,7 @@ if (not defined $info->field('version')) {
 
         my $name = $info->field('package');
         if ($name && $PERL_CORE_PROVIDES->known($name) &&
-                perl_core_has_version($name, '>=', $upstream)) {
+                perl_core_has_version($name, '>=', "$epoch:$upstream")) {
             my $core_version = $PERL_CORE_PROVIDES->value($name);
             tag 'package-superseded-by-perl', "with $core_version"
         }
diff --git a/t/tests/fields-perl-provides/debian/debian/control.in b/t/tests/fields-perl-provides/debian/debian/control.in
index 07ef20b..d81d209 100644
--- a/t/tests/fields-perl-provides/debian/debian/control.in
+++ b/t/tests/fields-perl-provides/debian/debian/control.in
@@ -15,3 +15,13 @@ Description: {$description}
  things.  It should not be installed like a regular package.  It may
  be an empty package.
 
+Package: libversion-perl
+Section: perl
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: another {$description}
+ This is another test package, designed to exercise epoch handling
+ in the 'package-superseded-by-perl' check. It is part of the Lintian
+ test suite and may do very odd things.  It should not be installed like
+ a regular package.  It may be an empty package.
+
diff --git a/t/tests/fields-perl-provides/debian/debian/rules b/t/tests/fields-perl-provides/debian/debian/rules
new file mode 100755
index 0000000..c965de0
--- /dev/null
+++ b/t/tests/fields-perl-provides/debian/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+%:
+	dh $@
+
+override_dh_gencontrol:
+	dh_gencontrol -plibversion-perl -- -v9:999
+	dh_gencontrol -i -Nlibversion-perl
+
-- 
1.7.10.4

Reply via email to