[lintian] 01/01: Check for PACKAGE.maintscript files that include "maint-script-parameters".
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch maintscript
in repository lintian.
commit 20b477392929dc2838a302386598f34ed3361a7c
Author: Chris Lamb <lamby@debian.org>
Date: Sun Sep 18 23:26:02 2016 +0100
Check for PACKAGE.maintscript files that include "maint-script-parameters".
---
checks/debhelper.desc | 8 ++++++++
checks/debhelper.pm | 10 ++++++++++
.../debian/debian/maintscript | 4 ++++
t/tests/maintscript-includes-maint-script-parameters/desc | 6 ++++++
t/tests/maintscript-includes-maint-script-parameters/tags | 3 +++
5 files changed, 31 insertions(+)
diff --git a/checks/debhelper.desc b/checks/debhelper.desc
index 9b9d046..3317d56 100644
--- a/checks/debhelper.desc
+++ b/checks/debhelper.desc
@@ -361,3 +361,11 @@ Info: The listed target in debian/rules command is a likely misspelling.
Implementation detail: The typo is detected by using "Levenshtein
edit distance". Therefore, if the typo involve several characters,
Lintian may not detect it.
+
+Tag: maintscript-includes-maint-script-parameters
+Severity: normal
+Certainty: possible
+Info: Lines in a <tt>debian/*.maintscript</tt> correspond to
+ <tt>dpkg-maintscript-helper(1)</tt> commands and parameters. However, the
+ "maint-script-parameters" should not be included as debhelper will add those
+ automatically. See <tt>dh_installdeb(1)</tt> for more information.
diff --git a/checks/debhelper.pm b/checks/debhelper.pm
index ad80fc8..6cbfb58 100644
--- a/checks/debhelper.pm
+++ b/checks/debhelper.pm
@@ -354,6 +354,16 @@ sub run {
_tag_if_executable($file);
} elsif ($basename =~ m/^ex\.|\.ex$/i) {
tag 'dh-make-template-in-source', $file;
+ } elsif ($basename =~ m/^(?:(.*)\.)?maintscript$/) {
+ next unless $file->is_open_ok;
+ my $fd = $file->open;
+ while (<$fd>) {
+ if (m/--\s+"\$(?:@|{@})"\s*$/) {
+ tag 'maintscript-includes-maint-script-parameters',
+ $basename, "(line $.)";
+ }
+ }
+ close($fd);
} elsif ($basename =~ m/^(?:.+\.)?debhelper(?:\.log)?$/){
# The regex matches "debhelper", but debhelper/Dh_Lib does not
# make those, so skip it.
diff --git a/t/tests/maintscript-includes-maint-script-parameters/debian/debian/maintscript b/t/tests/maintscript-includes-maint-script-parameters/debian/debian/maintscript
new file mode 100644
index 0000000..6a583d7
--- /dev/null
+++ b/t/tests/maintscript-includes-maint-script-parameters/debian/debian/maintscript
@@ -0,0 +1,4 @@
+rm_conffile /etc/correct.conf 0.2~ foo
+rm_conffile /etc/incorrect.conf 0.2~ foo -- "$@"
+rm_conffile /etc/incorrect.conf 0.2~ foo -- "${@}"
+rm_conffile /etc/incorrect.conf 0.2~ foo -- "$@"
diff --git a/t/tests/maintscript-includes-maint-script-parameters/desc b/t/tests/maintscript-includes-maint-script-parameters/desc
new file mode 100644
index 0000000..0313ac0
--- /dev/null
+++ b/t/tests/maintscript-includes-maint-script-parameters/desc
@@ -0,0 +1,6 @@
+Testname: maintscript-includes-maint-script-parameters
+Sequence: 6000
+Version: 1.0
+Description: Check for dh_installdeb .maintscript files
+Test-For:
+ maintscript-includes-maint-script-parameters
diff --git a/t/tests/maintscript-includes-maint-script-parameters/tags b/t/tests/maintscript-includes-maint-script-parameters/tags
new file mode 100644
index 0000000..088f8c3
--- /dev/null
+++ b/t/tests/maintscript-includes-maint-script-parameters/tags
@@ -0,0 +1,3 @@
+W: maintscript-includes-maint-script-parameters source: maintscript-includes-maint-script-parameters maintscript (line 2)
+W: maintscript-includes-maint-script-parameters source: maintscript-includes-maint-script-parameters maintscript (line 3)
+W: maintscript-includes-maint-script-parameters source: maintscript-includes-maint-script-parameters maintscript (line 4)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: