Index: doc/config/sets.docbook
===================================================================
--- doc/config/sets.docbook (revision 11319)
+++ doc/config/sets.docbook (working copy)
@@ -455,19 +455,6 @@
-
- portage.sets.dbapi.InheritSet
-
- Package set which contains all packages
- that inherit one or more specific eclasses.
- This class supports the following options:
-
- inherits: Required. A list of eclass names
- which should be used to create the package set.
-
-
-
-
portage.sets.dbapi.OwnerSet
@@ -481,20 +468,23 @@
-
- portage.sets.dbapi.RestrictSet
+
+ portage.sets.dbapi.VariableSet
Package set which contains all packages
- that match specified RESTRICT values.
+ that match specified values of specified variable.
This class supports the following options:
+ variable: The name of
+ the specified variable whose values are checked.
+
includes: A list of
- values that must be contained within the RESTRICT
- metadata.
+ values that must be contained within the specified
+ variable.
excludes: A list of
- values that must not be contained within the RESTRICT
- metadata.
+ values that must not be contained within the specified
+ variable.
@@ -545,7 +535,7 @@
security: uses NewAffectedSet with default options
everything: uses EverythingSet
preserved-rebuild: uses PreservedLibraryConsumerSet
- live-rebuild: uses InheritSet
+ live-rebuild: uses VariableSet
module-rebuild: uses OwnerSet
downgrade: uses DowngradeSet
Index: pym/portage/sets/dbapi.py
===================================================================
--- pym/portage/sets/dbapi.py (revision 11319)
+++ pym/portage/sets/dbapi.py (working copy)
@@ -8,7 +8,7 @@
from portage.sets import SetConfigError, get_boolean
__all__ = ["CategorySet", "DowngradeSet",
- "EverythingSet", "InheritSet", "OwnerSet", "RestrictSet"]
+ "EverythingSet", "OwnerSet", "VariableSet"]
class EverythingSet(PackageSet):
_operations = ["merge", "unmerge"]
@@ -89,63 +89,17 @@
singleBuilder = classmethod(singleBuilder)
-class InheritSet(PackageSet):
+class VariableSet(EverythingSet):
_operations = ["merge", "unmerge"]
description = "Package set which contains all packages " + \
- "that inherit one or more specific eclasses."
+ "that match specified values of specified variable."
- def __init__(self, portdb=None, vardb=None, inherits=None):
- super(InheritSet, self).__init__()
+ def __init__(self, vardb, portdb=None, variable=None, includes=None, excludes=None):
+ super(VariableSet, self).__init__(vardb)
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
- 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):
- 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)
-
- def singleBuilder(cls, options, settings, trees):
- if not "inherits" in options:
- raise SetConfigError("no inherits given")
-
- inherits = options["inherits"]
- return cls(portdb=trees["porttree"].dbapi,
- vardb=trees["vartree"].dbapi,
- inherits=frozenset(inherits.split()))
-
- singleBuilder = classmethod(singleBuilder)
-
-class RestrictSet(EverythingSet):
-
- _operations = ["merge", "unmerge"]
-
- description = "Package set which contains all packages " + \
- "that match specified RESTRICT values."
-
- def __init__(self, vardb, portdb=None, includes=None, excludes=None):
- super(RestrictSet, self).__init__(vardb)
- self._portdb = portdb
+ self._variable = variable
self._includes = includes
self._excludes = excludes
@@ -153,16 +107,17 @@
ebuild = self._portdb.xmatch("bestmatch-visible", atom)
if not ebuild:
return False
- restrict, = self._portdb.aux_get(ebuild, ["RESTRICT"])
- restrict = restrict.split()
- if self._includes and not self._includes.intersection(restrict):
+ values, = self._portdb.aux_get(ebuild, [self._variable])
+ values = values.split()
+ if self._includes and not self._includes.intersection(values):
return False
- if self._excludes and self._excludes.intersection(restrict):
+ if self._excludes and self._excludes.intersection(values):
return False
return True
def singleBuilder(cls, options, settings, trees):
+ variable = options.get("variable", "")
includes = options.get("includes", "")
excludes = options.get("excludes", "")
@@ -172,7 +127,8 @@
return cls(trees["vartree"].dbapi,
portdb=trees["porttree"].dbapi,
excludes=frozenset(excludes.split()),
- includes=frozenset(includes.split()))
+ includes=frozenset(includes.split()),
+ variable=variable)
singleBuilder = classmethod(singleBuilder)
Index: cnf/sets.conf
===================================================================
--- cnf/sets.conf (revision 11319)
+++ cnf/sets.conf (working copy)
@@ -47,9 +47,10 @@
# Installed ebuilds that inherit from known live eclasses.
[live-rebuild]
-class = portage.sets.dbapi.InheritSet
+class = portage.sets.dbapi.VariableSet
world-candidate = False
-inherits = cvs darcs git mercurial subversion
+variable = RESTRICT
+includes = constant-sources
# Installed packages that own files inside /lib/modules.
[module-rebuild]