← Back to team overview

credativ team mailing list archive

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

 

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

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

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

OpenUpgrade injects new module dependencies during the upgrade process, to prevent the 'Unmet module dependency' error. I was lazy when adding this method and did not iterate recursively to include the dependencies of the new dependencies. This change fixes that.

6.1 version here: https://code.launchpad.net/~therp-nl/openupgrade-server/6.1-include_recursive_deps
-- 
https://code.launchpad.net/~therp-nl/openupgrade-server/6.0-include_recursive_deps/+merge/217752
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/6.0-include_recursive_deps into lp:openupgrade-server/6.0.
=== modified file 'bin/openupgrade/openupgrade.py'
--- bin/openupgrade/openupgrade.py	2012-07-19 10:11:57 +0000
+++ bin/openupgrade/openupgrade.py	2014-04-30 12:13:44 +0000
@@ -339,19 +339,21 @@
     time. Used in the modified OpenUpgrade Server,
     not to be used in migration scripts
     """
-    if not module_list:
-        return module_list
-    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),))
-    dependencies = [x[0] for x in cr.fetchall()]
-    return list(set(module_list + dependencies))
+    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
+    return module_list
 
 def migrate():
     """