From a6b0c81209d3ff3bb114d5b076ea8c3fc12c209b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 24 Aug 2007 03:15:01 +0000 Subject: [PATCH] Use a config.reload() method to explicitly reload /etc/profile.env when setting up the ebuild environment. svn path=/main/trunk/; revision=7692 --- pym/emerge/__init__.py | 2 +- 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) -- 2.26.2