From ccad47cd44fc3bb3f2d332737d7310f19c0644bb Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 1 Nov 2008 02:43:56 +0000 Subject: Bug #244947 - Add repoman support for checking masked and forced flags on conditional USE deps. svn path=/main/trunk/; revision=11769 --- pym/portage/__init__.py | 15 +++++++++++---- pym/portage/dep.py | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 68b7a35ca..4b9457ae9 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -6110,7 +6110,7 @@ def dep_virtual(mysplit, mysettings): return newsplit def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", - trees=None, **kwargs): + trees=None, use_mask=None, use_force=None, **kwargs): """Recursively expand new-style virtuals so as to collapse one or more levels of indirection. In dep_zapdeps, new-style virtuals will be assigned zero cost regardless of whether or not they are currently installed. Virtual @@ -6146,8 +6146,14 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", raise portage.exception.ParseError( "invalid atom: '%s'" % x) - # Repoman only checks IUSE for USE deps, so there's - # no need to evaluate conditionals. + if repoman and x.use and x.use.conditional: + evaluated_atom = portage.dep.remove_slot(x) + if x.slot: + evaluated_atom += ":%s" % x.slot + evaluated_atom += str(x.use._eval_qa_conditionals( + use_mask, use_force)) + x = portage.dep.Atom(evaluated_atom) + if not repoman and \ myuse is not None and isinstance(x, portage.dep.Atom) and x.use: if x.use.conditional: @@ -6538,7 +6544,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, # collapse one or more levels of indirection. try: mysplit = _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, - use=use, mode=mode, myuse=myuse, use_cache=use_cache, + use=use, mode=mode, myuse=myuse, + use_force=useforce, use_mask=mymasks, use_cache=use_cache, use_binaries=use_binaries, myroot=myroot, trees=trees) except portage.exception.ParseError, e: return [0, str(e)] diff --git a/pym/portage/dep.py b/pym/portage/dep.py index a6e67c3ee..fc6a8b10e 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -459,6 +459,31 @@ class _use_dep(object): return _use_dep(tokens) + def _eval_qa_conditionals(self, use_mask, use_force): + """ + For repoman, evaluate all possible combinations within the constraints + of the given use.force and use.mask settings. The result may seem + ambiguous in the sense that the same flag can be in both the enabled + and disabled sets, but this is useful within the context of how its + intended to be used by repoman. It is assumed that the caller has + already ensured that there is no intersection between the given + use_mask and use_force sets when necessary. + """ + tokens = [] + + conditional = self.conditional + tokens.extend(self.enabled) + tokens.extend("-" + x for x in self.disabled) + tokens.extend(x for x in conditional.enabled if x not in use_mask) + tokens.extend("-" + x for x in conditional.disabled if x not in use_force) + + tokens.extend(x for x in conditional.equal if x not in use_mask) + tokens.extend("-" + x for x in conditional.equal if x not in use_force) + tokens.extend("-" + x for x in conditional.not_equal if x not in use_mask) + tokens.extend(x for x in conditional.not_equal if x not in use_force) + + return _use_dep(tokens) + class _AtomCache(type): """ Cache Atom instances from constructor calls and reuse -- cgit v1.2.3-1-g7c22