From e51d542e78b70c2f854bd8b14b24dfd3f43a5ff4 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Fri, 22 Jul 2011 10:21:00 -0700 Subject: bitbake|cooker: save a copy of the environment when BitBake is started Create a data store in the cooker containing the values of the environment from when BitBake is launched such that child processes can replicate (and/or use values from) the host environment, rather than the cleaned up environment that the main BitBake process uses. (Bitbake rev: 54c7206165c0e7cfe5f7b243c80461baf5e7dfb1) Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie --- bitbake/bin/bitbake | 5 ++++- bitbake/lib/bb/cooker.py | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'bitbake') diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index 8d6fef7b8b..5398cf122a 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake @@ -197,6 +197,9 @@ Default BBFILES are the .bb files in the current directory.""") handler = bb.event.LogHandler() logger.addHandler(handler) + # Before we start modifying the environment we should take a pristine + # copy for possible later use + initialenv = os.environ.copy() # Clear away any spurious environment variables. But don't wipe the # environment totally. This is necessary to ensure the correct operation # of the UIs (e.g. for DISPLAY, etc.) @@ -207,7 +210,7 @@ Default BBFILES are the .bb files in the current directory.""") server.initServer() idle = server.getServerIdleCB() - cooker = bb.cooker.BBCooker(configuration, idle) + cooker = bb.cooker.BBCooker(configuration, idle, initialenv) cooker.parseCommandLine() server.addcooker(cooker) diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index b0ddb2e112..044ceb179e 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -78,7 +78,7 @@ class BBCooker: Manages one bitbake build run """ - def __init__(self, configuration, server_registration_cb): + def __init__(self, configuration, server_registration_cb, savedenv={}): self.status = None self.appendlist = {} self.skiplist = {} @@ -87,6 +87,14 @@ class BBCooker: self.configuration = configuration + # Keep a datastore of the initial environment variables and their + # values from when BitBake was launched to enable child processes + # to use environment variables which have been cleaned from the + # BitBake processes env + self.savedenv = bb.data.init() + for k in savedenv: + self.savedenv.setVar(k, savedenv[k]) + self.caches_array = [] # Currently, only Image Creator hob ui needs extra cache. # So, we save Extra Cache class name and container file -- cgit v1.2.3-54-g00ecf