lib/oe/package_manager.py: DpkgPM, use lock on deploy dir

Lock deploy directory against concurrent index creation.

(From OE-Core rev: 127d19b84e78b5e650d0e6d7eaf29a8b7d799e5e)

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-28 14:43:14 +02:00 committed by Richard Purdie
parent a150272845
commit ce12c1bf9f
1 changed files with 8 additions and 0 deletions

View File

@ -1086,6 +1086,8 @@ class DpkgPM(PackageManager):
def update(self):
os.environ['APT_CONFIG'] = self.apt_conf_file
self.deploy_dir_lock()
cmd = "%s update" % self.apt_get_cmd
try:
@ -1094,6 +1096,8 @@ class DpkgPM(PackageManager):
bb.fatal("Unable to update the package index files. Command %s "
"returned %d" % (e.cmd, e.returncode))
self.deploy_dir_unlock()
def install(self, pkgs, attempt_only=False):
os.environ['APT_CONFIG'] = self.apt_conf_file
@ -1154,6 +1158,8 @@ class DpkgPM(PackageManager):
dpkg_scanpackages = bb.utils.which(os.getenv('PATH'), "dpkg-scanpackages")
gzip = bb.utils.which(os.getenv('PATH'), "gzip")
self.deploy_dir_lock()
index_cmds = []
deb_dirs_found = False
for arch in arch_list:
@ -1178,6 +1184,8 @@ class DpkgPM(PackageManager):
pool.close()
pool.join()
self.deploy_dir_unlock()
for result in results:
if result is not None:
bb.fatal(result)