← Back to team overview

credativ team mailing list archive

[Merge] lp:~therp-nl/openupgrade-server/7.0-include_recursive_deps into lp:openupgrade-server

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-server/7.0-include_recursive_deps into lp:openupgrade-server.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-include_recursive_deps/+merge/217777

Same as https://code.launchpad.net/~therp-nl/openupgrade-server/6.0-include_recursive_deps/+merge/217752,
https://code.launchpad.net/~therp-nl/openupgrade-server/6.1-include_recursive_deps/+merge/217753,

except that I'm deduplicating the module list as in 7.0, duplicates can be added in the lines above.
-- 
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-include_recursive_deps/+merge/217777
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/7.0-include_recursive_deps into lp:openupgrade-server.
=== modified file 'openerp/openupgrade/openupgrade_loading.py'
--- openerp/openupgrade/openupgrade_loading.py	2014-03-14 09:04:37 +0000
+++ openerp/openupgrade/openupgrade_loading.py	2014-04-30 15:10:23 +0000
@@ -61,19 +61,22 @@
     for module in list(module_list):
         module_list += forced_deps.get(module, [])
         module_list += autoinstall.get(module, [])
-
-    cr.execute("""
-        SELECT ir_module_module_dependency.name
-        FROM
-            ir_module_module,
-            ir_module_module_dependency
-        WHERE
-            module_id = ir_module_module.id
-            AND ir_module_module.name in %s
-        """, (tuple(module_list),))
-
-    module_list = list(set(
-        module_list + [row[0] for row in cr.fetchall()]))
+    module_list = list(set(module_list))
+
+    dependencies = module_list
+    while dependencies:
+        cr.execute("""
+            SELECT DISTINCT dep.name
+            FROM
+                ir_module_module,
+                ir_module_module_dependency dep
+            WHERE
+                module_id = ir_module_module.id
+                AND ir_module_module.name in %s
+                AND dep.name not in %s
+            """, (tuple(dependencies), tuple(module_list),))
+        dependencies = [x[0] for x in cr.fetchall()]
+        module_list += dependencies
 
     # Select auto_install modules of which all dependencies
     # are fulfilled based on the modules we know are to be


References