From 7bccf59a24cf2a2ddd6ebc3eb8e1a0f58d55513d Mon Sep 17 00:00:00 2001 From: Leonardo Sandoval Date: Tue, 7 Jul 2015 09:45:59 +0000 Subject: bitbake: cooker.py: Lock/Unlock members function into BBCooker (Bitbake rev: d66dccf9f9a33bfef5c28cc1c767bfc89faee532) Signed-off-by: Leonardo Sandoval Signed-off-by: Richard Purdie --- bitbake/lib/bb/cooker.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/bb/cooker.py') diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 72ae8b09c7..58137f6d62 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -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() -- cgit v1.2.3-54-g00ecf