summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-08-23 08:41:15 +0000
committerZac Medico <zmedico@gentoo.org>2007-08-23 08:41:15 +0000
commit0d71a4a97f6658dc41bcdce0c9cc02167c3119b5 (patch)
tree1cefa6e93095832a13da9822f7f3da890cf833eb
parent8e504594a5567a003394f7bc99ca9d0fa3badb24 (diff)
downloadportage-0d71a4a97f6658dc41bcdce0c9cc02167c3119b5.tar.gz
portage-0d71a4a97f6658dc41bcdce0c9cc02167c3119b5.tar.bz2
portage-0d71a4a97f6658dc41bcdce0c9cc02167c3119b5.zip
In config.regenerate(), skip loading /etc/profile.env if it's mtime hasn't changed. (trunk r7682)
svn path=/main/branches/2.1.2/; revision=7683
-rw-r--r--pym/portage.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/pym/portage.py b/pym/portage.py
index edb1de9a9..1afb96f86 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -987,6 +987,7 @@ class config:
self.user_profile_dir = None
self.local_config = local_config
self._use_wildcards = False
+ self._env_d_mtime = 0
if clone:
self.incrementals = copy.deepcopy(clone.incrementals)
@@ -1881,12 +1882,18 @@ class config:
self.already_in_regenerate = 1
# We grab the latest profile.env here since it changes frequently.
- self.configdict["env.d"].clear()
- env_d = getconfig(
- os.path.join(self["ROOT"], "etc", "profile.env"), expand=False)
- if env_d:
- # env_d will be None if profile.env doesn't exist.
- self.configdict["env.d"].update(env_d)
+ env_d_filename = os.path.join(self["ROOT"], "etc", "profile.env")
+ try:
+ cur_timestamp = os.stat(env_d_filename).st_mtime
+ except OSError:
+ cur_timestamp = 0
+ if cur_timestamp != self._env_d_mtime:
+ self._env_d_mtime = cur_timestamp
+ self.configdict["env.d"].clear()
+ env_d = getconfig(env_d_filename, expand=False)
+ if env_d:
+ # env_d will be None if profile.env doesn't exist.
+ self.configdict["env.d"].update(env_d)
if useonly:
myincrementals=["USE"]