summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2015-07-07 09:45:59 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-09 18:00:21 +0100
commit7bccf59a24cf2a2ddd6ebc3eb8e1a0f58d55513d (patch)
treed5f208e390c0775667b728f97cb78d171f641a9e /bitbake/lib/bb/cooker.py
parent4b9fc479b6a68e6a3fb7cd9da6bdc9c4a786e4d3 (diff)
downloadpoky-7bccf59a24cf2a2ddd6ebc3eb8e1a0f58d55513d.tar.gz
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>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py17
1 files changed, 14 insertions, 3 deletions
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:
151 151
152 # Take a lock so only one copy of bitbake can run against a given build 152 # Take a lock so only one copy of bitbake can run against a given build
153 # directory at a time 153 # directory at a time
154 lockfile = self.data.expand("${TOPDIR}/bitbake.lock") 154 if not self.lockBitbake():
155 self.lock = bb.utils.lockfile(lockfile, False, False)
156 if not self.lock:
157 bb.fatal("Only one copy of bitbake should be run against a build directory") 155 bb.fatal("Only one copy of bitbake should be run against a build directory")
158 try: 156 try:
159 self.lock.seek(0) 157 self.lock.seek(0)
@@ -1547,6 +1545,19 @@ class BBCooker:
1547 def reset(self): 1545 def reset(self):
1548 self.initConfigurationData() 1546 self.initConfigurationData()
1549 1547
1548 def lockBitbake(self):
1549 if not hasattr(self, 'lock'):
1550 self.lock = None
1551 if self.data:
1552 lockfile = self.data.expand("${TOPDIR}/bitbake.lock")
1553 if lockfile:
1554 self.lock = bb.utils.lockfile(lockfile, False, False)
1555 return self.lock
1556
1557 def unlockBitbake(self):
1558 if hasattr(self, 'lock') and self.lock:
1559 bb.utils.unlockfile(self.lock)
1560
1550def server_main(cooker, func, *args): 1561def server_main(cooker, func, *args):
1551 cooker.pre_serve() 1562 cooker.pre_serve()
1552 1563