1 |
Author: zmedico |
2 |
Date: 2008-11-01 02:43:56 +0000 (Sat, 01 Nov 2008) |
3 |
New Revision: 11769 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
main/trunk/pym/portage/dep.py |
8 |
Log: |
9 |
Bug #244947 - Add repoman support for checking masked and forced flags on |
10 |
conditional USE deps. |
11 |
|
12 |
|
13 |
Modified: main/trunk/pym/portage/__init__.py |
14 |
=================================================================== |
15 |
--- main/trunk/pym/portage/__init__.py 2008-10-31 21:37:18 UTC (rev 11768) |
16 |
+++ main/trunk/pym/portage/__init__.py 2008-11-01 02:43:56 UTC (rev 11769) |
17 |
@@ -6110,7 +6110,7 @@ |
18 |
return newsplit |
19 |
|
20 |
def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", |
21 |
- trees=None, **kwargs): |
22 |
+ trees=None, use_mask=None, use_force=None, **kwargs): |
23 |
"""Recursively expand new-style virtuals so as to collapse one or more |
24 |
levels of indirection. In dep_zapdeps, new-style virtuals will be assigned |
25 |
zero cost regardless of whether or not they are currently installed. Virtual |
26 |
@@ -6146,8 +6146,14 @@ |
27 |
raise portage.exception.ParseError( |
28 |
"invalid atom: '%s'" % x) |
29 |
|
30 |
- # Repoman only checks IUSE for USE deps, so there's |
31 |
- # no need to evaluate conditionals. |
32 |
+ if repoman and x.use and x.use.conditional: |
33 |
+ evaluated_atom = portage.dep.remove_slot(x) |
34 |
+ if x.slot: |
35 |
+ evaluated_atom += ":%s" % x.slot |
36 |
+ evaluated_atom += str(x.use._eval_qa_conditionals( |
37 |
+ use_mask, use_force)) |
38 |
+ x = portage.dep.Atom(evaluated_atom) |
39 |
+ |
40 |
if not repoman and \ |
41 |
myuse is not None and isinstance(x, portage.dep.Atom) and x.use: |
42 |
if x.use.conditional: |
43 |
@@ -6538,7 +6544,8 @@ |
44 |
# collapse one or more levels of indirection. |
45 |
try: |
46 |
mysplit = _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, |
47 |
- use=use, mode=mode, myuse=myuse, use_cache=use_cache, |
48 |
+ use=use, mode=mode, myuse=myuse, |
49 |
+ use_force=useforce, use_mask=mymasks, use_cache=use_cache, |
50 |
use_binaries=use_binaries, myroot=myroot, trees=trees) |
51 |
except portage.exception.ParseError, e: |
52 |
return [0, str(e)] |
53 |
|
54 |
Modified: main/trunk/pym/portage/dep.py |
55 |
=================================================================== |
56 |
--- main/trunk/pym/portage/dep.py 2008-10-31 21:37:18 UTC (rev 11768) |
57 |
+++ main/trunk/pym/portage/dep.py 2008-11-01 02:43:56 UTC (rev 11769) |
58 |
@@ -459,6 +459,31 @@ |
59 |
|
60 |
return _use_dep(tokens) |
61 |
|
62 |
+ def _eval_qa_conditionals(self, use_mask, use_force): |
63 |
+ """ |
64 |
+ For repoman, evaluate all possible combinations within the constraints |
65 |
+ of the given use.force and use.mask settings. The result may seem |
66 |
+ ambiguous in the sense that the same flag can be in both the enabled |
67 |
+ and disabled sets, but this is useful within the context of how its |
68 |
+ intended to be used by repoman. It is assumed that the caller has |
69 |
+ already ensured that there is no intersection between the given |
70 |
+ use_mask and use_force sets when necessary. |
71 |
+ """ |
72 |
+ tokens = [] |
73 |
+ |
74 |
+ conditional = self.conditional |
75 |
+ tokens.extend(self.enabled) |
76 |
+ tokens.extend("-" + x for x in self.disabled) |
77 |
+ tokens.extend(x for x in conditional.enabled if x not in use_mask) |
78 |
+ tokens.extend("-" + x for x in conditional.disabled if x not in use_force) |
79 |
+ |
80 |
+ tokens.extend(x for x in conditional.equal if x not in use_mask) |
81 |
+ tokens.extend("-" + x for x in conditional.equal if x not in use_force) |
82 |
+ tokens.extend("-" + x for x in conditional.not_equal if x not in use_mask) |
83 |
+ tokens.extend(x for x in conditional.not_equal if x not in use_force) |
84 |
+ |
85 |
+ return _use_dep(tokens) |
86 |
+ |
87 |
class _AtomCache(type): |
88 |
""" |
89 |
Cache Atom instances from constructor calls and reuse |