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

[lintian] 01/01: c/scripts: Track debhelper auto-snippets in maintscripts



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit cb55c0891b944361dc5cfc923529465a6c5bd351
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Apr 24 13:05:48 2016 +0000

    c/scripts: Track debhelper auto-snippets in maintscripts
    
    This would be vastly more awesome if we could also extract the version
    of the tool.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/scripts.desc                                          |  6 ++++++
 checks/scripts.pm                                            |  8 ++++++--
 debian/changelog                                             |  4 ++++
 .../debian/debian/postinst                                   | 12 ++++++++++++
 t/tests/scripts-maintainer-script-classification/desc        |  6 ++++++
 t/tests/scripts-maintainer-script-classification/tags        |  1 +
 6 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/checks/scripts.desc b/checks/scripts.desc
index ddcc5ed..12a642b 100644
--- a/checks/scripts.desc
+++ b/checks/scripts.desc
@@ -746,3 +746,9 @@ Info: Lintian has detected the presence of a #DEBHELPER# token in the
  .
  Please note that dh_installdeb does <i>not</i> substitute the #DEBHELPER#
  token in udebs.
+
+Tag: debhelper-autoscript-in-maintainer-scripts
+Severity: classification
+Certainty: possible
+Info: The maintainer scripts of the package one or more auto-generated
+ shell snippets inserted by the listed debhelper tool.
diff --git a/checks/scripts.pm b/checks/scripts.pm
index 246719c..49188bd 100644
--- a/checks/scripts.pm
+++ b/checks/scripts.pm
@@ -511,8 +511,7 @@ sub run {
     # normal scripts above, because there were just enough differences to
     # make a shared function awkward.
 
-    my %added_diversions;
-    my %removed_diversions;
+    my (%added_diversions, %removed_diversions, %dh_cmd_substs);
     my $expand_diversions = 0;
     while (<$ctrl_fd>) {
         chop;
@@ -619,6 +618,11 @@ sub run {
             if (/\#DEBHELPER\#/) {
                 tag 'maintainer-script-has-unexpanded-debhelper-token', $file;
             }
+            if (/^# Automatically added by (\S+)/) {
+                my $dh_cmd = $1;
+                tag 'debhelper-autoscript-in-maintainer-scripts', $dh_cmd
+                  if not $dh_cmd_substs{$dh_cmd}++;
+            }
 
             next if m,^\s*$,;  # skip empty lines
             next if m,^\s*\#,; # skip comment lines
diff --git a/debian/changelog b/debian/changelog
index 9898696..541864c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ lintian (2.5.45) UNRELEASED; urgency=medium
 
   XXX: generate tag summary with private/generate-tag-summary
 
+  * checks/scripts.{desc,pm}:
+    + [NT] Add tracking tag to trace auto-generated shell
+      snippets in maintainer scripts.
+
   * commands/reporting-lintian-harness.pm:
     + [NT] Re-enable pedantic tags by default.  These were
       disabled in the previous release by mistake.
diff --git a/t/tests/scripts-maintainer-script-classification/debian/debian/postinst b/t/tests/scripts-maintainer-script-classification/debian/debian/postinst
new file mode 100644
index 0000000..a447be9
--- /dev/null
+++ b/t/tests/scripts-maintainer-script-classification/debian/debian/postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+# Automatically added by dh_fake_lintian_tool
+if [ "$1" = configure ]; then
+    echo do something ...
+fi
+# End automatically added section
+
+exit 0
diff --git a/t/tests/scripts-maintainer-script-classification/desc b/t/tests/scripts-maintainer-script-classification/desc
new file mode 100644
index 0000000..c3dd280
--- /dev/null
+++ b/t/tests/scripts-maintainer-script-classification/desc
@@ -0,0 +1,6 @@
+Testname: scripts-maintainer-script-classification
+Sequence: 6000
+Version: 1.0
+Description: Test for classification tags in maintscripts
+Options: -EI -L +classification -C scripts
+Test-For: debhelper-autoscript-in-maintainer-scripts
diff --git a/t/tests/scripts-maintainer-script-classification/tags b/t/tests/scripts-maintainer-script-classification/tags
new file mode 100644
index 0000000..af1acac
--- /dev/null
+++ b/t/tests/scripts-maintainer-script-classification/tags
@@ -0,0 +1 @@
+C: scripts-maintainer-script-classification: debhelper-autoscript-in-maintainer-scripts dh_fake_lintian_tool

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: