[SCM] Debian package checker branch, master, updated. 2.5.4-75-gc1ceb87
The following commit has been merged in the master branch:
commit 6360fa20c43f6a06a12c6256f703c294a41cda50
Author: Gergely Nagy <algernon@balabit.hu>
Date: Fri Dec 23 14:51:33 2011 +0100
checks/debhelper: Add a check to look for unknown variables when using dh-exec
When using dh-exec, emit an info tag when a dh-exec script contains a
variable not known to dpkg-architecture.
Modifications to the original patch:
- Avoid capturing unused variables in the regex.
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 071a99f..09fa822 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -507,7 +507,14 @@ sub _check_dh_exec {
or fail ("Can't open $pkgpath: $!");
my ($dhe_subst, $dhe_install) = (0, 0);
while (<$fd>) {
- $dhe_subst = 1 if /\$\{[^\}]+\}/;
+ if (/\$\{([^\}]+)\}/) {
+ my $sv = $1;
+ $dhe_subst = 1;
+
+ if ($sv !~ /^DEB_(?:BUILD|HOST)_(?:ARCH(?:_OS|_CPU|_BITS|_ENDIAN)?|GNU_(?:CPU|SYSTEM|TYPE)|MULTIARCH)$/) {
+ tag 'dh-exec-subst-unknown-variable', $pkgpath, $sv;
+ }
+ }
$dhe_install = 1 if / => /;
}
close $fd;
diff --git a/checks/debhelper.desc b/checks/debhelper.desc
index 12f6fed..250e97a 100644
--- a/checks/debhelper.desc
+++ b/checks/debhelper.desc
@@ -359,3 +359,14 @@ Info: The package uses a dh-exec-install contruct in a non-.install
.
The dh-exec-install constructs are only allowed in dh_install's
.install files, and nowhere else.
+
+Tag: dh-exec-subst-unknown-variable
+Severity: minor
+Certainty: wild-guess
+Info: The package uses a variable in one of its debhelper config
+ files, but the variable is not one known to dpkg-architecture.
+ .
+ It is recommended to use a known subset of variables. If the package
+ needs more than that, and makes sure the variable is exported through
+ the build one way or the othern, then this tag can be safely ignored
+ or overriden.
diff --git a/t/tests/debhelper-dh-exec/debian/debian/manpages b/t/tests/debhelper-dh-exec/debian/debian/manpages
index 6c42b21..3d72f01 100755
--- a/t/tests/debhelper-dh-exec/debian/debian/manpages
+++ b/t/tests/debhelper-dh-exec/debian/debian/manpages
@@ -1,3 +1,4 @@
#! /usr/lib/dh-exec/dh-exec-subst
## The above works, but is not recommended.
foo => bar
+${DEB_BUILD_WHATEVER}
diff --git a/t/tests/debhelper-dh-exec/desc b/t/tests/debhelper-dh-exec/desc
index 3651100..5847cbe 100644
--- a/t/tests/debhelper-dh-exec/desc
+++ b/t/tests/debhelper-dh-exec/desc
@@ -3,9 +3,11 @@ Sequence: 6000
Version: 1.0
Options: --suppress-tags
package-needs-versioned-debhelper-build-depends
+ --display-info
Description: Tests related to executable, dh-exec using packaging files
Test-For:
dh-exec-install-not-allowed-here
dh-exec-private-helper
dh-exec-script-without-dh-exec-features
+ dh-exec-subst-unknown-variable
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 b40c656..95a3f97 100644
--- a/t/tests/debhelper-dh-exec/tags
+++ b/t/tests/debhelper-dh-exec/tags
@@ -1,4 +1,5 @@
E: debhelper-dh-exec source: dh-exec-install-not-allowed-here debian/manpages
E: debhelper-dh-exec source: dh-exec-private-helper debian/manpages
E: debhelper-dh-exec source: package-uses-dh-exec-but-lacks-build-depends
+I: debhelper-dh-exec source: dh-exec-subst-unknown-variable debian/manpages DEB_BUILD_WHATEVER
W: debhelper-dh-exec source: dh-exec-script-without-dh-exec-features debian/install
--
Debian package checker
Reply to: