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

[SCM] Debian package checker branch, master, updated. 1.24.2-95-g5995de2



The following commit has been merged in the master branch:
commit 5995de20b6c051e6047be2d870be571e7f5ea946
Author: Frank Lichtenheld <djpig@debian.org>
Date:   Fri Aug 8 20:19:46 2008 -0300

    checks/rules: Do not complain about using dh in a unused target
    
    dh will figure out from the control file whether it is actually a
    no-op. Since this makes the rules file more flexible without a
    great risk of failing, we should not discourage it.

diff --git a/checks/rules b/checks/rules
index 55e5d90..f655c1e 100644
--- a/checks/rules
+++ b/checks/rules
@@ -90,7 +90,7 @@ my %rules_per_target;
 my $debhelper_group;
 while (<RULES>) {
     next if /^\s*\#/;
-    $includes = 1 if /^ *[s-]?include\s+/;
+    $includes = 1 if m/^ *[s-]?include\s+/;
 
     # Check for DH_COMPAT settings outside of any rule, which are now
     # deprecated.  It's a bit easier structurally to do this here than in
@@ -177,8 +177,17 @@ unless ($includes) {
 }
 
 # Make sure we have no content for binary-arch if we are arch-indep:
-if ($architecture eq "all" && scalar @{$rules_per_target{'binary-arch'} || []}) {
-    tag "binary-arch-rules-but-pkg-is-arch-indep";
+$rules_per_target{'binary-arch'} ||= [];
+if ($architecture eq "all" && scalar @{$rules_per_target{'binary-arch'}}) {
+    my $nonempty = 0;
+    foreach (@{$rules_per_target{'binary-arch'}}) {
+	# dh binary-arch is actually a no-op if there is no
+	# Architecture: any package in the control file
+	unless (m/^\s*dh\s+(?:binary-arch|\$\@)/) {
+	    $nonempty = 1;
+	}
+    }
+    tag "binary-arch-rules-but-pkg-is-arch-indep" if $nonempty;
 }
 }
 1;
diff --git a/debian/changelog b/debian/changelog
index 2b0b214..8bc77f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -104,6 +104,7 @@ lintian (1.24.3) unstable; urgency=low
       Polo.
   * checks/rules:
     + [ADB] Use ::Collect for field access.
+    + [FL] Do not complain about using dh in a unused binary-* target.
   * checks/scripts{,.desc}:
     + [RA] Warn about maintainer scripts that prepend a path to commands.
       Based on a patch by Raphael Geissert.  (Closes: #376184)
diff --git a/t/tests/6000_rules-dh-unused-target-nonempty.desc b/t/tests/6000_rules-dh-unused-target-nonempty.desc
new file mode 100644
index 0000000..425f79d
--- /dev/null
+++ b/t/tests/6000_rules-dh-unused-target-nonempty.desc
@@ -0,0 +1,5 @@
+Testname: rules-dh-unused-target-nonempty
+Version: 1.0
+Description: Allow dh in unused targets, but nothing else
+Test-For: binary-arch-rules-but-pkg-is-arch-indep
+References: <[🔎] 20080806175819.GV11882@mail-vs.djpig.de>
diff --git a/t/tests/6000_rules-dh-unused-target.desc b/t/tests/6000_rules-dh-unused-target.desc
new file mode 100644
index 0000000..a8f2e17
--- /dev/null
+++ b/t/tests/6000_rules-dh-unused-target.desc
@@ -0,0 +1,5 @@
+Testname: rules-dh-unused-target
+Version: 1.0
+Description: Allow dh in unused targets
+Test-Against: binary-arch-rules-but-pkg-is-arch-indep
+References: <[🔎] 20080806175819.GV11882@mail-vs.djpig.de>
diff --git a/t/tests/rules-dh-unused-target-nonempty/debian/debian/rules b/t/tests/rules-dh-unused-target-nonempty/debian/debian/rules
new file mode 100755
index 0000000..bb4437f
--- /dev/null
+++ b/t/tests/rules-dh-unused-target-nonempty/debian/debian/rules
@@ -0,0 +1,26 @@
+#!/usr/bin/make -f
+
+build: build-stamp
+build-stamp:
+	dh build
+	touch $@
+
+clean:
+	dh $@
+
+install: install-stamp
+install-stamp: build-stamp
+	dh install
+	touch $@
+
+binary-arch: install
+	dh $@
+	# This target is not empty, but it should be
+	-install foo bar
+
+binary-indep: install
+	dh $@
+
+binary: binary-arch binary-indep
+
+.PHONY: binary binary-arch binary-indep install clean build
diff --git a/t/tests/rules-dh-unused-target-nonempty/tags b/t/tests/rules-dh-unused-target-nonempty/tags
new file mode 100644
index 0000000..eff746c
--- /dev/null
+++ b/t/tests/rules-dh-unused-target-nonempty/tags
@@ -0,0 +1 @@
+W: rules-dh-unused-target-nonempty source: binary-arch-rules-but-pkg-is-arch-indep
diff --git a/t/tests/rules-dh-unused-target/debian/debian/rules b/t/tests/rules-dh-unused-target/debian/debian/rules
new file mode 100755
index 0000000..a1067da
--- /dev/null
+++ b/t/tests/rules-dh-unused-target/debian/debian/rules
@@ -0,0 +1,24 @@
+#!/usr/bin/make -f
+
+build: build-stamp
+build-stamp:
+	dh build
+	touch $@
+
+clean:
+	dh $@
+
+install: install-stamp
+install-stamp: build-stamp
+	dh install
+	touch $@
+
+binary-arch: install
+	dh $@
+
+binary-indep: install
+	dh $@
+
+binary: binary-arch binary-indep
+
+.PHONY: binary binary-arch binary-indep install clean build
diff --git a/t/tests/basic-non-native/tags b/t/tests/rules-dh-unused-target/tags
similarity index 100%
copy from t/tests/basic-non-native/tags
copy to t/tests/rules-dh-unused-target/tags

-- 
Debian package checker


Reply to: