summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/build.py')
-rw-r--r--bitbake/lib/bb/build.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 23b6ee455f..aaada8a18b 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -27,6 +27,9 @@ from bb import data, event, utils
27bblogger = logging.getLogger('BitBake') 27bblogger = logging.getLogger('BitBake')
28logger = logging.getLogger('BitBake.Build') 28logger = logging.getLogger('BitBake.Build')
29 29
30verboseShellLogging = False
31verboseStdoutLogging = False
32
30__mtime_cache = {} 33__mtime_cache = {}
31 34
32def cached_mtime_noerror(f): 35def cached_mtime_noerror(f):
@@ -290,8 +293,8 @@ def exec_func_python(func, d, runfile, cwd=None):
290 lineno = int(d.getVarFlag(func, "lineno", False)) 293 lineno = int(d.getVarFlag(func, "lineno", False))
291 bb.methodpool.insert_method(func, text, fn, lineno - 1) 294 bb.methodpool.insert_method(func, text, fn, lineno - 1)
292 295
293 comp = utils.better_compile(code, func, "exec_python_func() autogenerated") 296 comp = utils.better_compile(code, func, "exec_func_python() autogenerated")
294 utils.better_exec(comp, {"d": d}, code, "exec_python_func() autogenerated") 297 utils.better_exec(comp, {"d": d}, code, "exec_func_python() autogenerated")
295 finally: 298 finally:
296 bb.debug(2, "Python function %s finished" % func) 299 bb.debug(2, "Python function %s finished" % func)
297 300
@@ -371,7 +374,7 @@ def exec_func_shell(func, d, runfile, cwd=None):
371 374
372 bb.data.emit_func(func, script, d) 375 bb.data.emit_func(func, script, d)
373 376
374 if bb.msg.loggerVerboseLogs: 377 if verboseShellLogging or bb.utils.to_boolean(d.getVar("BB_VERBOSE_LOGS", False)):
375 script.write("set -x\n") 378 script.write("set -x\n")
376 if cwd: 379 if cwd:
377 script.write("cd '%s'\n" % cwd) 380 script.write("cd '%s'\n" % cwd)
@@ -391,7 +394,7 @@ exit $ret
391 if fakerootcmd: 394 if fakerootcmd:
392 cmd = [fakerootcmd, runfile] 395 cmd = [fakerootcmd, runfile]
393 396
394 if bb.msg.loggerDefaultVerbose: 397 if verboseStdoutLogging:
395 logfile = LogTee(logger, StdoutNoopContextManager()) 398 logfile = LogTee(logger, StdoutNoopContextManager())
396 else: 399 else:
397 logfile = StdoutNoopContextManager() 400 logfile = StdoutNoopContextManager()
@@ -587,11 +590,15 @@ def _exec_task(fn, task, d, quieterr):
587 except bb.BBHandledException: 590 except bb.BBHandledException:
588 event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata) 591 event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata)
589 return 1 592 return 1
590 except Exception as exc: 593 except (Exception, SystemExit) as exc:
591 if quieterr: 594 if quieterr:
592 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata) 595 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
593 else: 596 else:
594 errprinted = errchk.triggered 597 errprinted = errchk.triggered
598 # If the output is already on stdout, we've printed the information in the
599 # logs once already so don't duplicate
600 if verboseStdoutLogging:
601 errprinted = True
595 logger.error(str(exc)) 602 logger.error(str(exc))
596 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata) 603 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata)
597 return 1 604 return 1
@@ -901,6 +908,8 @@ def tasksbetween(task_start, task_end, d):
901 def follow_chain(task, endtask, chain=None): 908 def follow_chain(task, endtask, chain=None):
902 if not chain: 909 if not chain:
903 chain = [] 910 chain = []
911 if task in chain:
912 bb.fatal("Circular task dependencies as %s depends on itself via the chain %s" % (task, " -> ".join(chain)))
904 chain.append(task) 913 chain.append(task)
905 for othertask in tasks: 914 for othertask in tasks:
906 if othertask == task: 915 if othertask == task: