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

[SCM] Debian package checker branch, master, updated. 2.3.1-6-g43dc297



The following commit has been merged in the master branch:
commit 43dc297502bebe2584f47d2ea88800fced448dcc
Author: Russ Allbery <rra@debian.org>
Date:   Sun Jan 3 20:49:49 2010 -0800

    Improved checks for architectures in build relations
    
    * checks/fields{,.desc}:
      + [RA] Reject "all" and "any" in architecture qualifications for build
        dependencies.  Thanks, Jonathan Yu.
      + [RA] Warn if some architectures in a build relation are negated and
        others are not.

diff --git a/checks/fields b/checks/fields
index 20ffb4f..a4cfecc 100644
--- a/checks/fields
+++ b/checks/fields
@@ -689,12 +689,16 @@ if ($type eq "source") {
 				for my $part_d (@alternatives) {
 					my ($d_pkg, $d_version, $d_arch, $rest, $part_d_orig) = @$part_d;
 
+					my $negated = 0;
 					for my $arch (@{$d_arch->[0]}) {
-						if (!$KNOWN_ARCHS->known($arch)) {
+						if ($arch eq 'all' or $arch eq 'any' or !$KNOWN_ARCHS->known($arch)) {
 							tag "invalid-arch-string-in-source-relation", "$arch [$field: $part_d_orig]"
 						}
 					}
 
+					tag 'conflicting-negation-in-source-relation', "$field: $part_d_orig"
+					    unless (not $d_arch or $d_arch->[1] == 0 or $d_arch->[1] eq @{ $d_arch->[0] });
+
 					tag "build-depends-on-build-essential", $field
 					    if ($d_pkg eq "build-essential");
 
@@ -886,11 +890,11 @@ for my $field (glob("fields/*")) {
 # splits "foo (>= 1.2.3) [!i386 ia64]" into
 # ( "foo", [ ">=", "1.2.3" ], [ [ "i386", "ia64" ], 1 ], "" )
 #                                                  ^^^   ^^
-#                                 true, if ! was given   ||
+#              count of negated arches, if ! was given   ||
 #           rest (should always be "" for valid dependencies)
 sub _split_dep {
 	my $dep = shift;
-	my ($pkg, $version, $darch) = ("", ["",""], [[],""]);
+	my ($pkg, $version, $darch) = ("", ["",""], [[], 0]);
 
 	$pkg = $1 if $dep =~ s/^\s*([^\s\[\(]+)\s*//;
 
@@ -900,8 +904,12 @@ sub _split_dep {
 		}
 		if ($dep && $dep =~ s/\s*\[([^\]]+)\]\s*//) {
 			my $t = $1;
-			$darch->[1] = 1 if ($t =~ s/!//g);
 			$darch->[0] = [ split /\s+/, $t ];
+			my $negated = 0;
+			for my $arch (@{ $darch->[0] }) {
+				$negated++ if $arch =~ s/^!//;
+			}
+			$darch->[1] = $negated;
 		}
 	}
 
diff --git a/checks/fields.desc b/checks/fields.desc
index 02dc874..663e66c 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -570,9 +570,20 @@ Tag: invalid-arch-string-in-source-relation
 Severity: important
 Certainty: possible
 Ref: policy 5.6.8
-Info: The architecture string in the source relation does not follow policy.
- A common cause of this is a comma in the arch, i.e. [i386, m68k], it should
- be [i386 m68k].
+Info: The architecture string in the source relation includes an unknown
+ architecture.  This may be a typo, or it may be an architecture that dpkg
+ doesn't know about yet.  A common problem is incorrectly separating
+ architectures with a comma, such as <tt>[i386, m68k]</tt>.  Architectures
+ are separated by spaces; this should instead be <tt>[i386 m68k]</tt>.
+
+Tag: conflicting-negation-in-source-relation
+Severity: serious
+Certainty: certain
+Ref: policy 7.1
+Info: The architecture string in this source relation has some
+ negated architectures (prepended by <tt>!</tt>) and others that are not
+ negated.  This is not permitted by Policy.  Either all architectures must
+ be negated or none of them may be.
 
 Tag: depends-on-build-essential-package-without-using-version
 Severity: important
diff --git a/debian/changelog b/debian/changelog
index 77a4eef..2be6d31 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,20 @@
 lintian (2.3.2) UNRELEASED; urgency=low
 
+  * Summary of tag changes:
+    + Added:
+      - conflicting-negation-in-source-relation
+
   * checks/changelog-file:
     + [RA] Avoid Perl warning when the NEWS file ends immediately after
       the most recent entry.  (Closes: #563585)
   * checks/copyright-file:
     + [RA] Relax the regex for matching dh-make-perl boilerplate to catch
       the current text.  Thanks, gregor herrmann.  (Closes: #563571)
+  * checks/fields{,.desc}:
+    + [RA] Reject "all" and "any" in architecture qualifications for build
+      dependencies.  Thanks, Jonathan Yu.
+    + [RA] Warn if some architectures in a build relation are negated and
+      others are not.
 
   * reporting/templates/maintainer.tmpl:
     + [RA] Really fix the logic to optionally display the archive area of
diff --git a/t/COVERAGE b/t/COVERAGE
index 791b944..b8c4b08 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,4 +1,4 @@
-Last generated 2010-01-02
+Last generated 2010-01-04
 
 The following tags are not tested by the test suite:
 
@@ -287,7 +287,6 @@ fields depends-on-essential-package-without-using-version
 fields depends-on-obsolete-package
 fields depends-on-old-emacs
 fields depends-on-python-minimal
-fields invalid-arch-string-in-source-relation
 fields malformed-dm-upload-allowed
 fields needlessly-depends-on-awk
 fields ored-build-depends-on-obsolete-package
@@ -741,7 +740,6 @@ relations
   depends-on-essential-package-without-using-version
   depends-on-obsolete-package
   depends-on-old-emacs
-  invalid-arch-string-in-source-relation
   needlessly-depends-on-awk
   ored-build-depends-on-obsolete-package
   ored-depends-on-obsolete-package
diff --git a/t/tests/fields-depends-general/debian/debian/control.in b/t/tests/fields-depends-general/debian/debian/control.in
index 8abffe9..f10beed 100644
--- a/t/tests/fields-depends-general/debian/debian/control.in
+++ b/t/tests/fields-depends-general/debian/debian/control.in
@@ -4,7 +4,8 @@ Section: {$section}
 Maintainer: {$author}
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7.0.50~), xorg-dev, java-propose-classpath,
- python3.1-dev
+ python3.1-dev, foo [all], bar [i386 any], baz [source i3!86],
+ baz [i386 !amd64]
 
 Package: {$srcpkg}
 Architecture: {$architecture}
diff --git a/t/tests/fields-depends-general/desc b/t/tests/fields-depends-general/desc
index f8b72ff..b96304f 100644
--- a/t/tests/fields-depends-general/desc
+++ b/t/tests/fields-depends-general/desc
@@ -6,6 +6,8 @@ Test-For:
  build-depends-on-metapackage
  build-depends-on-non-build-package
  build-depends-on-python-dev-with-no-arch-any
+ conflicting-negation-in-source-relation
  depends-on-metapackage
+ invalid-arch-string-in-source-relation
  lib-recommends-documentation
 References: Debian Bug#540594, Debian Bug#551793
diff --git a/t/tests/fields-depends-general/tags b/t/tests/fields-depends-general/tags
index ac5f549..8d0162a 100644
--- a/t/tests/fields-depends-general/tags
+++ b/t/tests/fields-depends-general/tags
@@ -1,5 +1,10 @@
 E: fields-depends-general source: build-depends-on-metapackage build-depends: xorg-dev
 E: fields-depends-general source: build-depends-on-non-build-package build-depends: java-propose-classpath
+E: fields-depends-general source: conflicting-negation-in-source-relation build-depends: baz [i386 !amd64]
+E: fields-depends-general source: invalid-arch-string-in-source-relation all [build-depends: foo [all]]
+E: fields-depends-general source: invalid-arch-string-in-source-relation any [build-depends: bar [i386 any]]
+E: fields-depends-general source: invalid-arch-string-in-source-relation i3!86 [build-depends: baz [source i3!86]]
+E: fields-depends-general source: invalid-arch-string-in-source-relation source [build-depends: baz [source i3!86]]
 E: fields-depends-general: depends-on-metapackage depends: xorg
 W: fields-depends-general source: build-depends-on-python-dev-with-no-arch-any
 W: libfields-depends-general: lib-recommends-documentation recommends: debconf-doc

-- 
Debian package checker


Reply to: