summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-07-31 05:45:56 +0000
committerZac Medico <zmedico@gentoo.org>2008-07-31 05:45:56 +0000
commitd4c3415c1049c7c342728307dec39359f3230634 (patch)
treea74a8d674b8c1ec03ed1539ce38a6fd663a179f1
parentc75779b2a5f0674681a7cbb42c364ba010572a4c (diff)
downloadportage-d4c3415c1049c7c342728307dec39359f3230634.tar.gz
portage-d4c3415c1049c7c342728307dec39359f3230634.tar.bz2
portage-d4c3415c1049c7c342728307dec39359f3230634.zip
Implement a new @live-ebuilds which is generated from installed packages
that inherit from know live eclasses such as cvs, darcs, git, mercurial, and subversion. The list of eclasses is controlled by an "inherits" attribute that is configure in sets.conf for and instance of InheritSet. This set serves a purpose similar to the -scm ebuild suffix that has been proposed in GLEP 54. svn path=/main/trunk/; revision=11292
-rw-r--r--cnf/sets.conf6
-rw-r--r--pym/portage/sets/dbapi.py39
2 files changed, 44 insertions, 1 deletions
diff --git a/cnf/sets.conf b/cnf/sets.conf
index f422f5004..13c09a366 100644
--- a/cnf/sets.conf
+++ b/cnf/sets.conf
@@ -41,3 +41,9 @@ directory = /etc/portage/sets
[preserved-rebuild]
class = portage.sets.libs.PreservedLibraryConsumerSet
world-candidate = False
+
+# Installed ebuilds that inherit from known live eclasses.
+[live-ebuilds]
+class = portage.sets.dbapi.InheritSet
+world-candidate = False
+inherits = "cvs darcs git mercurial subversion"
diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py
index 5352a32f3..c31db5542 100644
--- a/pym/portage/sets/dbapi.py
+++ b/pym/portage/sets/dbapi.py
@@ -6,7 +6,7 @@ from portage.versions import catsplit
from portage.sets.base import PackageSet
from portage.sets import SetConfigError, get_boolean
-__all__ = ["CategorySet", "EverythingSet"]
+__all__ = ["CategorySet", "EverythingSet", "InheritSet"]
class EverythingSet(PackageSet):
_operations = ["merge", "unmerge"]
@@ -32,6 +32,43 @@ class EverythingSet(PackageSet):
return EverythingSet(trees["vartree"].dbapi)
singleBuilder = classmethod(singleBuilder)
+class InheritSet(PackageSet):
+
+ _operations = ["merge", "unmerge"]
+
+ description = "Package set which contains all packages " + \
+ "that inherit one or more specific eclasses."
+
+ def __init__(self, vardb=None, inherits=None):
+ super(InheritSet, self).__init__()
+ self._db = vardb
+ self._inherits = inherits
+
+ def load(self):
+ atoms = []
+ inherits = self._inherits
+ cp_list = self._db.cp_list
+ aux_get = self._db.aux_get
+ aux_keys = ["INHERITED", "SLOT"]
+ 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))
+
+ self._setAtoms(atoms)
+
+ def singleBuilder(cls, options, settings, trees):
+ if not "inherits" in options:
+ raise SetConfigError("no inherits given")
+
+ inherits = options["inherits"]
+ return cls(vardb=trees["vartree"].dbapi,
+ inherits=frozenset(inherits.split()))
+
+ singleBuilder = classmethod(singleBuilder)
+
class CategorySet(PackageSet):
_operations = ["merge", "unmerge"]