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

Proposed by Stefan Rijnhart (Opener) on 2014-04-30
Status: Merged
Merged at revision: 3496
Proposed branch: lp:~therp-nl/openupgrade-server/6.0-include_recursive_deps
Merge into: lp:openupgrade-server/6.0
Diff against target: 38 lines (+15/-13)
1 file modified
bin/openupgrade/openupgrade.py (+15/-13)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-server/6.0-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+217752@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.

6.1 version here: https://code.launchpad.net/~therp-nl/openupgrade-server/6.1-include_recursive_deps/+merge/217753
7.0 version here: 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 :

module_list can be empty?

In that case, sql sentence is correctly executed?

v7 version is not needed?

Regards.

review: Needs Information (code review)

Ah yes, I'll prepare a 7.0 ;-)

If module list is empty, no sql is executed because of the 'while' statement.

Pedro Manuel Baeza (pedro.baeza) wrote :

Yeah, of course!! I didn't catch while condition.

Everything is right then.

Thanks for the improvement.

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 'bin/openupgrade/openupgrade.py'
2--- bin/openupgrade/openupgrade.py 2012-07-19 10:11:57 +0000
3+++ bin/openupgrade/openupgrade.py 2014-04-30 12:13:44 +0000
4@@ -339,19 +339,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