SHA256
1
0
forked from pool/rpmlint
rpmlint/add-weak-dependencies.diff

101 lines
3.6 KiB
Diff

Index: rpmlint-rpmlint-1.10/Pkg.py
===================================================================
--- rpmlint-rpmlint-1.10.orig/Pkg.py
+++ rpmlint-rpmlint-1.10/Pkg.py
@@ -494,6 +494,10 @@ class Pkg(AbstractPkg):
self._missingok_files = None
self._files = None
self._requires = None
+ self._suggests = None
+ self._supplements = None
+ self._enhances = None
+ self._recommends = None
self._req_names = -1
if header:
@@ -771,6 +775,22 @@ class Pkg(AbstractPkg):
self._gatherDepInfo()
return self._requires
+ def recommends(self):
+ self._gatherDepInfo()
+ return self._recommends
+
+ def suggests(self):
+ self._gatherDepInfo()
+ return self._suggests
+
+ def supplements(self):
+ self._gatherDepInfo()
+ return self._supplements
+
+ def enhances(self):
+ self._gatherDepInfo()
+ return self._enhances
+
def prereq(self):
"""
Get package PreReqs as list of
@@ -845,7 +865,7 @@ class Pkg(AbstractPkg):
# internal function to gather dependency info used by the above ones
def _gather_aux(self, header, list, nametag, flagstag, versiontag,
- prereq=None):
+ prereq = None, strong_only = False, weak_only = False):
names = header[nametag]
flags = header[flagstag]
versions = header[versiontag]
@@ -856,7 +876,11 @@ class Pkg(AbstractPkg):
evr = stringToVersion(b2s(versions[loop]))
if prereq is not None and flags[loop] & PREREQ_FLAG:
prereq.append((name, flags[loop] & (~PREREQ_FLAG), evr))
- else:
+ elif strong_only and flags[loop] & rpm.RPMSENSE_STRONG:
+ list.append((names[loop], versions[loop], flags[loop] & (~rpm.RPMSENSE_STRONG)))
+ elif weak_only and not (flags[loop] & rpm.RPMSENSE_STRONG):
+ list.append((names[loop], versions[loop], flags[loop]))
+ elif not (weak_only or strong_only):
list.append((name, flags[loop], evr))
def _gatherDepInfo(self):
@@ -924,6 +948,7 @@ class Pkg(AbstractPkg):
return prog
+
def getInstalledPkgs(name):
"""Get list of installed package objects by name."""
Index: rpmlint-rpmlint-1.10/TagsCheck.py
===================================================================
--- rpmlint-rpmlint-1.10.orig/TagsCheck.py
+++ rpmlint-rpmlint-1.10/TagsCheck.py
@@ -889,8 +889,27 @@ class TagsCheck(AbstractCheck.AbstractCh
value = Pkg.formatRequire(*c)
self._unexpanded_macros(pkg, 'Conflicts %s' % (value,), value)
+ for i in pkg.supplements():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Supplements %s' % (value,), value)
+
+ for i in pkg.suggests():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Suggests %s' % (value,), value)
+
+ for i in pkg.enhances():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Enhances %s' % (value,), value)
+
+ for i in pkg.recommends():
+ value = Pkg.formatRequire(*i)
+ self._unexpanded_macros(pkg, 'Recommends %s' % (value,), value)
+
obss = pkg.obsoletes()
if obss:
+ for obs in obss:
+ value = Pkg.formatRequire(*obs)
+ self._unexpanded_macros(pkg, 'Obsoletes %s' % (value,), value)
provs = pkg.provides()
for prov in provs:
for obs in obss: