diff options
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): | |||
355 | self.featureset = featureset | 355 | self.featureset = featureset |
356 | self.sockname = sockname | 356 | self.sockname = sockname |
357 | self.bitbake_lock = lock | 357 | self.bitbake_lock = lock |
358 | self.readypipe, self.readypipein = os.pipe() | ||
358 | 359 | ||
359 | # Create server control socket | 360 | # Create server control socket |
360 | if os.path.exists(sockname): | 361 | if os.path.exists(sockname): |
@@ -363,6 +364,8 @@ class BitBakeServer(object): | |||
363 | self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | 364 | self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) |
364 | # AF_UNIX has path length issues so chdir here to workaround | 365 | # AF_UNIX has path length issues so chdir here to workaround |
365 | cwd = os.getcwd() | 366 | cwd = os.getcwd() |
367 | logfile = os.path.join(cwd, "bitbake-cookerdaemon.log") | ||
368 | |||
366 | try: | 369 | try: |
367 | os.chdir(os.path.dirname(sockname)) | 370 | os.chdir(os.path.dirname(sockname)) |
368 | self.sock.bind(os.path.basename(sockname)) | 371 | self.sock.bind(os.path.basename(sockname)) |
@@ -371,10 +374,23 @@ class BitBakeServer(object): | |||
371 | self.sock.listen(1) | 374 | self.sock.listen(1) |
372 | 375 | ||
373 | os.set_inheritable(self.sock.fileno(), True) | 376 | os.set_inheritable(self.sock.fileno(), True) |
374 | bb.daemonize.createDaemon(self._startServer, "bitbake-cookerdaemon.log") | 377 | bb.daemonize.createDaemon(self._startServer, logfile) |
375 | self.sock.close() | 378 | self.sock.close() |
376 | self.bitbake_lock.close() | 379 | self.bitbake_lock.close() |
377 | 380 | ||
381 | ready = ConnectionReader(self.readypipe) | ||
382 | r = ready.wait(8) | ||
383 | if not r: | ||
384 | ready.close() | ||
385 | bb.error("Unable to start bitbake server") | ||
386 | if os.path.exists(logfile): | ||
387 | with open(logfile, "r") as f: | ||
388 | logs=f.readlines() | ||
389 | bb.error("Last 10 lines of server log %s:\n%s" % (logfile, "".join(logs[-10:]))) | ||
390 | raise SystemExit(1) | ||
391 | ready.close() | ||
392 | os.close(self.readypipein) | ||
393 | |||
378 | def _startServer(self): | 394 | def _startServer(self): |
379 | server = ProcessServer(self.bitbake_lock, self.sock, self.sockname) | 395 | server = ProcessServer(self.bitbake_lock, self.sock, self.sockname) |
380 | self.configuration.setServerRegIdleCallback(server.register_idle_function) | 396 | self.configuration.setServerRegIdleCallback(server.register_idle_function) |
@@ -385,7 +401,7 @@ class BitBakeServer(object): | |||
385 | if value: | 401 | if value: |
386 | setattr(self.configuration, "%s_server" % param, value) | 402 | setattr(self.configuration, "%s_server" % param, value) |
387 | 403 | ||
388 | self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset) | 404 | self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset, self.readypipein) |
389 | server.cooker = self.cooker | 405 | server.cooker = self.cooker |
390 | server.server_timeout = self.configuration.server_timeout | 406 | server.server_timeout = self.configuration.server_timeout |
391 | server.xmlrpcinterface = self.configuration.xmlrpcinterface | 407 | server.xmlrpcinterface = self.configuration.xmlrpcinterface |