SHA256
1
0
forked from pool/rpmlint

Accepting request 69228 from devel:openSUSE:Factory:rpmlint

- add account services (bnc#676638)

- another try to fix InitScriptCheck.py (bnc#690961)

- implement setFilterException()
- rediff noarch-lib64.diff and enable it again (bnc#663885)

- make error description more clearn (bnc#686328)

OBS-URL: https://build.opensuse.org/request/show/69228
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=107
This commit is contained in:
Marcus Rückert 2011-05-02 15:31:18 +00:00 committed by Git OBS Bridge
commit aa9b9ad420
8 changed files with 152 additions and 83 deletions

3
config
View File

@ -414,6 +414,9 @@ setOption("DBUSServices.WhiteList", (
# urfkill (bnc#688328)
"org.freedesktop.URfkill.service",
"org.freedesktop.URfkill.conf",
# account services (bnc#676638)
"org.freedesktop.Accounts.service",
"org.freedesktop.Accounts.conf",
))
# Output filters

View File

@ -1,43 +1,39 @@
--- BinariesCheck.py
+++ BinariesCheck.py
@@ -153,6 +153,7 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
binary=0
binary_in_usr_lib=0
has_usr_lib_file=0
+ file_in_lib64=0
@@ -223,6 +223,7 @@
binary = False
binary_in_usr_lib = False
has_usr_lib_file = False
+ file_in_lib64 = False
multi_pkg = False
res = srcname_regex.search(pkg[rpm.RPMTAG_SOURCERPM] or '')
if res:
@@ -161,10 +162,13 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
multi_pkg=0
@@ -239,6 +240,10 @@
# only-non-binary-in-usr-lib false positives
binary_in_usr_lib = True
for f in files:
- if usr_lib_regex.search(f) and not usr_lib_exception_regex.search(f) and not stat.S_ISDIR(files[f][0]):
+ if stat.S_ISREG(files[f][0]) and usr_lib_regex.search(f) and not usr_lib_exception_regex.search(f):
has_usr_lib_file=f
break
+ if stat.S_ISREG(files[f][0]) and (f.startswith("/usr/lib64") or f.startswith("/lib64")):
+ file_in_lib64=1
+ if stat.S_ISREG(pkgfile.mode) and \
+ (fname.startswith("/usr/lib64") or fname.startswith("/lib64")):
+ file_in_lib64 = True
+
for i in info:
is_elf = string.find(i[1], 'ELF') != -1
is_ar = string.find(i[1], 'current ar archive') != -1
@@ -316,9 +320,12 @@ class BinariesCheck(AbstractCheck.AbstractCheck):
is_elf = 'ELF' in pkgfile.magic
is_ar = 'current ar archive' in pkgfile.magic
is_ocaml_native = 'Objective caml native' in pkgfile.magic
@@ -433,9 +438,12 @@
if version and version != -1 and version not in pkg.name:
printError(pkg, 'incoherent-version-in-name', version)
if pkg.arch != 'noarch' and not multi_pkg:
- if binary == 0:
+ if binary == 0 and not file_in_lib64:
printError(pkg, 'no-binary')
- if not binary and not multi_pkg and pkg.arch != 'noarch':
+ if not binary and not multi_pkg and not file_in_lib64 and pkg.arch != 'noarch':
printError(pkg, 'no-binary')
+ if pkg.arch == 'noarch' and file_in_lib64:
+ printError(pkg, 'noarch-with-lib64')
+
if has_usr_lib_file and not binary_in_usr_lib:
printError(pkg, 'only-non-binary-in-usr-lib')
printWarning(pkg, 'only-non-binary-in-usr-lib')
@@ -343,6 +350,11 @@ FHS and the FSSTND forbid this.''',
@@ -459,6 +467,11 @@
# 'non-sparc32-binary',
# '',

View File

@ -1,3 +1,24 @@
-------------------------------------------------------------------
Mon May 2 14:17:04 UTC 2011 - lnussel@suse.de
- add account services (bnc#676638)
-------------------------------------------------------------------
Mon May 2 11:56:25 UTC 2011 - lnussel@suse.de
- another try to fix InitScriptCheck.py (bnc#690961)
-------------------------------------------------------------------
Wed Apr 27 15:09:54 CEST 2011 - dmueller@suse.de
- implement setFilterException()
- rediff noarch-lib64.diff and enable it again (bnc#663885)
-------------------------------------------------------------------
Tue Apr 26 15:19:36 CEST 2011 - dmueller@suse.de
- make error description more clearn (bnc#686328)
-------------------------------------------------------------------
Sat Apr 23 11:11:37 CEST 2011 - dmueller@suse.de

View File

@ -74,6 +74,7 @@ Patch11: suse-file-var-run.diff
Patch12: usr-arch.diff
Patch13: script-interpreter-only-for-exec-scripts.diff
Patch14: sourced-dirs.diff
Patch15: suse-filter-exception.diff
Patch17: docdata-examples.diff
Patch19: yast-provides.diff
Patch20: xdg-paths-update.diff
@ -122,6 +123,7 @@ Patch85: suse-changelog.patch
Patch86: suse-rclink-check.diff
# already upstream
Patch87: rpmlint-add-details.diff
Patch88: suse-speccheck-utf8.diff
%py_requires
%description
@ -152,6 +154,7 @@ Authors:
%patch12
%patch13
%patch14
%patch15
%patch17
%patch19
%patch20
@ -171,7 +174,7 @@ Authors:
#%patch41
%patch42
#%patch46
#%patch47
%patch47
#%patch49
%patch50
%patch51
@ -199,6 +202,7 @@ Authors:
%patch85
%patch86
%patch87 -p1
%patch88
cp -p %{SOURCE1} .
cp -p %{SOURCE2} .
cp -p %{SOURCE3} .

View File

@ -0,0 +1,57 @@
--- Config.py
+++ Config.py
@@ -115,6 +115,8 @@
# List of filters
_filters = []
_filters_re = None
+_filters_except = []
+_filters_except_re = None
def addFilter(s):
global _filters
@@ -137,8 +139,14 @@
_scoring = {}
def setBadness(s, score):
+ global _scoring
_scoring[s] = score
+def setFilterException(s):
+ global _filters_except
+
+ _filters_except.append(s)
+
def badness(s):
return _scoring.get(s, 0)
@@ -146,6 +154,8 @@
def isFiltered(s):
global _filters
global _filters_re
+ global _filters_except
+ global _filters_except_re
if _filters_re == None:
# no filter
@@ -162,7 +172,21 @@
_filters_re = _filters_re + '|(?:' + _filters[idx] +')'
_filters_re = re.compile(_filters_re)
+ if _filters_except_re == None and len(_filters_except):
+ _filters_except_re = '(?:' + _filters_except[0] + ')'
+
+ for idx in range(1, len(_filters_except)):
+ # to prevent named group overflow that happen when there is too
+ # many () in a single regexp: AssertionError: sorry, but this
+ # version only supports 100 named groups
+ if '(' in _filters_except[idx]:
+ _non_named_group_re.subn('(:?', _filters_except[idx])
+ _filters_except_re = _filters_except_re + '|(?:' + _filters_except[idx] +')'
+ _filters_except_re = re.compile(_filters_except_re)
+
if not no_exception:
+ if _filters_except_re and _filters_except_re.search(s):
+ return False
if _filters_re.search(s):
return True
return False

View File

@ -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

13
suse-speccheck-utf8.diff Normal file
View File

@ -0,0 +1,13 @@
--- SpecCheck.py
+++ SpecCheck.py
@@ -597,8 +597,8 @@
("Name:" tag). Either rename your package or the specfile.''',
'non-utf8-spec-file',
-'''The character encoding of the spec file is not UTF-8. Convert it for
-example using iconv(1).''',
+'''The character encoding of the spec file (or the merged bits from the .changes file)
+is not UTF-8. Convert it for example using iconv(1).''',
'use-of-RPM_SOURCE_DIR',
'''You use $RPM_SOURCE_DIR or %{_sourcedir} in your spec file. If you have to

View File

@ -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,