diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-01-13 17:01:49 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-15 10:05:19 +0000 |
commit | b9746b7e4d7aa5c34eba15a61427bfc6949af123 (patch) | |
tree | f57f042d1ff09a34383ad9b54921769cf5fbfe51 /lib/bb/build.py | |
parent | 50aea9a76e40cf71cc3f1462c88298e4846a031c (diff) | |
download | bitbake-b9746b7e4d7aa5c34eba15a61427bfc6949af123.tar.gz |
bitbake/knotty: avoid printing full task log when error already printed
If a task has logged an ERROR then don't print the contents of the
task's log file in knotty (the default terminal UI).
As a side-effect we now also respect BBINCLUDELOGS in knotty; if it is
false we never print the log (but the pointer to the log file is always
printed).
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/build.py')
-rw-r--r-- | lib/bb/build.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py index 39f075d41..e85d7c4f3 100644 --- a/lib/bb/build.py +++ b/lib/bb/build.py @@ -91,8 +91,9 @@ class TaskSucceeded(TaskBase): class TaskFailed(TaskBase): """Task execution failed""" - def __init__(self, task, logfile, metadata): + def __init__(self, task, logfile, metadata, errprinted = False): self.logfile = logfile + self.errprinted = errprinted super(TaskFailed, self).__init__(task, metadata) class TaskInvalid(TaskBase): @@ -288,6 +289,13 @@ def _exec_task(fn, task, d, quieterr): prefuncs = localdata.getVarFlag(task, 'prefuncs', expand=True) postfuncs = localdata.getVarFlag(task, 'postfuncs', expand=True) + class ErrorCheckHandler(logging.Handler): + def __init__(self): + self.triggered = False + logging.Handler.__init__(self, logging.ERROR) + def emit(self, record): + self.triggered = True + # Handle logfiles si = file('/dev/null', 'r') try: @@ -313,6 +321,9 @@ def _exec_task(fn, task, d, quieterr): handler.setLevel(logging.DEBUG - 2) bblogger.addHandler(handler) + errchk = ErrorCheckHandler() + bblogger.addHandler(errchk) + localdata.setVar('BB_LOGFILE', logfn) event.fire(TaskStarted(task, localdata), localdata) @@ -324,8 +335,9 @@ def _exec_task(fn, task, d, quieterr): exec_func(func, localdata) except FuncFailed as exc: if not quieterr: + errprinted = errchk.triggered logger.error(str(exc)) - event.fire(TaskFailed(task, logfn, localdata), localdata) + event.fire(TaskFailed(task, logfn, localdata, errprinted), localdata) return 1 finally: sys.stdout.flush() @@ -368,7 +380,7 @@ def exec_task(fn, task, d): if not quieterr: logger.error("Build of %s failed" % (task)) logger.error(format_exc()) - failedevent = TaskFailed(task, None, d) + failedevent = TaskFailed(task, None, d, True) event.fire(failedevent, d) return 1 |