Bug #275821 - Make emerge reject !!atom blockers for EAPI 0 and 1.
authorZac Medico <zmedico@gentoo.org>
Mon, 29 Jun 2009 23:03:19 +0000 (23:03 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 29 Jun 2009 23:03:19 +0000 (23:03 -0000)
svn path=/main/trunk/; revision=13736

pym/portage/__init__.py

index d14456565279517b8c85fbb253d9b87c9d4638f1..3a87cfd4728c33e680a85e1b69ac5a98bedfa968 100644 (file)
@@ -6876,7 +6876,12 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
        # According to GLEP 37, RDEPEND is the only dependency type that is valid
        # for new-style virtuals.  Repoman should enforce this.
        dep_keys = ["RDEPEND", "DEPEND", "PDEPEND"]
-       portdb = trees[myroot]["porttree"].dbapi
+       mytrees = trees[myroot]
+       portdb = mytrees["porttree"].dbapi
+       parent = mytrees.get("parent")
+       eapi = mytrees.get("eapi")
+       if eapi is None and parent is not None:
+               eapi = parent.metadata["EAPI"]
        repoman = not mysettings.local_config
        if kwargs["use_binaries"]:
                portdb = trees[myroot]["bintree"].dbapi
@@ -6899,6 +6904,11 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                                if portage.dep._dep_check_strict:
                                        raise portage.exception.ParseError(
                                                "invalid atom: '%s'" % x)
+                       else:
+                               if x.blocker and x.blocker.overlap.forbid and \
+                                       eapi in ("0", "1") and portage.dep._dep_check_strict:
+                                       raise portage.exception.ParseError(
+                                               "invalid atom: '%s'" % (x,))
 
                if repoman and x.use and x.use.conditional:
                        evaluated_atom = portage.dep.remove_slot(x)
@@ -6968,8 +6978,21 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                        if edebug:
                                print "Virtual Parent:   ", y[0]
                                print "Virtual Depstring:", depstring
+
+                       # Set EAPI used for validation in dep_check() recursion.
+                       virtual_eapi, = db.aux_get(cpv, ["EAPI"])
+                       prev_eapi = mytrees.get("eapi")
+                       mytrees["eapi"] = virtual_eapi
+
                        mycheck = dep_check(depstring, mydbapi, mysettings, myroot=myroot,
                                trees=trees, **pkg_kwargs)
+
+                       # Restore previous EAPI after recursion.
+                       if prev_eapi is not None:
+                               mytrees["eapi"] = prev_eapi
+                       else:
+                               del mytrees["eapi"]
+
                        if not mycheck[0]:
                                raise portage.exception.ParseError(
                                        "%s: %s '%s'" % (y[0], mycheck[1], depstring))