diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2008-09-30 21:08:24 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2008-09-30 21:08:24 +0000 |
commit | e1737a7506856f0660bf0fcf05517e1337dba1df (patch) | |
tree | 13326096e097fa31f6c0e5930d0f61c24e22719f /lib/bb/data.py | |
parent | 35562ac01ad18d3dc5374827e8fb5548a0a3537e (diff) | |
download | bitbake-e1737a7506856f0660bf0fcf05517e1337dba1df.tar.gz |
bin/bitbake: Add better environmental variable handling. By default it will now only pass certain whitelisted variables into the data store. If BB_PRESERVE_ENV is set bitbake will use all variable from the environment. If BB_ENV_WHITELIST is set, that whitelist will be used instead of the internal bitbake one. Alternatively, BB_ENV_EXTRAWHITE can be used to extend the internal whitelist.
Diffstat (limited to 'lib/bb/data.py')
-rw-r--r-- | lib/bb/data.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py index 54b2615af..82eef4498 100644 --- a/lib/bb/data.py +++ b/lib/bb/data.py @@ -324,21 +324,15 @@ def expandData(alterdata, readdata = None): if val != expanded: setVar(key, expanded, alterdata) -import os - def inheritFromOS(d): """Inherit variables from the environment.""" -# fakeroot needs to be able to set these - non_inherit_vars = [ "LD_LIBRARY_PATH", "LD_PRELOAD" ] for s in os.environ.keys(): - if not s in non_inherit_vars: - try: - setVar(s, os.environ[s], d) - setVarFlag(s, 'matchesenv', '1', d) - except TypeError: - pass - -import sys + try: + setVar(s, os.environ[s], d) + except TypeError: + pass + os.unsetenv(s) + del os.environ[s] def emit_var(var, o=sys.__stdout__, d = init(), all=False): """Emit a variable to be sourced by a shell.""" @@ -379,9 +373,6 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): o.write('unset %s\n' % varExpanded) return 1 - if getVarFlag(var, 'matchesenv', d): - return 0 - val.rstrip() if not val: return 0 |