All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] bitbake: server/process: Handle BBHandledException to avoid unexpected exceptions
@ 2019-08-15 11:56 Robert Yang
  2019-08-15 11:56 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Yang @ 2019-08-15 11:56 UTC (permalink / raw)
  To: bitbake-devel

The following changes since commit a3c53bff11671f470b76caa2902642a3be9d086a:

  bitbake: tests/runqueue: Fix tests (2019-08-15 08:43:22 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib rbt/python
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/python

Robert Yang (1):
  bitbake: server/process: Handle BBHandledException to avoid unexpected
    exceptions

 bitbake/lib/bb/server/process.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] bitbake: server/process: Handle BBHandledException to avoid unexpected exceptions
  2019-08-15 11:56 [PATCH 0/1] bitbake: server/process: Handle BBHandledException to avoid unexpected exceptions Robert Yang
@ 2019-08-15 11:56 ` Robert Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Yang @ 2019-08-15 11:56 UTC (permalink / raw)
  To: bitbake-devel

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]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 bitbake/lib/bb/server/process.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index f901fe5..69aae62 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -456,7 +456,10 @@ class BitBakeServer(object):
         self.configuration.setServerRegIdleCallback(server.register_idle_function)
         os.close(self.readypipe)
         writer = ConnectionWriter(self.readypipein)
-        self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
+        try:
+            self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
+        except bb.BBHandledException:
+            return None
         writer.send("r")
         writer.close()
         server.cooker = self.cooker
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-15 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-15 11:56 [PATCH 0/1] bitbake: server/process: Handle BBHandledException to avoid unexpected exceptions Robert Yang
2019-08-15 11:56 ` [PATCH 1/1] " Robert Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.