diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2014-01-13 10:01:53 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-11 11:53:39 +0000 |
commit | 1b3e7f0e277615cb63fedc1e5d844b5e1002b9d9 (patch) | |
tree | 80fe38c95285a08b00fcd45f90eceacc7f5e537c /meta/lib | |
parent | 2ead36fabdfda0c472d412af0789be766b64688b (diff) | |
download | poky-1b3e7f0e277615cb63fedc1e5d844b5e1002b9d9.tar.gz |
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>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/package_manager.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 93ca78acb2..f84644c62d 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -27,6 +27,8 @@ class PackageManager(object): | |||
27 | 27 | ||
28 | def __init__(self, d): | 28 | def __init__(self, d): |
29 | self.d = d | 29 | self.d = d |
30 | self.deploy_dir = None | ||
31 | self.deploy_lock = None | ||
30 | 32 | ||
31 | """ | 33 | """ |
32 | Update the package manager package database. | 34 | Update the package manager package database. |
@@ -110,6 +112,21 @@ class PackageManager(object): | |||
110 | 112 | ||
111 | self.install(complementary_pkgs.split(), attempt_only=True) | 113 | self.install(complementary_pkgs.split(), attempt_only=True) |
112 | 114 | ||
115 | def deploy_dir_lock(self): | ||
116 | if self.deploy_dir is None: | ||
117 | raise RuntimeError("deploy_dir is not set!") | ||
118 | |||
119 | lock_file_name = os.path.join(self.deploy_dir, "deploy.lock") | ||
120 | |||
121 | self.deploy_lock = bb.utils.lockfile(lock_file_name) | ||
122 | |||
123 | def deploy_dir_unlock(self): | ||
124 | if self.deploy_lock is None: | ||
125 | return | ||
126 | |||
127 | bb.utils.unlockfile(self.deploy_lock) | ||
128 | |||
129 | self.deploy_lock = None | ||
113 | 130 | ||
114 | class RpmPM(PackageManager): | 131 | class RpmPM(PackageManager): |
115 | def __init__(self): | 132 | def __init__(self): |