SHA256
1
0
forked from pool/rpmlint
Dirk Mueller 2011-04-27 13:22:17 +00:00 committed by Git OBS Bridge
parent fad8761a2b
commit bcd3938836
4 changed files with 89 additions and 28 deletions

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

View File

@ -23,7 +23,7 @@ Name: rpmlint
BuildRequires: rpm-python
Summary: Rpm correctness checker
Version: 1.1
Release: 27
Release: 29
Source0: %{name}-%{version}.tar.bz2
Source1: config
Source1001: config.in
@ -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
@ -153,6 +154,7 @@ Authors:
%patch12
%patch13
%patch14
%patch15
%patch17
%patch19
%patch20
@ -172,7 +174,7 @@ Authors:
#%patch41
%patch42
#%patch46
#%patch47
%patch47
#%patch49
%patch50
%patch51

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