diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/event.py | 9 | ||||
-rw-r--r-- | lib/bb/ui/crumbs/runningbuild.py | 15 | ||||
-rw-r--r-- | lib/bb/ui/knotty.py | 19 | ||||
-rw-r--r-- | lib/bb/ui/ncurses.py | 2 |
4 files changed, 45 insertions, 0 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py index 7ee28fcfc..deb1c2159 100644 --- a/lib/bb/event.py +++ b/lib/bb/event.py @@ -510,6 +510,15 @@ class MsgFatal(MsgBase): class MsgPlain(MsgBase): """General output""" +class LogExecTTY(Event): + """Send event containing program to spawn on tty of the logger""" + def __init__(self, msg, prog, sleep_delay, retries): + Event.__init__(self) + self.msg = msg + self.prog = prog + self.sleep_delay = sleep_delay + self.retries = retries + class LogHandler(logging.Handler): """Dispatch logging messages as bitbake events""" diff --git a/lib/bb/ui/crumbs/runningbuild.py b/lib/bb/ui/crumbs/runningbuild.py index a57d6db5e..700fd6501 100644 --- a/lib/bb/ui/crumbs/runningbuild.py +++ b/lib/bb/ui/crumbs/runningbuild.py @@ -375,6 +375,21 @@ class RunningBuild (gobject.GObject): msg += ("%s\n" % reason) self.emit("no-provider", msg) self.emit("log", msg) + elif isinstance(event, bb.event.LogExecTTY): + icon = "dialog-warning" + color = HobColors.WARNING + if self.sequential or not parent: + tree_add = self.model.append + else: + tree_add = self.model.prepend + tree_add(parent, + (None, + package, + task, + event.msg, + icon, + color, + 0)) else: if not isinstance(event, (bb.event.BuildBase, bb.event.StampUpdate, diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index 858cacfe5..d81ad5d54 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -27,6 +27,7 @@ import logging import progressbar import signal import bb.msg +import time import fcntl import struct import copy @@ -216,6 +217,10 @@ def main(server, eventHandler, tf = TerminalFilter): includelogs = server.runCommand(["getVariable", "BBINCLUDELOGS"]) loglines = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"]) consolelogfile = server.runCommand(["getVariable", "BB_CONSOLELOG"]) + if sys.stdin.isatty() and sys.stdout.isatty(): + log_exec_tty = True + else: + log_exec_tty = False helper = uihelper.BBUIHelper() @@ -271,6 +276,20 @@ def main(server, eventHandler, tf = TerminalFilter): if not main.shutdown: main.shutdown = 1 + if isinstance(event, bb.event.LogExecTTY): + if log_exec_tty: + tries = event.retries + while tries: + print "Trying to run: %s" % event.prog + if os.system(event.prog) == 0: + break + time.sleep(event.sleep_delay) + tries -= 1 + if tries: + continue + logger.warn(event.msg) + continue + if isinstance(event, logging.LogRecord): if event.levelno >= format.ERROR: errors = errors + 1 diff --git a/lib/bb/ui/ncurses.py b/lib/bb/ui/ncurses.py index f573b9557..f6ea7f9bc 100644 --- a/lib/bb/ui/ncurses.py +++ b/lib/bb/ui/ncurses.py @@ -318,6 +318,8 @@ class NCursesUI: if isinstance(event, bb.cooker.CookerExit): exitflag = True + if isinstance(event, bb.event.LogExecTTY): + mw.appendText('WARN: ' + event.msg + '\n') if helper.needUpdate: activetasks, failedtasks = helper.getTasks() taw.erase() |