lib/oe/package_manager.py: add deploy dir locking mechanism

This is needed in order to serialize the index file creation when
multiple do_rootfs tasks are running in the same time.

(From OE-Core rev: cb03d15482569c2e56232c921526938dcecfdb68)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Laurentiu Palcu 2014-01-13 10:01:53 +02:00 committed by Richard Purdie
parent 2ead36fabd
commit 1b3e7f0e27
1 changed files with 17 additions and 0 deletions

View File

@ -27,6 +27,8 @@ class PackageManager(object):
def __init__(self, d):
self.d = d
self.deploy_dir = None
self.deploy_lock = None
"""
Update the package manager package database.
@ -110,6 +112,21 @@ class PackageManager(object):
self.install(complementary_pkgs.split(), attempt_only=True)
def deploy_dir_lock(self):
if self.deploy_dir is None:
raise RuntimeError("deploy_dir is not set!")
lock_file_name = os.path.join(self.deploy_dir, "deploy.lock")
self.deploy_lock = bb.utils.lockfile(lock_file_name)
def deploy_dir_unlock(self):
if self.deploy_lock is None:
return
bb.utils.unlockfile(self.deploy_lock)
self.deploy_lock = None
class RpmPM(PackageManager):
def __init__(self):