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

[SCM] Debian package checker branch, master, updated. 2.1.5-18-g642c245



The following commit has been merged in the master branch:
commit 642c2450aba62980c59aa05ec0b862f849db712e
Author: Russ Allbery <rra@debian.org>
Date:   Sat Jan 17 12:59:11 2009 -0800

    Ignore architecture when checking some build dependencies
    
    * checks/debhelper:
      + [RA] Ignore architecture when checking whether sufficient build
        dependencies are present for dh_* commands.  If the maintainer has
        architecture-restricted build dependencies, they presumably know
        what they're doing.  (Closes: #511859)
    * checks/fields{,.desc}:
      + [RA] Ignore architecture qualifications when checking for missing
        build dependencies.
    * lib/Dep.pm:
      + [RA] New function, parse_noarch(), which ignores architecture
        qualifications when parsing a dependency field.

diff --git a/checks/debhelper b/checks/debhelper
index 1737b72..ebd9f81 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -215,6 +215,7 @@ while (defined(my $file=readdir(DEBIAN))) {
             $bdepends .= ', ' if $bdepends;
             $bdepends .= $control->{$field};
         }
+	my $bdepends_noarch = Dep::parse_noarch($bdepends);
         $bdepends = Dep::parse($bdepends);
         if ($needbuilddepends && ! Dep::implies($bdepends, Dep::parse('debhelper'))) {
 	    tag "package-uses-debhelper-but-lacks-build-depends", "";
@@ -222,7 +223,7 @@ while (defined(my $file=readdir(DEBIAN))) {
 	while (my ($dep, $command) = each %missingbdeps) {
 	    next if $dep eq 'debhelper'; #handled above
 	    tag 'missing-build-dependency-for-dh_-command', "$command=$dep"
-		unless (Dep::implies($bdepends, Dep::parse($dep)));
+		unless (Dep::implies($bdepends_noarch, Dep::parse($dep)));
 	}
     } elsif ($file =~ m/^ex\.|\.ex$/i) {
         tag "dh-make-template-in-source", "debian/$file";
diff --git a/checks/fields b/checks/fields
index 003cb88..9d58b62 100644
--- a/checks/fields
+++ b/checks/fields
@@ -754,13 +754,14 @@ if ($type eq "source") {
 	}
 
 	# Make sure build dependencies and conflicts are consistent.
-	$depend{'build-depends'} = Dep::parse($depend{'build-depends'} || '');
-	$depend{'build-depends-indep'} = Dep::parse($depend{'build-depends-indep'} || '');
+	my %parsed;
+	$parsed{'build-depends'} = Dep::parse($depend{'build-depends'} || '');
+	$parsed{'build-depends-indep'} = Dep::parse($depend{'build-depends-indep'} || '');
 	for ($depend{'build-conflicts'}, $depend{'build-conflicts-indep'}) {
 		next unless $_;
 		for my $conflict (split /\s*,\s*/, $_) {
-			if (Dep::implies($depend{'build-depends'}, Dep::parse($conflict))
-			    || Dep::implies($depend{'build-depends-indep'}, Dep::parse($conflict))) {
+			if (Dep::implies($parsed{'build-depends'}, Dep::parse($conflict))
+			    || Dep::implies($parsed{'build-depends-indep'}, Dep::parse($conflict))) {
 				tag "build-conflicts-with-build-dependency", $conflict;
 			}
 		}
@@ -772,8 +773,8 @@ if ($type eq "source") {
 	for my $package (keys %needed_clean) {
 		my $dep = Dep::parse($package);
 		my $tag = $needed_clean{$package} || 'missing-build-dependency';
-		unless (Dep::implies($depend{'build-depends'}, $dep)) {
-			if (Dep::implies($depend{'build-depends-indep'}, $dep)) {
+		unless (Dep::implies($parsed{'build-depends'}, $dep)) {
+			if (Dep::implies($parsed{'build-depends-indep'}, $dep)) {
 				tag "clean-should-be-satisfied-by-build-depends", $package;
 			} else {
 				if ($tag eq 'missing-build-dependency') {
@@ -784,8 +785,11 @@ if ($type eq "source") {
 			}
 		}
 	}
+	my $deps = $depend{'build-depends'} || '';
+	$deps .= ', ' if $deps && $depend{'build-depends-indep'};
+	$deps .= $depend{'build-depends-indep'} || '';
+	$deps = Dep::parse_noarch($deps);
 	for my $package (keys %needed) {
-		my $dep = Dep::parse($package);
 		my $tag = $needed{$package} || 'missing-build-dependency';
 
 		# dh_python deactivates itself if the new Python build policy
@@ -794,13 +798,11 @@ if ($type eq "source") {
 			next if -f 'debfiles/pycomat';
 			next if defined $info->field('python-version');
 		}
-		unless (Dep::implies($depend{'build-depends'}, $dep)) {
-			unless (Dep::implies($depend{'build-depends-indep'}, $dep)) {
-				if ($tag eq 'missing-build-dependency') {
-					tag $tag, $package;
-				} else {
-					tag $tag;
-				}
+		unless (Dep::implies($deps, Dep::parse($package))) {
+			if ($tag eq 'missing-build-dependency') {
+				tag $tag, $package;
+			} else {
+				tag $tag;
 			}
 		}
 	}
diff --git a/debian/changelog b/debian/changelog
index 460c1bd..cb9ffbc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,9 +16,16 @@ lintian (2.1.6) UNRELEASED; urgency=low
       Holger Levsen and Chris Lamb.  (Closes: #464837)
     + [RA] Warn if the Debian diff or a non-native package is entirely
       empty.  (Closes: #498668)
+  * checks/debhelper:
+    + [RA] Ignore architecture when checking whether sufficient build
+      dependencies are present for dh_* commands.  If the maintainer has
+      architecture-restricted build dependencies, they presumably know
+      what they're doing.  (Closes: #511859)
   * checks/fields{,.desc}:
     + [ADB] Warn about an individual uploader appearing multiple times
       in Uploaders.  Thanks, Joerg Jaspert.  (Closes: #511536)
+    + [RA] Ignore architecture qualifications when checking for missing
+      build dependencies.
   * checks/lintian.desc:
     + [RA] Add tag description for malformed-changes-file.
   * checks/menus:
@@ -43,6 +50,10 @@ lintian (2.1.6) UNRELEASED; urgency=low
       issue malformed-changes-file and skip them.  This catches .changes
       files that were PGP-signed twice.  (Closes: #315538)
 
+  * lib/Dep.pm:
+    + [RA] New function, parse_noarch(), which ignores architecture
+      qualifications when parsing a dependency field.
+
   * t/runtests:
     + [RA] Add pre_upstream hook to modify the upstream source before
       generation of the .orig.tar.gz.
diff --git a/lib/Dep.pm b/lib/Dep.pm
index 8119324..f630641 100644
--- a/lib/Dep.pm
+++ b/lib/Dep.pm
@@ -31,20 +31,20 @@ use Lintian::Command qw(spawn);
 sub Pred {
     $_[0] =~ 
 	    /^\s*                           # skip leading whitespace
-	      (                             # package name or substvar
+	      (                             # package name or substvar (1)
                [a-zA-Z0-9][a-zA-Z0-9+.-]+   #   package name
                |                            #   or
                (?:\$\{[a-zA-Z0-9:-]+\})     #   substvar
               )                             # end of package name or substvar
 	      (?:                           # start of optional part
   	        \s* \(                      # open parenthesis for version part
-                \s* (<<|<=|=|>=|>>|<|>)     # relation part
-                \s* (.*?)                   # do not attempt to parse version
+                \s* (<<|<=|=|>=|>>|<|>)     # relation part (2)
+                \s* (.*?)                   # version (3)
                 \s* \)                      # closing parenthesis
 	      )?                            # end of optional part
               (?:                           # start of optional architecture
                 \s* \[                      # open bracket for architecture
-                \s* (.*?)                   # don't parse architectures now
+                \s* (.*?)                   # architectures (4)
                 \s* \]                      # closing bracket
               )?                            # end of optional architecture
 	    /x;
@@ -85,6 +85,18 @@ sub parse {
     return ['AND', @deps];
 }
 
+# Convert a dependency line into the internal format, ignoring architectures.
+# This should be used in cases where we only care if a dependency is present
+# in some cases and we don't want to require that the architectures match
+# (such as when checking for proper build dependencies, since if there are
+# architecture constraints the maintainer is doing something beyond Lintian's
+# ability to analyze).
+sub parse_noarch {
+    my ($dep) = @_;
+    $dep =~ s/\[[^\]]*\]//g;
+    return parse($dep);
+}
+
 # Take the internal format and convert it back to text.  Note that what this
 # generates for NOT isn't valid Debian dependency syntax.
 sub unparse {
diff --git a/t/tests/6000_debhelper-arch-depends.desc b/t/tests/6000_debhelper-arch-depends.desc
new file mode 100644
index 0000000..07bd111
--- /dev/null
+++ b/t/tests/6000_debhelper-arch-depends.desc
@@ -0,0 +1,4 @@
+Testname: debhelper-arch-depends
+Version: 1.0
+Description: Test arch-specific dependencies on dh commands
+Test-Against: missing-build-dependency-for-dh_-command
diff --git a/t/tests/debhelper-dh-clean-k-ok/debian/debian/control.in b/t/tests/debhelper-arch-depends/debian/debian/control.in
similarity index 83%
copy from t/tests/debhelper-dh-clean-k-ok/debian/debian/control.in
copy to t/tests/debhelper-arch-depends/debian/debian/control.in
index 4c70e72..ed09e6d 100644
--- a/t/tests/debhelper-dh-clean-k-ok/debian/debian/control.in
+++ b/t/tests/debhelper-arch-depends/debian/debian/control.in
@@ -3,7 +3,8 @@ Priority: extra
 Section: {$section}
 Maintainer: {$author}
 Standards-Version: 3.8.0
-Build-Depends: debhelper (>= 4)
+Build-Depends: debhelper (>= 7),
+ cli-common-dev (>= 0.5.7) [i386 sparc amd64 ia64]
 
 Package: {$srcpkg}
 Architecture: {$architecture}
diff --git a/t/tests/debhelper-no-depends/debian/debian/rules b/t/tests/debhelper-arch-depends/debian/debian/rules
similarity index 83%
copy from t/tests/debhelper-no-depends/debian/debian/rules
copy to t/tests/debhelper-arch-depends/debian/debian/rules
index 18dc726..27900c2 100755
--- a/t/tests/debhelper-no-depends/debian/debian/rules
+++ b/t/tests/debhelper-arch-depends/debian/debian/rules
@@ -7,6 +7,4 @@ binary-arch:
 binary-indep:
 	dh binary-indep --until dh_prep
 	-dh_clideps
-	-dh_gtkmodules
-	dh_lisp || true
 	dh binary-indep --remaining
diff --git a/t/tests/basic-non-native/tags b/t/tests/debhelper-arch-depends/tags
similarity index 100%
copy from t/tests/basic-non-native/tags
copy to t/tests/debhelper-arch-depends/tags

-- 
Debian package checker


Reply to: