diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-03-11 07:29:17 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-12 22:11:47 +0000 |
commit | 36bf66654a557c570011db0b06f2084ee2ccf9cc (patch) | |
tree | a51485172e169325ff355245663819e47c721f50 /meta/lib/oe | |
parent | 35be67951305950ba797dc2efddbc7d88fc0556a (diff) | |
download | poky-36bf66654a557c570011db0b06f2084ee2ccf9cc.tar.gz |
package_manager.py: Fix race condition in OpkgIndexer.write_index()
When writing the index using ipk packages there could be a race condition
when populate the index. This happens because the architectures
are repeated (specially all) and the commands generated to write the index
run in parallel.
This change avoid the duplication of commands using a set instead of a list.
[YOCTO #8924]
(From OE-Core rev: 74adb14b0002e20099cc2c34e01862e8ddb8e013)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/package_manager.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 607e7c6eaa..919104f107 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -164,8 +164,8 @@ class OpkgIndexer(Indexer): | |||
164 | if not os.path.exists(os.path.join(self.deploy_dir, "Packages")): | 164 | if not os.path.exists(os.path.join(self.deploy_dir, "Packages")): |
165 | open(os.path.join(self.deploy_dir, "Packages"), "w").close() | 165 | open(os.path.join(self.deploy_dir, "Packages"), "w").close() |
166 | 166 | ||
167 | index_cmds = [] | 167 | index_cmds = set() |
168 | index_sign_files = [] | 168 | index_sign_files = set() |
169 | for arch_var in arch_vars: | 169 | for arch_var in arch_vars: |
170 | archs = self.d.getVar(arch_var, True) | 170 | archs = self.d.getVar(arch_var, True) |
171 | if archs is None: | 171 | if archs is None: |
@@ -181,10 +181,10 @@ class OpkgIndexer(Indexer): | |||
181 | if not os.path.exists(pkgs_file): | 181 | if not os.path.exists(pkgs_file): |
182 | open(pkgs_file, "w").close() | 182 | open(pkgs_file, "w").close() |
183 | 183 | ||
184 | index_cmds.append('%s -r %s -p %s -m %s' % | 184 | index_cmds.add('%s -r %s -p %s -m %s' % |
185 | (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir)) | 185 | (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir)) |
186 | 186 | ||
187 | index_sign_files.append(pkgs_file) | 187 | index_sign_files.add(pkgs_file) |
188 | 188 | ||
189 | if len(index_cmds) == 0: | 189 | if len(index_cmds) == 0: |
190 | bb.note("There are no packages in %s!" % self.deploy_dir) | 190 | bb.note("There are no packages in %s!" % self.deploy_dir) |