diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/server/process.py | 20 |
2 files changed, 23 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index d6e6919506..1a5e0038b6 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -165,7 +165,7 @@ class BBCooker: | |||
165 | Manages one bitbake build run | 165 | Manages one bitbake build run |
166 | """ | 166 | """ |
167 | 167 | ||
168 | def __init__(self, configuration, featureSet=None): | 168 | def __init__(self, configuration, featureSet=None, readypipe=None): |
169 | self.recipecaches = None | 169 | self.recipecaches = None |
170 | self.skiplist = {} | 170 | self.skiplist = {} |
171 | self.featureset = CookerFeatures() | 171 | self.featureset = CookerFeatures() |
@@ -237,6 +237,10 @@ class BBCooker: | |||
237 | # Let SIGHUP exit as SIGTERM | 237 | # Let SIGHUP exit as SIGTERM |
238 | signal.signal(signal.SIGHUP, self.sigterm_exception) | 238 | signal.signal(signal.SIGHUP, self.sigterm_exception) |
239 | 239 | ||
240 | if readypipe: | ||
241 | os.write(readypipe, b"ready") | ||
242 | os.close(readypipe) | ||
243 | |||
240 | def config_notifications(self, event): | 244 | def config_notifications(self, event): |
241 | if event.maskname == "IN_Q_OVERFLOW": | 245 | if event.maskname == "IN_Q_OVERFLOW": |
242 | bb.warn("inotify event queue overflowed, invalidating caches.") | 246 | bb.warn("inotify event queue overflowed, invalidating caches.") |
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 |