summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-24 00:21:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-24 11:19:41 +0100
commit8a60106c6f7d586c793b965c5e9460b6016fab15 (patch)
tree0b00a29e2c6ee5990fbe916a25b8b8e9c0a636bb
parentf45196cf84669723382730944dddc7eaf50826f2 (diff)
downloadbitbake-contrib-8a60106c6f7d586c793b965c5e9460b6016fab15.zip
bitbake-contrib-8a60106c6f7d586c793b965c5e9460b6016fab15.tar.gz
bitbake-contrib-8a60106c6f7d586c793b965c5e9460b6016fab15.tar.bz2
main: Attempt to gain bitbake.lock rather than just waiting
Rather than just waiting for 5s, try and get the lockfile. If we gain the lock, we know we're ready to retry and can skip any remaining timeout. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xlib/bb/main.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bb/main.py b/lib/bb/main.py
index 07972f6..6e6a346 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -446,7 +446,15 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
logger.info("Reconnecting to bitbake server...")
if not os.path.exists(sockname):
print("Previous bitbake instance shutting down?, waiting to retry...")
- time.sleep(5)
+ i = 0
+ lock = None
+ # Wait for 5s or until we can get the lock
+ while not lock and i < 50:
+ time.sleep(0.1)
+ _, lock = lockBitbake()
+ i += 1
+ if lock:
+ bb.utils.unlockfile(lock)
raise bb.server.process.ProcessTimeout("Bitbake still shutting down as socket exists but no lock?")
if not configParams.server_only:
try: