summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 1cf1a8da44..1f5540716a 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -565,18 +565,27 @@ def create_interactive_env(d):
565 for k in preserved_envvars_exported_interactive(): 565 for k in preserved_envvars_exported_interactive():
566 os.setenv(k, bb.data.getVar(k, d, True)) 566 os.setenv(k, bb.data.getVar(k, d, True))
567 567
568def approved_variables():
569 """
570 Determine and return the list of whitelisted variables which are approved
571 to remain in the envrionment.
572 """
573 approved = []
574 if 'BB_ENV_WHITELIST' in os.environ:
575 approved = os.environ['BB_ENV_WHITELIST'].split()
576 else:
577 approved = preserved_envvars()
578 if 'BB_ENV_EXTRAWHITE' in os.environ:
579 approved.extend(os.environ['BB_ENV_EXTRAWHITE'].split())
580 return approved
581
568def clean_environment(): 582def clean_environment():
569 """ 583 """
570 Clean up any spurious environment variables. This will remove any 584 Clean up any spurious environment variables. This will remove any
571 variables the user hasn't chose to preserve. 585 variables the user hasn't chosen to preserve.
572 """ 586 """
573 if 'BB_PRESERVE_ENV' not in os.environ: 587 if 'BB_PRESERVE_ENV' not in os.environ:
574 if 'BB_ENV_WHITELIST' in os.environ: 588 good_vars = approved_variables()
575 good_vars = os.environ['BB_ENV_WHITELIST'].split()
576 else:
577 good_vars = preserved_envvars()
578 if 'BB_ENV_EXTRAWHITE' in os.environ:
579 good_vars.extend(os.environ['BB_ENV_EXTRAWHITE'].split())
580 filter_environment(good_vars) 589 filter_environment(good_vars)
581 590
582def empty_environment(): 591def empty_environment():