SHA256
1
0
forked from pool/rpmlint
OBS User unknown 2009-01-12 11:17:10 +00:00 committed by Git OBS Bridge
parent 0eed81f49d
commit 53597c7cde
4 changed files with 66 additions and 20 deletions

View File

@ -27,6 +27,13 @@ def isdebuginfo(pkg):
or pkg.name.endswith('-debug'): or pkg.name.endswith('-debug'):
return True return True
def notsymlink(pkg, f):
files = pkg.files()
enreg = files[f]
mode = enreg[0]
type = (mode>>12)&017
return type != 012
_checks = [ _checks = [
{ {
'good': [ 'good': [
@ -47,16 +54,16 @@ _checks = [
'bad': [ 'bad': [
'/usr/share/info/dir', '/usr/share/info/dir',
'*~', '*~',
'*/CV', '*/CVS',
'*/CVS/', '*/CVS/*',
'*/.cvsignor', '*/.cvsignore',
'*/.svn', '*/.svn',
'*/RC', '*/RCS',
'*/RCS/', '*/RCS/*',
'*,v', '*,v',
'*.ba', '*.bak',
'*/.xvpic', '*/.xvpics',
'*.ori', '*.orig',
'*.orig.gz', '*.orig.gz',
'/usr/share/*/.libs*', '/usr/share/*/.libs*',
'/usr/share/*/.deps*', '/usr/share/*/.deps*',
@ -79,14 +86,27 @@ _checks = [
'error': 'suse-filelist-forbidden-devel-in-lib', 'error': 'suse-filelist-forbidden-devel-in-lib',
'details': 'please move la files, static libs and .so symlinks out of /', 'details': 'please move la files, static libs and .so symlinks out of /',
'bad': [ 'bad': [
"/lib/*.so",
"/lib/*.la", "/lib/*.la",
"/lib/*.a", "/lib/*.a",
"/lib64/*.la", "/lib64/*.la",
"/lib64/*.a", "/lib64/*.a",
"/lib64/*.so",
] ]
}, },
{
'error': 'suse-filelist-forbidden-devel-in-lib',
'details': 'please move la files, static libs and .so symlinks out of /',
'good': [
# exception for pam
"/lib/security/*.so",
"/lib64/security/*.so",
],
'bad': [
"/lib/*.so",
"/lib64/*.so",
],
# some libs without proper soname are packaged directly
'ignorefileif': notsymlink,
},
{ {
'error': 'suse-filelist-forbidden-fhs22', 'error': 'suse-filelist-forbidden-fhs22',
'msg': '%(file)s is not allowed in FHS 2.2', 'msg': '%(file)s is not allowed in FHS 2.2',
@ -147,7 +167,7 @@ _checks = [
'/opt/kde3/lib64/*', '/opt/kde3/lib64/*',
'/usr/lib/pkgconfig/*', '/usr/lib/pkgconfig/*',
], ],
'ignoreif': notnoarch, 'ignorepkgif': notnoarch,
}, },
{ {
'error': 'suse-filelist-forbidden-debuginfo', 'error': 'suse-filelist-forbidden-debuginfo',
@ -155,7 +175,7 @@ _checks = [
'bad': [ 'bad': [
'/usr/lib/debug/*', '/usr/lib/debug/*',
], ],
'ignoreif': isdebuginfo, 'ignorepkgif': isdebuginfo,
}, },
{ {
'error': 'suse-filelist-forbidden-locale', 'error': 'suse-filelist-forbidden-locale',
@ -241,6 +261,18 @@ _checks = [
'/sbin/conf.d/*', '/sbin/conf.d/*',
], ],
}, },
{
'error': 'suse-filelist-forbidden-opt',
'details': """/opt may not be used by a distribution. It is reserved for 3rd party packagers""",
'good': [
# KDE3 legacy exception
'/opt/kde3',
'/opt/kde3/*',
],
'bad': [
'/opt/*',
],
},
{ {
'error': 'suse-filelist-forbidden-fhs22', 'error': 'suse-filelist-forbidden-fhs22',
'good': [ 'good': [
@ -263,6 +295,8 @@ _checks = [
'/media/*', '/media/*',
'/mnt', '/mnt',
'/opt', '/opt',
# handled in separate check
'/opt/*',
'/proc', '/proc',
'/root', '/root',
'/root/.exrc', '/root/.exrc',
@ -412,8 +446,8 @@ class FilelistCheck(AbstractCheck.AbstractCheck):
for check in _checks: for check in _checks:
if 'ignoreif' in check: if 'ignorepkgif' in check:
if check['ignoreif'](pkg): if check['ignorepkgif'](pkg):
continue continue
if 'msg' in check: if 'msg' in check:
@ -430,16 +464,19 @@ class FilelistCheck(AbstractCheck.AbstractCheck):
ok = False ok = False
if 'good' in check: if 'good' in check:
for g in check['good']: for g in check['good']:
if (not isinstance(g, str)) and g.match(f) or g == f: if (not isinstance(g, str) and g.match(f)) or g == f:
ok = True ok = True
break break
if ok: if ok:
continue continue
for b in check['bad']: for b in check['bad']:
if (not isinstance(b, str)) and b.match(f) or b == f: if 'ignorefileif' in check:
msg = msg % { 'file':f } if check['ignorefileif'](pkg, f):
printError(pkg, error, msg) continue
if (not isinstance(b, str) and b.match(f)) or b == f:
m = msg % { 'file':f }
printError(pkg, error, m)
check=FilelistCheck() check=FilelistCheck()

View File

@ -103,7 +103,7 @@ class PolkitCheck(AbstractCheck.AbstractCheck):
if iserr: if iserr:
printError(pkg, 'polkit-unauthorized-privilege', action) printError(pkg, 'polkit-unauthorized-privilege', action)
else: else:
printWarning(pkg, 'polkit-unauthorized-privilege', action) printInfo(pkg, 'polkit-unauthorized-privilege', action)
if foundno or not anyseen: if foundno or not anyseen:
printWarning(pkg, 'polkit-cant-acquire-privilege', action) printWarning(pkg, 'polkit-cant-acquire-privilege', action)

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jan 12 10:48:19 CET 2009 - lnussel@suse.de
- CheckFilelist: add exceptions for kde and pam
- CheckPolkitPrivs: use info instead of warning to avoid badness assignment
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jan 8 11:05:50 CET 2009 - lnussel@suse.de Thu Jan 8 11:05:50 CET 2009 - lnussel@suse.de

View File

@ -22,7 +22,7 @@ Name: rpmlint
BuildRequires: rpm-python BuildRequires: rpm-python
Summary: Rpm correctness checker Summary: Rpm correctness checker
Version: 0.84 Version: 0.84
Release: 7 Release: 9
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
Source1: config Source1: config
Source1001: config.in Source1001: config.in
@ -220,6 +220,9 @@ rm -rf $RPM_BUILD_ROOT
/usr/share/man/man1/rpmlint.1.gz /usr/share/man/man1/rpmlint.1.gz
%changelog %changelog
* Mon Jan 12 2009 lnussel@suse.de
- CheckFilelist: add exceptions for kde and pam
- CheckPolkitPrivs: use info instead of warning to avoid badness assignment
* Thu Jan 08 2009 lnussel@suse.de * Thu Jan 08 2009 lnussel@suse.de
- prefix dbus check with suse- - prefix dbus check with suse-
- add filelist check - add filelist check