summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2019-08-15 19:56:51 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-16 10:05:32 +0100
commit2cb6a75b5ad54fb4224a41a65a4f2bcc902f5b94 (patch)
tree28d6bda43a9989eef2840e3f3b30f1c24fb67c3b /bitbake
parent5f0d31ce4653f7a76a5226fa379a285ceca19d63 (diff)
downloadpoky-2cb6a75b5ad54fb4224a41a65a4f2bcc902f5b94.tar.gz
bitbake: bitbake: server/process: Handle BBHandledException to avoid unexpected exceptions
The parseBaseConfiguration() raises bb.BBHandledException(), but BitBakeServer() didn't handle it, so we always got unexpected exceptions when there were errors. For example: === Case 1: * Add "print "hello"' in base.bbclass' def oe_import() function def oe_import(d): print "hello" [snip] $ bitbake -p ERROR: Unable to start bitbake server (None) ERROR: Last 60 lines of server log for this session (/buildarea1/lyang1/test_hy/bitbake-cookerdaemon.log): File "/buildarea1/lyang1/poky/meta/classes/base.bbclass", line 21 print "hello" ^ SyntaxError: Missing parentheses in call to 'print' <The first exception> During handling of the above exception, another exception occurred: <Tracebacks> <The second exception> During handling of the above exception, another exception occurred: <Tracebacks> <The third exception> During handling of the above exception, another exception occurred: <Tracebacks> [snip] Now it looks like: $ bitbake -p ERROR: Unable to start bitbake server (None) ERROR: Server log for this session (/buildarea1/lyang1/test_hy/bitbake-cookerdaemon.log): ERROR: Error in compiling python function in /buildarea1/lyang1/poky/meta/classes/base.bbclass, line 21: The code lines resulting in this error were: 0001:def oe_import(d): *** 0002: print "hello" 0003: import sys 0004: 0005: bbpath = d.getVar("BBPATH").split(":") 0006: sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath] SyntaxError: Missing parentheses in call to 'print' (base.bbclass, line 21) === Case 2: * Add 'HOSTTOOLS += "hello"' to conf/local.conf: $ bitbake -p ERROR: Unable to start bitbake server (None) ERROR: Server log for this session (/buildarea1/lyang1/test_hy/bitbake-cookerdaemon.log): <Tracebacks> [snip] During handling of the above exception, another exception occurred: [snip] <Tracebacks> ERROR: The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed: hello The error message is printed by bb.fatal() which raises bb.BBHandledException(), but BitBakeServer() doesn't handle it, so we got it. Now it looks like: ERROR: Unable to start bitbake server (None) ERROR: Server log for this session (/buildarea1/lyang1/test_hy/bitbake-cookerdaemon.log): ERROR: The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed: hello No unexpected exceptions anymore. [YOCTO #13267] (Bitbake rev: 6e6865e6371dbd31a136eae64cc5b1fa5f5bee33) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/server/process.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index f901fe505a..69aae626eb 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -456,7 +456,10 @@ class BitBakeServer(object):
456 self.configuration.setServerRegIdleCallback(server.register_idle_function) 456 self.configuration.setServerRegIdleCallback(server.register_idle_function)
457 os.close(self.readypipe) 457 os.close(self.readypipe)
458 writer = ConnectionWriter(self.readypipein) 458 writer = ConnectionWriter(self.readypipein)
459 self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset) 459 try:
460 self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
461 except bb.BBHandledException:
462 return None
460 writer.send("r") 463 writer.send("r")
461 writer.close() 464 writer.close()
462 server.cooker = self.cooker 465 server.cooker = self.cooker