glsa: use _pkg_str + vercmp, not pkgcmp
authorZac Medico <zmedico@gentoo.org>
Mon, 14 May 2012 01:23:53 +0000 (18:23 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 14 May 2012 01:23:53 +0000 (18:23 -0700)
pym/portage/glsa.py

index 16f662f0d5ba98cbdf2267e6abd790b46be466c0..0e590688e0e3b47076b02eb4ff8a5d0a16fe81b3 100644 (file)
@@ -13,7 +13,7 @@ from portage import os
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
-from portage.versions import pkgsplit, catpkgsplit, pkgcmp, best
+from portage.versions import pkgsplit, vercmp, best
 from portage.util import grabfile, urlopen
 from portage.const import CACHE_PATH
 from portage.localization import _
@@ -368,17 +368,14 @@ def getMinUpgrade(vulnerableList, unaffectedList, portdbapi, vardbapi, minimize=
        for u in unaffectedList:
                mylist = match(u, portdbapi, match_type="match-all")
                for c in mylist:
-                       c_pv = catpkgsplit(c)
-                       i_pv = catpkgsplit(best(v_installed))
-                       if pkgcmp(c_pv[1:], i_pv[1:]) > 0 \
+                       i = best(v_installed)
+                       if vercmp(c.version, i.version) > 0 \
                                        and (rValue == None \
                                                or not match("="+rValue, portdbapi) \
-                                               or (minimize ^ (pkgcmp(c_pv[1:], catpkgsplit(rValue)[1:]) > 0)) \
+                                               or (minimize ^ (vercmp(c.version, rValue.version) > 0)) \
                                                        and match("="+c, portdbapi)) \
                                        and portdbapi.aux_get(c, ["SLOT"]) == vardbapi.aux_get(best(v_installed), ["SLOT"]):
-                               rValue = c_pv[0]+"/"+c_pv[1]+"-"+c_pv[2]
-                               if c_pv[3] != "r0":             # we don't like -r0 for display
-                                       rValue += "-"+c_pv[3]
+                               rValue = c
        return rValue
 
 def format_date(datestr):