From b6d8f96ee51d8897e083974bd10d48f64ddffd32 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 11 Feb 2013 11:00:45 +0000 Subject: bitbake: bitbake/utils: Improve environment handling to allow UIs access to original environment We need to empty out the environment whilst we build the cooker but we need the environment for the UIs since hob uses DISPLAY and other session variables. This patch adapts the utils functions to return removed environment components so we can reinject them for use by the UI, allowing hob to work again. (Bitbake rev: fc330d810099c57fefd4e706159a73ad8401d97c) Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 484fb2dc76..b1a0f25e75 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -474,17 +474,17 @@ def filter_environment(good_vars): are not known and may influence the build in a negative way. """ - removed_vars = [] + removed_vars = {} for key in os.environ.keys(): if key in good_vars: continue - removed_vars.append(key) + removed_vars[key] = os.environ[key] os.unsetenv(key) del os.environ[key] if len(removed_vars): - logger.debug(1, "Removed the following variables from the environment: %s", ", ".join(removed_vars)) + logger.debug(1, "Removed the following variables from the environment: %s", ", ".join(removed_vars.keys())) return removed_vars @@ -509,7 +509,9 @@ def clean_environment(): """ if 'BB_PRESERVE_ENV' not in os.environ: good_vars = approved_variables() - filter_environment(good_vars) + return filter_environment(good_vars) + + return {} def empty_environment(): """ -- cgit v1.2.3-54-g00ecf