summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-11-09 15:51:10 +0000
committerMarius Mauch <genone@gentoo.org>2007-11-09 15:51:10 +0000
commit47efccdc281786f392c83e8b9ee1e2344d80b942 (patch)
tree4e211f82cd09c8e0f0176a066ee4e1ed19e56e2b
parentd042fff18f2b7621dc0ec11c57e9c5b1936c8ca2 (diff)
downloadportage-47efccdc281786f392c83e8b9ee1e2344d80b942.tar.gz
portage-47efccdc281786f392c83e8b9ee1e2344d80b942.tar.bz2
portage-47efccdc281786f392c83e8b9ee1e2344d80b942.zip
if multiple glsas result in the same cat/pkg:slot being affected only use the highest resulting atom
svn path=/main/trunk/; revision=8480
-rw-r--r--pym/portage/sets/security.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/pym/portage/sets/security.py b/pym/portage/sets/security.py
index 24661a42e..f93b34ef8 100644
--- a/pym/portage/sets/security.py
+++ b/pym/portage/sets/security.py
@@ -6,6 +6,7 @@ import os
import portage.glsa as glsa
from portage.util import grabfile, write_atomic
from portage.sets.base import PackageSet
+from portage.versions import catpkgsplit, pkgcmp
__all__ = ["SecuritySet", "NewGlsaSet", "NewAffectedSet", "AffectedSet"]
@@ -39,7 +40,22 @@ class SecuritySet(PackageSet):
#print glsaid, myglsa.isVulnerable(), myglsa.isApplied(), myglsa.getMergeList()
if self.useGlsa(myglsa):
atomlist += ["="+x for x in myglsa.getMergeList(least_change=self._least_change)]
- self._setAtoms(atomlist)
+ self._setAtoms(self._reduce(atomlist))
+
+ def _reduce(self, atomlist):
+ mydict = {}
+ for atom in atomlist[:]:
+ cpv = self._portdbapi.match(atom)[0]
+ slot = self._portdbapi.aux_get(cpv, ["SLOT"])[0]
+ cps = "/".join(catpkgsplit(cpv)[0:2]) + ":" + slot
+ if not cps in mydict:
+ mydict[cps] = (atom, cpv)
+ else:
+ other_cpv = mydict[cps][1]
+ if pkgcmp(catpkgsplit(cpv)[1:], catpkgsplit(other_cpv)[1:]) > 0:
+ atomlist.remove(mydict[cps][0])
+ mydict[cps] = (atom, cpv)
+ return atomlist
def useGlsa(self, myglsa):
return True