summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data.py
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-11-28 17:39:09 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2010-12-09 13:16:14 +0000
commit0ba9a9fffee966ec912eec5fd52c468338560e6a (patch)
tree667079024d685b4f7ed1be59d3f23b7e00e97b2b /bitbake/lib/bb/data.py
parent39dd60462c6d1e87f7c4105e1a3913e0aa54dba0 (diff)
downloadpoky-0ba9a9fffee966ec912eec5fd52c468338560e6a.tar.gz
bitbake: Overhaul environment handling
Currently, anything whitelisted in the environment makes it into the worker processes. This is undesireable and the worker environment should be as clean as possible. This patch adapts bitbake sosme variables are loaded into bitbake's datastore but not exported by default. Any variable can be exported by setting its export flag. Currently, this code only finalises the environment in he worker as doing so in the server means variables are unavailable in the worker. If we switch back to fork() calls instead of exec() this code will need revisting. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/data.py')
-rw-r--r--bitbake/lib/bb/data.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index fee10ccda4..d4d43fd8c8 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -161,10 +161,12 @@ def expandKeys(alterdata, readdata = None):
161 161
162def inheritFromOS(d): 162def inheritFromOS(d):
163 """Inherit variables from the environment.""" 163 """Inherit variables from the environment."""
164 exportlist = bb.utils.preserved_envvars_export_list()
164 for s in os.environ.keys(): 165 for s in os.environ.keys():
165 try: 166 try:
166 setVar(s, os.environ[s], d) 167 setVar(s, os.environ[s], d)
167 setVarFlag(s, "export", True, d) 168 if s in exportlist:
169 setVarFlag(s, "export", True, d)
168 except TypeError: 170 except TypeError:
169 pass 171 pass
170 172
@@ -244,6 +246,12 @@ def export_vars(d):
244 pass 246 pass
245 return ret 247 return ret
246 248
249def export_envvars(v, d):
250 for s in os.environ.keys():
251 if s not in v:
252 v[s] = os.environ[s]
253 return v
254
247def emit_func(func, o=sys.__stdout__, d = init()): 255def emit_func(func, o=sys.__stdout__, d = init()):
248 """Emits all items in the data store in a format such that it can be sourced by a shell.""" 256 """Emits all items in the data store in a format such that it can be sourced by a shell."""
249 257