bitbake: cooker.py: Lock/Unlock members function into BBCooker

(Bitbake rev: d66dccf9f9a33bfef5c28cc1c767bfc89faee532)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Leonardo Sandoval
2015-07-07 09:45:59 +00:00
committed by Richard Purdie
parent 4b9fc479b6
commit 7bccf59a24

View File

@@ -151,9 +151,7 @@ class BBCooker:
# Take a lock so only one copy of bitbake can run against a given build
# directory at a time
lockfile = self.data.expand("${TOPDIR}/bitbake.lock")
self.lock = bb.utils.lockfile(lockfile, False, False)
if not self.lock:
if not self.lockBitbake():
bb.fatal("Only one copy of bitbake should be run against a build directory")
try:
self.lock.seek(0)
@@ -1547,6 +1545,19 @@ class BBCooker:
def reset(self):
self.initConfigurationData()
def lockBitbake(self):
if not hasattr(self, 'lock'):
self.lock = None
if self.data:
lockfile = self.data.expand("${TOPDIR}/bitbake.lock")
if lockfile:
self.lock = bb.utils.lockfile(lockfile, False, False)
return self.lock
def unlockBitbake(self):
if hasattr(self, 'lock') and self.lock:
bb.utils.unlockfile(self.lock)
def server_main(cooker, func, *args):
cooker.pre_serve()