[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

New check: ahead-of-time-standards-version



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

This new check will cause more work whenever a new standards version is
known by lintian (because it requires updating either the control and
changelog files, or the tags file).

I've seen a couple of packages which would trigger this tag, so it is not
something I just imagined.

I set Type: error because it _is_ really bad to do that.

Patch attached.

Cheers,
- -- 
Atomo64 - Raphael

Please avoid sending me Word, PowerPoint or Excel attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIaZwyYy49rUbZzloRArL9AJ9GfFxQKm5qHfTGFmeaBB8UpDadnACdFqC9
x2PINkCxsKgWABHuBg07pL0=
=8QmH
-----END PGP SIGNATURE-----
diff --git a/checks/standards-version b/checks/standards-version
index 6248ab3..cbac441 100644
--- a/checks/standards-version
+++ b/checks/standards-version
@@ -109,31 +109,42 @@ if (not exists $standards{$stdver}) {
     } else {
         tag 'invalid-standards-version', $version;
     }
-} elsif ($stdver eq $current) {
-    # Current standard.  Nothing more to check.
-    return 0;
 } else {
-    # Otherwise, we need to see if the standard that this package declares is
+
+    my $stddate = $standards{$stdver};
+    my $changes = $info->changelog;
+    my $ood_check = 1;
+
+    # We need to see if the standard that this package declares is
     # both new enough to not be ancient and was the current standard at the
     # time the package was uploaded.
-    my $stddate = $standards{$stdver};
-    if (str2time($stddate) < time - (60 * 60 * 24 * 365 * 2)) {
+    if (    $stdver ne $current
+        and str2time($stddate) < time - (60 * 60 * 24 * 365 * 2)) {
         tag 'ancient-standards-version', $tag;
-    } else {
-        # We have to get the package date from the changelog file.  If we
-        # can't find the changelog file, always issue the tag.
-        my $changes = $info->changelog;
-        if (not defined $changes) {
+        # don't emit the out-of-date... tag if we already emit this one
+        $ood_check = 0;
+    }
+
+    if ($ood_check and not defined $changes and $stdver ne $current) {
+        tag 'out-of-date-standards-version', $tag;
+        return 0;
+    }
+    return 0 if (not defined $changes);
+
+    # Past this point the standards version is $current or older
+    # but the changelog _is_ present
+
+    my ($entry) = $changes->data;
+    my $timestamp = $entry ? $entry->Timestamp : 0;
+    for my $standard (@standards) {
+        if ($ood_check and str2time($standard->[1]) < $timestamp) {
             tag 'out-of-date-standards-version', $tag;
-            return 0;
+	    $ood_check = 0;
         }
-        my ($entry) = $changes->data;
-        my $timestamp = $entry ? $entry->Timestamp : 0;
-        for my $standard (@standards) {
-            last if $standard->[0] eq $stdver;
-            if (str2time($standard->[1]) < $timestamp) {
-                tag 'out-of-date-standards-version', $tag;
-            }
+        if (    $standard->[0] eq $stdver
+            and $timestamp < str2time($standard->[1])) {
+            tag 'ahead-of-time-standards-version';
+	    last;
         }
     }
 }
diff --git a/checks/standards-version.desc b/checks/standards-version.desc
index 5af8de9..5a2bb4e 100644
--- a/checks/standards-version.desc
+++ b/checks/standards-version.desc
@@ -46,3 +46,9 @@ Info: The source package refers to a Standards-Version older than the one
  timestamp of the latest <tt>debian/changelog</tt> entry).  Please
  consider updating the package to current Policy and setting this control
  field appropriately.
+
+Tag: ahead-of-time-standards-version
+Type: error
+Info: The source package refers to a Standards-Version newer than the one
+ that was current at the time the package was created (according to the
+ timestamp for the latest <tt>debian/changelog</tt> entry).
diff --git a/testset/tags.cdbs-test b/testset/tags.cdbs-test
index 7a30c9a..579d3b9 100644
--- a/testset/tags.cdbs-test
+++ b/testset/tags.cdbs-test
@@ -8,3 +8,4 @@ W: cdbs-test source: no-human-maintainers
 W: cdbs-test source: out-of-date-standards-version 3.7.3 (current is 3.8.0)
 W: cdbs-test source: package-has-a-duplicate-build-relation cdbs, cdbs
 W: cdbs-test: debian-changelog-line-too-long line 1
+W: cdbs-test: description-contains-duplicated-word bla bla
diff --git a/testset/tags.copyright b/testset/tags.copyright
index c78fa16..668440f 100644
--- a/testset/tags.copyright
+++ b/testset/tags.copyright
@@ -1,3 +1,4 @@
+E: copyright source: ahead-of-time-standards-version
 E: copyright.compressed: copyright-file-compressed
 E: copyright.full-apache-2: copyright-file-contains-full-apache-2-license
 E: copyright.full-gfdl: copyright-file-contains-full-gfdl-license
diff --git a/testset/tags.debconf b/testset/tags.debconf
index 7f43642..19bf9f9 100644
--- a/testset/tags.debconf
+++ b/testset/tags.debconf
@@ -1,3 +1,4 @@
+E: debconf source: ahead-of-time-standards-version
 E: debconf source: declares-possibly-conflicting-debhelper-compat-versions rules=4 compat=4
 E: debconf source: missing-dh_python-build-dependency
 E: debconf-test: extended-description-is-empty
diff --git a/testset/tags.debug b/testset/tags.debug
index 134cfcb..ba48175 100644
--- a/testset/tags.debug
+++ b/testset/tags.debug
@@ -1,3 +1,4 @@
+E: debug source: ahead-of-time-standards-version
 E: debug source: build-depends-indep-without-arch-indep
 E: debug source: version-substvar-for-external-package libhello0-dbg -> libhello
 E: hello: pkg-has-symbols-control-file-but-no-shared-libs
diff --git a/testset/tags.description b/testset/tags.description
index 9ef6bf0..6d379b3 100644
--- a/testset/tags.description
+++ b/testset/tags.description
@@ -1,3 +1,4 @@
+E: description source: ahead-of-time-standards-version
 E: description source: debian-rules-missing-required-target binary-arch
 E: description-bar: description-contains-invalid-control-statement
 E: description-bar: description-synopsis-is-empty
diff --git a/testset/tags.dh7-test b/testset/tags.dh7-test
index 15cf288..decc9b6 100644
--- a/testset/tags.dh7-test
+++ b/testset/tags.dh7-test
@@ -1,3 +1,4 @@
+E: dh7-test source: ahead-of-time-standards-version
 W: dh7-test source: changelog-should-mention-nmu
 W: dh7-test source: debhelper-script-needs-versioned-build-depends dh (>= 7)
 W: dh7-test source: debian-watch-file-should-mangle-version
diff --git a/testset/tags.diffs b/testset/tags.diffs
index d4196c6..8465478 100644
--- a/testset/tags.diffs
+++ b/testset/tags.diffs
@@ -1,3 +1,4 @@
+E: diffs source: ahead-of-time-standards-version
 E: diffs source: debian-files-list-in-source
 E: diffs: arch-independent-package-contains-binary-or-object ./usr/bin/diffs
 E: diffs: missing-dependency-on-libc needed by ./usr/bin/diffs
diff --git a/testset/tags.relations b/testset/tags.relations
index cff0ed5..8563a92 100644
--- a/testset/tags.relations
+++ b/testset/tags.relations
@@ -40,6 +40,7 @@ I: relations-multiple-libs: ored-depends-on-obsolete-package suggests: gs
 I: relations: ored-depends-on-obsolete-package recommends: gs-aladdin
 W: relations source: bad-homepage lintian.debian.org
 W: relations source: build-depends-on-1-revision build-depends-indep: libfoo (>= 1.2-1)
+W: relations source: out-of-date-standards-version 3.7.3 (current is 3.8.0)
 W: relations source: package-depends-on-itself relations depends
 W: relations source: package-depends-on-itself relations-multiple-libs recommends
 W: relations source: package-has-a-duplicate-build-relation foo (= 3) [!amd64 !i386], foo (<< 4) [!amd64 !i386]


Reply to: