summaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2009-05-20 21:46:46 +0000
committerfuzzyray <fuzzyray@gentoo.org>2009-05-20 21:46:46 +0000
commitef38a394c5c2f5901173a53914705730850f9b3f (patch)
tree733282a59a631f8fa17700e4e811f344f8ba05fe /pym
parent10e55d71bd5914fc7c9082adadf7bde2bec14ae3 (diff)
downloadgentoolkit-ef38a394c5c2f5901173a53914705730850f9b3f.tar.gz
Change behaviour of getMinUpgrade
This allows to differentiate between situations where the system is unaffected and unexistance of an upgrade path. Previously, the glsa-check would treat GLSAs that had no upgrade path (such as mask glsas) as not affecting the system. svn path=/trunk/gentoolkit/; revision=647
Diffstat (limited to 'pym')
-rw-r--r--pym/gentoolkit/glsa/__init__.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/pym/gentoolkit/glsa/__init__.py b/pym/gentoolkit/glsa/__init__.py
index cc80517..121f066 100644
--- a/pym/gentoolkit/glsa/__init__.py
+++ b/pym/gentoolkit/glsa/__init__.py
@@ -378,8 +378,9 @@ def getMinUpgrade(vulnerableList, unaffectedList, minimize=True):
I{vulnerableList} and returns string describing
the lowest version for the package that matches an atom in
I{unaffectedList} and is greater than the currently installed
- version or None if the system is not affected. Both
- I{vulnerableList} and I{unaffectedList} should have the
+ version. It will return an empty list if the system is affected,
+ and no upgrade is possible or None if the system is not affected.
+ Both I{vulnerableList} and I{unaffectedList} should have the
same base package.
@type vulnerableList: List of Strings
@@ -393,7 +394,7 @@ def getMinUpgrade(vulnerableList, unaffectedList, minimize=True):
@return: the lowest unaffected version that is greater than
the installed version.
"""
- rValue = None
+ rValue = ""
v_installed = reduce(operator.add, [match(v, "vartree") for v in vulnerableList], [])
u_installed = reduce(operator.add, [match(u, "vartree") for u in unaffectedList], [])
@@ -403,15 +404,15 @@ def getMinUpgrade(vulnerableList, unaffectedList, minimize=True):
install_unaffected = False
if install_unaffected:
- return rValue
-
+ return None
+
for u in unaffectedList:
mylist = match(u, "porttree", match_type="match-all")
for c in mylist:
c_pv = portage.catpkgsplit(c)
i_pv = portage.catpkgsplit(portage.best(v_installed))
if portage.pkgcmp(c_pv[1:], i_pv[1:]) > 0 \
- and (rValue == None \
+ and (rValue == "" \
or not match("="+rValue, "porttree") \
or (minimize ^ (portage.pkgcmp(c_pv[1:], portage.catpkgsplit(rValue)[1:]) > 0)) \
and match("="+c, "porttree")) \
@@ -658,7 +659,7 @@ class Glsa:
for v in path["vul_atoms"]:
rValue = rValue \
or (len(match(v, "vartree")) > 0 \
- and getMinUpgrade(path["vul_atoms"], path["unaff_atoms"]))
+ and None != getMinUpgrade(path["vul_atoms"], path["unaff_atoms"]))
return rValue
def isApplied(self):