Bug #244947 - Add repoman support for checking masked and forced flags on
authorZac Medico <zmedico@gentoo.org>
Sat, 1 Nov 2008 02:43:56 +0000 (02:43 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 1 Nov 2008 02:43:56 +0000 (02:43 -0000)
conditional USE deps.

svn path=/main/trunk/; revision=11769

pym/portage/__init__.py
pym/portage/dep.py

index 68b7a35ca9713d781122d7dc77304f49806229f8..4b9457ae9305af9ddf9a14e484c8c948cd0c741f 100644 (file)
@@ -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)]
index a6e67c3ee07a66cbeed46585c641c424dfba8af8..fc6a8b10e66d13f9cbe2f490000ee56511f61110 100644 (file)
@@ -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