diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-08-01 04:51:07 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-08-01 04:51:07 +0000 |
commit | 636869d60cf57515c95c61ca9c21f9727bde80e2 (patch) | |
tree | 7365da40504d34e0a13eb88f5e7834bff20194ea | |
parent | ce4847e2e7db79f23f662115d2b070b596e0118e (diff) | |
download | portage-636869d60cf57515c95c61ca9c21f9727bde80e2.tar.gz portage-636869d60cf57515c95c61ca9c21f9727bde80e2.tar.bz2 portage-636869d60cf57515c95c61ca9c21f9727bde80e2.zip |
Make InheritSet more like DowngradeSet, and check INHERITED from the highest
visible ebuild in the portage tree rather than from the installed package
itself.
svn path=/main/trunk/; revision=11308
-rw-r--r-- | pym/portage/sets/dbapi.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py index 798b322e3..46973de75 100644 --- a/pym/portage/sets/dbapi.py +++ b/pym/portage/sets/dbapi.py @@ -75,23 +75,32 @@ class InheritSet(PackageSet): description = "Package set which contains all packages " + \ "that inherit one or more specific eclasses." - def __init__(self, vardb=None, inherits=None): + def __init__(self, portdb=None, vardb=None, inherits=None): super(InheritSet, self).__init__() + self._portdb = portdb self._db = vardb self._inherits = inherits def load(self): atoms = [] inherits = self._inherits + xmatch = self._portdb.xmatch + xmatch_level = "bestmatch-visible" cp_list = self._db.cp_list aux_get = self._db.aux_get - aux_keys = ["INHERITED", "SLOT"] + portdb_aux_get = self._portdb.aux_get + vardb_keys = ["SLOT"] + portdb_keys = ["INHERITED"] for cp in self._db.cp_all(): for cpv in cp_list(cp): - inherited, slot = aux_get(cpv, aux_keys) - inherited = inherited.split() - if inherits.intersection(inherited): - atoms.append("%s:%s" % (cp, slot)) + slot, = aux_get(cpv, vardb_keys) + slot_atom = "%s:%s" % (cp, slot) + ebuild = xmatch(xmatch_level, slot_atom) + if not ebuild: + continue + inherited, = portdb_aux_get(ebuild, portdb_keys) + if inherits.intersection(inherited.split()): + atoms.append(slot_atom) self._setAtoms(atoms) @@ -100,7 +109,8 @@ class InheritSet(PackageSet): raise SetConfigError("no inherits given") inherits = options["inherits"] - return cls(vardb=trees["vartree"].dbapi, + return cls(portdb=trees["porttree"].dbapi, + vardb=trees["vartree"].dbapi, inherits=frozenset(inherits.split())) singleBuilder = classmethod(singleBuilder) |