diff options
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 5 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/depexp.py | 38 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/goggle.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 45 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 21 |
5 files changed, 84 insertions, 42 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py index 52acec1028..21bea236c4 100644 --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py @@ -102,7 +102,10 @@ class HobHandler(gobject.GObject): def runCommand(self, commandline): try: - return self.server.runCommand(commandline) + result, error = self.server.runCommand(commandline) + if error: + raise Exception("Error running command '%s': %s" % (commandline, error)) + return result except Exception as e: self.commands_async = [] self.clear_busy() diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py index b62adbf851..1254128edd 100644 --- a/bitbake/lib/bb/ui/depexp.py +++ b/bitbake/lib/bb/ui/depexp.py @@ -198,17 +198,23 @@ class gtkthread(threading.Thread): def main(server, eventHandler): try: - cmdline = server.runCommand(["getCmdLineAction"]) - if cmdline and not cmdline['action']: - print(cmdline['msg']) - return - elif not cmdline or (cmdline['action'] and cmdline['action'][0] != "generateDotGraph"): + cmdline, error = server.runCommand(["getCmdLineAction"]) + if error: + print("Error getting bitbake commandline: %s" % error) + return 1 + elif not cmdline: + print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") + return 1 + elif not cmdline or cmdline[0] != "generateDotGraph": print("This UI is only compatible with the -g option") - return - ret = server.runCommand(["generateDepTreeEvent", cmdline['action'][1], cmdline['action'][2]]) - if ret != True: - print("Couldn't run command! %s" % ret) - return + return 1 + ret, error = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]]) + if error: + print("Error running command '%s': %s" % (cmdline, error)) + return 1 + elif ret != True: + print("Error running command '%s': returned %s" % (cmdline, ret)) + return 1 except xmlrpclib.Fault as x: print("XMLRPC Fault getting commandline:\n %s" % x) return @@ -229,7 +235,9 @@ def main(server, eventHandler): try: event = eventHandler.waitEvent(0.25) if gtkthread.quit.isSet(): - server.runCommand(["stateStop"]) + _, error = server.runCommand(["stateStop"]) + if error: + print('Unable to cleanly stop: %s' % error) break if event is None: @@ -302,9 +310,13 @@ def main(server, eventHandler): break if shutdown == 1: print("\nSecond Keyboard Interrupt, stopping...\n") - server.runCommand(["stateStop"]) + _, error = server.runCommand(["stateStop"]) + if error: + print('Unable to cleanly stop: %s' % error) if shutdown == 0: print("\nKeyboard Interrupt, closing down...\n") - server.runCommand(["stateShutdown"]) + _, error = server.runCommand(["stateShutdown"]) + if error: + print('Unable to cleanly shutdown: %s' % error) shutdown = shutdown + 1 pass diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py index b2fd2741aa..c0785b7990 100644 --- a/bitbake/lib/bb/ui/goggle.py +++ b/bitbake/lib/bb/ui/goggle.py @@ -80,16 +80,19 @@ def main (server, eventHandler): running_build.connect ("build-failed", running_build_failed_cb) try: - cmdline = server.runCommand(["getCmdLineAction"]) - if not cmdline: + cmdline, error = server.runCommand(["getCmdLineAction"]) + if err: + print("Error getting bitbake commandline: %s" % error) + return 1 + elif not cmdline: print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") return 1 - elif not cmdline['action']: - print(cmdline['msg']) + ret, error = server.runCommand(cmdline) + if error: + print("Error running command '%s': %s" % (cmdline, error)) return 1 - ret = server.runCommand(cmdline['action']) - if ret != True: - print("Couldn't get default commandline! %s" % ret) + elif ret != True: + print("Error running command '%s': returned %s" % (cmdline, ret)) return 1 except xmlrpclib.Fault as x: print("XMLRPC Fault getting commandline:\n %s" % x) diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 01674169ec..439a792800 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -107,9 +107,18 @@ class TerminalFilter(object): def main(server, eventHandler, tf = TerminalFilter): # Get values of variables which control our output - includelogs = server.runCommand(["getVariable", "BBINCLUDELOGS"]) - loglines = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"]) - consolelogfile = server.runCommand(["getVariable", "BB_CONSOLELOG"]) + includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"]) + if error: + logger.error("Unable to get the value of BBINCLUDELOGS variable: %s" % error) + return 1 + loglines, error = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"]) + if error: + logger.error("Unable to get the value of BBINCLUDELOGS_LINES variable: %s" % error) + return 1 + consolelogfile, error = server.runCommand(["getVariable", "BB_CONSOLELOG"]) + if error: + logger.error("Unable to get the value of BB_CONSOLELOG variable: %s" % error) + return 1 helper = uihelper.BBUIHelper() @@ -125,19 +134,22 @@ def main(server, eventHandler, tf = TerminalFilter): logger.addHandler(consolelog) try: - cmdline = server.runCommand(["getCmdLineAction"]) - if not cmdline: + cmdline, error = server.runCommand(["getCmdLineAction"]) + if error: + logger.error("Unable to get bitbake commandline arguments: %s" % error) + return 1 + elif not cmdline: print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") return 1 - elif not cmdline['action']: - print(cmdline['msg']) + ret, error = server.runCommand(cmdline) + if error: + logger.error("Command '%s' failed: %s" % (cmdline, error)) return 1 - ret = server.runCommand(cmdline['action']) - if ret != True: - print("Couldn't get default commandline! %s" % ret) + elif ret != True: + logger.error("Command '%s' failed: returned %s" % (cmdline, ret)) return 1 except xmlrpclib.Fault as x: - print("XMLRPC Fault getting commandline:\n %s" % x) + logger.error("XMLRPC Fault getting commandline:\n %s" % x) return 1 parseprogress = None @@ -318,14 +330,19 @@ def main(server, eventHandler, tf = TerminalFilter): if ioerror.args[0] == 4: pass except KeyboardInterrupt: + import time termfilter.clearFooter() if main.shutdown == 1: print("\nSecond Keyboard Interrupt, stopping...\n") - server.runCommand(["stateStop"]) + _, error = server.runCommand(["stateStop"]) + if error: + logger.error("Unable to cleanly stop: %s" % error) if main.shutdown == 0: - interrupted = True print("\nKeyboard Interrupt, closing down...\n") - server.runCommand(["stateShutdown"]) + interrupted = True + _, error = server.runCommand(["stateShutdown"]) + if error: + logger.error("Unable to cleanly shutdown: %s" % error) main.shutdown = main.shutdown + 1 pass diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 8524446d22..896ed01a78 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py @@ -230,15 +230,18 @@ class NCursesUI: shutdown = 0 try: - cmdline = server.runCommand(["getCmdLineAction"]) + cmdline, error = server.runCommand(["getCmdLineAction"]) if not cmdline: print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") return - elif not cmdline['action']: - print(cmdline['msg']) + elif error: + print("Error getting bitbake commandline: %s" % error) return - ret = server.runCommand(cmdline['action']) - if ret != True: + ret, error = server.runCommand(cmdline) + if error: + print("Error running command '%s': %s" % (cmdline, error)) + return + elif ret != True: print("Couldn't get default commandlind! %s" % ret) return except xmlrpclib.Fault as x: @@ -337,10 +340,14 @@ class NCursesUI: exitflag = True if shutdown == 1: mw.appendText("Second Keyboard Interrupt, stopping...\n") - server.runCommand(["stateStop"]) + _, error = server.runCommand(["stateStop"]) + if error: + print("Unable to cleanly stop: %s" % error) if shutdown == 0: mw.appendText("Keyboard Interrupt, closing down...\n") - server.runCommand(["stateShutdown"]) + _, error = server.runCommand(["stateShutdown"]) + if error: + print("Unable to cleanly shutdown: %s" % error) shutdown = shutdown + 1 pass |