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

[SCM] Debian package checker branch, master, updated. 2.1.5-16-g84ea02f



The following commit has been merged in the master branch:
commit 560751b24c23a2181a056af4ce57deb85cc78aae
Author: Russ Allbery <rra@debian.org>
Date:   Sat Jan 17 11:58:28 2009 -0800

    Recognize type as a way of checking for binaries
    
    * checks/menus:
      + [RA] Recognize type as a way of checking for binaries, even though
        it's a bashism, so that we don't issue confusing duplicate tags for
        one same problem.  (Closes: #512119)
    * checks/scripts{,.desc}:
      + [RA] Recognize type as a way of checking for binaries, even though
        it's a bashism, so that we don't issue confusing duplicate tags for
        one same problem.

diff --git a/checks/menus b/checks/menus
index 5bd69ec..0392b6f 100644
--- a/checks/menus
+++ b/checks/menus
@@ -596,7 +596,8 @@ sub check_script {
 	##
 
 	# does the script check whether update-menus exists?
-	if (/-x\s+\S*update-menus/o or /(which|command)(\s+\S+)?\s+update-menus/o) {
+	if (/-x\s+\S*update-menus/o or /(which|type)\s+update-menus/o
+	    or /command\s+.*?update-menus/o) {
 	    # yes, it does.
 	    $pres->{'checks-for-updatemenus'} = 1;
 	}
@@ -615,7 +616,7 @@ sub check_script {
 	}
 
 	# does the script check whether wm-menu-config exists?
-	if (s/-x\s+\S*wm-menu-config//o or /which\s+wm-menu-config/o
+	if (s/-x\s+\S*wm-menu-config//o or /(which|type)\s+wm-menu-config/o
 	    or s/command\s+.*?wm-menu-config//o) {
 	    # yes, it does.
 	    $pres->{'checks-for-wmmenuconfig'} = 1;
@@ -653,7 +654,7 @@ sub check_script {
 	}
 
 	# does the script check whether install-docs exists?
-	if (s/-x\s+\S*install-docs//o or /which\s+install-docs/o
+	if (s/-x\s+\S*install-docs//o or /(which|type)\s+install-docs/o
 	    or s/command\s+.*?install-docs//o) {
 	    # yes, it does.
 	    $pres->{'checks-for-installdocs'} = 1;
diff --git a/checks/scripts b/checks/scripts
index f04e4dd..47d63db 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -849,7 +849,7 @@ while (<SCRIPTS>) {
 	    for my $rule (@depends_needed) {
 		my ($package, $regex) = @$rule;
 		if ($pkg ne $package and /$regex/ and ! $warned{$package}) {
-		    if (m,-x\s+\S*$regex, or m,which\s+$regex, or m,command\s+.*?$regex,) {
+		    if (m,-x\s+\S*$regex, or m,(which|type)\s+$regex, or m,command\s+.*?$regex,) {
 			$warned{$package} = 1;
 		    } else {
 			my $needed = Dep::parse($package);
diff --git a/debian/changelog b/debian/changelog
index 8533f1a..00e1a11 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,12 +20,19 @@ lintian (2.1.6) UNRELEASED; urgency=low
       in Uploaders.  Thanks, Joerg Jaspert.  (Closes: #511536)
   * checks/lintian.desc:
     + [RA] Add tag description for malformed-changes-file.
+  * checks/menus:
+    + [RA] Recognize type as a way of checking for binaries, even though
+      it's a bashism, so that we don't issue confusing duplicate tags for
+      one same problem.  (Closes: #512119)
   * checks/nmu{,.desc}:
     + [RA] Suppress NMU warnings for packages with "local" in the version
       number or "local package" in the first line of the changelog.
       Thanks, Zack Weinberg.  (Closes: #501523)
-  * checks/scripts.desc:
+  * checks/scripts{,.desc}:
     + [RA] Mention type as a bashism and recommend which or command -v.
+    + [RA] Recognize type as a way of checking for binaries, even though
+      it's a bashism, so that we don't issue confusing duplicate tags for
+      one same problem.
 
   * frontend/lintian:
     + [RA] Check that .changes files have at least a Format key.  If not,
diff --git a/t/tests/6000_menus-script-check-ok.desc b/t/tests/6000_menus-script-check-ok.desc
new file mode 100644
index 0000000..39aa562
--- /dev/null
+++ b/t/tests/6000_menus-script-check-ok.desc
@@ -0,0 +1,7 @@
+Testname: menus-script-check-ok
+Version: 1.0
+Description: Correct program checks in maintainer scripts
+Test-Against:
+ maintainer-script-does-not-check-for-existence-of-installdocs
+ maintainer-script-does-not-check-for-existence-of-updatemenus
+ maintainer-script-does-not-check-for-existence-of-wm-menu-config
diff --git a/t/tests/menus-script-check-ok/debian/debian/install b/t/tests/menus-script-check-ok/debian/debian/install
new file mode 100644
index 0000000..1d3c127
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/install
@@ -0,0 +1,5 @@
+debian/test-doc.txt  usr/share/doc/menus-script-check-ok
+debian/test-doc      usr/share/doc-base
+debian/test-menu     usr/share/menu
+debian/test-script   usr/bin
+debian/test-script.1 usr/share/man/man1
diff --git a/t/tests/menus-script-check-ok/debian/debian/postinst b/t/tests/menus-script-check-ok/debian/debian/postinst
new file mode 100644
index 0000000..091248c
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/postinst
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+# Checks that the maintainer script checks for the existence of programs
+# that it calls.  This should produce no warnings except a bashism warning
+# about using type and a warning about the deprecated wm-menu-config
+# invocation.
+if [ -x /usr/bin/update-menus ] ; then
+    update-menus
+fi
+if command -v wm-menu-config >/dev/null 2>&1 ; then
+    wm-menu-config
+fi
+if type install-docs >/dev/null 2>&1 ; then
+    install-docs -i /usr/share/doc-base/test-doc
+fi
+
+#DEBHELPER#
diff --git a/t/tests/menus-script-check-ok/debian/debian/postrm b/t/tests/menus-script-check-ok/debian/debian/postrm
new file mode 100644
index 0000000..c2274f3
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/postrm
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+if type update-menus >/dev/null 2>&1 ; then
+    update-menus
+fi
+
+#DEBHELPER#
diff --git a/t/tests/menus-script-check-ok/debian/debian/prerm b/t/tests/menus-script-check-ok/debian/debian/prerm
new file mode 100644
index 0000000..8618321
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/prerm
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+if [ -x "`which install-docs 2>/dev/null`" ] ; then
+    install-docs -r test-doc
+fi
+
+#DEBHELPER#
diff --git a/t/tests/menus-script-check-ok/debian/debian/test-doc b/t/tests/menus-script-check-ok/debian/debian/test-doc
new file mode 100644
index 0000000..4a133c4
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/test-doc
@@ -0,0 +1,8 @@
+Document: test-doc
+Title: Test document for Lintian test
+Author: Russ Allbery
+Abstract: This is just a test document
+Section: Debian
+
+Format: text
+Files: /usr/share/doc/menus-script-check-ok/test-doc.txt
diff --git a/t/tests/menus-script-check-ok/debian/debian/test-doc.txt b/t/tests/menus-script-check-ok/debian/debian/test-doc.txt
new file mode 100644
index 0000000..a0f31e8
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/test-doc.txt
@@ -0,0 +1 @@
+This is a test document.
diff --git a/t/tests/menus-script-check-ok/debian/debian/test-menu b/t/tests/menus-script-check-ok/debian/debian/test-menu
new file mode 100644
index 0000000..9da38aa
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/test-menu
@@ -0,0 +1,5 @@
+?package(menus-script-check-ok):\
+  section="Applications/Programming"\
+  needs="text"\
+  title="Test menu entry"\
+  command="/usr/bin/test-script"
diff --git a/t/tests/menus-script-check-ok/debian/debian/test-script b/t/tests/menus-script-check-ok/debian/debian/test-script
new file mode 100644
index 0000000..f5da270
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/test-script
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo 'This script does nothing.'
diff --git a/t/tests/menus-script-check-ok/debian/debian/test-script.1 b/t/tests/menus-script-check-ok/debian/debian/test-script.1
new file mode 100644
index 0000000..f9e84b6
--- /dev/null
+++ b/t/tests/menus-script-check-ok/debian/debian/test-script.1
@@ -0,0 +1,7 @@
+.TH test-script 1
+.SH NAME
+test\-script \- some test script
+.SH SYNOPSIS
+.B test\-script
+.SH DESCRIPTION
+Some test script.
diff --git a/t/tests/menus-script-check-ok/tags b/t/tests/menus-script-check-ok/tags
new file mode 100644
index 0000000..ea949ab
--- /dev/null
+++ b/t/tests/menus-script-check-ok/tags
@@ -0,0 +1,3 @@
+W: menus-script-check-ok: maintainer-script-calls-deprecated-wm-menu-config postinst:12
+W: menus-script-check-ok: possible-bashism-in-maintainer-script postinst:14 'if type '
+W: menus-script-check-ok: possible-bashism-in-maintainer-script postrm:3 'if type '

-- 
Debian package checker


Reply to: