diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 48ed0d72e5..5b3710f84f 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -291,17 +291,6 @@ def join_deps(deps): | |||
291 | result.append(dep) | 291 | result.append(dep) |
292 | return ", ".join(result) | 292 | return ", ".join(result) |
293 | 293 | ||
294 | def extend_deps(dest, src): | ||
295 | """ | ||
296 | Extend the results from explode_dep_versions by appending all of the items | ||
297 | in the second list, avoiding duplicates. | ||
298 | """ | ||
299 | for dep in src: | ||
300 | if dep not in dest: | ||
301 | dest[dep] = src[dep] | ||
302 | elif dest[dep] != src[dep]: | ||
303 | dest[dep] = src[dep] | ||
304 | |||
305 | def _print_trace(body, line): | 294 | def _print_trace(body, line): |
306 | """ | 295 | """ |
307 | Print the Environment of a Text Body | 296 | Print the Environment of a Text Body |
@@ -355,16 +344,14 @@ def better_exec(code, context, text, realfile = "<code>"): | |||
355 | if t in [bb.parse.SkipPackage, bb.build.FuncFailed]: | 344 | if t in [bb.parse.SkipPackage, bb.build.FuncFailed]: |
356 | raise | 345 | raise |
357 | 346 | ||
358 | logger.exception("Error executing python function in '%s'", code.co_filename) | 347 | import traceback |
359 | 348 | exception = traceback.format_exception_only(t, value) | |
360 | # print the Header of the Error Message | 349 | logger.error('Error executing a python function in %s:\n%s', |
361 | logger.error("There was an error when executing a python function in: %s" % code.co_filename) | 350 | realfile, ''.join(exception)) |
362 | logger.error("Exception:%s Message:%s" % (t, value)) | ||
363 | 351 | ||
364 | # Strip 'us' from the stack (better_exec call) | 352 | # Strip 'us' from the stack (better_exec call) |
365 | tb = tb.tb_next | 353 | tb = tb.tb_next |
366 | 354 | ||
367 | import traceback | ||
368 | textarray = text.split('\n') | 355 | textarray = text.split('\n') |
369 | linefailed = traceback.tb_lineno(tb) | 356 | linefailed = traceback.tb_lineno(tb) |
370 | 357 | ||
@@ -490,9 +477,9 @@ def sha256_file(filename): | |||
490 | s.update(line) | 477 | s.update(line) |
491 | return s.hexdigest() | 478 | return s.hexdigest() |
492 | 479 | ||
493 | # Variables which are preserved from the original environment *and* exported | 480 | def preserved_envvars_exported(): |
494 | # into our worker context | 481 | """Variables which are taken from the environment and placed in and exported |
495 | def preserved_envvars_export_list(): | 482 | from the metadata""" |
496 | return [ | 483 | return [ |
497 | 'BB_TASKHASH', | 484 | 'BB_TASKHASH', |
498 | 'HOME', | 485 | 'HOME', |
@@ -505,9 +492,9 @@ def preserved_envvars_export_list(): | |||
505 | 'USERNAME', | 492 | 'USERNAME', |
506 | ] | 493 | ] |
507 | 494 | ||
508 | # Variables which are preserved from the original environment *and* exported | 495 | def preserved_envvars_exported_interactive(): |
509 | # into our worker context for interactive tasks (e.g. requiring X) | 496 | """Variables which are taken from the environment and placed in and exported |
510 | def preserved_envvars_export_interactive_list(): | 497 | from the metadata, for interactive tasks""" |
511 | return [ | 498 | return [ |
512 | 'COLORTERM', | 499 | 'COLORTERM', |
513 | 'DBUS_SESSION_BUS_ADDRESS', | 500 | 'DBUS_SESSION_BUS_ADDRESS', |
@@ -525,8 +512,8 @@ def preserved_envvars_export_interactive_list(): | |||
525 | 'XDG_SESSION_COOKIE', | 512 | 'XDG_SESSION_COOKIE', |
526 | ] | 513 | ] |
527 | 514 | ||
528 | # Variables which are preserved from the original environment into the datastore | 515 | def preserved_envvars(): |
529 | def preserved_envvars_list(): | 516 | """Variables which are taken from the environment and placed in the metadata""" |
530 | v = [ | 517 | v = [ |
531 | 'BBPATH', | 518 | 'BBPATH', |
532 | 'BB_PRESERVE_ENV', | 519 | 'BB_PRESERVE_ENV', |
@@ -535,7 +522,7 @@ def preserved_envvars_list(): | |||
535 | 'LANG', | 522 | 'LANG', |
536 | '_', | 523 | '_', |
537 | ] | 524 | ] |
538 | return v + preserved_envvars_export_list() + preserved_envvars_export_interactive_list() | 525 | return v + preserved_envvars_exported() + preserved_envvars_exported_interactive() |
539 | 526 | ||
540 | def filter_environment(good_vars): | 527 | def filter_environment(good_vars): |
541 | """ | 528 | """ |
@@ -557,8 +544,8 @@ def filter_environment(good_vars): | |||
557 | 544 | ||
558 | return removed_vars | 545 | return removed_vars |
559 | 546 | ||
560 | def create_intereactive_env(d): | 547 | def create_interactive_env(d): |
561 | for k in preserved_envvars_export_interactive_list(): | 548 | for k in preserved_envvars_exported_interactive(): |
562 | os.setenv(k, bb.data.getVar(k, d, True)) | 549 | os.setenv(k, bb.data.getVar(k, d, True)) |
563 | 550 | ||
564 | def clean_environment(): | 551 | def clean_environment(): |
@@ -570,7 +557,7 @@ def clean_environment(): | |||
570 | if 'BB_ENV_WHITELIST' in os.environ: | 557 | if 'BB_ENV_WHITELIST' in os.environ: |
571 | good_vars = os.environ['BB_ENV_WHITELIST'].split() | 558 | good_vars = os.environ['BB_ENV_WHITELIST'].split() |
572 | else: | 559 | else: |
573 | good_vars = preserved_envvars_list() | 560 | good_vars = preserved_envvars() |
574 | if 'BB_ENV_EXTRAWHITE' in os.environ: | 561 | if 'BB_ENV_EXTRAWHITE' in os.environ: |
575 | good_vars.extend(os.environ['BB_ENV_EXTRAWHITE'].split()) | 562 | good_vars.extend(os.environ['BB_ENV_EXTRAWHITE'].split()) |
576 | filter_environment(good_vars) | 563 | filter_environment(good_vars) |