forked from pool/rpmlint
This commit is contained in:
parent
e8698f6643
commit
ca5eacfc5f
@ -1,84 +1,14 @@
|
|||||||
--- Config.py
|
|
||||||
+++ Config.py
|
|
||||||
@@ -126,6 +126,17 @@
|
|
||||||
else:
|
|
||||||
_filters_re = None
|
|
||||||
|
|
||||||
+_scoring={}
|
|
||||||
+
|
|
||||||
+def setBadness(s, score):
|
|
||||||
+ _scoring[s] = score
|
|
||||||
+ setOption('UseBadness', True)
|
|
||||||
+
|
|
||||||
+def badness(s):
|
|
||||||
+ if _scoring.has_key(s):
|
|
||||||
+ return _scoring[s]
|
|
||||||
+ return 0
|
|
||||||
+
|
|
||||||
_non_named_group_re = re.compile('[^\\](\()[^:]')
|
|
||||||
def isFiltered(s):
|
|
||||||
global _filters
|
|
||||||
--- Filter.py
|
--- Filter.py
|
||||||
+++ Filter.py
|
+++ Filter.py
|
||||||
@@ -11,19 +11,27 @@
|
@@ -74,26 +74,28 @@
|
||||||
import Config
|
|
||||||
import Testing
|
|
||||||
|
|
||||||
+_badness_score = 0
|
|
||||||
+_diagnostic = list()
|
|
||||||
+
|
|
||||||
def printInfo(pkg, reason, *details):
|
|
||||||
- if _print("I", pkg, reason, details) and Config.info:
|
|
||||||
- printDescriptions(reason)
|
|
||||||
+ _print("I", pkg, reason, details)
|
|
||||||
|
|
||||||
def printWarning(pkg, reason, *details):
|
|
||||||
- if _print("W", pkg, reason, details) and Config.info:
|
|
||||||
- printDescriptions(reason)
|
|
||||||
+ _print("W", pkg, reason, details)
|
|
||||||
|
|
||||||
def printError(pkg, reason, *details):
|
|
||||||
- if _print("E", pkg, reason, details) and Config.info:
|
|
||||||
- printDescriptions(reason)
|
|
||||||
+ _print("E", pkg, reason, details)
|
|
||||||
|
|
||||||
def _print(type, pkg, reason, details):
|
|
||||||
+ global _badness_score, _diagnostic
|
|
||||||
+
|
|
||||||
+ badness = Config.badness(reason)
|
|
||||||
+ if Config.getOption('UseBadness'):
|
|
||||||
+ type = "W"
|
|
||||||
+ if badness:
|
|
||||||
+ type = "E"
|
|
||||||
+
|
|
||||||
ln = ""
|
|
||||||
if pkg.current_linenum is not None:
|
|
||||||
ln = "%s:" % pkg.current_linenum
|
|
||||||
@@ -31,14 +39,16 @@
|
|
||||||
if pkg.arch is not None:
|
|
||||||
arch = ".%s" % pkg.arch
|
|
||||||
s = "%s%s:%s %s: %s" % (pkg.name, arch, ln, type, reason)
|
|
||||||
+ if badness:
|
|
||||||
+ s = s + " (Badness: %d)" % badness
|
|
||||||
for d in details:
|
|
||||||
s = s + " %s" % d
|
|
||||||
if Testing.isTest():
|
|
||||||
Testing.addOutput(s)
|
|
||||||
else:
|
|
||||||
if not Config.isFiltered(s):
|
|
||||||
- sys.stdout.write(s)
|
|
||||||
- sys.stdout.write("\n")
|
|
||||||
+ _diagnostic.append(s + "\n")
|
|
||||||
+ _badness_score += badness
|
|
||||||
return 1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
@@ -52,12 +62,56 @@
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
+def _diag_compare(x,y):
|
|
||||||
+
|
+
|
||||||
|
def _diag_compare(x,y):
|
||||||
|
|
||||||
|
- where_a = x.split()[1]
|
||||||
|
- level_a = x.split()[2]
|
||||||
+ where_a = x.split()[2]
|
+ where_a = x.split()[2]
|
||||||
+ level_a = x.split()[1]
|
+ level_a = x.split()[1]
|
||||||
+
|
+
|
||||||
@ -87,69 +17,28 @@
|
|||||||
+
|
+
|
||||||
+ if (level_b > level_a):
|
+ if (level_b > level_a):
|
||||||
+ return 1
|
+ return 1
|
||||||
+
|
|
||||||
|
- where_b = y.split()[1]
|
||||||
|
- level_b = y.split()[2]
|
||||||
+ if (level_b < level_a):
|
+ if (level_b < level_a):
|
||||||
+ return -1
|
+ return -1
|
||||||
+
|
|
||||||
|
- if level_b > level_a:
|
||||||
+ if (where_b < where_a):
|
+ if (where_b < where_a):
|
||||||
+ return 1
|
return 1
|
||||||
|
- elif level_b == level_a:
|
||||||
|
- if where_b > where_b:
|
||||||
|
- return 1
|
||||||
|
- elif where_b == where_a:
|
||||||
|
- return 0
|
||||||
|
- else:
|
||||||
|
- return -1
|
||||||
|
- else:
|
||||||
+
|
+
|
||||||
+ if (where_b > where_a):
|
+ if (where_b > where_a):
|
||||||
+ return -1
|
return -1
|
||||||
+
|
|
||||||
+ return 0
|
+ return 0
|
||||||
+
|
|
||||||
+def printAllReasons():
|
|
||||||
+ global _badness_score, _diagnostic
|
|
||||||
+ _diagnostic.sort(_diag_compare)
|
|
||||||
+ last_reason=''
|
|
||||||
+ for diag in _diagnostic:
|
|
||||||
+ if Config.info:
|
|
||||||
+ reason = diag.split()[2]
|
|
||||||
+ if reason != last_reason:
|
|
||||||
+ if len(last_reason):
|
|
||||||
+ printDescriptions(last_reason)
|
|
||||||
+ last_reason=reason
|
|
||||||
+ sys.stdout.write(diag)
|
|
||||||
+ if Config.info and len(last_reason):
|
|
||||||
+ printDescriptions(last_reason)
|
|
||||||
+ _diagnostic = list()
|
|
||||||
+ return _badness_score > 1000
|
|
||||||
+
|
|
||||||
_details={}
|
|
||||||
|
|
||||||
def addDetails(*details):
|
|
||||||
for idx in range(len(details)/2):
|
|
||||||
_details[details[idx*2]]=details[idx*2+1]
|
|
||||||
|
|
||||||
+def BadnessScore():
|
|
||||||
+ global _badness_score
|
|
||||||
+
|
|
||||||
+ return _badness_score
|
|
||||||
+
|
|
||||||
# Filter.py ends here
|
|
||||||
|
|
||||||
# Local variables:
|
|
||||||
--- README
|
|
||||||
+++ README
|
|
||||||
@@ -79,6 +79,7 @@
|
|
||||||
FilesCheck.py
|
|
||||||
SystemLibPaths list of strings ('/lib', '/usr/lib', '/usr/X11R6/lib')
|
|
||||||
UseBzip2 boolean 1
|
|
||||||
+UseBadness boolean 0
|
|
||||||
UseDefaultRunlevels boolean 1
|
|
||||||
UseEpoch boolean 0
|
|
||||||
UseIndexedJars boolean 1
|
|
||||||
--- rpmlint.py
|
|
||||||
+++ rpmlint.py
|
|
||||||
@@ -146,6 +146,10 @@
|
|
||||||
sys.stderr.write('Interrupted, exiting while scanning all packages\n')
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
+ if printAllReasons():
|
|
||||||
+ sys.stdout.write('RPMLINT: E: BADNESS is %d - threshold exceeded. aborting the build.\n' % BadnessScore() )
|
|
||||||
+ sys.exit(1)
|
|
||||||
+
|
|
||||||
finally:
|
|
||||||
pkg and pkg.cleanup()
|
|
||||||
|
|
||||||
|
def printAllReasons():
|
||||||
|
threshold = badnessThreshold()
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
BinariesCheck.py | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
Index: BinariesCheck.py
|
|
||||||
===================================================================
|
|
||||||
--- BinariesCheck.py.orig
|
|
||||||
+++ BinariesCheck.py
|
|
||||||
@@ -26,8 +26,8 @@ class BinaryInfo:
|
|
||||||
needed_regex=re.compile('\s+\(NEEDED\).*\[(\S+)\]')
|
|
||||||
rpath_regex=re.compile('\s+\(RPATH\).*\[(\S+)\]')
|
|
||||||
soname_regex=re.compile('\s+\(SONAME\).*\[(\S+)\]')
|
|
||||||
- comment_regex=re.compile('^\s+\[\d+\]\s+\.comment\s+')
|
|
||||||
- pic_regex=re.compile('^\s+\[\d+\]\s+\.rela?\.(data|text)')
|
|
||||||
+ comment_regex=re.compile('^\s+\[\s*\d+\]\s+\.comment\s+')
|
|
||||||
+ pic_regex=re.compile('^\s+\[\s*\d+\]\s+\.rela?\.(data|text)')
|
|
||||||
non_pic_regex=re.compile('TEXTREL', re.MULTILINE)
|
|
||||||
undef_regex=re.compile('^undefined symbol:\s+(\S+)')
|
|
||||||
unused_regex=re.compile('^\s+(\S+)')
|
|
14
fix-tabs-indenting.diff
Normal file
14
fix-tabs-indenting.diff
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
--- SpecCheck.py
|
||||||
|
+++ SpecCheck.py
|
||||||
|
@@ -342,9 +342,9 @@ class SpecCheck(AbstractCheck.AbstractCh
|
||||||
|
(ifarch_regex.search(line) or if_regex.search(line) or
|
||||||
|
endif_regex.search(line)):
|
||||||
|
if defattr_regex.search(line):
|
||||||
|
- files_has_defattr = 1;
|
||||||
|
+ files_has_defattr = 1;
|
||||||
|
elif not (files_has_defattr or attr_regex.search(line)):
|
||||||
|
- printError(pkg, 'files-attr-not-set')
|
||||||
|
+ printError(pkg, 'files-attr-not-set')
|
||||||
|
|
||||||
|
# TODO: check scriptlets for these too
|
||||||
|
if current_section == 'files' and noarch:
|
@ -1,94 +0,0 @@
|
|||||||
--- PostCheck.py
|
|
||||||
+++ PostCheck.py
|
|
||||||
@@ -33,7 +33,7 @@
|
|
||||||
# shells that grok the -n switch for debugging
|
|
||||||
syntaxcheck_shells = ('/bin/sh', '/bin/bash')
|
|
||||||
|
|
||||||
-percent_regex = re.compile('%{?\w{3,}', re.MULTILINE)
|
|
||||||
+percent_regex = re.compile('^[^#]*%{?\w{3,}', re.MULTILINE)
|
|
||||||
bracket_regex=re.compile('^[^#]*if.*[^ :\]]\]', re.MULTILINE)
|
|
||||||
home_regex=re.compile('[^a-zA-Z]+~/|\${?HOME(\W|$)', re.MULTILINE)
|
|
||||||
dangerous_command_regex=re.compile("(^|[;\|`]|&&|$\()\s*(?:\S*/s?bin/)?(cp|mv|ln|tar|rpm|chmod|chown|rm|cpio|install|perl|userdel|groupdel)\s", re.MULTILINE)
|
|
||||||
@@ -44,14 +44,49 @@
|
|
||||||
menu_regex=re.compile('^/usr/lib/menu/|^/etc/menu-methods/|^/usr/share/applications/')
|
|
||||||
bogus_var_regex=re.compile('(\${?RPM_BUILD_(ROOT|DIR)}?)')
|
|
||||||
|
|
||||||
+# [foo, (bar, baz)]:
|
|
||||||
+# if a script contains foo then the rpm must prerequire bar or contain baz
|
|
||||||
prereq_assoc = (
|
|
||||||
# ['chkconfig', ('chkconfig', '/sbin/chkconfig')],
|
|
||||||
['chkfontpath', ('chkfontpath', '/usr/sbin/chkfontpath')],
|
|
||||||
['rpm-helper', ('rpm-helper',)],
|
|
||||||
+ ['cp', ('coreutils', '/bin/cp')],
|
|
||||||
+ ['ln', ('coreutils', '/bin/ln')],
|
|
||||||
+ ['mv', ('coreutils', '/bin/mv')],
|
|
||||||
+ ['rm', ('coreutils', '/bin/rm')],
|
|
||||||
+ ['rmdir', ('coreutils', '/bin/rmdir')],
|
|
||||||
+ ['cat', ('coreutils', '/bin/cat')],
|
|
||||||
+ ['cut', ('coreutils', '/usr/bin/cut')],
|
|
||||||
+ ['uname', ('coreutils', '/bin/uname')],
|
|
||||||
+ ['md5sum', ('coreutils', '/usr/bin/md5sum')],
|
|
||||||
+ ['pear', ('php5-pear', '/usr/bin/pear')],
|
|
||||||
+ ['update-alternatives', ('update-alternatives', '/usr/sbin/update-alternatives')],
|
|
||||||
+ ['a2enmod', ('apache2', '/usr/sbin/a2enmod')],
|
|
||||||
+
|
|
||||||
+ ['sed', ('sed', '/bin/sed')],
|
|
||||||
+ ['awk', ('gawk', '/usr/bin/awk')],
|
|
||||||
+ ['gawk', ('gawk', '/usr/bin/gawk')],
|
|
||||||
+ ['grep', ('grep', '/usr/bin/grep')],
|
|
||||||
+ ['useradd', ('pwdutils', '/usr/sbin/useradd')],
|
|
||||||
+ ['groupadd', ('pwdutils', '/usr/sbin/groupadd')],
|
|
||||||
+ ['chkstat', ('permissions', '/usr/bin/chkstat')],
|
|
||||||
+ ['diff', ('diffutils', '/usr/bin/diff')],
|
|
||||||
+ ['cmp', ('diffutils', '/usr/bin/cmp')],
|
|
||||||
+ ['patch', ('patch', '/usr/bin/patch')],
|
|
||||||
+ ['fillup', ('fillup', '/bin/fillup')],
|
|
||||||
+ ['tar', ('tar', '/bin/tar')],
|
|
||||||
+ ['cpio', ('cpio', '/bin/cpio')],
|
|
||||||
+ ['odbcinst', ('unixODBC', '/usr/bin/odbcinst')],
|
|
||||||
+ ['install-info', ('info', '/sbin/install-info')],
|
|
||||||
+ ['gpg', ('gpg2', '/usr/bin/gpg')],
|
|
||||||
+ ['nm', ('binutils', '/usr/bin/nm')],
|
|
||||||
+ ['edit-xml-catalog', ('awk', '/usr/bin/awk')],
|
|
||||||
+ ['usermod', ('pwdutils', '/usr/sbin/usermod')],
|
|
||||||
)
|
|
||||||
|
|
||||||
+# \b is word boundary
|
|
||||||
for p in prereq_assoc:
|
|
||||||
- p[0] = re.compile('^[^#]+' + p[0], re.MULTILINE)
|
|
||||||
+ p[0] = re.compile('^[^#]+\\b(' + p[0] + ')\\b', re.MULTILINE)
|
|
||||||
|
|
||||||
# pychecker fix
|
|
||||||
del p
|
|
||||||
@@ -163,15 +196,17 @@
|
|
||||||
printError(pkg, 'update-menus-without-menu-file-in-' + tag[2])
|
|
||||||
if tmp_regex.search(script):
|
|
||||||
printError(pkg, 'use-tmp-in-' + tag[2])
|
|
||||||
+
|
|
||||||
for c in prereq_assoc:
|
|
||||||
- if c[0].search(script):
|
|
||||||
+ res = c[0].search(script)
|
|
||||||
+ if res:
|
|
||||||
found=0
|
|
||||||
for p in c[1]:
|
|
||||||
if p in prereq or p in files:
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
if not found:
|
|
||||||
- printError(pkg, 'no-prereq-on', c[1][0])
|
|
||||||
+ printError(pkg, 'no-prereq-on', c[1][0], 'or', c[1][1], 'for', res.group(1))
|
|
||||||
|
|
||||||
if prog in syntaxcheck_shells:
|
|
||||||
if incorrect_shell_script(prog, script):
|
|
||||||
@@ -230,6 +265,11 @@
|
|
||||||
policy type was found in the scriptlet. These types are subject to change
|
|
||||||
on a policy version upgrade. Use the restorecon command which queries the
|
|
||||||
currently loaded policy for the correct type instead.''',
|
|
||||||
+
|
|
||||||
+'no-prereq-on',
|
|
||||||
+'''Your rpm post/postun scripts contain a call to a command that is missing
|
|
||||||
+from the rpm prereq list. This might cause the package to fail during
|
|
||||||
+installation due to the required program not being available yet.'''
|
|
||||||
)
|
|
||||||
|
|
||||||
# PostCheck.py ends here
|
|
@ -1,24 +0,0 @@
|
|||||||
--- NamingPolicyCheck.py
|
|
||||||
+++ NamingPolicyCheck.py
|
|
||||||
@@ -85,14 +85,14 @@ check=NamingPolicyCheck()
|
|
||||||
# if somone as a elegant solution, I will be happy to implement and test it.
|
|
||||||
|
|
||||||
|
|
||||||
-check.add_check('xmms', '^xmms-', '^/usr/lib/xmms/')
|
|
||||||
-check.add_check('python', '^python-', '^/usr/lib/python[1-9](-[1-9])?')
|
|
||||||
-check.add_check('perl5', '^perl-', '^/usr/lib/perl5/vendor_perl')
|
|
||||||
-check.add_check('apache2', '^apache2-mod_', '^/usr/lib/apache2-')
|
|
||||||
+check.add_check('xmms', '^xmms-', '^/usr/lib(64)?/xmms/')
|
|
||||||
+check.add_check('python', '^python-', '^/usr/lib(64)?/python[1-9](-[1-9])?')
|
|
||||||
+check.add_check('perl5', '^perl-', '^/usr/lib(64)?/perl5/vendor_perl')
|
|
||||||
+check.add_check('apache2', '^apache2-mod_', '^/usr/lib(64)?/apache2-')
|
|
||||||
check.add_check('fortune', '^fortune-', '^/usr/share/games/fortunes/')
|
|
||||||
-check.add_check('php', '^php-', '/usr/lib/php/extensions/')
|
|
||||||
-check.add_check('ruby', '^ruby-', '/usr/lib/ruby/[1-9](-[1-9])?/')
|
|
||||||
-check.add_check('ocaml', '^ocaml-', '/usr/lib/ocaml/')
|
|
||||||
+check.add_check('php', '^php-', '/usr/lib(64)?/php/extensions/')
|
|
||||||
+check.add_check('ruby', '^ruby-', '/usr/lib(64)?/ruby/[1-9](-[1-9])?/')
|
|
||||||
+check.add_check('ocaml', '^ocaml-', '/usr/lib(64)?/ocaml/')
|
|
||||||
|
|
||||||
# these exception should be added
|
|
||||||
# apache2 => apache2-devel
|
|
52
no-badness-return.diff
Normal file
52
no-badness-return.diff
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
Index: Filter.py
|
||||||
|
===================================================================
|
||||||
|
--- Filter.py (Revision 1434)
|
||||||
|
+++ Filter.py (Arbeitskopie)
|
||||||
|
@@ -96,10 +96,6 @@ def _diag_compare(x,y):
|
||||||
|
|
||||||
|
|
||||||
|
def printAllReasons():
|
||||||
|
- threshold = badnessThreshold()
|
||||||
|
- if threshold < 0:
|
||||||
|
- return 0
|
||||||
|
-
|
||||||
|
global _badness_score, _diagnostic
|
||||||
|
_diagnostic.sort(_diag_compare)
|
||||||
|
last_reason=''
|
||||||
|
@@ -114,8 +110,6 @@ def printAllReasons():
|
||||||
|
if Config.info and len(last_reason):
|
||||||
|
printDescriptions(last_reason)
|
||||||
|
_diagnostic = list()
|
||||||
|
- return _badness_score > threshold
|
||||||
|
-
|
||||||
|
|
||||||
|
_details={}
|
||||||
|
|
||||||
|
Index: rpmlint.py
|
||||||
|
===================================================================
|
||||||
|
--- rpmlint.py (Revision 1434)
|
||||||
|
+++ rpmlint.py (Arbeitskopie)
|
||||||
|
@@ -155,9 +155,7 @@ def main():
|
||||||
|
sys.stderr.write('Interrupted, exiting while scanning all packages\n')
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
- if printAllReasons():
|
||||||
|
- sys.stderr.write('rpmlint: E: badness %d exceeds threshold %d, aborting.\n' % (badnessScore(), badnessThreshold()))
|
||||||
|
- sys.exit(66)
|
||||||
|
+ printAllReasons()
|
||||||
|
|
||||||
|
finally:
|
||||||
|
pkg and pkg.cleanup()
|
||||||
|
@@ -165,6 +163,12 @@ def main():
|
||||||
|
% (packages_checked, specfiles_checked,
|
||||||
|
printed_messages["E"], printed_messages["W"])
|
||||||
|
|
||||||
|
+ if (badnessThreshold() >= 0):
|
||||||
|
+ if badnessScore() >= badnessThreshold():
|
||||||
|
+ sys.stderr.write('rpmlint: E: badness %d exceeds threshold %d, aborting.\n' % (badnessScore(), badnessThreshold()))
|
||||||
|
+ sys.exit(66)
|
||||||
|
+ sys.exit(0)
|
||||||
|
+
|
||||||
|
if printed_messages["E"] > 0:
|
||||||
|
sys.exit(64)
|
||||||
|
elif printed_messages["W"] > 0:
|
@ -1,11 +0,0 @@
|
|||||||
--- FilesCheck.py
|
|
||||||
+++ FilesCheck.py
|
|
||||||
@@ -824,7 +824,7 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|
||||||
printError(pkg, 'version-control-internal-file', f)
|
|
||||||
elif f.endswith('/.htaccess'):
|
|
||||||
printError(pkg, 'htaccess-file', f)
|
|
||||||
- elif hidden_file_regex.search(f):
|
|
||||||
+ elif hidden_file_regex.search(f) and not f.startswith("/etc/skel/"):
|
|
||||||
printWarning(pkg, 'hidden-file-or-dir', f)
|
|
||||||
elif manifest_perl_regex.search(f):
|
|
||||||
printWarning(pkg, 'manifest-in-perl-module', f)
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:fc9168bb9d950d9ee7282c71a683693156b3f7c697598309b0a9bf978e8e367b
|
|
||||||
size 79182
|
|
3
rpmlint-0.83.tar.bz2
Normal file
3
rpmlint-0.83.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:a4bb8e93c14e86c7d0d2774bcb9147f5de54e117dd573e989f45a927feffd29d
|
||||||
|
size 81991
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jun 23 00:43:46 CEST 2008 - dmueller@suse.de
|
||||||
|
|
||||||
|
- update to 0.83:
|
||||||
|
* removed upstreamed patches
|
||||||
|
* a couple of new checks, bugfixes
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jun 18 14:33:09 CEST 2008 - dmueller@suse.de
|
Wed Jun 18 14:33:09 CEST 2008 - dmueller@suse.de
|
||||||
|
|
||||||
|
30
rpmlint.spec
30
rpmlint.spec
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package rpmlint (Version 0.82)
|
# spec file for package rpmlint (Version 0.83)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
# This file and all modifications and additions to the pristine
|
# This file and all modifications and additions to the pristine
|
||||||
@ -14,8 +14,8 @@
|
|||||||
Name: rpmlint
|
Name: rpmlint
|
||||||
BuildRequires: rpm-python
|
BuildRequires: rpm-python
|
||||||
Summary: Rpm correctness checker
|
Summary: Rpm correctness checker
|
||||||
Version: 0.82
|
Version: 0.83
|
||||||
Release: 57
|
Release: 1
|
||||||
Source0: %{name}-%{version}.tar.bz2
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
Source1: config
|
Source1: config
|
||||||
Source1001: config.in
|
Source1001: config.in
|
||||||
@ -47,6 +47,7 @@ Patch4: invalid-filerequires.diff
|
|||||||
Patch5: suse-bzip-bigger-than-100k.diff
|
Patch5: suse-bzip-bigger-than-100k.diff
|
||||||
Patch6: suse-filesystem.diff
|
Patch6: suse-filesystem.diff
|
||||||
Patch7: suse-checks.diff
|
Patch7: suse-checks.diff
|
||||||
|
Patch8: suse-debuginfo.diff
|
||||||
Patch9: no-doc-for-lib.diff
|
Patch9: no-doc-for-lib.diff
|
||||||
Patch10: add-scoring-support.diff
|
Patch10: add-scoring-support.diff
|
||||||
Patch11: suse-spec-bzip2.diff
|
Patch11: suse-spec-bzip2.diff
|
||||||
@ -63,7 +64,6 @@ Patch21: fix-buildroot-test.diff
|
|||||||
Patch22: better-wrong-script.diff
|
Patch22: better-wrong-script.diff
|
||||||
Patch23: buildroot-doc.diff
|
Patch23: buildroot-doc.diff
|
||||||
Patch24: sysv5-init-checks.diff
|
Patch24: sysv5-init-checks.diff
|
||||||
Patch25: suse-devel-dependencies.diff
|
|
||||||
Patch26: ignore-non-readable-in-etc.diff
|
Patch26: ignore-non-readable-in-etc.diff
|
||||||
Patch27: detailed-desktop-file-check.diff
|
Patch27: detailed-desktop-file-check.diff
|
||||||
Patch29: rpmgroup-checks.diff
|
Patch29: rpmgroup-checks.diff
|
||||||
@ -72,7 +72,6 @@ Patch31: only-reg-files-are-scripts.diff
|
|||||||
Patch33: check-buildroot-during-install.diff
|
Patch33: check-buildroot-during-install.diff
|
||||||
Patch34: verify-buildrequires.diff
|
Patch34: verify-buildrequires.diff
|
||||||
Patch35: fix-versioned-prereq.diff
|
Patch35: fix-versioned-prereq.diff
|
||||||
Patch36: improve-postdep-check.diff
|
|
||||||
Patch37: buildroot-in-scripts.diff
|
Patch37: buildroot-in-scripts.diff
|
||||||
Patch38: fix-patch-detection.diff
|
Patch38: fix-patch-detection.diff
|
||||||
Patch39: libtool-wrapper-check.diff
|
Patch39: libtool-wrapper-check.diff
|
||||||
@ -80,19 +79,16 @@ Patch41: perl-versioned-rpath-deps.diff
|
|||||||
Patch42: check-cron-dependency.diff
|
Patch42: check-cron-dependency.diff
|
||||||
Patch46: locale-support.diff
|
Patch46: locale-support.diff
|
||||||
Patch47: noarch-lib64.diff
|
Patch47: noarch-lib64.diff
|
||||||
Patch48: try-harder-with-spec-name.diff
|
|
||||||
Patch49: stricter-tags-check.diff
|
Patch49: stricter-tags-check.diff
|
||||||
Patch50: suse-no-run-ldconfig.diff
|
Patch50: suse-no-run-ldconfig.diff
|
||||||
Patch51: description-check.diff
|
Patch51: description-check.diff
|
||||||
Patch52: suppress-for-perl-python.diff
|
Patch52: suppress-for-perl-python.diff
|
||||||
Patch53: no-dot-in-skel.diff
|
|
||||||
Patch54: locale-update.diff
|
Patch54: locale-update.diff
|
||||||
Patch55: suse-debuginfo.diff
|
|
||||||
Patch56: fix-BinariesCheck-regex.diff
|
|
||||||
Patch57: suse-mono-deps-checks.diff
|
Patch57: suse-mono-deps-checks.diff
|
||||||
Patch58: add-weak-dependencies.diff
|
Patch58: add-weak-dependencies.diff
|
||||||
Patch59: naming-policy-lib64.diff
|
|
||||||
Patch60: selfconflicts-provide.diff
|
Patch60: selfconflicts-provide.diff
|
||||||
|
Patch61: fix-tabs-indenting.diff
|
||||||
|
Patch62: no-badness-return.diff
|
||||||
%py_requires
|
%py_requires
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -116,6 +112,7 @@ Authors:
|
|||||||
%patch5
|
%patch5
|
||||||
%patch6
|
%patch6
|
||||||
%patch7
|
%patch7
|
||||||
|
%patch8
|
||||||
%patch9
|
%patch9
|
||||||
%patch10
|
%patch10
|
||||||
%patch11
|
%patch11
|
||||||
@ -132,7 +129,6 @@ Authors:
|
|||||||
%patch22
|
%patch22
|
||||||
%patch23
|
%patch23
|
||||||
%patch24
|
%patch24
|
||||||
%patch25
|
|
||||||
%patch26
|
%patch26
|
||||||
%patch27
|
%patch27
|
||||||
%patch29
|
%patch29
|
||||||
@ -141,7 +137,6 @@ Authors:
|
|||||||
%patch33
|
%patch33
|
||||||
%patch34
|
%patch34
|
||||||
%patch35
|
%patch35
|
||||||
%patch36
|
|
||||||
%patch37
|
%patch37
|
||||||
%patch38
|
%patch38
|
||||||
%patch39
|
%patch39
|
||||||
@ -149,19 +144,16 @@ Authors:
|
|||||||
%patch42
|
%patch42
|
||||||
%patch46
|
%patch46
|
||||||
%patch47
|
%patch47
|
||||||
%patch48
|
|
||||||
%patch49
|
%patch49
|
||||||
%patch50
|
%patch50
|
||||||
%patch51
|
%patch51
|
||||||
%patch52
|
%patch52
|
||||||
%patch53
|
|
||||||
%patch54
|
%patch54
|
||||||
%patch55
|
|
||||||
%patch56
|
|
||||||
%patch57
|
%patch57
|
||||||
%patch58
|
%patch58
|
||||||
%patch59
|
|
||||||
%patch60
|
%patch60
|
||||||
|
%patch61
|
||||||
|
%patch62
|
||||||
cp -p %{SOURCE1} .
|
cp -p %{SOURCE1} .
|
||||||
cp -p %{SOURCE2} .
|
cp -p %{SOURCE2} .
|
||||||
cp -p %{SOURCE3} .
|
cp -p %{SOURCE3} .
|
||||||
@ -200,6 +192,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/usr/share/man/man1/rpmlint.1.gz
|
/usr/share/man/man1/rpmlint.1.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 23 2008 dmueller@suse.de
|
||||||
|
- update to 0.83:
|
||||||
|
* removed upstreamed patches
|
||||||
|
* a couple of new checks, bugfixes
|
||||||
* Wed Jun 18 2008 dmueller@suse.de
|
* Wed Jun 18 2008 dmueller@suse.de
|
||||||
- fix exception in tags check (bnc#399655)
|
- fix exception in tags check (bnc#399655)
|
||||||
- add a warning for self-conflicts
|
- add a warning for self-conflicts
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
+ useless_reqs.add(r)
|
+ useless_reqs.add(r)
|
||||||
+ else:
|
+ else:
|
||||||
+ if r[0] != '/':
|
+ if r[0] != '/':
|
||||||
+ printWarning(pkg, 'useless-explicit-requires', r[0])
|
+ printWarning(pkg, 'useless-explicit-requires', r)
|
||||||
for p in pkg.provides():
|
for p in pkg.provides():
|
||||||
- if string.find(p[1], '%') != -1:
|
- if string.find(p[1], '%') != -1:
|
||||||
+ if string.find(p[1], '%') != -1 or string.find(p[0], '%') != -1:
|
+ if string.find(p[1], '%') != -1 or string.find(p[0], '%') != -1:
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
From: Jan Blunck <jblunck@suse.de>
|
--- BinariesCheck.py
|
||||||
Subject: Add checks for static libraries missing symtab and debuginfo
|
|
||||||
|
|
||||||
Static libraries without a symbol table are not linkable. Binaries linking
|
|
||||||
against static libraries without debuginfo are not debuggable.
|
|
||||||
---
|
|
||||||
BinariesCheck.py | 31 +++++++++++++++++++++++++++++--
|
|
||||||
1 file changed, 29 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
Index: BinariesCheck.py
|
|
||||||
===================================================================
|
|
||||||
--- BinariesCheck.py.orig
|
|
||||||
+++ BinariesCheck.py
|
+++ BinariesCheck.py
|
||||||
@@ -32,6 +32,8 @@ class BinaryInfo:
|
@@ -34,6 +34,8 @@
|
||||||
undef_regex=re.compile('^undefined symbol:\s+(\S+)')
|
undef_regex=re.compile('^undefined symbol:\s+(\S+)')
|
||||||
unused_regex=re.compile('^\s+(\S+)')
|
unused_regex=re.compile('^\s+(\S+)')
|
||||||
debug_file_regex=re.compile('\.debug$')
|
debug_file_regex=re.compile('\.debug$')
|
||||||
@ -20,55 +9,34 @@ Index: BinariesCheck.py
|
|||||||
|
|
||||||
def __init__(self, pkg, path, file, is_ar):
|
def __init__(self, pkg, path, file, is_ar):
|
||||||
self.had_error=0
|
self.had_error=0
|
||||||
@@ -42,6 +44,8 @@ class BinaryInfo:
|
@@ -46,6 +48,8 @@
|
||||||
self.comment=0
|
|
||||||
self.soname=0
|
|
||||||
self.non_pic=1
|
self.non_pic=1
|
||||||
|
self.stack = 0
|
||||||
|
self.exec_stack = 0
|
||||||
+ self.debuginfo=0
|
+ self.debuginfo=0
|
||||||
+ self.symtab=0
|
+ self.symtab=0
|
||||||
|
|
||||||
is_debug=BinaryInfo.debug_file_regex.search(path)
|
is_debug=BinaryInfo.debug_file_regex.search(path)
|
||||||
|
|
||||||
@@ -65,6 +69,10 @@ class BinaryInfo:
|
@@ -87,6 +91,14 @@
|
||||||
r=BinaryInfo.soname_regex.search(l)
|
self.exec_stack = 1
|
||||||
if r:
|
continue
|
||||||
self.soname=r.group(1)
|
|
||||||
+ if BinaryInfo.debuginfo_regex.search(l):
|
+ if BinaryInfo.debuginfo_regex.search(l):
|
||||||
+ self.debuginfo=1
|
+ self.debuginfo=1
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
+ if BinaryInfo.symtab_regex.search(l):
|
+ if BinaryInfo.symtab_regex.search(l):
|
||||||
+ self.symtab=1
|
+ self.symtab=1
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
if self.non_pic:
|
if self.non_pic:
|
||||||
self.non_pic=BinaryInfo.non_pic_regex.search(res[1])
|
self.non_pic=BinaryInfo.non_pic_regex.search(res[1])
|
||||||
else:
|
else:
|
||||||
@@ -114,6 +122,7 @@ shared_object_regex=re.compile('shared o
|
@@ -216,6 +228,17 @@
|
||||||
executable_regex=re.compile('executable')
|
|
||||||
libc_regex=re.compile('libc\.')
|
|
||||||
ldso_soname_regex=re.compile('^ld(-linux(-(ia|x86_)64))?\.so')
|
|
||||||
+ar_regex=re.compile('\.a$')
|
|
||||||
so_regex=re.compile('/lib(64)?/[^/]+\.so(\.[0-9]+)*$')
|
|
||||||
validso_regex=re.compile('(\.so\.\d+(\.\d+)*|\d\.so)$')
|
|
||||||
sparc_regex=re.compile('SPARC32PLUS|SPARC V9|UltraSPARC')
|
|
||||||
@@ -171,7 +180,7 @@ class BinariesCheck(AbstractCheck.Abstra
|
|
||||||
|
|
||||||
for i in info:
|
|
||||||
is_elf = string.find(i[1], 'ELF') != -1
|
|
||||||
- is_ar = string.find(i[1], 'current ar archive') != -1
|
|
||||||
+ is_ar = ar_regex.search(i[0])
|
|
||||||
is_ocaml_native = string.find(i[1], 'Objective caml native') != -1
|
|
||||||
is_shell = string.find(i[1], "shell script") != -1
|
|
||||||
is_binary = is_elf or is_ar or is_ocaml_native
|
|
||||||
@@ -196,13 +205,23 @@ class BinariesCheck(AbstractCheck.Abstra
|
|
||||||
|
|
||||||
# stripped ?
|
|
||||||
if not unstrippable.search(i[0]) and not is_ocaml_native:
|
|
||||||
- if not_stripped.search(i[1]) and \
|
|
||||||
+ if not is_ar and not_stripped.search(i[1]) and \
|
|
||||||
(os.environ.get('BUILD_IS_RUNNING', None) == None or \
|
|
||||||
os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1):
|
|
||||||
printWarning(pkg, 'unstripped-binary-or-object', i[0])
|
|
||||||
|
|
||||||
# inspect binary file
|
# inspect binary file
|
||||||
bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0], is_ar)
|
bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0], is_ar)
|
||||||
|
|
||||||
+ # stripped static library
|
+ # stripped static library
|
||||||
+ if is_ar:
|
+ if is_ar:
|
||||||
+ if bin_info.had_error:
|
+ if bin_info.had_error:
|
||||||
@ -79,14 +47,14 @@ Index: BinariesCheck.py
|
|||||||
+ (os.environ.get('BUILD_IS_RUNNING', None) == None or \
|
+ (os.environ.get('BUILD_IS_RUNNING', None) == None or \
|
||||||
+ os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1):
|
+ os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1):
|
||||||
+ printWarning(pkg, 'static-library-without-debuginfo', i[0])
|
+ printWarning(pkg, 'static-library-without-debuginfo', i[0])
|
||||||
|
+
|
||||||
# so name in library
|
# so name in library
|
||||||
if so_regex.search(i[0]):
|
if so_regex.search(i[0]):
|
||||||
@@ -441,6 +460,14 @@ with the intended shared libraries only.
|
has_lib.append(i[0])
|
||||||
|
@@ -430,6 +453,14 @@
|
||||||
'ldd-failed',
|
'ldd-failed',
|
||||||
'''Executing ldd on this file failed, all checks could not be run.''',
|
'''Executing ldd on this file failed, all checks could not be run.''',
|
||||||
+
|
|
||||||
+'static-library-without-symtab',
|
+'static-library-without-symtab',
|
||||||
+'''The static library doesn't contain any symbols and therefore can't be linked
|
+'''The static library doesn't contain any symbols and therefore can't be linked
|
||||||
+against. This may indicated that it was strip.''',
|
+against. This may indicated that it was strip.''',
|
||||||
@ -94,6 +62,7 @@ Index: BinariesCheck.py
|
|||||||
+'static-library-without-debuginfo',
|
+'static-library-without-debuginfo',
|
||||||
+'''The static library doesn't contain any debuginfo. Binaries linking against
|
+'''The static library doesn't contain any debuginfo. Binaries linking against
|
||||||
+this static library can't be properly debugged.''',
|
+this static library can't be properly debugged.''',
|
||||||
)
|
+
|
||||||
|
'executable-stack',
|
||||||
# BinariesCheck.py ends here
|
'''The binary declares the stack as executable. Executable stack is usually an
|
||||||
|
error as it is only needed if the code contains GCC trampolines or similar
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
--- TagsCheck.py
|
|
||||||
+++ TagsCheck.py
|
|
||||||
@@ -515,7 +515,7 @@
|
|
||||||
break
|
|
||||||
if has_so:
|
|
||||||
for d in deps:
|
|
||||||
- if d[0] == base:
|
|
||||||
+ if d[0].startswith(base):
|
|
||||||
dep=d
|
|
||||||
break
|
|
||||||
if not dep:
|
|
@ -1,30 +1,32 @@
|
|||||||
--- SpecCheck.py
|
--- SpecCheck.py
|
||||||
+++ SpecCheck.py
|
+++ SpecCheck.py
|
||||||
@@ -47,6 +47,7 @@
|
@@ -52,6 +52,7 @@
|
||||||
buildprereq_regex = re.compile('^BuildPreReq:\s*(.+?)\s*$', re.IGNORECASE)
|
comment_or_empty_regex = re.compile('^\s*(#|$)')
|
||||||
use_utf8 = Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT)
|
defattr_regex = re.compile('^\s*%defattr\\b')
|
||||||
macro_regex = re.compile('(%+)[{(]?(\w+)')
|
attr_regex = re.compile('^\s*%attr\\b')
|
||||||
+suse_version_regex = re.compile('%suse_version\s*[<>=]+\s*(\d+)')
|
+suse_version_regex = re.compile('%suse_version\s*[<>=]+\s*(\d+)')
|
||||||
|
|
||||||
# Only check for /lib, /usr/lib, /usr/X11R6/lib
|
# Only check for /lib, /usr/lib, /usr/X11R6/lib
|
||||||
# TODO: better handling of X libraries and modules.
|
# TODO: better handling of X libraries and modules.
|
||||||
@@ -287,6 +288,12 @@
|
@@ -306,7 +307,13 @@
|
||||||
if lib_package_regex.search(line):
|
if lib_package_regex.search(line):
|
||||||
lib = 1
|
lib = 1
|
||||||
|
|
||||||
|
- res = prereq_regex.search(line)
|
||||||
+ res = suse_version_regex.search(line)
|
+ res = suse_version_regex.search(line)
|
||||||
+ if res and int(res.group(1)) > 0 and int(res.group(1)) < 1010:
|
+ if res and int(res.group(1)) > 0 and int(res.group(1)) < 1020:
|
||||||
+ printWarning(pkg, "obsolete-suse-version-check", res.group(1))
|
+ printWarning(pkg, "obsolete-suse-version-check", res.group(1))
|
||||||
+ elif res and int(res.group(1)) > 1100:
|
+ elif res and int(res.group(1)) > 1100:
|
||||||
+ printError(pkg, "invalid-suse-version-check", res.group(1))
|
+ printError(pkg, "invalid-suse-version-check", res.group(1))
|
||||||
+
|
+
|
||||||
res = prereq_regex.search(line)
|
+ eres = prereq_regex.search(line)
|
||||||
if res:
|
if res:
|
||||||
printWarning(pkg, 'prereq-use', res.group(2))
|
printWarning(pkg, 'prereq-use', res.group(2))
|
||||||
@@ -514,6 +521,15 @@
|
|
||||||
problems, restrict future package/provides naming, and may match something it
|
@@ -568,6 +575,16 @@
|
||||||
was originally not inteded to match -- make the Obsoletes versioned if
|
set which may result in security issues in the resulting binary package
|
||||||
possible.''',
|
depending on the system where the package is built. Add default attributes
|
||||||
|
using %defattr before it in the %files section, or use per line %attr's.''',
|
||||||
+
|
+
|
||||||
+'obsolete-suse-version-check',
|
+'obsolete-suse-version-check',
|
||||||
+'''The specfile contains a comparison of %suse_version against a suse release
|
+'''The specfile contains a comparison of %suse_version against a suse release
|
||||||
@ -34,6 +36,7 @@
|
|||||||
+'invalid-suse-version-check',
|
+'invalid-suse-version-check',
|
||||||
+'''The specfile contains a comparison of %suse_version against a suse release
|
+'''The specfile contains a comparison of %suse_version against a suse release
|
||||||
+that does not exist. Please double check.'''
|
+that does not exist. Please double check.'''
|
||||||
|
+
|
||||||
)
|
)
|
||||||
|
|
||||||
# SpecCheck.py ends here
|
# SpecCheck.py ends here
|
||||||
|
@ -6,5 +6,6 @@ import sys
|
|||||||
for filename in sys.argv[1:]:
|
for filename in sys.argv[1:]:
|
||||||
try:
|
try:
|
||||||
compile(open(filename).read(), filename, 'exec')
|
compile(open(filename).read(), filename, 'exec')
|
||||||
except:
|
except Exception, e:
|
||||||
|
print e
|
||||||
exit(1)
|
exit(1)
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
--- SpecCheck.py
|
|
||||||
+++ SpecCheck.py
|
|
||||||
@@ -169,18 +169,22 @@
|
|
||||||
|
|
||||||
# lookup spec file
|
|
||||||
files = pkg.files()
|
|
||||||
- for f in files.keys():
|
|
||||||
- if f.endswith('.spec'):
|
|
||||||
- self._spec_file = pkg.dirName() + "/" + f
|
|
||||||
- break
|
|
||||||
+ if (pkg.name + ".spec") in files.keys():
|
|
||||||
+ self._spec_file = pkg.name + ".spec"
|
|
||||||
+ else:
|
|
||||||
+ for f in files.keys():
|
|
||||||
+ if f.endswith('.spec'):
|
|
||||||
+ self._spec_file = f
|
|
||||||
+ break
|
|
||||||
+
|
|
||||||
if not self._spec_file:
|
|
||||||
printError(pkg, "no-spec-file")
|
|
||||||
else:
|
|
||||||
- if f != pkg.name + ".spec":
|
|
||||||
- printError(pkg, "invalid-spec-name", f)
|
|
||||||
+ if self._spec_file != pkg.name + ".spec":
|
|
||||||
+ printError(pkg, "invalid-spec-name", self._spec_file)
|
|
||||||
|
|
||||||
# check content of spec file
|
|
||||||
- spec_lines = Pkg.readlines(self._spec_file)
|
|
||||||
+ spec_lines = Pkg.readlines(pkg.dirName() + "/" + self._spec_file)
|
|
||||||
self.check_spec(pkg, spec_lines)
|
|
||||||
|
|
||||||
def check_spec(self, pkg, spec_lines):
|
|
||||||
@@ -219,7 +223,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
if self._spec_file:
|
|
||||||
- if use_utf8 and not Pkg.is_utf8(self._spec_file):
|
|
||||||
+ if use_utf8 and not Pkg.is_utf8(pkg.dirName() + "/" + self._spec_file):
|
|
||||||
printError(pkg, "non-utf8-spec-file", self._spec_file)
|
|
||||||
|
|
||||||
# gather info from spec lines
|
|
Loading…
Reference in New Issue
Block a user