When creating a config instance for ROOT=/ with a clean env, copy PATH and
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:13:24 +0000 (20:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:13:24 +0000 (20:13 -0000)
TERM variables, since they may be useful. (trunk r15345)

svn path=/main/branches/2.1.7/; revision=15572

pym/portage/__init__.py

index e7667e1317eb1c1252bd351e60a2d507bdd63985..0708aead813c6d1ce4788a86872fc8bf19ab8a7c 100644 (file)
@@ -9195,8 +9195,13 @@ def create_trees(config_root=None, target_root=None, trees=None):
 
                # When ROOT != "/" we only want overrides from the calling
                # environment to apply to the config that's associated
-               # with ROOT != "/", so pass an empty dict for the env parameter.
-               settings = config(config_root=None, target_root="/", env={})
+               # with ROOT != "/", so pass a nearly empty dict for the env parameter.
+               clean_env = {}
+               for k in ('PATH', 'TERM'):
+                       v = settings.get(k)
+                       if v is not None:
+                               clean_env[k] = v
+               settings = config(config_root=None, target_root="/", env=clean_env)
                settings.lock()
                myroots.append((settings["ROOT"], settings))