diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 5419af6246..f468fafc12 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -465,13 +465,25 @@ def sha256_file(filename): | |||
465 | s.update(line) | 465 | s.update(line) |
466 | return s.hexdigest() | 466 | return s.hexdigest() |
467 | 467 | ||
468 | def preserved_envvars_list(): | 468 | # Variables which are preserved from the original environment *and* exported |
469 | # into our worker context | ||
470 | def preserved_envvars_export_list(): | ||
469 | return [ | 471 | return [ |
470 | 'BBPATH', | ||
471 | 'BB_PRESERVE_ENV', | ||
472 | 'BB_ENV_WHITELIST', | ||
473 | 'BB_ENV_EXTRAWHITE', | ||
474 | 'BB_TASKHASH', | 472 | 'BB_TASKHASH', |
473 | 'HOME', | ||
474 | 'LOGNAME', | ||
475 | 'PATH', | ||
476 | 'PWD', | ||
477 | 'SHELL', | ||
478 | 'TERM', | ||
479 | 'USER', | ||
480 | 'USERNAME', | ||
481 | ] | ||
482 | |||
483 | # Variables which are preserved from the original environment *and* exported | ||
484 | # into our worker context for interactive tasks (e.g. requiring X) | ||
485 | def preserved_envvars_export_interactive_list(): | ||
486 | return [ | ||
475 | 'COLORTERM', | 487 | 'COLORTERM', |
476 | 'DBUS_SESSION_BUS_ADDRESS', | 488 | 'DBUS_SESSION_BUS_ADDRESS', |
477 | 'DESKTOP_SESSION', | 489 | 'DESKTOP_SESSION', |
@@ -481,23 +493,25 @@ def preserved_envvars_list(): | |||
481 | 'GNOME_KEYRING_SOCKET', | 493 | 'GNOME_KEYRING_SOCKET', |
482 | 'GPG_AGENT_INFO', | 494 | 'GPG_AGENT_INFO', |
483 | 'GTK_RC_FILES', | 495 | 'GTK_RC_FILES', |
484 | 'HOME', | ||
485 | 'LANG', | ||
486 | 'LOGNAME', | ||
487 | 'PATH', | ||
488 | 'PWD', | ||
489 | 'SESSION_MANAGER', | 496 | 'SESSION_MANAGER', |
490 | 'SHELL', | ||
491 | 'SSH_AUTH_SOCK', | 497 | 'SSH_AUTH_SOCK', |
492 | 'TERM', | ||
493 | 'USER', | ||
494 | 'USERNAME', | ||
495 | '_', | ||
496 | 'XAUTHORITY', | 498 | 'XAUTHORITY', |
497 | 'XDG_DATA_DIRS', | 499 | 'XDG_DATA_DIRS', |
498 | 'XDG_SESSION_COOKIE', | 500 | 'XDG_SESSION_COOKIE', |
499 | ] | 501 | ] |
500 | 502 | ||
503 | # Variables which are preserved from the original environment into the datastore | ||
504 | def preserved_envvars_list(): | ||
505 | v = [ | ||
506 | 'BBPATH', | ||
507 | 'BB_PRESERVE_ENV', | ||
508 | 'BB_ENV_WHITELIST', | ||
509 | 'BB_ENV_EXTRAWHITE', | ||
510 | 'LANG', | ||
511 | '_', | ||
512 | ] | ||
513 | return v + preserved_envvars_export_list() + preserved_envvars_export_interactive_list() | ||
514 | |||
501 | def filter_environment(good_vars): | 515 | def filter_environment(good_vars): |
502 | """ | 516 | """ |
503 | Create a pristine environment for bitbake. This will remove variables that | 517 | Create a pristine environment for bitbake. This will remove variables that |
@@ -518,6 +532,10 @@ def filter_environment(good_vars): | |||
518 | 532 | ||
519 | return removed_vars | 533 | return removed_vars |
520 | 534 | ||
535 | def create_intereactive_env(d): | ||
536 | for k in preserved_envvars_export_interactive_list(): | ||
537 | os.setenv(k, bb.data.getVar(k, d, True)) | ||
538 | |||
521 | def clean_environment(): | 539 | def clean_environment(): |
522 | """ | 540 | """ |
523 | Clean up any spurious environment variables. This will remove any | 541 | Clean up any spurious environment variables. This will remove any |