Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] cooker.py: Ensure only one copy of bitbake executes at once
Date: Tue, 08 Nov 2011 17:52:44 +0000	[thread overview]
Message-ID: <1320774764.10843.96.camel@ted> (raw)

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())




                 reply	other threads:[~2011-11-08 17:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320774764.10843.96.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox