In doebuild_environment(), detect if setcpv() hasn't been called properly,
authorZac Medico <zmedico@gentoo.org>
Sun, 20 Sep 2009 18:38:00 +0000 (18:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 20 Sep 2009 18:38:00 +0000 (18:38 -0000)
and call it if necessary (mainly for api consumers).

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

pym/portage/__init__.py

index a905d8e20532e352fa58f7216cc249e52780aaaa..8837398cd1f48a7a8d3af15c5abd9a85958cf4a0 100644 (file)
@@ -5881,12 +5881,18 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
        # so that the caller can override it.
        tmpdir = mysettings["PORTAGE_TMPDIR"]
 
-       if mycpv != mysettings.mycpv:
-               if mydo == 'depend':
+       if mydo == 'depend':
+               if mycpv != mysettings.mycpv:
                        # Don't pass in mydbapi here since the resulting aux_get
                        # call would lead to infinite 'depend' phase recursion.
                        mysettings.setcpv(mycpv)
-               else:
+       else:
+               # If IUSE isn't in configdict['pkg'], it means that setcpv()
+               # hasn't been called with the mydb argument, so we have to
+               # call it here (portage code always calls setcpv properly,
+               # but api consumers might not).
+               if mycpv != mysettings.mycpv or \
+                       'IUSE' not in mysettings.configdict['pkg']:
                        # Reload env.d variables and reset any previous settings.
                        mysettings.reload()
                        mysettings.reset()