--- TagsCheck.py +++ TagsCheck.py @@ -507,7 +507,7 @@ class TagsCheck(AbstractCheck.AbstractCheck): 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: @@ -665,29 +665,39 @@ class TagsCheck(AbstractCheck.AbstractCheck): 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: printError(pkg, 'obsolete-on-name') for o in obs: if not o in provs: 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) for p in useless_provides: printError(pkg, 'useless-explicit-provides',p) + useless_reqs=set() + for r in reqs: + 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]) 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]) + + 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: