[oe-commits] [openembedded-core] 09/22: package_manager.py: Fix race condition in OpkgIndexer.write_index()

git at git.openembedded.org git at git.openembedded.org
Sat Mar 12 09:19:31 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit eadfc9edaa29a540f63612b566b86d71811e57f4
Author: Mariano Lopez <mariano.lopez at linux.intel.com>
AuthorDate: Fri Mar 11 07:29:17 2016 +0000

    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]
    
    Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oe/package_manager.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 607e7c6..919104f 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -164,8 +164,8 @@ class OpkgIndexer(Indexer):
         if not os.path.exists(os.path.join(self.deploy_dir, "Packages")):
             open(os.path.join(self.deploy_dir, "Packages"), "w").close()
 
-        index_cmds = []
-        index_sign_files = []
+        index_cmds = set()
+        index_sign_files = set()
         for arch_var in arch_vars:
             archs = self.d.getVar(arch_var, True)
             if archs is None:
@@ -181,10 +181,10 @@ class OpkgIndexer(Indexer):
                 if not os.path.exists(pkgs_file):
                     open(pkgs_file, "w").close()
 
-                index_cmds.append('%s -r %s -p %s -m %s' %
+                index_cmds.add('%s -r %s -p %s -m %s' %
                                   (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir))
 
-                index_sign_files.append(pkgs_file)
+                index_sign_files.add(pkgs_file)
 
         if len(index_cmds) == 0:
             bb.note("There are no packages in %s!" % self.deploy_dir)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list