[lintian] 05/07: Check for override_dh_auto_test targets that do not check DEB_BUILD_OPTIONS for "nocheck". (Closes: #712394)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit deaf67c91e17072d7963b457c9a7f16c2ee309e4
Author: Chris Lamb <lamby@debian.org>
Date: Mon Jan 29 09:01:27 2018 +0000
Check for override_dh_auto_test targets that do not check DEB_BUILD_OPTIONS for "nocheck". (Closes: #712394)
---
checks/rules.desc | 19 +++++++++++++++++++
checks/rules.pm | 12 ++++++++++--
debian/changelog | 3 +++
.../debian/debian/rules | 8 ++++++++
.../desc | 5 +++++
.../tags | 0
.../debian/debian/rules | 9 +++++++++
.../desc | 5 +++++
.../tags | 0
.../debian/debian/rules | 7 +++++++
.../desc | 5 +++++
.../tags | 1 +
12 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/checks/rules.desc b/checks/rules.desc
index 4e89148..25fe627 100644
--- a/checks/rules.desc
+++ b/checks/rules.desc
@@ -337,3 +337,22 @@ Info: The <tt>debian/rules</tt> file for this package has a call to
.
Please remove the call and let dpkg-deb(1) select suitable defaults.
Ref: #829100, dpkg-deb(1)
+
+Tag: override_dh_auto_test-does-not-check-DEB_BUILD_PROFILES
+Severity: normal
+Certainty: possible
+Info: The <tt>debian/rules</tt> file for this package has an
+ <tt>override_dh_auto_test</tt> target that does not appear to
+ check <tt>DEB_BUILD_PROFILES</tt> against <tt>nocheck</tt>.
+ .
+ As this check is not automatically performed by debhelper(1), the
+ specified testsuite is run regardless of using the <tt>nocheck</tt>
+ build profile.
+ .
+ Please add a check such as:
+ .
+ override_dh_auto_test:
+ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+ ./run-upstream-testsuite
+ endif
+Ref: https://wiki.debian.org/BuildProfileSpec#Registered_profile_names
diff --git a/checks/rules.pm b/checks/rules.pm
index 4b3086a..3e1b2c3 100644
--- a/checks/rules.pm
+++ b/checks/rules.pm
@@ -166,7 +166,7 @@ sub run {
my @indep_rules = (qr/^build$/, qr/^build-indep$/, qr/^binary-indep$/);
my (@current_targets, %rules_per_target, %debhelper_group);
my (%seen, %overridden);
- my $maybe_skipping;
+ my ($maybe_skipping, @conditionals);
my %variables;
my $uses_makefile_pl = 0;
my $includes = 0;
@@ -251,7 +251,8 @@ sub run {
}
# Keep track of whether this portion of debian/rules may be optional
- if (/^ifn?(?:eq|def)\s/) {
+ if (/^ifn?(?:eq|def)\s(.*)/) {
+ push(@conditionals, $1);
$maybe_skipping++;
} elsif (/^endif\s/) {
$maybe_skipping--;
@@ -438,6 +439,13 @@ sub run {
@{$rules_per_target{"override_$cmd"}};
}
+ if (my $line = $overridden{'dh_auto_test'}) {
+ tag 'override_dh_auto_test-does-not-check-DEB_BUILD_PROFILES',
+ "(line $line)"
+ if $rules_per_target{'override_dh_auto_test'}
+ and none { m/(DEB_BUILD_OPTIONS|nocheck)/ } @conditionals;
+ }
+
# Make sure that all the required build dependencies are there. Don't
# issue missing-build-dependency errors for debhelper, since there's
# another test that does that and it would just be a duplicate.
diff --git a/debian/changelog b/debian/changelog
index 161807d..4a5db1f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,9 @@ lintian (2.5.73) UNRELEASED; urgency=medium
* checks/patch-systems.{desc,pm}:
+ [CL] Emit a pedantic warning for packages that are using the dpatch
patch system. (Closes: #884500)
+ * checks/rules.pm:
+ + [CL] Check for override_dh_auto_test targets that do not check
+ DEB_BUILD_OPTIONS for "nocheck". (Closes: #712394)
* checks/source-copyright.{desc,pm}:
+ [CL] Warn about packages that specify a Files-Excluded header without
a valid Format header as the former will be ignored by uscan(1).
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/debian/debian/rules b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/debian/debian/rules
new file mode 100755
index 0000000..a205d48
--- /dev/null
+++ b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/debian/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
+# Empty target follows
+override_dh_auto_test:
+ # comment
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/desc b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/desc
new file mode 100644
index 0000000..09f3706
--- /dev/null
+++ b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/desc
@@ -0,0 +1,5 @@
+Testname: rules-dh-auto-test-does-not-check-deb-build-options-empty
+Version: 1.0
+Description: Test for missing checks for DEB_BUILD_PROFILES (empty false-positive)
+Test-Against:
+ override_dh_auto_test-does-not-check-DEB_BUILD_PROFILES
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/tags b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-empty/tags
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/debian/debian/rules b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/debian/debian/rules
new file mode 100755
index 0000000..6f702fe
--- /dev/null
+++ b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/debian/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
+override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+ /bin/true
+endif
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/desc b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/desc
new file mode 100644
index 0000000..a430984
--- /dev/null
+++ b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/desc
@@ -0,0 +1,5 @@
+Testname: rules-dh-auto-test-does-not-check-deb-build-options-unrel
+Version: 1.0
+Description: Test for missing checks for DEB_BUILD_PROFILES (false-positive)
+Test-Against:
+ override_dh_auto_test-does-not-check-DEB_BUILD_PROFILES
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/tags b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options-unrel/tags
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/debian/debian/rules b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/debian/debian/rules
new file mode 100755
index 0000000..07c493b
--- /dev/null
+++ b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/debian/debian/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
+override_dh_auto_test:
+ /bin/true
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/desc b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/desc
new file mode 100644
index 0000000..814ee32
--- /dev/null
+++ b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/desc
@@ -0,0 +1,5 @@
+Testname: rules-dh-auto-test-does-not-check-deb-build-options
+Version: 1.0
+Description: Test for missing checks for DEB_BUILD_PROFILES
+Test-For:
+ override_dh_auto_test-does-not-check-DEB_BUILD_PROFILES
diff --git a/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/tags b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/tags
new file mode 100644
index 0000000..17e0c15
--- /dev/null
+++ b/t/tests/rules-dh-auto-test-does-not-check-deb-build-options/tags
@@ -0,0 +1 @@
+W: rules-dh-auto-test-does-not-check-deb-build-options source: override_dh_auto_test-does-not-check-DEB_BUILD_PROFILES (line 6)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: