forked from pool/rpmlint
- add check for /var/lock/subsys usage
OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=31
This commit is contained in:
parent
958e7f5a2f
commit
4264d7212b
1
config
1
config
@ -64,6 +64,7 @@ setOption("UseUTF8", 1)
|
||||
#setOption("ValidGroups", ("Group1", "Group2"))
|
||||
#setOption("KernelModuleRPMsOK", 0)
|
||||
setOption("CompressExtension", None)
|
||||
setOption('UseVarLockSubsys', False)
|
||||
|
||||
setOption('StandardGroups', (
|
||||
'aegis',
|
||||
|
73
rpmlint-subsys.diff
Normal file
73
rpmlint-subsys.diff
Normal file
@ -0,0 +1,73 @@
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue May 31 11:29:52 UTC 2011 - lnussel@suse.de
|
||||
|
||||
- add check for /var/lock/subsys usage
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 24 14:20:48 UTC 2011 - lnussel@suse.de
|
||||
|
||||
|
@ -130,6 +130,7 @@ Patch88: suse-speccheck-utf8.diff
|
||||
Patch89: rpmlint-pie.diff
|
||||
# accepted upstream
|
||||
Patch90: rpmlint-typo.diff
|
||||
Patch91: rpmlint-subsys.diff
|
||||
%py_requires
|
||||
|
||||
%description
|
||||
@ -145,6 +146,7 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q -n rpmlint-%{version}
|
||||
%patch91 -p1
|
||||
%patch0
|
||||
%patch1
|
||||
%patch2
|
||||
|
@ -2,7 +2,7 @@ Index: InitScriptCheck.py
|
||||
===================================================================
|
||||
--- InitScriptCheck.py.orig
|
||||
+++ InitScriptCheck.py
|
||||
@@ -50,7 +50,7 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
@@ -52,7 +52,7 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
return
|
||||
|
||||
initscript_list = []
|
||||
@ -11,7 +11,7 @@ Index: InitScriptCheck.py
|
||||
|
||||
# check chkconfig call in %post and %preun
|
||||
postin = pkg[rpm.RPMTAG_POSTIN] or pkg[rpm.RPMTAG_POSTINPROG]
|
||||
@@ -59,6 +59,10 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
@@ -61,6 +61,10 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
|
||||
for fname, pkgfile in pkg.files().items():
|
||||
|
||||
@ -22,9 +22,9 @@ Index: InitScriptCheck.py
|
||||
if not fname.startswith('/etc/init.d/') and \
|
||||
not fname.startswith('/etc/rc.d/init.d/'):
|
||||
continue
|
||||
@@ -194,6 +198,12 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
if not subsys_regex_found:
|
||||
printError(pkg, 'subsys-not-used', fname)
|
||||
@@ -198,6 +202,12 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
elif subsys_regex_found and not use_subsys:
|
||||
printError(pkg, 'subsys-unsupported', fname)
|
||||
|
||||
+ for script in initscript_list:
|
||||
+ if script.startswith("rc") or script.startswith("boot."):
|
||||
@ -35,7 +35,7 @@ Index: InitScriptCheck.py
|
||||
goodnames = (pkg.name.lower(), pkg.name.lower() + 'd')
|
||||
if len(initscript_list) == 1 and initscript_list[0] not in goodnames:
|
||||
printWarning(pkg, 'incoherent-init-script-name', initscript_list[0],
|
||||
@@ -216,6 +226,10 @@ a call to chkconfig.''',
|
||||
@@ -220,6 +230,10 @@ a call to chkconfig.''',
|
||||
'''The package contains an init script but doesn't contain a %preun with
|
||||
a call to chkconfig.''',
|
||||
|
||||
|
@ -2,17 +2,18 @@ Index: InitScriptCheck.py
|
||||
===================================================================
|
||||
--- InitScriptCheck.py.orig
|
||||
+++ InitScriptCheck.py
|
||||
@@ -29,6 +29,9 @@ dot_in_name_regex = re.compile('.*\..*')
|
||||
use_deflevels = Config.getOption('UseDefaultRunlevels', True)
|
||||
lsb_tags_regex = re.compile('^# ([\w-]+):\s*(.*?)\s*$')
|
||||
@@ -31,6 +31,10 @@ lsb_tags_regex = re.compile('^# ([\w-]+)
|
||||
lsb_cont_regex = re.compile('^#(?:\t| )(.*?)\s*$')
|
||||
use_subsys = Config.getOption('UseVarLockSubsys', True)
|
||||
|
||||
+stop_on_removal_regex=re.compile('/etc/init.d/\$service stop > /dev/null')
|
||||
+restart_on_update_regex=re.compile('/etc/init.d/\$service try-restart > /dev/null')
|
||||
+insserv_cleanup_regex=re.compile('^\s*/sbin/insserv /etc/init.d$', re.MULTILINE)
|
||||
|
||||
+
|
||||
LSB_KEYWORDS = ('Provides', 'Required-Start', 'Required-Stop', 'Should-Start',
|
||||
'Should-Stop', 'Default-Start', 'Default-Stop',
|
||||
@@ -47,6 +50,13 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
'Short-Description', 'Description')
|
||||
@@ -48,6 +52,13 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
return
|
||||
|
||||
initscript_list = []
|
||||
@ -26,7 +27,7 @@ Index: InitScriptCheck.py
|
||||
for fname, pkgfile in pkg.files().items():
|
||||
|
||||
if not fname.startswith('/etc/init.d/') and \
|
||||
@@ -60,18 +70,15 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
@@ -61,18 +72,15 @@ class InitScriptCheck(AbstractCheck.Abst
|
||||
|
||||
if dot_in_name_regex.match(basename):
|
||||
printError(pkg, 'init-script-name-with-dot', fname)
|
||||
@ -54,7 +55,7 @@ Index: InitScriptCheck.py
|
||||
|
||||
status_found = False
|
||||
reload_found = False
|
||||
@@ -264,6 +271,17 @@ of chkconfig don't work as expected with
|
||||
@@ -271,6 +279,17 @@ of chkconfig don't work as expected with
|
||||
'init-script-non-executable',
|
||||
'''The init script should have at least the execution bit set for root
|
||||
in order for it to run at boot time.''',
|
||||
|
Loading…
Reference in New Issue
Block a user