All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cooker.py: Ensure only one copy of bitbake executes at once
@ 2011-11-08 17:52 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2011-11-08 17:52 UTC (permalink / raw)
  To: bitbake-devel

The bitbake codebase makes assumptions that only one copy is active
against a given build directory at a given time. This patch adds a
lockfile in TOPDIR to ensure that is the case.

Note that no unlock is needed, that is automatically dropped when
execution terminates.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 546a92c..ee8323e 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -135,6 +135,13 @@ class BBCooker:
         self.configuration.data = None
         self.loadConfigurationData()
 
+        # Take a lock so only one copy of bitbake can run against a given build
+        # directory at a time
+        lockfile = bb.data.expand("${TOPDIR}/bitbake.lock", self.configuration.data)
+        self.lock = bb.utils.lockfile(lockfile, False, False)
+        if not self.lock:
+            bb.fatal("Only one copy of bitbake should be run against a build directory")
+
         bbpkgs = bb.data.getVar('BBPKGS', self.configuration.data, True)
         if bbpkgs and len(self.configuration.pkgs_to_build) == 0:
             self.configuration.pkgs_to_build.extend(bbpkgs.split())




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-08 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 17:52 [PATCH] cooker.py: Ensure only one copy of bitbake executes at once Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.