summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 20:16:56 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 20:38:28 +0100
commitc7f76a1bc9868ea4709688967d9794acd4d784ec (patch)
tree0599fe8923b2dc0a89853b03b4eb17b836bacc54 /bitbake/lib
parentbdab8e93543bfc0d7b07c61da043b410036ac2c7 (diff)
downloadast2050-yocto-poky-c7f76a1bc9868ea4709688967d9794acd4d784ec.zip
ast2050-yocto-poky-c7f76a1bc9868ea4709688967d9794acd4d784ec.tar.gz
bitbake/data/runqueue: Sync up with upstream to clean up environment variable handling
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/data.py27
-rw-r--r--bitbake/lib/bb/runqueue.py11
2 files changed, 12 insertions, 26 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index 50f2218..720dd76 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -234,25 +234,20 @@ def emit_env(o=sys.__stdout__, d = init(), all=False):
for key in keys:
emit_var(key, o, d, all and not isfunc) and o.write('\n')
-def export_vars(d):
- keys = (key for key in d.keys() if d.getVarFlag(key, "export"))
- ret = {}
- for k in keys:
+def exported_keys(d):
+ return (key for key in d.keys() if not key.startswith('__') and
+ d.getVarFlag(key, 'export') and
+ not d.getVarFlag(key, 'unexport'))
+
+def exported_vars(d):
+ for key in exported_keys(d):
try:
- v = d.getVar(k, True)
- if v:
- ret[k] = v
- except (KeyboardInterrupt, bb.build.FuncFailed):
- raise
- except Exception, exc:
+ value = d.getVar(key, True)
+ except Exception:
pass
- return ret
-def export_envvars(v, d):
- for s in os.environ.keys():
- if s not in v:
- v[s] = os.environ[s]
- return v
+ if value is not None:
+ yield key, str(value)
def emit_func(func, o=sys.__stdout__, d = init()):
"""Emits all items in the data store in a format such that it can be sourced by a shell."""
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 772b366..af21eae 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1062,7 +1062,6 @@ class RunQueueExecute:
# We need to setup the environment BEFORE the fork, since
# a fork() or exec*() activates PSEUDO...
- env = {}
envbackup = {}
taskdep = self.rqdata.dataCache.task_deps[fn]
@@ -1071,7 +1070,6 @@ class RunQueueExecute:
for key, value in (var.split('=') for var in envvars):
envbackup[key] = os.environ.get(key)
os.environ[key] = value
- env[key] = value
fakedirs = (self.rqdata.dataCache.fakerootdirs[fn] or "").split()
for p in fakedirs:
@@ -1118,14 +1116,7 @@ class RunQueueExecute:
for h in self.rqdata.hash_deps:
the_data.setVar("BBHASHDEPS_%s" % h, self.rqdata.hash_deps[h])
- env2 = bb.data.export_vars(the_data)
- env2 = bb.data.export_envvars(env2, the_data)
- for e in os.environ:
- os.unsetenv(e)
- for e in env2:
- os.putenv(e, env2[e])
- for e in env:
- os.putenv(e, env[e])
+ os.environ.update(bb.data.exported_vars(the_data))
if quieterrors:
the_data.setVarFlag(taskname, "quieterrors", "1")
OpenPOWER on IntegriCloud