SHA256
1
0
forked from pool/rpmlint
OBS User unknown 2009-03-13 15:06:45 +00:00 committed by Git OBS Bridge
parent b6e725ef80
commit be02ab9e01
14 changed files with 131 additions and 178 deletions

View File

@ -525,7 +525,7 @@ class LibraryPolicyCheck(AbstractCheck.AbstractCheck):
pass
std_dirs = dirs.intersection(('/lib', '/lib64', '/usr/lib', '/usr/lib64',
'/opt/kde3/lib'))
'/opt/kde3/lib', '/opt/kde3/lib64'))
non_std_dirs = dirs.difference(std_dirs)
@ -542,6 +542,8 @@ class LibraryPolicyCheck(AbstractCheck.AbstractCheck):
if std_lib_package:
for lib in libs.copy():
lib_dir = libs_to_dir[lib]
if lib_dir.startswith("/opt/kde3"):
continue
for lib_part in lib_dir.split('/'):
if len(lib_part) == 0:
continue

View File

@ -1,40 +0,0 @@
--- SpecCheck.py
+++ SpecCheck.py
@@ -24,8 +24,8 @@
DEFAULT_HARDCODED_LIB_PATH_EXCEPTIONS = '/lib/(modules|cpp|perl5|rpm|hotplug|firmware)($|[\s/,])'
patch_regex = re.compile("^Patch(\d*)\s*:\s*([^\s]+)", re.IGNORECASE)
-# TODO: http://rpmlint.zarb.org/cgi-bin/trac.cgi/ticket/59
-applied_patch_regex = re.compile("^%patch.*-P\s+(\d+)|^%patch(\d*)\s")
+applied_patch_regex = re.compile("^\s*%patch(\d*)")
+applied_patch_p_regex = re.compile("-P\s*([\d]*)")
source_dir_regex = re.compile("^[^#]*(\$RPM_SOURCE_DIR|%{?_sourcedir}?)")
obsolete_tags_regex = re.compile("^(Copyright|Serial)\s*:\s*([^\s]+)")
buildroot_regex = re.compile('Buildroot\s*:\s*([^\s]+)', re.IGNORECASE)
@@ -147,8 +147,8 @@
def check_spec(self, pkg, spec_lines):
patches = {}
- applied_patches = []
- applied_patches_ifarch = []
+ applied_patches = set()
+ applied_patches_ifarch = set()
source_dir = None
buildroot = 0
configure = 0
@@ -230,10 +230,11 @@
else:
res = applied_patch_regex.search(line)
if res:
- pnum = int(res.group(1) or res.group(2) or 0)
- applied_patches.append(pnum)
- if ifarch_depth > 0:
- applied_patches_ifarch.append(pnum)
+ for tmp in applied_patch_p_regex.findall(line) or [res.group(1)]:
+ pnum=int(tmp or 0)
+ applied_patches.add(pnum)
+ if ifarch_depth > 0:
+ applied_patches_ifarch.add(pnum)
elif not source_dir:
res = source_dir_regex.search(line)
if res:

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:549feb0da65719327afef7d30481111624379faadf0493d63151a9f517489869
size 82164

3
rpmlint-0.85.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2db36de1c9b60e77ae3fd4b63a89c69deccfb2ee53988dc359c43ec2ec3147f7
size 83579

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Feb 27 17:05:41 CET 2009 - dmueller@suse.de
- update to 0.85:
* various new checks and fixes to existing checks
* remove upstreamed patches
-------------------------------------------------------------------
Thu Feb 26 11:11:54 CET 2009 - lnussel@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package rpmlint (Version 0.84)
# spec file for package rpmlint (Version 0.85)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -21,8 +21,8 @@
Name: rpmlint
BuildRequires: rpm-python
Summary: Rpm correctness checker
Version: 0.84
Release: 17
Version: 0.85
Release: 1
Source0: %{name}-%{version}.tar.bz2
Source1: config
Source1001: config.in
@ -84,7 +84,6 @@ Patch33: check-buildroot-during-install.diff
Patch34: verify-buildrequires.diff
Patch35: fix-versioned-prereq.diff
Patch37: buildroot-in-scripts.diff
Patch38: fix-patch-detection.diff
Patch39: libtool-wrapper-check.diff
Patch41: perl-versioned-rpath-deps.diff
Patch42: check-cron-dependency.diff
@ -156,7 +155,6 @@ Authors:
%patch34
%patch35
%patch37
%patch38
%patch39
%patch41
%patch42
@ -224,6 +222,10 @@ rm -rf $RPM_BUILD_ROOT
/usr/share/man/man1/rpmlint.1.gz
%changelog
* Fri Feb 27 2009 dmueller@suse.de
- update to 0.85:
* various new checks and fixes to existing checks
* remove upstreamed patches
* Thu Feb 26 2009 lnussel@suse.de
- use separate error for sysconfig stuff (bnc#470965)
- move RCS detection to FilesCheck.py

View File

@ -1,23 +1,23 @@
--- TagsCheck.py
+++ TagsCheck.py
@@ -665,6 +665,7 @@ class TagsCheck(AbstractCheck.AbstractCheck):
@@ -680,6 +680,7 @@
obs=map(lambda x: x[0], pkg.obsoletes())
provs=map(lambda x: x[0].split(':/')[0], pkg.provides())
+ conflicts=map(lambda x: x[0].split(':/')[0], pkg.conflicts())
reqs=map(lambda x: x[0], pkg.requires() + pkg.prereq())
if pkg.name in obs:
printError(pkg, 'obsolete-on-name')
@@ -677,6 +678,8 @@ class TagsCheck(AbstractCheck.AbstractCheck):
obs_names = map(lambda x: x[0], pkg.obsoletes())
prov_names = map(lambda x: x[0].split(':/')[0], pkg.provides())
+ conf_names = map(lambda x: x[0].split(':/')[0], pkg.conflicts())
req_names = map(lambda x: x[0], pkg.requires() + pkg.prereq())
useless_provides=set()
for p in provs:
+ if p in conflicts:
+ printWarning(pkg,'conflicts-with-provides', p)
if provs.count(p) != 1:
if pkg.name in obs_names:
@@ -695,6 +696,8 @@
# https://bugzilla.redhat.com/460872
useless_provides=[]
for p in prov_names:
+ if p in conf_names:
+ printWarning(pkg, 'conflicts-with-provides', p)
if prov_names.count(p) != 1:
if p not in useless_provides:
useless_provides.add(p)
@@ -776,6 +779,10 @@ the Release tag.''',
useless_provides.append(p)
@@ -796,6 +799,10 @@
'''There is no Name tag in your package. You have to specify a name using the
Name tag.''',

View File

@ -1,6 +1,6 @@
--- TagsCheck.py
+++ TagsCheck.py
@@ -507,7 +507,7 @@ class TagsCheck(AbstractCheck.AbstractCheck):
@@ -509,7 +509,7 @@
printError(pkg, 'explicit-lib-dependency', d[0])
if d[2] == rpm.RPMSENSE_EQUAL and string.find(d[1], '-') != -1:
printWarning(pkg, 'requires-on-release', d[0], d[1])
@ -9,68 +9,48 @@
printError(pkg, 'percent-in-dependency', d[0], d[1])
if not name:
@@ -665,29 +665,39 @@ class TagsCheck(AbstractCheck.AbstractCheck):
@@ -680,6 +680,7 @@
obs=map(lambda x: x[0], pkg.obsoletes())
provs=map(lambda x: x[0].split(':/')[0], pkg.provides())
+ reqs=map(lambda x: x[0], pkg.requires() + pkg.prereq())
if pkg.name in obs:
obs_names = map(lambda x: x[0], pkg.obsoletes())
prov_names = map(lambda x: x[0].split(':/')[0], pkg.provides())
+ req_names = map(lambda x: x[0], pkg.requires() + pkg.prereq())
if pkg.name in obs_names:
printError(pkg, 'obsolete-on-name')
for o in obs:
if not o in provs:
@@ -687,7 +688,7 @@
if not o in prov_names:
printWarning(pkg, 'obsolete-not-provided', o)
for o in pkg.obsoletes():
- if string.find(o[1], '%') != -1:
+ if string.find(o[1], '%') != -1 or string.find(o[0], '%') != -1:
printError(pkg, 'percent-in-obsoletes', o[0], o[1])
- useless_provides=[]
+ useless_provides=set()
for p in provs:
if provs.count(p) != 1:
if p not in useless_provides:
- useless_provides.append(p)
+ useless_provides.add(p)
# TODO: should take versions, <, <=, =, >=, > into account here
@@ -700,14 +701,41 @@
for p in useless_provides:
printError(pkg, 'useless-explicit-provides',p)
printError(pkg, 'useless-provides', p)
+ useless_reqs=set()
+ for r in reqs:
+ for r in req_names:
+ if not r in useless_reqs:
+ useless_reqs.add(r)
+ else:
+ if r[0] != '/':
+ printWarning(pkg, 'useless-explicit-requires', r)
+
for p in pkg.provides():
- if string.find(p[1], '%') != -1:
+ if string.find(p[1], '%') != -1 or string.find(p[0], '%') != -1:
printError(pkg, 'percent-in-provides', p[0], p[1])
+ if p[0] == pkg.name and not p[1]:
+ printError(pkg, 'unversioned-explicit-self-provides', p[0])
+ if p[0] == pkg.name and not p[1]:
+ printError(pkg, 'unversioned-explicit-self-provides', p[0])
+
for c in pkg.conflicts():
- if string.find(c[1], '%') != -1:
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
printError(pkg, 'percent-in-conflicts', c[0], c[1])
expected='%s-%s-%s.%s.rpm' % (name, version, release, pkg.arch)
@@ -877,6 +887,10 @@ explicit Requires: tags.''',
'''This package provides 2 times the same capacity. It should only provide it
once.''',
+'unversioned-explicit-self-provides',
+'''This package provides it's own name explicitely, which might break
+upgrade path. self-provides are autogenerated. Remove the provide.''',
+
'obsolete-on-name',
'''A package should not obsolete itself, as it can cause weird errors in tools.''',
--- TagsCheck.py
+++ TagsCheck.py
@@ -711,6 +711,22 @@ class TagsCheck(AbstractCheck.AbstractCheck):
if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
printError(pkg, 'percent-in-conflicts', c[0], c[1])
+ for c in pkg.supplements():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-supplements', c[0], c[1])
@ -90,3 +70,15 @@
expected='%s-%s-%s.%s.rpm' % (name, version, release, pkg.arch)
basename=string.split(pkg.filename, '/')[-1]
if basename != expected:
@@ -897,6 +925,10 @@
'''This package provides 2 times the same capacity. It should only provide it
once.''',
+'unversioned-explicit-self-provides',
+'''This package provides it's own name explicitely, which might break
+upgrade path. self-provides are autogenerated. Remove the provide.''',
+
'obsolete-on-name',
'''A package should not obsolete itself, as it can cause weird errors in tools.''',
Nur in b/rpmlint-0.85: TagsCheck.py.rej.

View File

@ -1,19 +1,19 @@
--- BinariesCheck.py
+++ BinariesCheck.py
@@ -51,10 +51,11 @@ class BinaryInfo:
self.exec_stack = 0
@@ -56,10 +56,11 @@
self.debuginfo=0
self.symtab=0
+ self.compileOpts=set()
self.tail = ''
+ self.compileOpts = set()
is_debug=BinaryInfo.debug_file_regex.search(path)
- cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d']
+ cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d', '-p', '.comment.SUSE.OPTs']
- cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d', '-s']
+ cmd = ['env', 'LC_ALL=C', 'readelf', '-W', '-S', '-l', '-d', '-s', '-p', '.comment.SUSE.OPTs']
cmd.append(path)
res = Pkg.getstatusoutput(cmd)
if not res[0]:
@@ -100,6 +101,9 @@ class BinaryInfo:
@@ -115,6 +116,9 @@
self.symtab=1
continue
@ -22,4 +22,4 @@
+
if self.non_pic:
self.non_pic=BinaryInfo.non_pic_regex.search(res[1])
else:

View File

@ -1,26 +1,26 @@
--- BinariesCheck.py
+++ BinariesCheck.py
@@ -34,6 +34,8 @@
undef_regex=re.compile('^undefined symbol:\s+(\S+)')
unused_regex=re.compile('^\s+(\S+)')
@@ -36,6 +36,8 @@
debug_file_regex=re.compile('\.debug$')
exit_call_regex = re.compile('\s+FUNC\s+.*?\s+(_?exit(?:@\S+)?)(?:\s|$)')
fork_call_regex = re.compile('\s+FUNC\s+.*?\s+(fork(?:@\S+)?)(?:\s|$)')
+ debuginfo_regex=re.compile('^\s+\[\s*\d+\]\s+\.debug_.*\s+')
+ symtab_regex=re.compile('^\s+\[\s*\d+\]\s+\.symtab\s+')
def __init__(self, pkg, path, file, is_ar):
self.had_error=0
@@ -46,6 +48,8 @@
self.non_pic=1
self.stack = 0
def __init__(self, pkg, path, file, is_ar, is_shlib):
self.readelf_error = 0
@@ -50,6 +52,8 @@
self.exec_stack = 0
+ self.debuginfo=0
self.exit_calls = []
fork_called = 0
+ self.debuginfo = 0
+ self.symtab=0
self.tail = ''
is_debug=BinaryInfo.debug_file_regex.search(path)
@@ -87,6 +91,14 @@
self.exec_stack = 1
continue
@@ -102,6 +106,14 @@
fork_called = 1
continue
+ if BinaryInfo.debuginfo_regex.search(l):
+ self.debuginfo=1
@ -32,14 +32,14 @@
+
if self.non_pic:
self.non_pic=BinaryInfo.non_pic_regex.search(res[1])
else:
@@ -216,6 +228,17 @@
@@ -249,6 +261,17 @@
# 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, is_shlib)
+ # stripped static library
+ if is_ar:
+ if bin_info.had_error:
+ if bin_info.readelf_error:
+ pass
+ elif not bin_info.symtab:
+ printError(pkg, 'static-library-without-symtab', i[0])
@ -49,9 +49,9 @@
+ printWarning(pkg, 'static-library-without-debuginfo', i[0])
+
# so name in library
if so_regex.search(i[0]):
if is_shlib:
has_lib.append(i[0])
@@ -430,6 +453,14 @@
@@ -475,6 +498,14 @@
'ldd-failed',
'''Executing ldd on this file failed, all checks could not be run.''',

View File

@ -1,20 +1,11 @@
--- TagsCheck.py
+++ TagsCheck.py
@@ -517,7 +517,7 @@ class TagsCheck(AbstractCheck.AbstractCheck):
base=is_devel.group(1)
dep=None
has_so=0
- for f in pkg.files().keys():
+ for f in pkg.files():
if f.endswith('.so'):
has_so=1
break
@@ -686,6 +686,17 @@ class TagsCheck(AbstractCheck.AbstractCheck):
for p in useless_provides:
printError(pkg, 'useless-explicit-provides',p)
+ have_mono_reqs=False
+ for r in reqs + provs:
+ for r in req_names + prov_names:
+ if r.startswith('mono('):
+ have_mono_reqs=True
+ break

View File

@ -8,22 +8,20 @@
# Only check for /lib, /usr/lib, /usr/X11R6/lib
# TODO: better handling of X libraries and modules.
@@ -306,7 +307,13 @@
if lib_package_regex.search(line):
lib = 1
@@ -340,6 +341,12 @@
if res:
noarch = 1
- res = prereq_regex.search(line)
+ res = suse_version_regex.search(line)
+ if res and int(res.group(1)) > 0 and int(res.group(1)) < 1030:
+ printWarning(pkg, "obsolete-suse-version-check", res.group(1))
+ elif res and int(res.group(1)) > 1110:
+ printError(pkg, "invalid-suse-version-check", res.group(1))
+ res = suse_version_regex.search(line)
+ if res and int(res.group(1)) > 0 and int(res.group(1)) < 1030:
+ printWarning(pkg, "obsolete-suse-version-check", res.group(1))
+ elif res and int(res.group(1)) > 1110:
+ printError(pkg, "invalid-suse-version-check", res.group(1))
+
+ res = prereq_regex.search(line)
if res:
printWarning(pkg, 'prereq-use', res.group(2))
@@ -568,6 +575,16 @@
res = prereq_regex.search(line)
if res:
printError(pkg, 'prereq-use', res.group(2))
@@ -598,6 +605,16 @@
set which may result in security issues in the resulting binary package
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.''',
@ -40,3 +38,4 @@
)
# SpecCheck.py ends here
Nur in b/rpmlint-0.85: SpecCheck.py.orig.

View File

@ -1,6 +1,6 @@
--- SpecCheck.py
+++ SpecCheck.py
@@ -44,7 +44,8 @@
@@ -45,7 +45,8 @@
biarch_package_regex = re.compile(DEFAULT_BIARCH_PACKAGES)
hardcoded_lib_path_exceptions_regex = re.compile(Config.getOption('HardcodedLibPathExceptions', DEFAULT_HARDCODED_LIB_PATH_EXCEPTIONS))
prereq_regex = re.compile('^PreReq(\(.*\))?:\s*(.+?)\s*$', re.IGNORECASE)
@ -9,8 +9,8 @@
+buildrequires_regex = re.compile('^\s*BuildRequires\s*:\s*(.+)\s*$', re.IGNORECASE)
use_utf8 = Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT)
macro_regex = re.compile('(%+)[{(]?(\w+)')
suse_version_regex = re.compile('%suse_version\s*[<>=]+\s*(\d+)')
@@ -111,6 +112,25 @@
libdir_regex = re.compile('%{?_lib(?:dir)?\}?\\b')
@@ -126,6 +127,25 @@
res.append(tok)
return res
@ -36,31 +36,31 @@
def contains_buildroot(line):
'''Check if the given line contains use of rpm buildroot.'''
res = rpm_buildroot_regex.search(line)
@@ -174,6 +194,8 @@
indent_spaces = 0
@@ -188,6 +208,8 @@
indent_tabs = 0
files_has_defattr = 0
section = {}
+ buildrequires = set()
+
for sec in ['description', 'prep', 'build', 'install', 'clean',
'files', 'changelog', 'package', 'check']:
section[sec] = {
@@ -316,6 +338,14 @@
if res:
printWarning(pkg, 'buildprereq-use', res.group(1))
@@ -348,6 +370,14 @@
if res:
printError(pkg, 'buildprereq-use', res.group(1))
+ res = buildrequires_regex.search(line)
+ if not if_depth and res:
+ for r in deptokens(res.group(1)):
+ name = r.split(' ')[0]
+ if name in buildrequires:
+ printWarning(pkg, 'duplicate-buildrequires', name)
+ buildrequires.add(name)
+ res = buildrequires_regex.search(line)
+ if not if_depth and res:
+ for r in deptokens(res.group(1)):
+ name = r.split(' ')[0]
+ if name in buildrequires:
+ printWarning(pkg, 'duplicate-buildrequires', name)
+ buildrequires.add(name)
+
if scriptlet_requires_regex.search(line) and current_section == 'package':
printError(pkg, 'broken-syntax-in-scriptlet-requires', string.strip(line))
if scriptlet_requires_regex.search(line):
printError(pkg, 'broken-syntax-in-scriptlet-requires', string.strip(line))
@@ -376,6 +406,24 @@
@@ -420,6 +450,24 @@
'(spaces: line %d, tab: line %d)' %
(indent_spaces, indent_tabs))
@ -85,7 +85,7 @@
# process gathered info
for p in patches.keys():
if p in applied_patches_ifarch:
@@ -522,6 +570,17 @@
@@ -557,6 +605,17 @@
odd entries eg. in source rpms, which is rarely wanted. Avoid use of macros
in %changelog altogether, or use two '%'s to escape them, like '%%foo'.''',

View File

@ -1,11 +1,11 @@
--- TagsCheck.py
+++ TagsCheck.py
@@ -648,7 +648,7 @@
@@ -670,7 +670,7 @@
printWarning(pkg, 'no-url-tag')
obs=map(lambda x: x[0], pkg.obsoletes())
- provs=map(lambda x: x[0], pkg.provides())
+ provs=map(lambda x: x[0].split(':/')[0], pkg.provides())
if pkg.name in obs:
printError(pkg, 'obsolete-on-name')
obs_names = map(lambda x: x[0], pkg.obsoletes())
- prov_names = map(lambda x: x[0], pkg.provides())
+ prov_names = map(lambda x: x[0].split(':/')[0], pkg.provides())
if pkg.name in obs_names:
printError(pkg, 'obsolete-on-name')