diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 5419af6246..f468fafc12 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -465,13 +465,25 @@ def sha256_file(filename): s.update(line) return s.hexdigest() -def preserved_envvars_list(): +# Variables which are preserved from the original environment *and* exported +# into our worker context +def preserved_envvars_export_list(): return [ - 'BBPATH', - 'BB_PRESERVE_ENV', - 'BB_ENV_WHITELIST', - 'BB_ENV_EXTRAWHITE', 'BB_TASKHASH', + 'HOME', + 'LOGNAME', + 'PATH', + 'PWD', + 'SHELL', + 'TERM', + 'USER', + 'USERNAME', + ] + +# Variables which are preserved from the original environment *and* exported +# into our worker context for interactive tasks (e.g. requiring X) +def preserved_envvars_export_interactive_list(): + return [ 'COLORTERM', 'DBUS_SESSION_BUS_ADDRESS', 'DESKTOP_SESSION', @@ -481,23 +493,25 @@ def preserved_envvars_list(): 'GNOME_KEYRING_SOCKET', 'GPG_AGENT_INFO', 'GTK_RC_FILES', - 'HOME', - 'LANG', - 'LOGNAME', - 'PATH', - 'PWD', 'SESSION_MANAGER', - 'SHELL', 'SSH_AUTH_SOCK', - 'TERM', - 'USER', - 'USERNAME', - '_', 'XAUTHORITY', 'XDG_DATA_DIRS', 'XDG_SESSION_COOKIE', ] +# Variables which are preserved from the original environment into the datastore +def preserved_envvars_list(): + v = [ + 'BBPATH', + 'BB_PRESERVE_ENV', + 'BB_ENV_WHITELIST', + 'BB_ENV_EXTRAWHITE', + 'LANG', + '_', + ] + return v + preserved_envvars_export_list() + preserved_envvars_export_interactive_list() + def filter_environment(good_vars): """ Create a pristine environment for bitbake. This will remove variables that @@ -518,6 +532,10 @@ def filter_environment(good_vars): return removed_vars +def create_intereactive_env(d): + for k in preserved_envvars_export_interactive_list(): + os.setenv(k, bb.data.getVar(k, d, True)) + def clean_environment(): """ Clean up any spurious environment variables. This will remove any |