|
@@ -217,9 +217,19 @@ 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
|
|
|
+
|
|
|
if sys.stdin.isatty() and sys.stdout.isatty():
|
|
|
log_exec_tty = True
|
|
|
else:
|
|
@@ -240,19 +250,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
|
|
@@ -447,14 +460,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
|
|
|
|