[lintian] 01/01: Check for packages using sensible-utils without declaring a dependency after its split from debianutils. (Closes: #872611)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch sensible-utils-872611
in repository lintian.
commit 780b3eb917dcf1d9e7e36c87892511d43c604377
Author: Chris Lamb <lamby@debian.org>
Date: Sat Aug 19 18:52:45 2017 -0700
Check for packages using sensible-utils without declaring a dependency after its split from debianutils. (Closes: #872611)
---
checks/scripts.desc | 13 +++++++++++++
checks/scripts.pm | 16 ++++++++++++++++
debian/changelog | 2 ++
.../debian/debian/install | 1 +
.../debian/debian/postinst | 7 +++++++
.../debian/test-script | 8 ++++++++
.../scripts-script-needs-depends-on-sensible-utils/desc | 4 ++++
.../scripts-script-needs-depends-on-sensible-utils/tags | 2 ++
8 files changed, 53 insertions(+)
diff --git a/checks/scripts.desc b/checks/scripts.desc
index 8a5b6bb..7f7664b 100644
--- a/checks/scripts.desc
+++ b/checks/scripts.desc
@@ -752,3 +752,16 @@ Tag: elf-maintainer-script
Severity: classification
Certainty: certain
Info: The maintainer script is an ELF binary.
+
+Tag: script-needs-depends-on-sensible-utils
+Severity: important
+Certainty: possible
+Info: The listed script uses one or more of the binaries in
+ <tt>sensible-utils</tt> but is missing a dependency for this package.
+ .
+ As part of the transition to split <tt>sensible-utils</tt> and
+ <tt>debianutils</tt>, the remaining <tt>Depends</tt> from
+ <tt>debianutils</tt> was removed in version 4.8.2.
+ .
+ In most cases, you will need to add a <tt>Depends</tt> on
+ <tt>sensible-utils</tt>.
diff --git a/checks/scripts.pm b/checks/scripts.pm
index d118dea..7828e85 100644
--- a/checks/scripts.pm
+++ b/checks/scripts.pm
@@ -349,6 +349,7 @@ sub run {
if (check_script_syntax($interpreter, $path)) {
script_tag('shell-script-fails-syntax-check', $filename);
}
+ check_script_uses_sensible_utils($path);
}
}
@@ -614,6 +615,7 @@ sub run {
if (check_script_syntax("/bin/${base}", $path)) {
tag 'maintainer-shell-script-fails-syntax-check', $file;
}
+ check_script_uses_sensible_utils($path);
}
}
@@ -1267,6 +1269,20 @@ sub check_script_syntax {
return $?;
}
+sub check_script_uses_sensible_utils {
+ my ($path) = @_;
+ my $fd = $path->open;
+ while (<$fd>) {
+ if (m/${LEADIN}(?:select-editor|sensible-(?:browser|editor|pager))\b/){
+ tag 'script-needs-depends-on-sensible-utils',
+ $path->name, "(line $.)";
+ last;
+ }
+ }
+ close($fd);
+ return;
+}
+
sub remove_comments {
local $_;
diff --git a/debian/changelog b/debian/changelog
index 64dbc0f..b70d933 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,6 +64,8 @@ lintian (2.5.53) UNRELEASED; urgency=medium
valid shell prefix. (Closes: #869587)
+ [CL] Check for missing calls to dpkg-maintscript-helper(1) in
maintainer scripts. (Closes: #872042)
+ + [CL] Check for packages using sensible-utils without declaring a
+ dependency after its split from debianutils. (Closes: #872611)
* checks/testsuite.{desc,pm}:
+ [CL] Remove recommendations to add a "Testsuite: autopkgtest" field
to debian/control as it is added when needed by dpkg-source(1)
diff --git a/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/debian/install b/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/debian/install
new file mode 100644
index 0000000..4c88597
--- /dev/null
+++ b/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/debian/install
@@ -0,0 +1 @@
+test-script var/lib/test
diff --git a/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/debian/postinst b/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/debian/postinst
new file mode 100644
index 0000000..f369cc0
--- /dev/null
+++ b/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/debian/postinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+sensible-pager
+
+#DEBHELPER#
diff --git a/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/test-script b/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/test-script
new file mode 100755
index 0000000..f0a46b2
--- /dev/null
+++ b/t/tests/scripts-script-needs-depends-on-sensible-utils/debian/test-script
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+sensible-editor
+
+# sensible-pager false positive
+
+# Only report on the first match
+select-editor
diff --git a/t/tests/scripts-script-needs-depends-on-sensible-utils/desc b/t/tests/scripts-script-needs-depends-on-sensible-utils/desc
new file mode 100644
index 0000000..50a4c14
--- /dev/null
+++ b/t/tests/scripts-script-needs-depends-on-sensible-utils/desc
@@ -0,0 +1,4 @@
+Testname: scripts-script-needs-depends-on-sensible-utils
+Version: 1.0
+Description: Check missing dep on sensible-utils
+Test-For: script-needs-depends-on-sensible-utils
diff --git a/t/tests/scripts-script-needs-depends-on-sensible-utils/tags b/t/tests/scripts-script-needs-depends-on-sensible-utils/tags
new file mode 100644
index 0000000..e3db3d2
--- /dev/null
+++ b/t/tests/scripts-script-needs-depends-on-sensible-utils/tags
@@ -0,0 +1,2 @@
+E: scripts-script-needs-depends-on-sensible-utils: script-needs-depends-on-sensible-utils postinst (line 5)
+E: scripts-script-needs-depends-on-sensible-utils: script-needs-depends-on-sensible-utils var/lib/test/test-script (line 3)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: