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

[SCM] Debian package checker branch, master, updated. 2.2.18-78-gd81a343



The following commit has been merged in the master branch:
commit d81a343e33ecbd9f0350ddf7cb49bbe83aacd06b
Author: Russ Allbery <rra@debian.org>
Date:   Fri Dec 25 17:17:49 2009 -0800

    Check for duplicates in relation fields in debian/control
    
    * checks/control-file{,.desc}:
      + [RA] Add a pedantic check for duplicates in relation fields in
        debian/control prior to the fixes applied by dpkg-dev.  Thanks,
        Nelson A. de Oliveira.  (Closes: #548819)
      + [RA] Fix a typo that skipped checks on the Build-Conflicts field.

diff --git a/checks/control-file b/checks/control-file
index fc448d7..bc0e530 100644
--- a/checks/control-file
+++ b/checks/control-file
@@ -106,15 +106,22 @@ for my $binary_control (@binary_controls) {
 # by spaces, so we have to remove any architecture restrictions first.  This
 # unfortunately distorts our report a little, but hopefully not too much.
 #
-# Also check for < and > relations.  dpkg-source warns about them and then
+# Also check for < and > relations.  dpkg-gencontrol warns about them and then
 # transforms them in the output to <= and >=, but it's easy to miss the error
-# message.
+# message.  Similarly, check for duplicates, which dpkg-source eliminates.
 for my $control ($header, @binary_controls) {
 	for my $field (qw(pre-depends depends recommends suggests breaks
 			  conflicts provides replaces enhances
 			  build-depends build-depends-indep
-			  build-conflics build-conflicts-indep)) {
+			  build-conflicts build-conflicts-indep)) {
 		next unless $control->{$field};
+		my $relation = Lintian::Relation->new($control->{$field});
+		my @dups = $relation->duplicates;
+		for my $dup (@dups) {
+			tag 'duplicate-in-relation-field', 'in',
+			    ($control->{source} ? 'source' : $control->{package}),
+			    "$field:", join(', ', @$dup);
+		}
 		my $value = $control->{$field};
 		$value =~ s/\n(\s)/$1/g;
 		$value =~ s/\[[^\]]*\]//g;
diff --git a/checks/control-file.desc b/checks/control-file.desc
index 366ba71..65e3e67 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -131,6 +131,15 @@ Info: The listed binary packages all share the same extended description.
  particularly for users who aren't familiar with Debian's package naming
  conventions.
 
+Tag: duplicate-in-relation-field
+Severity: pedantic
+Certainty: certain
+Info: The given field in the <tt>debian/control</tt> file contains
+ relations that are either identical or imply each other.  The less
+ restrictive one can be removed.  This is done automatically by
+ <tt>dpkg-source</tt> and <tt>dpkg-gencontrol</tt>, so this does not
+ affect the generated package.
+
 Tag: missing-separator-between-items
 Severity: important
 Certainty: certain
diff --git a/debian/changelog b/debian/changelog
index be9e038..9d965d6 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ lintian (2.3.0) UNRELEASED; urgency=low
   * Summary of tag changes:
     + Added:
       - debian-rules-automatically-updates-control
+      - duplicate-in-relation-field (pedantic)
       - duplicated-compressed-file
       - init.d-script-missing-dependency-on-local_fs (experimental)
       - init.d-script-missing-dependency-on-remote_fs (experimental)
@@ -37,6 +38,10 @@ lintian (2.3.0) UNRELEASED; urgency=low
     + [RA] Check for < and > version dependencies in debian/control since
       dpkg-source helpfully rewrites and fixes them in binary packages.
       Thanks, Jakub Wilk.  (Closes: #557971)
+    + [RA] Add a pedantic check for duplicates in relation fields in
+      debian/control prior to the fixes applied by dpkg-dev.  Thanks,
+      Nelson A. de Oliveira.  (Closes: #548819)
+    + [RA] Fix a typo that skipped checks on the Build-Conflicts field.
   * checks/cruft:
     + [RA] Allow an automake or libtool dependency in Build-Depends-Indep
       to also satisfy the check for outdated helper files.  Thanks,
diff --git a/t/tests/control-file-suggests-itself/debian/debian/control.in b/t/tests/control-file-duplicate/debian/debian/control.in
similarity index 59%
copy from t/tests/control-file-suggests-itself/debian/debian/control.in
copy to t/tests/control-file-duplicate/debian/debian/control.in
index b2aa344..da02d86 100644
--- a/t/tests/control-file-suggests-itself/debian/debian/control.in
+++ b/t/tests/control-file-duplicate/debian/debian/control.in
@@ -3,12 +3,17 @@ Priority: extra
 Section: {$section}
 Maintainer: {$author}
 Standards-Version: {$standards_version}
-Build-Depends: debhelper (>= 7)
+Build-Depends: debhelper (>= 7.0.50~), debhelper
+Build-Depends-Indep: cdbs, foo, cdbs
+Build-Conflicts: bar,
+ baz,
+ bar [i386]
 
 Package: {$srcpkg}
 Architecture: {$architecture}
-Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
-Suggests: {$srcpkg}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}, $\{misc:Depends\}
+Recommends: foo (>> 1.0) | bar, foo
+Suggests: baz (= 1.0), baz, baz (>= 2.0)
 Description: {$description}
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
diff --git a/t/tests/control-file-duplicate/desc b/t/tests/control-file-duplicate/desc
new file mode 100644
index 0000000..b86da0d
--- /dev/null
+++ b/t/tests/control-file-duplicate/desc
@@ -0,0 +1,7 @@
+Testname: control-file-duplicate
+Sequence: 6000
+Version: 1.0
+Skeleton: pedantic
+Options: --pedantic -I -E
+Description: Pedantic test for duplicate relations
+Test-For: duplicate-in-relation-field
diff --git a/t/tests/control-file-duplicate/tags b/t/tests/control-file-duplicate/tags
new file mode 100644
index 0000000..becac80
--- /dev/null
+++ b/t/tests/control-file-duplicate/tags
@@ -0,0 +1,5 @@
+P: control-file-duplicate source: duplicate-in-relation-field in control-file-duplicate depends: ${misc:Depends}, ${misc:Depends}
+P: control-file-duplicate source: duplicate-in-relation-field in control-file-duplicate suggests: baz (= 1.0), baz, baz (>= 2.0)
+P: control-file-duplicate source: duplicate-in-relation-field in source build-conflicts: bar, bar [i386]
+P: control-file-duplicate source: duplicate-in-relation-field in source build-depends-indep: cdbs, cdbs
+P: control-file-duplicate source: duplicate-in-relation-field in source build-depends: debhelper (>= 7.0.50~), debhelper

-- 
Debian package checker


Reply to: