diff --git a/rpmlint.changes b/rpmlint.changes index 9f97dbe..6782e5d 100644 --- a/rpmlint.changes +++ b/rpmlint.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon May 2 11:56:25 UTC 2011 - lnussel@suse.de + +- another try to fix InitScriptCheck.py + ------------------------------------------------------------------- Wed Apr 27 15:09:54 CEST 2011 - dmueller@suse.de diff --git a/suse-rclink-check.diff b/suse-rclink-check.diff index 201ac37..a705bb4 100644 --- a/suse-rclink-check.diff +++ b/suse-rclink-check.diff @@ -1,6 +1,8 @@ ---- InitScriptCheck.py +Index: InitScriptCheck.py +=================================================================== +--- InitScriptCheck.py.orig +++ InitScriptCheck.py -@@ -51,7 +51,7 @@ +@@ -50,7 +50,7 @@ class InitScriptCheck(AbstractCheck.Abst return initscript_list = [] @@ -9,17 +11,18 @@ # check chkconfig call in %post and %preun postin = pkg[rpm.RPMTAG_POSTIN] or pkg[rpm.RPMTAG_POSTINPROG] -@@ -60,6 +60,9 @@ +@@ -59,6 +59,10 @@ class InitScriptCheck(AbstractCheck.Abst for fname, pkgfile in pkg.files().items(): -+ if stat.S_ISLNK(pkgfile.mode) and fname.startswith("/usr/sbin/rc"): ++ 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 +202,12 @@ +@@ -194,6 +198,12 @@ class InitScriptCheck(AbstractCheck.Abst if not subsys_regex_found: printError(pkg, 'subsys-not-used', fname) @@ -32,13 +35,13 @@ 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], -@@ -229,6 +238,10 @@ - '''The package contains an init script but doesn't contain a %postun - with a call to %insserv_cleanup-postun''', +@@ -216,6 +226,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 -+have contain the SUSE policy symlink /usr/sbin/rcFOO -> /etc/init.d/FOO''', ++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 diff --git a/sysv5-init-checks.diff b/sysv5-init-checks.diff index ec159a1..91ec130 100644 --- a/sysv5-init-checks.diff +++ b/sysv5-init-checks.diff @@ -1,17 +1,18 @@ ---- InitScriptCheck.py +Index: InitScriptCheck.py +=================================================================== +--- InitScriptCheck.py.orig +++ InitScriptCheck.py -@@ -29,6 +29,10 @@ +@@ -29,6 +29,9 @@ 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*$') -+insserv_regex=re.compile('^\s*sbin/insserv', re.MULTILINE) -+stop_on_removal_regex=re.compile('^\s*%stop_on_removal\s+\S+', re.MULTILINE) -+restart_on_update_regex=re.compile('^\s*%restart_on_update\s\S+', re.MULTILINE) -+insserv_cleanup_regex=re.compile('^\s*%insserv_cleanup', re.MULTILINE) ++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 +51,13 @@ +@@ -47,6 +50,13 @@ class InitScriptCheck(AbstractCheck.Abst return initscript_list = [] @@ -25,7 +26,7 @@ for fname, pkgfile in pkg.files().items(): if not fname.startswith('/etc/init.d/') and \ -@@ -60,18 +71,19 @@ +@@ -60,18 +70,15 @@ class InitScriptCheck(AbstractCheck.Abst if dot_in_name_regex.match(basename): printError(pkg, 'init-script-name-with-dot', fname) @@ -35,47 +36,25 @@ - printError(pkg, 'init-script-without-chkconfig-postin', fname) - elif not chkconfig_regex.search(postin): - printError(pkg, 'postin-without-chkconfig', fname) - +- - preun = pkg[rpm.RPMTAG_PREUN] or pkg[rpm.RPMTAG_PREUNPROG] - if not preun: +- if not preun: - printError(pkg, 'init-script-without-chkconfig-preun', fname) - elif not chkconfig_regex.search(preun): - printError(pkg, 'preun-without-chkconfig', fname) -+ printError(pkg, 'init-script-without-%stop_on_removal-preun', fname) -+ elif not stop_on_removal_regex.search(preun): -+ printError(pkg, 'preun-without-%stop_on_removal-preun', fname) + -+ if not postun: ++ if not preun or not stop_on_removal_regex.search(preun): ++ printError(pkg, 'init-script-without-%stop_on_removal-preun', fname) ++ ++ if not postun or not restart_on_update_regex.search(postun): + printError(pkg, 'init-script-without-%restart_on_update-postun', fname) -+ else: -+ if not restart_on_update_regex.search(postun): -+ printError(pkg, 'postun-without-%restart_on_update', fname) -+ if not insserv_cleanup_regex.search(postun): -+ printError(pkg, 'postun-without-%insserv_cleanup', fname) ++ ++ if not postun or not insserv_cleanup_regex.search(postun): ++ printError(pkg, 'init-script-without-%insserv_cleanup-postun', fname) status_found = False reload_found = False -@@ -202,10 +214,18 @@ - '''The package contains an init script but doesn't call chkconfig in its - %post script.''', - --'init-script-without-chkconfig-preun', -+'init-script-without-%stop_on_removal-preun', - '''The package contains an init script but doesn't contain a %preun with - a call to chkconfig.''', - -+'init-script-without-%insserv_cleanup-postun', -+'''The package contains an init script but doesn't contain a %postun -+with a call to %insserv_cleanup-postun''', -+ -+'postun-without-%insserv_cleanup', -+'''The package contains an init script but doesn't contain a %postun -+with a call to %insserv_cleanup-postun''', -+ - 'preun-without-chkconfig', - '''The package contains an init script but doesn't call chkconfig in its - %preun script.''', -@@ -264,6 +284,24 @@ +@@ -264,6 +271,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.''', @@ -83,16 +62,9 @@ +'init-script-without-%stop_on_removal-preun', +'''The init script should have a %preun script that calls %stop_on_removal.''', + -+'preun-without-%stop_on_removal-preun', -+'''The init script is not listed in %stop_on_removal in %preun.''', -+ +'init-script-without-%insserv_cleanup-postun', +'''The package doesn't have a %insserv_cleanup call in %postun''', + -+'postun-without-%insserv_cleanup', -+'''The package has an init script that is inserted with insserv but -+doesn't have a %insserv_cleanup call in %postun''', -+ +'init-script-without-%restart_on_update-postun', +''' The package has an init script but is missing the %restart_on_update +call in %postun to automatically restart the daemon. This is optional,