SHA256
1
0
forked from pool/rpmlint
rpmlint/stricter-tags-check.diff

85 lines
3.4 KiB
Diff
Raw Normal View History

--- TagsCheck.py
+++ TagsCheck.py
@@ -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])
- if string.find(d[1], '%') != -1:
+ if string.find(d[1], '%') != -1 or string.find(d[0], '%') != -1:
printError(pkg, 'percent-in-dependency', d[0], d[1])
if not name:
@@ -680,6 +680,7 @@
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')
@@ -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])
# TODO: should take versions, <, <=, =, >=, > into account here
@@ -700,14 +701,41 @@
for p in useless_provides:
printError(pkg, 'useless-provides', p)
+ useless_reqs=set()
+ 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])
+
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])
+ 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])
+
+ for c in pkg.suggests():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-suggests', c[0], c[1])
+
+ for c in pkg.enhances():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-enhances', c[0], c[1])
+
+ for c in pkg.recommends():
+ if string.find(c[1], '%') != -1 or string.find(c[0], '%') != -1:
+ printError(pkg, 'percent-in-recommends', c[0], c[1])
+
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.