[SCM] Debian package checker branch, master, updated. 2.5.4-75-gc1ceb87
The following commit has been merged in the master branch:
commit df619a41975f8844d22809316c4561c4e39156bd
Author: Gergely Nagy <algernon@balabit.hu>
Date: Fri Dec 23 12:52:07 2011 +0100
checks/debhelper: Check that a dh-exec script does use dh-exec features.
Modifications to original patch:
- Use "$fd" rather than "IN" as file descriptor.
- Explicitly close the stream.
- Added new tag in "Test-For" of the test.
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/debhelper b/checks/debhelper
index 0130620..08ad875 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -502,6 +502,20 @@ sub _check_dh_exec {
if ( $cmd =~ m,/usr/lib/dh-exec/, ) {
tag 'dh-exec-private-helper', $pkgpath;
}
+
+ open (my $fd, '<', $fspath)
+ or fail ("Can't open $pkgpath: $!");
+ my ($dhe_subst, $dhe_install) = (0, 0);
+ while (<$fd>) {
+ $dhe_subst = 1 if /\$\{[^\}]+\}/;
+ $dhe_install = 1 if / => /;
+ }
+ close $fd;
+
+ if ( ! ( $dhe_subst || $dhe_install ) ) {
+ tag 'dh-exec-script-without-dh-exec-features', $pkgpath;
+ }
+
}
# Return the command after the #! in the file (if any).
diff --git a/checks/debhelper.desc b/checks/debhelper.desc
index 4e8922f..68e873b 100644
--- a/checks/debhelper.desc
+++ b/checks/debhelper.desc
@@ -341,3 +341,12 @@ Severity: important
Certainty: possible
Info: If a package uses dh-exec, it must declare a Build-Depends
on it.
+
+Tag: dh-exec-script-without-dh-exec-features
+Severity: normal
+Certainty: possible
+Info: The package uses dh-exec in at least one of its files, but does
+ not use any of the features provided by dh-exec.
+ .
+ If the features provided by dh-exec is not needed, please remove the
+ executable bit, and the dh-exec usage.
diff --git a/t/tests/debhelper-dh-exec/desc b/t/tests/debhelper-dh-exec/desc
index 3bab222..1bd4dc5 100644
--- a/t/tests/debhelper-dh-exec/desc
+++ b/t/tests/debhelper-dh-exec/desc
@@ -6,4 +6,5 @@ Options: --suppress-tags
Description: Tests related to executable, dh-exec using packaging files
Test-For:
dh-exec-private-helper
+ dh-exec-script-without-dh-exec-features
package-uses-dh-exec-but-lacks-build-depends
diff --git a/t/tests/debhelper-dh-exec/tags b/t/tests/debhelper-dh-exec/tags
index f94bb40..564ac8c 100644
--- a/t/tests/debhelper-dh-exec/tags
+++ b/t/tests/debhelper-dh-exec/tags
@@ -1,2 +1,3 @@
E: debhelper-dh-exec source: dh-exec-private-helper debian/manpages
E: debhelper-dh-exec source: package-uses-dh-exec-but-lacks-build-depends
+W: debhelper-dh-exec source: dh-exec-script-without-dh-exec-features debian/manpages
--
Debian package checker
Reply to: