lintian: r1359 - in trunk: checks debian testset testset/cdbs-test/debian testset/dh7-test/debian
Author: rra
Date: 2008-06-07 09:50:41 +0200 (Sat, 07 Jun 2008)
New Revision: 1359
Added:
trunk/checks/watch-file
trunk/checks/watch-file.desc
trunk/testset/cdbs-test/debian/watch
trunk/testset/cdbs-test_1.orig.tar.gz
trunk/testset/dh7-test/debian/watch
trunk/testset/dh7-test_1.dfsg.orig.tar.gz
Modified:
trunk/debian/changelog
trunk/testset/dh7-test/debian/changelog
trunk/testset/tags.cdbs-test
trunk/testset/tags.dh7-test
trunk/testset/tags.diffs
Log:
* checks/watch-file{.desc,}:
+ [RA] New checks for watch files, based on work by Patrick
Schoenfeld. (Closes: #234202, #409104, #456629, #472499)
Added: trunk/checks/watch-file
===================================================================
--- trunk/checks/watch-file (rev 0)
+++ trunk/checks/watch-file 2008-06-07 07:50:41 UTC (rev 1359)
@@ -0,0 +1,91 @@
+# watch-file -- lintian check script -*- perl -*-
+#
+# Copyright (C) 2008 Patrick Schoenfeld
+# Copyright (C) 2008 Russ Allbery
+#
+# 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
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::watch_file;
+use strict;
+
+use Lintian::Collect;
+use Tags;
+
+sub run {
+
+my $pkg = shift;
+my $type = shift;
+my $collect = Lintian::Collect->new($pkg, $type);
+
+unless ($collect->native) {
+ unless (-f "debfiles/watch") {
+ tag 'debian-watch-file-is-missing';
+ return;
+ }
+
+ # Gather information from the watch file and look for problems we can
+ # diagnose on the first time through.
+ open(WATCH, '<', 'debfiles/watch') or fail("cannot open watch file: $!");
+ local $_;
+ my ($watchver, $mangle);
+ while (<WATCH>) {
+ next if /^\s*\#/;
+ next if /^\s*$/;
+ if (/^version=(\d+)(\s|\Z)/) {
+ if (defined $watchver) {
+ tag 'debian-watch-file-declares-multiple-versions', "line $.";
+ }
+ $watchver = $1;
+ if ($watchver ne '2' and $watchver ne '3') {
+ tag 'debian-watch-file-unknown-version', $watchver;
+ }
+ } else {
+ unless ($watchver) {
+ tag 'debian-watch-file-missing-version';
+ $watchver = 1;
+ }
+ while (s/\\\s*$//) {
+ $_ .= <WATCH>;
+ }
+ chomp;
+ my ($opts, @opts);
+ if (s/^opts=(\S+)\s*// || s/^opts=\"([^\"]+)\"//) {
+ $opts = $1;
+ @opts = split(',', $opts);
+ $mangle = 1 if grep { /^[ud]versionmangle/ } @opts;
+ }
+ }
+ }
+ close WATCH;
+
+ # If the version of the package contains dfsg, assume that it needs to be
+ # mangled to get reasonable matches with upstream.
+ my $version = $collect->field('version');
+ if ($version =~ /dfsg/ and not $mangle) {
+ tag 'debian-watch-file-should-mangle-version';
+ }
+}
+
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 ts=4 et shiftround
Added: trunk/checks/watch-file.desc
===================================================================
--- trunk/checks/watch-file.desc (rev 0)
+++ trunk/checks/watch-file.desc 2008-06-07 07:50:41 UTC (rev 1359)
@@ -0,0 +1,52 @@
+Check-Script: watch-file
+Author: Patrick Schoenfeld <schoenfeld@in-medisa-res.com>
+Abbrev: watch
+Type: source
+Unpack-Level: 1
+Needs-Info: debfiles
+Info: Check debian/watch files in source packages.
+
+Tag: debian-watch-file-is-missing
+Type: info
+Ref: policy 4.11, uscan(1)
+Info: This source package is not Debian-native but it does not have a
+ <tt>debian/watch</tt> file. This file is used for automatic detection of
+ new upstream versions by the Debian External Health Status project and
+ other project infrastructure. If this package is maintained upstream,
+ please consider adding a <tt>debian/watch</tt> file to detect new
+ releases. If the package is not maintained upstream, consider adding a
+ <tt>debian/watch</tt> file containing only comments to document this.
+
+Tag: debian-watch-file-declares-multiple-versions
+Type: warning
+Ref: uscan(1)
+Info: The <tt>debian/watch</tt> file in this package contains multiple
+ lines starting with <tt>version=</tt>. There should be only one version
+ declaration in a watch file, on the first non-comment line of the file.
+
+Tag: debian-watch-file-unknown-version
+Type: warning
+Ref: uscan(1)
+Info: The <tt>version=</tt> line in the <tt>debian/watch</tt> file in this
+ package declares an unknown version. The currently known watch file
+ versions are 2 and 3.
+
+Tag: debian-watch-file-missing-version
+Type: warning
+Ref: uscan(1)
+Info: The <tt>debian/watch</tt> file in this package doesn't start a
+ <tt>version=</tt> line. The first non-comment line of
+ <tt>debian/watch</tt> should be a <tt>version=</tt> declaration. This
+ may mean that this is an old version one watch file that should be
+ updated to the current version.
+
+Tag: debian-watch-file-should-mangle-version
+Type: warning
+Ref: uscan(1)
+Info: The version of this package contains <tt>dfsg</tt>, which normally
+ indicates that the upstream source has been repackaged to comply with the
+ Debian Free Software Guidelines, but there is no version mangling in the
+ <tt>debian/watch</tt> file. Since the <tt>dfsg</tt> string is not
+ part of the upstream version, the <tt>debian/watch</tt> file should
+ normally use the dversionmangle option to remove the <tt>dfsg</tt> before
+ version number comparison.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-06-07 07:47:11 UTC (rev 1358)
+++ trunk/debian/changelog 2008-06-07 07:50:41 UTC (rev 1359)
@@ -74,6 +74,9 @@
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)
+ * checks/watch-file{.desc,}:
+ + [RA] New checks for watch files, based on work by Patrick
+ Schoenfeld. (Closes: #234202, #409104, #456629, #472499)
* data/fields/obsolete-packages:
+ [RA] Moved from common_data.pm. Removed many very old packages that
Added: trunk/testset/cdbs-test/debian/watch
===================================================================
--- trunk/testset/cdbs-test/debian/watch (rev 0)
+++ trunk/testset/cdbs-test/debian/watch 2008-06-07 07:50:41 UTC (rev 1359)
@@ -0,0 +1,4 @@
+# Test of multiple and unknown version numbers in a watch file.
+version=2
+version=4
+http://example.com/cdbs-test-(.*)\.tar\.gz
Added: trunk/testset/cdbs-test_1.orig.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/testset/cdbs-test_1.orig.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/testset/dh7-test/debian/changelog
===================================================================
--- trunk/testset/dh7-test/debian/changelog 2008-06-07 07:47:11 UTC (rev 1358)
+++ trunk/testset/dh7-test/debian/changelog 2008-06-07 07:50:41 UTC (rev 1359)
@@ -1,4 +1,4 @@
-dh7-test (1-1) unstable; urgency=low
+dh7-test (1.dfsg-1) unstable; urgency=low
* Initial release
Added: trunk/testset/dh7-test/debian/watch
===================================================================
--- trunk/testset/dh7-test/debian/watch (rev 0)
+++ trunk/testset/dh7-test/debian/watch 2008-06-07 07:50:41 UTC (rev 1359)
@@ -0,0 +1,5 @@
+# watch file with no version mangling, even though there's a dfsg in the
+# package version number.
+
+version=2
+http://www.example.com/dist/ dh7-test\.([\d.]+)\.tar\.gz
Added: trunk/testset/dh7-test_1.dfsg.orig.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/testset/dh7-test_1.dfsg.orig.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/testset/tags.cdbs-test
===================================================================
--- trunk/testset/tags.cdbs-test 2008-06-07 07:47:11 UTC (rev 1358)
+++ trunk/testset/tags.cdbs-test 2008-06-07 07:50:41 UTC (rev 1359)
@@ -2,7 +2,8 @@
E: cdbs-test source: missing-python-build-dependency
I: cdbs-test source: build-depends-without-arch-dep yada
I: cdbs-test source: package-lacks-versioned-build-depends-on-debhelper 5
-W: cdbs-test source: native-package-with-dash-version
+W: cdbs-test source: debian-watch-file-declares-multiple-versions line 3
+W: cdbs-test source: debian-watch-file-unknown-version 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
Modified: trunk/testset/tags.dh7-test
===================================================================
--- trunk/testset/tags.dh7-test 2008-06-07 07:47:11 UTC (rev 1358)
+++ trunk/testset/tags.dh7-test 2008-06-07 07:50:41 UTC (rev 1359)
@@ -1,6 +1,6 @@
W: dh7-test source: changelog-should-mention-nmu
W: dh7-test source: debhelper-script-needs-versioned-build-depends dh (>= 7)
-W: dh7-test source: native-package-with-dash-version
+W: dh7-test source: debian-watch-file-should-mangle-version
W: dh7-test source: no-human-maintainers
-W: dh7-test source: source-nmu-has-incorrect-version-number 1-1
+W: dh7-test source: source-nmu-has-incorrect-version-number 1.dfsg-1
W: dh7-test: new-package-should-close-itp-bug
Modified: trunk/testset/tags.diffs
===================================================================
--- trunk/testset/tags.diffs 2008-06-07 07:47:11 UTC (rev 1358)
+++ trunk/testset/tags.diffs 2008-06-07 07:50:41 UTC (rev 1359)
@@ -4,6 +4,7 @@
E: diffs: no-copyright-file
E: diffs: unstripped-binary-or-object ./usr/bin/diffs
I: diffs source: build-depends-without-arch-dep dpatch
+I: diffs source: debian-watch-file-is-missing
I: diffs source: diff-contains-editor-backup-file binary.c~
I: diffs source: source-contains-git-control-dir .git
I: diffs source: source-contains-svn-commit-file svn-commit.tmp
Reply to: