[lintian] 10/12: c/control-files: Classify (absence of) maintscripts
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit cf53e6fe6f933f11517763664d73c842d0fe7344
Author: Niels Thykier <niels@thykier.net>
Date: Fri Apr 22 16:21:47 2016 +0000
c/control-files: Classify (absence of) maintscripts
Signed-off-by: Niels Thykier <niels@thykier.net>
---
checks/control-files.desc | 14 ++++++++++++++
checks/control-files.pm | 8 ++++++++
.../debian/debian/postinst | 9 +++++++++
.../debian/debian/prerm | 9 +++++++++
t/tests/control-files-classifications-ctrl-script/desc | 6 ++++++
t/tests/control-files-classifications-ctrl-script/tags | 2 ++
t/tests/control-files-classifications-no-ctrl-scripts/desc | 6 ++++++
t/tests/control-files-classifications-no-ctrl-scripts/tags | 1 +
t/tests/debhelper-compat-old/tags | 1 +
9 files changed, 56 insertions(+)
diff --git a/checks/control-files.desc b/checks/control-files.desc
index 8ece2a2..ca22856 100644
--- a/checks/control-files.desc
+++ b/checks/control-files.desc
@@ -45,3 +45,17 @@ Tag: control-file-is-not-a-file
Severity: serious
Certainty: certain
Info: The package contains a control file that is not a regular file.
+
+Tag: ctrl-script
+Severity: classification
+Certainty: certain
+Info: This package has one or more maintainer scripts (or other
+ executable control files).
+ .
+ This flags any control file with the executable bit set.
+
+Tag: no-ctrl-scripts
+Severity: classification
+Certainty: certain
+Info: The package does not rely on any maintainer scripts (or other
+ executable control files).
diff --git a/checks/control-files.pm b/checks/control-files.pm
index af81bef..bc9b2ab 100644
--- a/checks/control-files.pm
+++ b/checks/control-files.pm
@@ -39,6 +39,7 @@ sub run {
my (undef, $type, $info) = @_;
my $ctrl = $type eq 'udeb' ? $UDEB_PERMISSIONS : $DEB_PERMISSIONS;
my $ctrl_alt = $type eq 'udeb' ? $DEB_PERMISSIONS : $UDEB_PERMISSIONS;
+ my $has_ctrl_script = 0;
# process control-index file
foreach my $file ($info->sorted_control_index) {
@@ -76,6 +77,10 @@ sub run {
next if $file eq 'control';
$operm = $file->operm;
+ if ($operm & 0111 or $experm & 0111) {
+ $has_ctrl_script = 1;
+ tag 'ctrl-script', $file;
+ }
# correct permissions?
unless ($operm == $experm) {
@@ -92,6 +97,9 @@ sub run {
# for other maintainer scripts checks, see the scripts check
}
+ if (not $has_ctrl_script) {
+ tag 'no-ctrl-scripts';
+ }
return;
} # </run>
diff --git a/t/tests/control-files-classifications-ctrl-script/debian/debian/postinst b/t/tests/control-files-classifications-ctrl-script/debian/debian/postinst
new file mode 100644
index 0000000..690173c
--- /dev/null
+++ b/t/tests/control-files-classifications-ctrl-script/debian/debian/postinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] && which bar 2>/dev/null >/dev/null; then
+ bar configure
+fi
+
+#DEBHELPER#
diff --git a/t/tests/control-files-classifications-ctrl-script/debian/debian/prerm b/t/tests/control-files-classifications-ctrl-script/debian/debian/prerm
new file mode 100644
index 0000000..a166618
--- /dev/null
+++ b/t/tests/control-files-classifications-ctrl-script/debian/debian/prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] && which bar 2>/dev/null >/dev/null; then
+ bar remove
+fi
+
+#DEBHELPER#
diff --git a/t/tests/control-files-classifications-ctrl-script/desc b/t/tests/control-files-classifications-ctrl-script/desc
new file mode 100644
index 0000000..935ed55
--- /dev/null
+++ b/t/tests/control-files-classifications-ctrl-script/desc
@@ -0,0 +1,6 @@
+Testname: control-files-classifications-ctrl-script
+Sequence: 6000
+Version: 1.0
+Description: Test for control-files classifications
+Options: -L +=classification -C control-files
+Test-For: ctrl-script
diff --git a/t/tests/control-files-classifications-ctrl-script/tags b/t/tests/control-files-classifications-ctrl-script/tags
new file mode 100644
index 0000000..c4f5895
--- /dev/null
+++ b/t/tests/control-files-classifications-ctrl-script/tags
@@ -0,0 +1,2 @@
+C: control-files-classifications-ctrl-script: ctrl-script postinst
+C: control-files-classifications-ctrl-script: ctrl-script prerm
diff --git a/t/tests/control-files-classifications-no-ctrl-scripts/desc b/t/tests/control-files-classifications-no-ctrl-scripts/desc
new file mode 100644
index 0000000..f209e4c
--- /dev/null
+++ b/t/tests/control-files-classifications-no-ctrl-scripts/desc
@@ -0,0 +1,6 @@
+Testname: control-files-classifications-no-ctrl-scripts
+Sequence: 6000
+Version: 1.0
+Description: Test for control-files classifications
+Options: -L +=classification -C control-files
+Test-For: no-ctrl-scripts
diff --git a/t/tests/control-files-classifications-no-ctrl-scripts/tags b/t/tests/control-files-classifications-no-ctrl-scripts/tags
new file mode 100644
index 0000000..8f74784
--- /dev/null
+++ b/t/tests/control-files-classifications-no-ctrl-scripts/tags
@@ -0,0 +1 @@
+C: control-files-classifications-no-ctrl-scripts: no-ctrl-scripts
diff --git a/t/tests/debhelper-compat-old/tags b/t/tests/debhelper-compat-old/tags
index d88995d..964a560 100644
--- a/t/tests/debhelper-compat-old/tags
+++ b/t/tests/debhelper-compat-old/tags
@@ -1,3 +1,4 @@
C: debhelper-compat-old source: debian-build-system dh
C: debhelper-compat-old source: source-format 1.0 [non-native]
+C: debhelper-compat-old: no-ctrl-scripts
P: debhelper-compat-old source: package-uses-old-debhelper-compat-version 8
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: