diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 7 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 50 |
2 files changed, 34 insertions, 23 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index fd17edcc58..b50ed0553f 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
@@ -714,6 +714,9 @@ class Tinfoil: | |||
714 | eventmask.extend(extra_events) | 714 | eventmask.extend(extra_events) |
715 | ret = self.set_event_mask(eventmask) | 715 | ret = self.set_event_mask(eventmask) |
716 | 716 | ||
717 | includelogs = self.config_data.getVar('BBINCLUDELOGS') | ||
718 | loglines = self.config_data.getVar('BBINCLUDELOGS_LINES') | ||
719 | |||
717 | ret = self.run_command('buildTargets', targets, task) | 720 | ret = self.run_command('buildTargets', targets, task) |
718 | if handle_events: | 721 | if handle_events: |
719 | result = False | 722 | result = False |
@@ -743,6 +746,10 @@ class Tinfoil: | |||
743 | if event_callback and event_callback(event): | 746 | if event_callback and event_callback(event): |
744 | continue | 747 | continue |
745 | if helper.eventHandler(event): | 748 | if helper.eventHandler(event): |
749 | if isinstance(event, bb.build.TaskFailedSilent): | ||
750 | logger.warning("Logfile for failed setscene task is %s" % event.logfile) | ||
751 | elif isinstance(event, bb.build.TaskFailed): | ||
752 | bb.ui.knotty.print_event_log(event, includelogs, loglines, termfilter) | ||
746 | continue | 753 | continue |
747 | if isinstance(event, bb.event.ProcessStarted): | 754 | if isinstance(event, bb.event.ProcessStarted): |
748 | if self.quiet > 1: | 755 | if self.quiet > 1: |
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 6b0781d8f0..fa88e6ccdd 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -312,6 +312,32 @@ class TerminalFilter(object): | |||
312 | fd = sys.stdin.fileno() | 312 | fd = sys.stdin.fileno() |
313 | self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup) | 313 | self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup) |
314 | 314 | ||
315 | def print_event_log(event, includelogs, loglines, termfilter): | ||
316 | # FIXME refactor this out further | ||
317 | logfile = event.logfile | ||
318 | if logfile and os.path.exists(logfile): | ||
319 | termfilter.clearFooter() | ||
320 | bb.error("Logfile of failure stored in: %s" % logfile) | ||
321 | if includelogs and not event.errprinted: | ||
322 | print("Log data follows:") | ||
323 | f = open(logfile, "r") | ||
324 | lines = [] | ||
325 | while True: | ||
326 | l = f.readline() | ||
327 | if l == '': | ||
328 | break | ||
329 | l = l.rstrip() | ||
330 | if loglines: | ||
331 | lines.append(' | %s' % l) | ||
332 | if len(lines) > int(loglines): | ||
333 | lines.pop(0) | ||
334 | else: | ||
335 | print('| %s' % l) | ||
336 | f.close() | ||
337 | if lines: | ||
338 | for line in lines: | ||
339 | print(line) | ||
340 | |||
315 | def _log_settings_from_server(server, observe_only): | 341 | def _log_settings_from_server(server, observe_only): |
316 | # Get values of variables which control our output | 342 | # Get values of variables which control our output |
317 | includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"]) | 343 | includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"]) |
@@ -489,29 +515,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
489 | continue | 515 | continue |
490 | if isinstance(event, bb.build.TaskFailed): | 516 | if isinstance(event, bb.build.TaskFailed): |
491 | return_value = 1 | 517 | return_value = 1 |
492 | logfile = event.logfile | 518 | print_event_log(event, includelogs, loglines, termfilter) |
493 | if logfile and os.path.exists(logfile): | ||
494 | termfilter.clearFooter() | ||
495 | bb.error("Logfile of failure stored in: %s" % logfile) | ||
496 | if includelogs and not event.errprinted: | ||
497 | print("Log data follows:") | ||
498 | f = open(logfile, "r") | ||
499 | lines = [] | ||
500 | while True: | ||
501 | l = f.readline() | ||
502 | if l == '': | ||
503 | break | ||
504 | l = l.rstrip() | ||
505 | if loglines: | ||
506 | lines.append(' | %s' % l) | ||
507 | if len(lines) > int(loglines): | ||
508 | lines.pop(0) | ||
509 | else: | ||
510 | print('| %s' % l) | ||
511 | f.close() | ||
512 | if lines: | ||
513 | for line in lines: | ||
514 | print(line) | ||
515 | if isinstance(event, bb.build.TaskBase): | 519 | if isinstance(event, bb.build.TaskBase): |
516 | logger.info(event._message) | 520 | logger.info(event._message) |
517 | continue | 521 | continue |