Trigger a config.regenerate() call inside setcpv() when the
authorZac Medico <zmedico@gentoo.org>
Wed, 19 Dec 2007 02:55:39 +0000 (02:55 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 19 Dec 2007 02:55:39 +0000 (02:55 -0000)
EBUILD_PHASE variable is defined. It's too expensive to do
the regenerate() call every time. Do in when EBUILD_PHASE
is defined since it's needed to create the filtered USE that
environ() passes to the ebuild environment. (trunk r8961)

svn path=/main/branches/2.1.2/; revision=8962

pym/portage.py

index fd678f7df4a84b777d5af0758dc55d49951af6b0..9e0a5e6ffc98f67d5c8075377c4d5e9597347169 100644 (file)
@@ -1945,7 +1945,7 @@ class config:
                self.configdict["pkg"]["USE"]    = self.puse[:] # this gets appended to USE
                if iuse != self.configdict["pkg"].get("IUSE",""):
                        self.configdict["pkg"]["IUSE"] = iuse
-                       if self._use_wildcards:
+                       if self._use_wildcards or self.get("EBUILD_PHASE"):
                                # Without this conditional, regenerate() would be called
                                # *every* time.
                                has_changed = True
@@ -3793,6 +3793,11 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
        # so that the caller can override it.
        tmpdir = mysettings["PORTAGE_TMPDIR"]
 
+       # This variable is a signal to setcpv where it triggers
+       # filtering of USE for the ebuild environment.
+       mysettings["EBUILD_PHASE"] = mydo
+       mysettings.backup_changes("EBUILD_PHASE")
+
        if mydo != "depend":
                """For performance reasons, setcpv only triggers reset when it
                detects a package-specific change in config.  For the ebuild
@@ -3805,6 +3810,7 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
        # so restore it to it's original value.
        mysettings["PORTAGE_TMPDIR"] = tmpdir
 
+       mysettings.pop("EBUILD_PHASE", None) # remove from backupenv
        mysettings["EBUILD_PHASE"] = mydo
 
        mysettings["PORTAGE_MASTER_PID"] = str(os.getpid())