rpmlint/suse-rclink-check.diff
Dirk Mueller 3073721c60 - update to 1.4:
* rpmdiff: Teach rpmdiff about pretrans and posttrans
  * SpecCheck.py: merge patch from #97, using BuildArch with
  something else than Noarch is likely a error and causing issues.
  * FilesCheck.py: Add Python 3.3 magic number
  * FilesCheck.py, InitScriptCheck.py, MenuCheck.py, Pkg.py,
    PostCheck.py: Prepare for rpm-python possibly returning script
   progs as arrays.

OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=133
2012-09-13 16:01:40 +00:00

49 lines
1.9 KiB
Diff

Index: InitScriptCheck.py
===================================================================
--- InitScriptCheck.py.orig
+++ InitScriptCheck.py
@@ -51,7 +51,7 @@ class InitScriptCheck(AbstractCheck.Abst
return
initscript_list = []
-
+ rclinks = set()
# check chkconfig call in %post and %preun
postin = pkg[rpm.RPMTAG_POSTIN] or pkg.scriptprog(pkg[rpm.RPMTAG_POSTINPROG])
@@ -60,6 +60,10 @@ class InitScriptCheck(AbstractCheck.Abst
for fname, pkgfile in pkg.files().items():
+ if stat.S_ISLNK(pkgfile.mode) and (fname.startswith("/usr/sbin/rc") \
+ or fname.startswith("/sbin/rc")):
+ rclinks.add(fname.partition('/rc')[2])
+
if not fname.startswith('/etc/init.d/') and \
not fname.startswith('/etc/rc.d/init.d/'):
continue
@@ -199,6 +203,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."):
+ continue
+ if not script in rclinks:
+ printWarning(pkg, 'suse-missing-rclink', script)
+
if len(initscript_list) == 1:
pkgname = re.sub("-sysvinit$", "", pkg.name.lower())
goodnames = (pkgname, pkgname + 'd')
@@ -223,6 +233,10 @@ a call to chkconfig.''',
'''The package contains an init script but doesn't contain a %preun with
a call to chkconfig.''',
+'suse-missing-rclink',
+'''The package contains an init script with the given name but does not
+contain the SUSE policy symlink /usr/sbin/rcFOO -> /etc/init.d/FOO''',
+
'preun-without-chkconfig',
'''The package contains an init script but doesn't call chkconfig in its
%preun script.''',