Bug #334365 - Make dep_check() less strict with respect to EAPI
authorZac Medico <zmedico@gentoo.org>
Thu, 26 Aug 2010 23:49:20 +0000 (16:49 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 26 Aug 2010 23:49:20 +0000 (16:49 -0700)
constraints for installed packages since previous validation will
have already marked them as invalid when necessary and now we're
more interested in evaluating dependencies so that things like
--depclean work as well as possible in spite of partial
invalidity. Also, remove obsolete EAPI atom validation code from
_expand_new_virtuals() since it's handled by use_reduce() and
the Atom constructor now.

pym/portage/dep/dep_check.py

index bfbdc608e87f77301d9e6f76aacd6d645b7126fe..07a38d0c5b0294ea2c89ddc37bece0e44bb87caa 100644 (file)
@@ -62,21 +62,6 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                        raise ParseError(
                                _("invalid token: '%s'") % x)
 
-               if x.blocker and x.blocker.overlap.forbid and \
-                       not eapi_has_strong_blocks(eapi):
-                       raise ParseError(
-                               _("strong blocks are not allowed in EAPI %s: '%s'") % (eapi, x))
-               if x.use and not eapi_has_use_deps(eapi):
-                       raise ParseError(
-                               _("use deps are not allowed in EAPI %s: '%s'") % (eapi, x))
-               if x.slot and not eapi_has_slot_deps(eapi):
-                       raise ParseError(
-                               _("slot deps are not allowed in EAPI %s: '%s'") % (eapi, x))
-               if x.use and (x.use.missing_enabled or x.use.missing_disabled) \
-                       and not eapi_has_use_dep_defaults(eapi):
-                       raise ParseError(
-                               _("use dep defaults are not allowed in EAPI %s: '%s'") % (eapi, x))
-
                if repoman:
                        x = x._eval_qa_conditionals(use_mask, use_force)
 
@@ -537,12 +522,22 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
        mytrees = trees[myroot]
        parent = mytrees.get("parent")
        virt_parent = mytrees.get("virt_parent")
+       current_parent = None
        eapi = None
        if parent is not None:
                if virt_parent is not None:
-                       eapi = virt_parent[0].metadata['EAPI']
+                       current_parent = virt_parent[0]
                else:
-                       eapi = parent.metadata["EAPI"]
+                       current_parent = parent
+
+       if current_parent is not None:
+               # Don't pass the eapi argument to use_reduce() for installed packages
+               # since previous validation will have already marked them as invalid
+               # when necessary and now we're more interested in evaluating
+               # dependencies so that things like --depclean work as well as possible
+               # in spite of partial invalidity.
+               if not current_parent.installed:
+                       eapi = current_parent.metadata['EAPI']
 
        try:
                mysplit = use_reduce(depstring, uselist=myusesplit, masklist=mymasks, \