Merge lp:~therp-nl/openupgrade-server/6.1-include_recursive_deps into lp:openupgrade-server/6.1

Proposed by Stefan Rijnhart (Opener) on 2014-04-30
Status: Merged
Merged at revision: 4007
Proposed branch: lp:~therp-nl/openupgrade-server/6.1-include_recursive_deps
Merge into: lp:openupgrade-server/6.1
Diff against target: 38 lines (+15/-13)
1 file modified
openerp/openupgrade/openupgrade.py (+15/-13)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-server/6.1-include_recursive_deps
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve on 2014-05-05
Pedro Manuel Baeza code review 2014-04-30 Approve on 2014-04-30
Review via email: mp+217753@code.launchpad.net

Description of the change

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.

Other versions here:

https://code.launchpad.net/~therp-nl/openupgrade-server/6.0-include_recursive_deps/+merge/217752
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-include_recursive_deps/+merge/217777

To post a comment you must log in.
Pedro Manuel Baeza (pedro.baeza) wrote :

Same as 6.0, so LGTM.

Regards.

review: Approve (code review)
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/openupgrade/openupgrade.py'
2--- openerp/openupgrade/openupgrade.py 2012-10-17 12:52:44 +0000
3+++ openerp/openupgrade/openupgrade.py 2014-04-30 12:14:31 +0000
4@@ -336,19 +336,21 @@
5 time. Used in the modified OpenUpgrade Server,
6 not to be used in migration scripts
7 """
8- if not module_list:
9- return module_list
10- cr.execute("""
11- SELECT ir_module_module_dependency.name
12- FROM
13- ir_module_module,
14- ir_module_module_dependency
15- WHERE
16- module_id = ir_module_module.id
17- AND ir_module_module.name in %s
18- """, (tuple(module_list),))
19- dependencies = [x[0] for x in cr.fetchall()]
20- return list(set(module_list + dependencies))
21+ dependencies = module_list
22+ while dependencies:
23+ cr.execute("""
24+ SELECT DISTINCT dep.name
25+ FROM
26+ ir_module_module,
27+ ir_module_module_dependency dep
28+ WHERE
29+ module_id = ir_module_module.id
30+ AND ir_module_module.name in %s
31+ AND dep.name not in %s
32+ """, (tuple(dependencies), tuple(module_list),))
33+ dependencies = [x[0] for x in cr.fetchall()]
34+ module_list += dependencies
35+ return module_list
36
37 def migrate():
38 """

Subscribers

People subscribed via source and target branches

to status/vote changes: