diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 9537239b03..4f01cc10c6 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -138,6 +138,13 @@ class BBCooker: if not self.configuration.cmd: self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build" + # 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())