diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-08-24 03:15:01 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-08-24 03:15:01 +0000 |
commit | a6b0c81209d3ff3bb114d5b076ea8c3fc12c209b (patch) | |
tree | 5623e6bdf9559add3cf7d5efff86577a15f47934 | |
parent | b485bb0e09f261c985e2e5dc80fa3fc6365bdafa (diff) | |
download | portage-a6b0c81209d3ff3bb114d5b076ea8c3fc12c209b.tar.gz portage-a6b0c81209d3ff3bb114d5b076ea8c3fc12c209b.tar.bz2 portage-a6b0c81209d3ff3bb114d5b076ea8c3fc12c209b.zip |
Use a config.reload() method to explicitly reload /etc/profile.env when setting up the ebuild environment.
svn path=/main/trunk/; revision=7692
-rw-r--r-- | pym/emerge/__init__.py | 2 | ||||
-rw-r--r-- | pym/portage/__init__.py | 24 |
2 files changed, 10 insertions, 16 deletions
diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 1f545b0cd..61b4e4a17 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -4401,7 +4401,7 @@ def post_emerge(trees, mtimedb, retval): # Load the most current variables from ${ROOT}/etc/profile.env settings.unlock() - settings.regenerate() + settings.reload() settings.lock() config_protect = settings.get("CONFIG_PROTECT","").split() diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a722d231c..1f6d49c22 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -881,7 +881,6 @@ class config(object): 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) @@ -1904,6 +1903,14 @@ class config(object): if modified: self.virtuals = self.__getvirtuals_compile() + def reload(self): + """Reload things like /etc/profile.env that can change during runtime.""" + env_d_filename = os.path.join(self["ROOT"], "etc", "profile.env") + 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) def regenerate(self,useonly=0,use_cache=1): """ @@ -1930,20 +1937,6 @@ class config(object): else: self.already_in_regenerate = 1 - # We grab the latest profile.env here since it changes frequently. - 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"] else: @@ -3313,6 +3306,7 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m detects a package-specific change in config. For the ebuild environment, a reset call is forced in order to ensure that the latest env.d variables are used.""" + mysettings.reload() mysettings.reset(use_cache=use_cache) mysettings.setcpv(mycpv, use_cache=use_cache, mydb=mydbapi) |