1 |
Author: zmedico |
2 |
Date: 2008-07-31 05:45:56 +0000 (Thu, 31 Jul 2008) |
3 |
New Revision: 11292 |
4 |
|
5 |
Modified: |
6 |
main/trunk/cnf/sets.conf |
7 |
main/trunk/pym/portage/sets/dbapi.py |
8 |
Log: |
9 |
Implement a new @live-ebuilds which is generated from installed packages |
10 |
that inherit from know live eclasses such as cvs, darcs, git, mercurial, |
11 |
and subversion. The list of eclasses is controlled by an "inherits" |
12 |
attribute that is configure in sets.conf for and instance of InheritSet. |
13 |
This set serves a purpose similar to the -scm ebuild suffix that has |
14 |
been proposed in GLEP 54. |
15 |
|
16 |
|
17 |
Modified: main/trunk/cnf/sets.conf |
18 |
=================================================================== |
19 |
--- main/trunk/cnf/sets.conf 2008-07-31 04:51:33 UTC (rev 11291) |
20 |
+++ main/trunk/cnf/sets.conf 2008-07-31 05:45:56 UTC (rev 11292) |
21 |
@@ -41,3 +41,9 @@ |
22 |
[preserved-rebuild] |
23 |
class = portage.sets.libs.PreservedLibraryConsumerSet |
24 |
world-candidate = False |
25 |
+ |
26 |
+# Installed ebuilds that inherit from known live eclasses. |
27 |
+[live-ebuilds] |
28 |
+class = portage.sets.dbapi.InheritSet |
29 |
+world-candidate = False |
30 |
+inherits = "cvs darcs git mercurial subversion" |
31 |
|
32 |
Modified: main/trunk/pym/portage/sets/dbapi.py |
33 |
=================================================================== |
34 |
--- main/trunk/pym/portage/sets/dbapi.py 2008-07-31 04:51:33 UTC (rev 11291) |
35 |
+++ main/trunk/pym/portage/sets/dbapi.py 2008-07-31 05:45:56 UTC (rev 11292) |
36 |
@@ -6,7 +6,7 @@ |
37 |
from portage.sets.base import PackageSet |
38 |
from portage.sets import SetConfigError, get_boolean |
39 |
|
40 |
-__all__ = ["CategorySet", "EverythingSet"] |
41 |
+__all__ = ["CategorySet", "EverythingSet", "InheritSet"] |
42 |
|
43 |
class EverythingSet(PackageSet): |
44 |
_operations = ["merge", "unmerge"] |
45 |
@@ -32,6 +32,43 @@ |
46 |
return EverythingSet(trees["vartree"].dbapi) |
47 |
singleBuilder = classmethod(singleBuilder) |
48 |
|
49 |
+class InheritSet(PackageSet): |
50 |
+ |
51 |
+ _operations = ["merge", "unmerge"] |
52 |
+ |
53 |
+ description = "Package set which contains all packages " + \ |
54 |
+ "that inherit one or more specific eclasses." |
55 |
+ |
56 |
+ def __init__(self, vardb=None, inherits=None): |
57 |
+ super(InheritSet, self).__init__() |
58 |
+ self._db = vardb |
59 |
+ self._inherits = inherits |
60 |
+ |
61 |
+ def load(self): |
62 |
+ atoms = [] |
63 |
+ inherits = self._inherits |
64 |
+ cp_list = self._db.cp_list |
65 |
+ aux_get = self._db.aux_get |
66 |
+ aux_keys = ["INHERITED", "SLOT"] |
67 |
+ for cp in self._db.cp_all(): |
68 |
+ for cpv in cp_list(cp): |
69 |
+ inherited, slot = aux_get(cpv, aux_keys) |
70 |
+ inherited = inherited.split() |
71 |
+ if inherits.intersection(inherited): |
72 |
+ atoms.append("%s:%s" % (cp, slot)) |
73 |
+ |
74 |
+ self._setAtoms(atoms) |
75 |
+ |
76 |
+ def singleBuilder(cls, options, settings, trees): |
77 |
+ if not "inherits" in options: |
78 |
+ raise SetConfigError("no inherits given") |
79 |
+ |
80 |
+ inherits = options["inherits"] |
81 |
+ return cls(vardb=trees["vartree"].dbapi, |
82 |
+ inherits=frozenset(inherits.split())) |
83 |
+ |
84 |
+ singleBuilder = classmethod(singleBuilder) |
85 |
+ |
86 |
class CategorySet(PackageSet): |
87 |
_operations = ["merge", "unmerge"] |