summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-12 19:37:26 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-12 19:37:26 +0000
commit27eb5584a0d544a1b96d7c7035208d90389c4988 (patch)
treef74b0adb7624b5d63b6ac746c9cf6fcce06e956f
parent6cf1ad9dfeb68bdc91d12a6ddcac280896fd4747 (diff)
downloadportage-27eb5584a0d544a1b96d7c7035208d90389c4988.tar.gz
portage-27eb5584a0d544a1b96d7c7035208d90389c4988.tar.bz2
portage-27eb5584a0d544a1b96d7c7035208d90389c4988.zip
* Optimize config.setcpv() to return early if IUSE has not changed since
the previous setcpv() call. * Add EBUILD_PHASE to the blacklisted variables list. svn path=/main/trunk/; revision=9854
-rw-r--r--pym/portage/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 75ff00824..2cad377d2 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1291,7 +1291,8 @@ class config(object):
self.lookuplist.reverse()
# Blacklist vars that could interfere with portage internals.
- for blacklisted in "CATEGORY", "PKGUSE", "PORTAGE_CONFIGROOT", \
+ for blacklisted in "CATEGORY", "EBUILD_PHASE", \
+ "PKGUSE", "PORTAGE_CONFIGROOT", \
"PORTAGE_IUSE", "PORTAGE_USE", "ROOT":
for cfg in self.lookuplist:
cfg.pop(blacklisted, None)
@@ -1942,6 +1943,7 @@ class config(object):
has_changed = True
self.configdict["pkg"]["PKGUSE"] = self.puse[:] # For saving to PUSE file
self.configdict["pkg"]["USE"] = self.puse[:] # this gets appended to USE
+ previous_iuse = self.configdict["pkg"].get("IUSE")
self.configdict["pkg"]["IUSE"] = iuse
# Always set known good values for these variables, since
@@ -1953,6 +1955,12 @@ class config(object):
if has_changed:
self.reset(keeping_pkg=1,use_cache=use_cache)
+ # If this is not an ebuild phase and reset() has not been called,
+ # it's safe to return early here if IUSE has not changed.
+ if not (has_changed or ebuild_phase) and \
+ previous_iuse == iuse:
+ return
+
# Filter out USE flags that aren't part of IUSE. This has to
# be done for every setcpv() call since practically every
# package has different IUSE. Some flags are considered to