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

[SCM] Debian package checker branch, master, updated. 2.2.14-44-gfee7702



The following commit has been merged in the master branch:
commit fc1474dd4cc01c96b4e2538ce01a755b0adce48c
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Fri Aug 28 21:18:09 2009 -0500

    Add a check for init script deps. that should be virtual
    
    Some init scripts depend on a non-virtual facility although they should
    really depend on the virtual facility that implies that non-virtual facility.

diff --git a/checks/init.d b/checks/init.d
index 958e653..bcc4fe7 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -34,6 +34,17 @@ my %lsb_keywords = (provides		=> 1,
 		    'short-description' => 1,
 		    'description'	=> 0);
 
+my %common_implied_dependencies = ('mountall' => '$local_fs',
+				    'mountnfs' => '$remote_fs',
+				    'hwclock' => '$time',
+				    'portmap' => '$portmap',
+				    'named' => '$named',
+				    'bind9' => '$named',
+				    'networking' => '$network',
+				    'syslog' => '$syslog',
+				    'rsyslog' => '$syslog',
+				    'sysklogd' => '$syslog');
+
 sub run {
 
 my $pkg = shift;
@@ -289,6 +300,16 @@ sub check_init {
 	    unless ($named_after_script);
     }
 
+    for my $keyword qw(required-start should-start required-stop should-stop) {
+	next unless defined($lsb{$keyword});
+	for my $dependency (split(/\s+/, $lsb{$keyword})) {
+	    if (defined($common_implied_dependencies{$dependency})) {
+		tag "init.d-script-dependency-better-on-virtual-facility",
+			"/etc/init.d/$_ $dependency -> $common_implied_dependencies{$dependency}";
+	    }
+	}
+    }
+
     # all tags included in file?
     $tag{'start'} or tag "init.d-script-does-not-implement-required-option", "/etc/init.d/$_ start";
     $tag{'stop'} or tag "init.d-script-does-not-implement-required-option", "/etc/init.d/$_ stop";
diff --git a/checks/init.d.desc b/checks/init.d.desc
index 3650cdb..d4eda6d 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -258,3 +258,14 @@ Info: This <tt>/etc/init.d</tt> script indicates it provides one or
  naming convention, in most cases that's the right way to name the
  facility provided by the init script.
 Ref: http://wiki.debian.org/LSBInitScripts
+
+Tag: init.d-script-dependency-better-on-virtual-facility
+Severity: important
+Certainty: possible
+Info: The given <tt>/etc/init.d</tt> script depends on a non-virtual
+ facility although it should probably depend on the virtual facility
+ that implies that facility. One such example is when a dependency on
+ <tt>networking</tt> is declared, although the script should probably
+ depend on <tt>$network</tt> instead, which will pull in whataver
+ init script provides that virtual facility, therefore accomodating to
+ other setups and requirements.
diff --git a/t/tests/init.d-lsb-headers/debian/debian/init.d-lsb-headers.init b/t/tests/init.d-lsb-headers/debian/debian/init.d-lsb-headers.init
index fb50bbb..1630531 100644
--- a/t/tests/init.d-lsb-headers/debian/debian/init.d-lsb-headers.init
+++ b/t/tests/init.d-lsb-headers/debian/debian/init.d-lsb-headers.init
@@ -4,8 +4,9 @@ set -e
 
 ### BEGIN INIT INFO
 # Provides:          nothing $bad_facility
-# Required-Start:
-# Required-Stop:
+# Required-Start: mountall networking sysklogd
+# Should-Start: portmap
+# Required-Stop: mountnfs
 # Default-Start: 0 6 X
 # Default-Stop: S Y
 # Short-Description: Do nothing at all
diff --git a/t/tests/init.d-lsb-headers/desc b/t/tests/init.d-lsb-headers/desc
index 87544a8..6466b13 100644
--- a/t/tests/init.d-lsb-headers/desc
+++ b/t/tests/init.d-lsb-headers/desc
@@ -9,3 +9,4 @@ Test-For:
  init.d-script-starts-in-stop-runlevel
  init.d-script-provides-virtual-facility-in-header
  init.d-script-provides-not-after-its-name
+ init.d-script-dependency-better-on-virtual-facility
diff --git a/t/tests/init.d-lsb-headers/tags b/t/tests/init.d-lsb-headers/tags
index b2479fa..6801139 100644
--- a/t/tests/init.d-lsb-headers/tags
+++ b/t/tests/init.d-lsb-headers/tags
@@ -1,3 +1,8 @@
+E: init.d-lsb-headers: init.d-script-dependency-better-on-virtual-facility /etc/init.d/init.d-lsb-headers mountall -> $local_fs
+E: init.d-lsb-headers: init.d-script-dependency-better-on-virtual-facility /etc/init.d/init.d-lsb-headers mountnfs -> $remote_fs
+E: init.d-lsb-headers: init.d-script-dependency-better-on-virtual-facility /etc/init.d/init.d-lsb-headers networking -> $network
+E: init.d-lsb-headers: init.d-script-dependency-better-on-virtual-facility /etc/init.d/init.d-lsb-headers portmap -> $portmap
+E: init.d-lsb-headers: init.d-script-dependency-better-on-virtual-facility /etc/init.d/init.d-lsb-headers sysklogd -> $syslog
 W: init.d-lsb-headers: init-d-script-stops-in-s-runlevel /etc/init.d/init.d-lsb-headers
 W: init.d-lsb-headers: init.d-script-has-bad-start-runlevel /etc/init.d/init.d-lsb-headers X
 W: init.d-lsb-headers: init.d-script-has-bad-stop-runlevel /etc/init.d/init.d-lsb-headers Y

-- 
Debian package checker


Reply to: