forked from pool/rpmlint
103 lines
3.9 KiB
Diff
103 lines
3.9 KiB
Diff
--- Pkg.py
|
|
+++ Pkg.py
|
|
@@ -176,6 +176,10 @@ class Pkg:
|
|
self._missing_ok_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:
|
|
@@ -414,6 +418,22 @@ class Pkg:
|
|
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):
|
|
self._gatherDepInfo()
|
|
return self._prereq
|
|
@@ -453,7 +473,8 @@ class Pkg:
|
|
return self._provides
|
|
|
|
# internal function to gather dependency info used by the above ones
|
|
- def _gather_aux(self, header, list, nametag, versiontag, flagstag, prereq=None):
|
|
+ def _gather_aux(self, header, list, nametag, versiontag, flagstag,
|
|
+ prereq=None,strong_only=False,weak_only=False):
|
|
names = header[nametag]
|
|
versions = header[versiontag]
|
|
flags = header[flagstag]
|
|
@@ -462,10 +483,15 @@ class Pkg:
|
|
# workaroung buggy rpm python module that doesn't return a list
|
|
if type(flags) != types.ListType:
|
|
flags=[flags]
|
|
+
|
|
for loop in range(len(versions)):
|
|
if prereq != None and flags[loop] & PREREQ_FLAG:
|
|
prereq.append((names[loop], versions[loop], flags[loop] & (~PREREQ_FLAG)))
|
|
- 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((names[loop], versions[loop], flags[loop]))
|
|
|
|
def _gatherDepInfo(self):
|
|
@@ -475,6 +501,10 @@ class Pkg:
|
|
self._provides = []
|
|
self._conflicts = []
|
|
self._obsoletes = []
|
|
+ self._suggests = []
|
|
+ self._supplements = []
|
|
+ self._enhances = []
|
|
+ self._recommends = []
|
|
|
|
self._gather_aux(self.header, self._requires,
|
|
rpm.RPMTAG_REQUIRENAME,
|
|
@@ -493,6 +523,27 @@ class Pkg:
|
|
rpm.RPMTAG_OBSOLETENAME,
|
|
rpm.RPMTAG_OBSOLETEVERSION,
|
|
rpm.RPMTAG_OBSOLETEFLAGS)
|
|
+ try:
|
|
+ self._gather_aux(self.header, self._recommends,
|
|
+ rpm.RPMTAG_SUGGESTSNAME,
|
|
+ rpm.RPMTAG_SUGGESTSVERSION,
|
|
+ rpm.RPMTAG_SUGGESTSFLAGS, strong_only=True)
|
|
+ self._gather_aux(self.header, self._suggests,
|
|
+ rpm.RPMTAG_SUGGESTSNAME,
|
|
+ rpm.RPMTAG_SUGGESTSVERSION,
|
|
+ rpm.RPMTAG_SUGGESTSFLAGS, weak_only=True)
|
|
+ self._gather_aux(self.header, self._enhances,
|
|
+ rpm.RPMTAG_ENHANCESNAME,
|
|
+ rpm.RPMTAG_ENHANCESVERSION,
|
|
+ rpm.RPMTAG_ENHANCESFLAGS, weak_only=True)
|
|
+ self._gather_aux(self.header, self._supplements,
|
|
+ rpm.RPMTAG_ENHANCESNAME,
|
|
+ rpm.RPMTAG_ENHANCESVERSION,
|
|
+ rpm.RPMTAG_ENHANCESFLAGS, strong_only=True)
|
|
+
|
|
+ except:
|
|
+ pass
|
|
+
|
|
|
|
def getInstalledPkgs(name):
|
|
"""Get list of installed package objects by name."""
|