summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-01-13 17:01:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-15 10:06:22 +0000
commiteb6291b36fd9206aec0476852042a18113039317 (patch)
tree9622c21183d5c34ee1aaed441d544dbc051606e1 /bitbake
parentecdfc1ebbe260fc7b2842b751d913580d294cb42 (diff)
downloadast2050-yocto-poky-eb6291b36fd9206aec0476852042a18113039317.zip
ast2050-yocto-poky-eb6291b36fd9206aec0476852042a18113039317.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). (Bitbake rev: b9746b7e4d7aa5c34eba15a61427bfc6949af123) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/build.py18
-rw-r--r--bitbake/lib/bb/ui/knotty.py2
2 files changed, 16 insertions, 4 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 30e5497..1e041a2 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/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):
@@ -286,6 +287,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:
@@ -311,6 +319,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)
@@ -322,8 +333,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()
@@ -366,7 +378,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
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 5366386..205a8d8 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -142,7 +142,7 @@ def main(server, eventHandler):
logfile = event.logfile
if logfile and os.path.exists(logfile):
print("ERROR: Logfile of failure stored in: %s" % logfile)
- if 1 or includelogs:
+ if includelogs and not event.errprinted:
print("Log data follows:")
f = open(logfile, "r")
lines = []
OpenPOWER on IntegriCloud