lintian: r1034 - in trunk: checks debian testset testset/relations/debian
Author: rra
Date: 2007-12-04 06:27:34 +0100 (Tue, 04 Dec 2007)
New Revision: 1034
Modified:
trunk/checks/control-file
trunk/checks/control-file.desc
trunk/debian/changelog
trunk/testset/relations/debian/control
trunk/testset/tags.relations
Log:
* checks/control-file:
+ [RA] Diagnose stronger dependencies that imply weaker dependencies,
such as the same dependency in both Depends and Recommends or
Recommends and Suggests. Thanks, Joerg Jaspert. (Closes: #453302)
Modified: trunk/checks/control-file
===================================================================
--- trunk/checks/control-file 2007-12-04 05:25:34 UTC (rev 1033)
+++ trunk/checks/control-file 2007-12-04 05:27:34 UTC (rev 1034)
@@ -22,6 +22,7 @@
use strict;
use lib "$ENV{'LINTIAN_ROOT'}/checks/";
use common_data;
+use Dep;
use Util;
use Tags;
@@ -76,6 +77,25 @@
$binary_control->{"build-conflicts"} || $binary_control->{"build-conflicts-indep"});
}
+# Make sure that a stronger dependency field doesn't imply any of the elements
+# of a weaker dependency field. dpkg-gencontrol will fix this up for us, but
+# we want to check the source package since dpkg-gencontrol may silently "fix"
+# something that's a more subtle bug.
+my @dep_fields = qw(pre-depends depends recommends suggests);
+for my $control (@binary_controls) {
+ for my $strong (0 .. ($#dep_fields - 1)) {
+ next unless $control->{$dep_fields[$strong]};
+ my $parsed = Dep::parse ($control->{$dep_fields[$strong]});
+ for my $weak (($strong + 1) .. $#dep_fields) {
+ next unless $control->{$dep_fields[$weak]};
+ for my $dependency (split /\s*,\s*/, $control->{$dep_fields[$weak]}) {
+ tag "stronger-dependency-implies-weaker", "$dep_fields[$strong] -> $dep_fields[$weak]", $dependency
+ if Dep::implies($parsed, Dep::parse($dependency));
+ }
+ }
+ }
+}
+
# Check that every package is in the same archive category, except that
# sources in main can deliver both main and contrib packages. The source
# package may or may not have a section specified; if it doesn't, derive the
Modified: trunk/checks/control-file.desc
===================================================================
--- trunk/checks/control-file.desc 2007-12-04 05:25:34 UTC (rev 1033)
+++ trunk/checks/control-file.desc 2007-12-04 05:27:34 UTC (rev 1034)
@@ -68,3 +68,15 @@
of dpkg 1.14.6, the XS- prefix is no longer necessary. dpkg now
recognizes these headers and handles them correctly. Consider removing
the XS- prefix for this field.
+
+Tag: stronger-dependency-implies-weaker
+Type: warning
+Ref: 7.2
+Info: A stronger dependency field implies one of the dependencies in a
+ weaker dependency field. In other words, the Depends field of the
+ package requires that one of the packages listed in Recommends or
+ Suggests be installed, or a package is listed in Recommends as well as
+ Recommends. Current versions of dpkg-gencontrol will silently fix this
+ problem by removing the weaker dependency, but it may indicate a more
+ subtle bug (misspelling or forgetting to remove the stronger dependency
+ when it was moved to the weaker field).
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2007-12-04 05:25:34 UTC (rev 1033)
+++ trunk/debian/changelog 2007-12-04 05:27:34 UTC (rev 1034)
@@ -12,6 +12,10 @@
B. McCarty. (Closes: #448207)
* checks/common_data.pm:
+ [RA] Add Dm-Upload-Allowed as a control field. (Closes: #453779)
+ * checks/control-file:
+ + [RA] Diagnose stronger dependencies that imply weaker dependencies,
+ such as the same dependency in both Depends and Recommends or
+ Recommends and Suggests. Thanks, Joerg Jaspert. (Closes: #453302)
* checks/control-files:
+ [RA] Add symbols as a known control file for debs and udebs.
* checks/copyright-file:
Modified: trunk/testset/relations/debian/control
===================================================================
--- trunk/testset/relations/debian/control 2007-12-04 05:25:34 UTC (rev 1033)
+++ trunk/testset/relations/debian/control 2007-12-04 05:27:34 UTC (rev 1034)
@@ -15,13 +15,14 @@
Package: relations
Architecture: all
Section: contrib/misc
+Pre-Depends: awk|gawk
Depends: relations(<< 3), dpkg, bash (>> 2.0 ), mail-transport-agent, gawk | awk, foo (>> 2.0), foo (<< 2.2), coreutils, null (>= 0)
Provides: mail-reader
Replaces: relations
Conflicts: foobar (<< 5&5), foo, relations,
gnuwdf,
-Suggests: alpha, gnu (>= 44-3-4-8-11.4) | ung (<< 89beta) | nug | ngu, beta
-Recommends: emacs21 | emacsen
+Suggests: alpha, gnu (>= 44-3-4-8-11.4) | ung (<< 89beta) | nug | ngu, beta, some-other-package
+Recommends: emacs21 | emacsen, dpkg, null, some-other-package
Description: Strange dependency relationships
This package declares relationships designed to tickle lintian's "fields"
check. It should generate a number of tags for these.
Modified: trunk/testset/tags.relations
===================================================================
--- trunk/testset/tags.relations 2007-12-04 05:25:34 UTC (rev 1033)
+++ trunk/testset/tags.relations 2007-12-04 05:27:34 UTC (rev 1034)
@@ -4,7 +4,7 @@
E: relations source: build-depends-on-essential-package-without-using-version build-depends-indep: bash
E: relations source: build-depends-on-essential-package-without-using-version build-depends: findutils
E: relations source: build-depends-on-obsolete-package build-depends-indep: debmake
-E: relations source: debian-control-with-duplicate-fields provides: 36, 37
+E: relations source: debian-control-with-duplicate-fields provides: 37, 38
E: relations source: depends-on-build-essential-package-without-using-version libc6-dev [build-depends: libc6-dev]
E: relations source: depends-on-build-essential-package-without-using-version make [build-depends-indep: make]
E: relations source: invalid-arch-string-in-source-relation test [build-conflicts: bar [alpha test]]
@@ -22,7 +22,7 @@
E: relations: conflicts-with-dependency relations
E: relations: depends-on-essential-package-without-using-version depends: coreutils
E: relations: depends-on-essential-package-without-using-version depends: dpkg
-E: relations: needlessly-depends-on-awk depends
+E: relations: needlessly-depends-on-awk pre-depends
E: relations: no-copyright-file
I: relations source: build-depends-without-arch-dep arch-test1
I: relations source: build-depends-without-arch-dep arch-test2
@@ -40,6 +40,10 @@
W: relations source: package-has-a-duplicate-build-relation foo (= 3) [!amd64 !i386], foo (<< 4) [!amd64 !i386]
W: relations source: package-has-a-duplicate-build-relation perl, perl (>= 5.0)
W: relations source: redundant-origin-field
+W: relations source: stronger-dependency-implies-weaker depends -> recommends dpkg
+W: relations source: stronger-dependency-implies-weaker depends -> recommends null
+W: relations source: stronger-dependency-implies-weaker pre-depends -> depends gawk | awk
+W: relations source: stronger-dependency-implies-weaker recommends -> suggests some-other-package
W: relations source: virtual-package-depends-without-real-package-depends build-depends: mail-transport-agent
W: relations-multiple-libs: description-synopsis-might-not-be-phrased-properly
W: relations-multiple-libs: redundant-bugs-field
@@ -50,3 +54,4 @@
W: relations: redundant-bugs-field
W: relations: redundant-origin-field
W: relations: virtual-package-depends-without-real-package-depends depends: mail-transport-agent
+W: relations: virtual-package-depends-without-real-package-depends pre-depends: awk
Reply to: