summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/goggle.py
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2012-10-29 13:01:23 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-07 17:25:54 +0000
commit3b9a640f8d19cd50d64ae2722304ace80453149e (patch)
treec62c9a85e3dea9580d1d88b0579594c6e57ac524 /bitbake/lib/bb/ui/goggle.py
parenta2100b9b9d06c88f3791620729f64c39f8443f64 (diff)
downloadpoky-3b9a640f8d19cd50d64ae2722304ace80453149e.tar.gz
bitbake: command: add error to return of runCommand
Currently, command.py can return an error message from runCommand, due to being unable to run the command, yet few of our UIs (just hob) can handle it today. This can result in seeing a TypeError with traceback in certain rare circumstances. To resolve this, we need a clean way to get errors back from runCommand, without having to isinstance() the return value. This implements such a thing by making runCommand also return an error (or None if no error occurred). As runCommand now has a method of returning errors, we can also alter the getCmdLineAction bits such that the returned value is just the action, not an additional message. If a sync command wants to return an error, it raises CommandError(message), and the message will be passed to the caller appropriately. Example Usage: result, error = server.runCommand(...) if error: log.error('Unable to run command: %s' % error) return 1 (Bitbake rev: d1002e33e05d45a7e1bd65d79537419a4057e43a) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/goggle.py')
-rw-r--r--bitbake/lib/bb/ui/goggle.py17
1 files changed, 10 insertions, 7 deletions
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):
80 running_build.connect ("build-failed", running_build_failed_cb) 80 running_build.connect ("build-failed", running_build_failed_cb)
81 81
82 try: 82 try:
83 cmdline = server.runCommand(["getCmdLineAction"]) 83 cmdline, error = server.runCommand(["getCmdLineAction"])
84 if not cmdline: 84 if err:
85 print("Error getting bitbake commandline: %s" % error)
86 return 1
87 elif not cmdline:
85 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") 88 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
86 return 1 89 return 1
87 elif not cmdline['action']: 90 ret, error = server.runCommand(cmdline)
88 print(cmdline['msg']) 91 if error:
92 print("Error running command '%s': %s" % (cmdline, error))
89 return 1 93 return 1
90 ret = server.runCommand(cmdline['action']) 94 elif ret != True:
91 if ret != True: 95 print("Error running command '%s': returned %s" % (cmdline, ret))
92 print("Couldn't get default commandline! %s" % ret)
93 return 1 96 return 1
94 except xmlrpclib.Fault as x: 97 except xmlrpclib.Fault as x:
95 print("XMLRPC Fault getting commandline:\n %s" % x) 98 print("XMLRPC Fault getting commandline:\n %s" % x)