summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-09-09 17:25:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-09-09 18:37:41 +0100
commit67e5e23034c5ec2b9efcca935242830306c0048d (patch)
treea2352fb904a12d828a8a68fd5a0c9f1e42a75b8c
parent24272dae15ccf641ece11ef5a6e2bfa3ebb6f5f9 (diff)
downloadbitbake-67e5e23034c5ec2b9efcca935242830306c0048d.tar.gz
runqueue: Ensure task environment is correct
This fixes two problems: a) Variables which were in the parent environment but not set as "export" variables in the datastore could end up in the task environment b) oe.environ.update() can't cope with the generator returned by bb.data.exported_vars() Whilst the updated code isn't as neat, it does do the expected thing, sets the environment correctly and stops unwanted values leaking into the task environment. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/runqueue.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index d0505c128..cf3363c99 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -1072,6 +1072,7 @@ class RunQueueExecute:
# a fork() or exec*() activates PSEUDO...
envbackup = {}
+ fakeenv = {}
umask = None
taskdep = self.rqdata.dataCache.task_deps[fn]
@@ -1087,6 +1088,7 @@ class RunQueueExecute:
for key, value in (var.split('=') for var in envvars):
envbackup[key] = os.environ.get(key)
os.environ[key] = value
+ fakeenv[key] = value
fakedirs = (self.rqdata.dataCache.fakerootdirs[fn] or "").split()
for p in fakedirs:
@@ -1136,7 +1138,14 @@ class RunQueueExecute:
for h in self.rqdata.hash_deps:
the_data.setVar("BBHASHDEPS_%s" % h, self.rqdata.hash_deps[h])
- os.environ.update(bb.data.exported_vars(the_data))
+ # exported_vars() returns a generator which *cannot* be passed to os.environ.update()
+ # successfully. We also need to unset anything from the environment which shouldn't be there
+ exports = bb.data.exported_vars(the_data)
+ bb.utils.empty_environment()
+ for e, v in exports:
+ os.environ[e] = v
+ for e in fakeenv:
+ os.environ[e] = fakeenv[e]
if quieterrors:
the_data.setVarFlag(taskname, "quieterrors", "1")