SHA256
1
0
forked from pool/rpmlint
rpmlint/rpmlint-subsys.diff

74 lines
3.0 KiB
Diff
Raw Normal View History

From 665a612a589e161509de4aeab1486f430cc99e03 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Tue, 31 May 2011 13:21:27 +0200
Subject: [PATCH] add option to disable /var/lock/subsys check
openSUSE for example doesn't use /var/lock/subsys
---
InitScriptCheck.py | 11 +++++++++--
config | 4 ++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/InitScriptCheck.py b/InitScriptCheck.py
index ba7952e..167385b 100644
--- a/InitScriptCheck.py
+++ b/InitScriptCheck.py
@@ -29,6 +29,7 @@ dot_in_name_regex = re.compile('.*\..*')
use_deflevels = Config.getOption('UseDefaultRunlevels', True)
lsb_tags_regex = re.compile('^# ([\w-]+):\s*(.*?)\s*$')
lsb_cont_regex = re.compile('^#(?:\t| )(.*?)\s*$')
+use_subsys = Config.getOption('UseVarLockSubsys', True)
LSB_KEYWORDS = ('Provides', 'Required-Start', 'Required-Stop', 'Should-Start',
'Should-Stop', 'Default-Start', 'Default-Stop',
@@ -152,7 +153,7 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
if res:
subsys_regex_found = True
name = res.group(1)
- if name != basename:
+ if use_subsys and name != basename:
error = True
if name[0] == '$':
value = Pkg.substitute_shell_vars(name, content_str)
@@ -181,8 +182,10 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
printWarning(pkg, 'no-reload-entry', fname)
if not chkconfig_content_found:
printError(pkg, 'no-chkconfig-line', fname)
- if not subsys_regex_found:
+ if not subsys_regex_found and use_subsys:
printError(pkg, 'subsys-not-used', fname)
+ elif subsys_regex_found and not use_subsys:
+ printError(pkg, 'subsys-unsupported', fname)
goodnames = (pkg.name.lower(), pkg.name.lower() + 'd')
if len(initscript_list) == 1 and initscript_list[0] not in goodnames:
@@ -238,6 +241,10 @@ reasons, most services should not be. Use "-" as the default runlevel in the
init script's "chkconfig:" line and/or remove the "Default-Start:" LSB keyword
to fix this if appropriate for this service.''',
+'subsys-unsupported',
+'''The init script uses /var/lock/subsys which is not supported by
+this distribution.''',
+
'subsys-not-used',
'''While your daemon is running, you have to put a lock file in
/var/lock/subsys/. To see an example, look at this directory on your
diff --git a/config b/config
index 8ed05d4..5631260 100644
--- a/config
+++ b/config
@@ -162,6 +162,10 @@ from Config import *
# Type: boolean, default: True
#setOption("UseVersionInChangelog", True)
+# Whether init scripts must use /var/lock/subsys
+# Type: boolean, default: True
+#setOption("UseVarLockSubsys", True)
+
# Architecture dependent paths in which packages are allowed to install files
# even if they are all non-binary.
# Type: regexp, default: see BinariesCheck
--
1.7.3.4