lintian: r1356 - in trunk: checks debian testset testset/cdbs-test/debian testset/relations/debian
Author: rra
Date: 2008-06-07 06:55:09 +0200 (Sat, 07 Jun 2008)
New Revision: 1356
Modified:
trunk/checks/standards-version
trunk/checks/standards-version.desc
trunk/debian/changelog
trunk/debian/control
trunk/testset/cdbs-test/debian/changelog
trunk/testset/relations/debian/changelog
trunk/testset/relations/debian/control
trunk/testset/tags.debconf
trunk/testset/tags.debug
trunk/testset/tags.relations
Log:
* checks/standards-version{.desc,}:
+ [RA] Largely rewritten. Now contains a list of standards versions
with the date when they were released, adding 3.8.0. Only emit tag
out-of-date-standards-version if the newer version predates the date
of the package. Base ancient-standards-version on whether the
standards version of the package is more than two years old. Remove
package-declares-source-relation-but-has-older-standards-version;
policy 3.1.0 was a long time ago. (Closes: #472513)
Modified: trunk/checks/standards-version
===================================================================
--- trunk/checks/standards-version 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/checks/standards-version 2008-06-07 04:55:09 UTC (rev 1356)
@@ -1,17 +1,17 @@
# standards-version -- lintian check script -*- perl -*-
# Copyright (C) 1998 Christian Schwarz and Richard Braakman
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, you can find it on the World Wide
# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
@@ -20,114 +20,124 @@
package Lintian::standards_version;
use strict;
+
+use Date::Parse qw(str2time);
+use Parse::DebianChangelog;
+
use Tags;
use Util;
+# This is a list of all known standards versions, current and older, with
+# their dates of publication.
+my @standards =
+ ([ '3.8.0' => '2008-06-04' ],
+ [ '3.7.3' => '2007-12-02' ],
+ [ '3.7.2' => '2006-05-03' ],
+ [ '3.7.1' => '2006-05-03' ],
+ [ '3.7.0' => '2006-04-25' ],
+ [ '3.6.2' => '2005-06-16' ],
+ [ '3.6.1' => '2003-08-19' ],
+ [ '3.6.0' => '2003-07-09' ],
+ [ '3.5.10' => '2003-05-10' ],
+ [ '3.5.9' => '2003-03-07' ],
+ [ '3.5.8' => '2002-11-15' ],
+ [ '3.5.7' => '2002-08-31' ],
+ [ '3.5.6' => '2001-07-24' ],
+ [ '3.5.5' => '2001-07-01' ],
+ [ '3.5.4' => '2001-04-28' ],
+ [ '3.5.3' => '2001-04-15' ],
+ [ '3.5.2' => '2001-02-18' ],
+ [ '3.5.1' => '2001-02-15' ],
+ [ '3.5.0' => '2001-01-28' ],
+ [ '3.2.1' => '2000-08-24' ],
+ [ '3.2.0' => '2000-07-30' ],
+ [ '3.1.1' => '1999-11-16' ],
+ [ '3.1.0' => '1999-11-04' ],
+ [ '3.0.1' => '1999-07-15' ],
+ [ '3.0.0' => '1999-06-30' ],
+ [ '2.5.1' => '1999-04-27' ],
+ [ '2.5.0' => '1998-10-29' ],
+ [ '2.4.1' => '1998-04-14' ],
+ [ '2.4.0' => '1998-01-30' ],
+ [ '2.3.0' => '1997-09-02' ],
+ [ '2.2.0' => '1997-07-13' ],
+ [ '2.1.3' => '1997-03-15' ],
+ [ '2.1.2' => '1996-11-22' ],
+ [ '2.1.1' => '1996-09-12' ],
+ [ '2.1.0' => '1996-09-01' ],
+ [ '2.0.1' => '1996-08-31' ],
+ [ '2.0.0' => '1996-08-26' ],
+ [ '0.2.1' => '1996-08-23' ],
+ [ '0.2.0' => '1996-08-21' ]);
+my %standards = map { $$_[0] => $$_[1] } @standards;
+my $current = $standards[0][0];
+my @current = split (/\./, $current);
+
sub run {
-# 1 means current
-# 2 means old
-# 3 means ancient
-my %valid_standard = (
- '3.8.0', 1,
- '3.7.3', 2,
- '3.7.2', 2,
- '3.7.1', 2,
- '3.7.0', 2,
- '3.6.2', 3,
- '3.6.1', 3,
- '3.6.0', 3,
- '3.5.10', 3,
- '3.5.9', 3,
- '3.5.8', 3,
- '3.5.7', 3,
- '3.5.6', 3,
- '3.5.5', 3,
- '3.5.4', 3,
- '3.5.3', 3,
- '3.5.2', 3,
- '3.5.1', 3,
- '3.5.0', 3,
- '3.2.1', 3,
- '3.2.0', 3,
- '3.1.1', 3,
- '3.1.0', 3,
- '3.0.1', 3,
- '3.0.0', 3,
- '2.5.1', 3,
- '2.5.0', 3,
- '2.4.1', 3,
- '2.4.0', 3,
- '2.3.0', 3,
- '2.2.0', 3,
- '2.1.3', 3,
- '2.1.2', 3,
- '2.1.1', 3,
- '2.1.0', 3,
- '2.0.1', 3,
- '2.0.0', 3,
- '0.2.1', 3,
- '0.2.0', 3,
- );
-
-# version lintian is programmed for. ($valid_standard[0]?)
-my $MAJOR = 3;
-my $MINOR = 8;
-my $PATCH = 0;
-
my $pkg = shift;
my $type = shift;
-unless ( -d "fields" ) {
- fail("fields/ directory missing in lintian laboratory");
-};
-
-my $std = "fields/standards-version";
-# Standards-Version?
-if (not -f $std) {
- # udebs aren't required to conform to policy, so they don't need
- # Standards-Version. (If they have it, though, it should be valid.)
- tag "no-standards-version-field", "" unless $type eq 'udeb';
+# udebs aren't required to conform to policy, so they don't need
+# Standards-Version. (If they have it, though, it should be valid.)
+unless (open(STANDARD, '<', 'fields/standards-version')) {
+ tag 'no-standards-version-field' unless $type eq 'udeb';
return 0;
}
+my $version = <STANDARD>;
+close STANDARD;
+chomp $version;
-open(IN, '<', $std) or fail("cannot open $std for reading: $!");
-chop($_ = <IN>);
-close(IN);
-
-unless (m/^\s*(\d+\.\d+\.\d+)(?:\.\d+)?\s*$/) {
- # invalid standard
- tag "invalid-standards-version", "$_";
+# Check basic syntax and strip off the fourth digit. People are allowed to
+# include the fourth digit if they want, but it indicates a non-normative
+# change in Policy and is therefore meaningless in the Standards-Version
+# field.
+unless ($version =~ m/^\s*(\d+\.\d+\.\d+)(?:\.\d+)?\s*$/) {
+ tag 'invalid-standards-version', $version;
return 0;
}
-
my $stdver = $1;
my ($major, $minor, $patch) = $stdver =~ m/^(\d+)\.(\d+)\.(\d+)/;
-if (not exists $valid_standard{$stdver}) {
- # unknown standard. perhaps newer?
- if (($major > $MAJOR) or
- ($major == $MAJOR and $minor > $MINOR) or
- ($major == $MAJOR and $minor == $MINOR and $patch > $PATCH)) {
- tag "newer-standards-version", "$_ (current is $MAJOR.$MINOR.$PATCH)";
+if (not exists $standards{$stdver}) {
+ # Unknown standards version. Perhaps newer?
+ if ( ($major > $current[0])
+ or ($major == $current[0] and $minor > $current[1])
+ or ($major == $current[0] and $minor == $current[1]
+ and $patch > $current[2])) {
+ tag 'newer-standards-version', "$version (current is $current)";
} else {
- # invalid standard
- tag "invalid-standards-version", "$_";
+ tag 'invalid-standards-version', $version;
}
-} elsif ($valid_standard{$stdver} == 2) {
- # old standard
- tag "out-of-date-standards-version", "$_ (current is $MAJOR.$MINOR.$PATCH)";
-} elsif ($valid_standard{$stdver} == 3) {
- # OK, now this is ancient.
- tag "ancient-standards-version", "$_ (current is $MAJOR.$MINOR.$PATCH)";
-} else { # looks valid ......
- if (($major == 3 and $minor == 0) or $major < 3) {
- if (-f "fields/build-depends" or
- -f "fields/build-depends-indep" or
- -f "fields/build-conflicts" or
- -f "fields/build-conflicts-indep") {
- tag "package-declares-source-relation-but-has-older-standards-version", "$_ < 3.1.0";
- }
+} 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
+ # 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)) {
+ tag 'ancient-standards-version', "$version (current is $current)";
+ } else {
+ # We have to get the package date from the changelog file. If we
+ # can't find the changelog file, always issue the tag.
+ if (-l 'debfiles/changelog' || ! -f 'debfiles/changelog') {
+ tag 'out-of-date-standards-version',
+ "$version (current is $current)";
+ return 0;
+ }
+ my %opts = (infile => 'debfiles/changelog', quiet => 1);
+ my $changes = Parse::DebianChangelog->init(\%opts);
+ 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',
+ "$version (current is $current)";
+ }
+ }
}
}
@@ -136,7 +146,7 @@
1;
# Local Variables:
-# indent-tabs-mode: t
+# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
-# vim: syntax=perl sw=4 ts=8
+# vim: syntax=perl sw=4 sts=4 ts=4 et shiftround
Modified: trunk/checks/standards-version.desc
===================================================================
--- trunk/checks/standards-version.desc 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/checks/standards-version.desc 2008-06-07 04:55:09 UTC (rev 1356)
@@ -4,49 +4,45 @@
Type: source
Unpack-Level: 1
Info: This script checks if a source package contains a valid
- `Standards-Version' field.
+ Standards-Version field.
+Needs-Info: debfiles
Tag: no-standards-version-field
Type: error
-Info: The source package does not have a `Standards-Version' control field.
- Please update your package to latest policy and set this control field
+Ref: policy 5.6.11
+Info: The source package does not have a Standards-Version control field.
+ Please update your package to latest Policy and set this control field
appropriately.
-Tested: empty
Tag: invalid-standards-version
Type: error
-Info: The source package refers to a `Standards-Version' which never
- existed. Please update your package to latest policy and set this
+Info: The source package refers to a Standards-Version which never
+ existed. Please update your package to latest Policy and set this
control field appropriately.
Tag: newer-standards-version
Type: warning
-Info: The source package refers to a `Standards-Version' which is
+Info: The source package refers to a Standards-Version which is
newer than the highest one lintian is programmed to check. If the source
package is correct, then please upgrade lintian to the newest version.
- (If there is no newer lintian version, then please bug &maint; to
- make one.)
+ (If there is no newer lintian version, then please bug &maint; to make
+ one.)
Tag: ancient-standards-version
Type: warning
-Info: The source package refers to a `Standards-Version' older than one
- year. Please update your package to latest policy and set this
+Info: The source package refers to a Standards-Version that is more than
+ two years old. Please update your package to latest Policy and set this
control field appropriately.
.
- If the package is already compliant with the current standards, you
- don't have to re-upload the package just to adjust the
- Standards-Version control field. However, please remember to update
- this field next time you upload the package.
+ If the package is already compliant with the current standards, you don't
+ have to re-upload the package just to adjust the Standards-Version
+ control field. However, please remember to update this field next time
+ you upload the package.
Tag: out-of-date-standards-version
Type: warning
-Info: The source package refers to a 'Standards-Version' that is starting
- to get out of date, compared to current Policy. You can safely ignore this
- warning, but please consider updating the package to current Policy.
-
-Tag: package-declares-source-relation-but-has-older-standards-version
-Type: error
-Info: Source relations were added in 3.1.0, packages with an older standards
- version should not have them. Most likely the standards version of the
- package simply needs updating. However, policy should be referred to before
- assuming the package is completely up-to-date.
+Info: The source package refers to a Standards-Version older than the one
+ that was current at the time the package was created (according to the
+ timestamp of the latest <tt>debian/changelog</tt> entry). Please
+ consider updating the package to current Policy and setting this control
+ field appropriately.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/debian/changelog 2008-06-07 04:55:09 UTC (rev 1356)
@@ -64,9 +64,14 @@
chown. Patch by Raphael Geissert. (Closes: #483775)
+ [RA] $((var+1)) now works in dash and is in POSIX, so remove it from
bashisms. Patch by Adam D. Barratt. (Closes: #473156)
- * checks/standards-version:
- + [RA] Policy 3.8.0 is now current and anything older than 3.7.2 is
- now ancient.
+ * checks/standards-version{.desc,}:
+ + [RA] Largely rewritten. Now contains a list of standards versions
+ with the date when they were released, adding 3.8.0. Only emit tag
+ out-of-date-standards-version if the newer version predates the date
+ of the package. Base ancient-standards-version on whether the
+ standards version of the package is more than two years old. Remove
+ package-declares-source-relation-but-has-older-standards-version;
+ policy 3.1.0 was a long time ago. (Closes: #472513)
* data/fields/obsolete-packages:
+ [RA] Moved from common_data.pm. Removed many very old packages that
Modified: trunk/debian/control
===================================================================
--- trunk/debian/control 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/debian/control 2008-06-07 04:55:09 UTC (rev 1356)
@@ -17,8 +17,8 @@
Architecture: all
Depends: perl, libdigest-md5-perl | perl (>> 5.8), dpkg-dev (>= 1.13.17),
file, binutils, diffstat (>= 1.27-1), man-db (>= 2.3.20-1), gettext (>= 0.16),
- intltool-debian, libparse-debianchangelog-perl (>= 0.6), liburi-perl,
- libdigest-sha-perl
+ intltool-debian, libdigest-sha-perl, libparse-debianchangelog-perl (>= 0.6),
+ libtimedate-perl, liburi-perl
Suggests: binutils-multiarch, libtext-template-perl, man-db (>= 2.5.1-1)
Description: Debian package checker
Lintian dissects Debian packages and reports bugs and policy
Modified: trunk/testset/cdbs-test/debian/changelog
===================================================================
--- trunk/testset/cdbs-test/debian/changelog 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/testset/cdbs-test/debian/changelog 2008-06-07 04:55:09 UTC (rev 1356)
@@ -5,7 +5,7 @@
- New.
* Not really too long: “héh锓héh锓héh锓héh锓héh锓héhé”
- -- Lintian Maintainers <debian-lint-maint@lists.debian.org> Wed, 05 Dec 2007 17:23:59 -0800
+ -- Lintian Maintainers <debian-lint-maint@lists.debian.org> Thu, 05 Jun 2008 00:00:00 -0700
cdbs-test (1-1) unstable; urgency=low
Modified: trunk/testset/relations/debian/changelog
===================================================================
--- trunk/testset/relations/debian/changelog 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/testset/relations/debian/changelog 2008-06-07 04:55:09 UTC (rev 1356)
@@ -3,7 +3,7 @@
* I'm orphaning this package -- I'm sick of it: it's completely broken,
lintian complains all over the place.
- -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl> Sun, 18 Apr 2004 02:08:41 +0200
+ -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl> Sun, 02 Dec 2007 00:00:00 -0800
relations (4) unstable; urgency=low
Modified: trunk/testset/relations/debian/control
===================================================================
--- trunk/testset/relations/debian/control 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/testset/relations/debian/control 2008-06-07 04:55:09 UTC (rev 1356)
@@ -8,7 +8,7 @@
Build-Conflicts: foo [amd64 i386], bar [alpha test], xlibs-dev, arch-test1 [powerpc], arch-test2 [!sparc]
Build-Conflicts-Indep: debmake [!powerpc]
Maintainer: Debian QA Group <packages@qa.debian.org>
-Standards-Version: 3.1.1
+Standards-Version: 3.7.3
Homepage: lintian.debian.org
Origin: Debian
Bugs: debbugs://bugs.debian.org/
Modified: trunk/testset/tags.debconf
===================================================================
--- trunk/testset/tags.debconf 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/testset/tags.debconf 2008-06-07 04:55:09 UTC (rev 1356)
@@ -9,6 +9,7 @@
E: debconf-udeb udeb: udeb-postinst-must-not-call-ldconfig
I: debconf source: package-needs-python-policy-debhelper
I: debconf-test: debconf-error-requires-versioned-depends debconf/error
+W: debconf source: ancient-standards-version 3.7.2 (current is 3.8.0)
W: debconf source: debian-rules-calls-debhelper-in-odd-order dh_makeshlibs (line 48)
W: debconf source: debian-rules-calls-debhelper-in-odd-order dh_makeshlibs (line 52)
W: debconf source: debian-rules-sets-DH_COMPAT line 3
@@ -19,7 +20,6 @@
W: debconf source: misnamed-po-file debian/po/lang.po
W: debconf source: misnamed-po-file debian/po/sample-file.po
W: debconf source: newer-debconf-templates
-W: debconf source: out-of-date-standards-version 3.7.2 (current is 3.8.0)
W: debconf source: stray-translated-debconf-templates debconf-test.templates.de
W: debconf source: translated-default-field debconf-test.templates: 67
W: debconf source: translated-default-field debconf-test.templates: 72
Modified: trunk/testset/tags.debug
===================================================================
--- trunk/testset/tags.debug 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/testset/tags.debug 2008-06-07 04:55:09 UTC (rev 1356)
@@ -7,10 +7,10 @@
E: libhello0-dbg: sharedobject-in-library-directory-missing-soname usr/lib/libhello.so.dbg
I: debug source: non-standard-architecture kfreebsd-i386
I: debug source: non-standard-architecture ppc64
+W: debug source: ancient-standards-version 3.7.0 (current is 3.8.0)
W: debug source: changelog-should-not-mention-nmu
W: debug source: debhelper-script-needs-versioned-build-depends dh_icons (>= 5.0.51~)
W: debug source: debian-rules-sets-DH_COMPAT line 5
-W: debug source: out-of-date-standards-version 3.7.0 (current is 3.8.0)
W: hello: binary-without-manpage usr/bin/hello
W: hello: binary-without-manpage usr/bin/hello.dbg
W: libhello0-dbg: dbg-package-missing-depends libhello0
Modified: trunk/testset/tags.relations
===================================================================
--- trunk/testset/tags.relations 2008-06-07 03:32:17 UTC (rev 1355)
+++ trunk/testset/tags.relations 2008-06-07 04:55:09 UTC (rev 1356)
@@ -32,7 +32,6 @@
I: relations source: build-depends-without-arch-dep foo
I: relations source: build-depends-without-arch-dep libc6-dev
I: relations source: build-depends-without-arch-dep mail-transport-agent
-W: relations source: ancient-standards-version 3.1.1 (current is 3.8.0)
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: package-depends-on-itself relations depends
Reply to: