When creating a config instance for ROOT=/ with a clean env, copy PATH and
authorZac Medico <zmedico@gentoo.org>
Fri, 12 Feb 2010 09:09:06 +0000 (09:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 12 Feb 2010 09:09:06 +0000 (09:09 -0000)
TERM variables, since they may be useful.

svn path=/main/trunk/; revision=15345

pym/portage/__init__.py

index 0879b9b9dd99d566eb1af1df5d0c715abd0f0e49..381701b60f74008dbd9b1dee7918516706e401de 100644 (file)
@@ -9198,8 +9198,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))