diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-28 15:40:02 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-30 08:43:36 +0100 |
commit | b2c39835bb61687220abbef72e4f69a272cf8afb (patch) | |
tree | 991e25807b5baee65a54386bfcfadcc6c09d69cb /bitbake/lib/bb/server/process.py | |
parent | dd3a59d3546b900dae92ab3b3eccca5a215ddf61 (diff) | |
download | openembedded-core-contrib-b2c39835bb61687220abbef72e4f69a272cf8afb.tar.gz |
bitbake: process/cooker: Allow UI process to know if the cooker was started successfully
Currently if the server fails to start, the user sees no error message and
the server will be repeatedly attempted to be started until some longer
timeouts expire. There are error messages in the cookerdeamon log but
nobody thinks to look there.
Add in a pipe which can be used to tell the starting process whether the cooker
did actually start or not. If it fails to start, no further attempts can be
made and if present, the log file can be shown to the user.
[YOCTO #11834]
(Bitbake rev: 57000d44beb1aeba37dfc70782b0d6418943acc5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index fb96804e68..6106c07380 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py @@ -355,6 +355,7 @@ class BitBakeServer(object): self.featureset = featureset self.sockname = sockname self.bitbake_lock = lock + self.readypipe, self.readypipein = os.pipe() # Create server control socket if os.path.exists(sockname): @@ -363,6 +364,8 @@ class BitBakeServer(object): self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) # AF_UNIX has path length issues so chdir here to workaround cwd = os.getcwd() + logfile = os.path.join(cwd, "bitbake-cookerdaemon.log") + try: os.chdir(os.path.dirname(sockname)) self.sock.bind(os.path.basename(sockname)) @@ -371,10 +374,23 @@ class BitBakeServer(object): self.sock.listen(1) os.set_inheritable(self.sock.fileno(), True) - bb.daemonize.createDaemon(self._startServer, "bitbake-cookerdaemon.log") + bb.daemonize.createDaemon(self._startServer, logfile) self.sock.close() self.bitbake_lock.close() + ready = ConnectionReader(self.readypipe) + r = ready.wait(8) + if not r: + ready.close() + bb.error("Unable to start bitbake server") + if os.path.exists(logfile): + with open(logfile, "r") as f: + logs=f.readlines() + bb.error("Last 10 lines of server log %s:\n%s" % (logfile, "".join(logs[-10:]))) + raise SystemExit(1) + ready.close() + os.close(self.readypipein) + def _startServer(self): server = ProcessServer(self.bitbake_lock, self.sock, self.sockname) self.configuration.setServerRegIdleCallback(server.register_idle_function) @@ -385,7 +401,7 @@ class BitBakeServer(object): if value: setattr(self.configuration, "%s_server" % param, value) - self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset) + self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset, self.readypipein) server.cooker = self.cooker server.server_timeout = self.configuration.server_timeout server.xmlrpcinterface = self.configuration.xmlrpcinterface |