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

Proposed by Stefan Rijnhart (Opener)
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
Pedro Manuel Baeza code review Approve
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.
Revision history for this message
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)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

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

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

Revision history for this message
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)
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
339 time. Used in the modified OpenUpgrade Server,339 time. Used in the modified OpenUpgrade Server,
340 not to be used in migration scripts340 not to be used in migration scripts
341 """341 """
342 if not module_list:342 dependencies = module_list
343 return module_list343 while dependencies:
344 cr.execute("""344 cr.execute("""
345 SELECT ir_module_module_dependency.name345 SELECT DISTINCT dep.name
346 FROM346 FROM
347 ir_module_module,347 ir_module_module,
348 ir_module_module_dependency348 ir_module_module_dependency dep
349 WHERE349 WHERE
350 module_id = ir_module_module.id350 module_id = ir_module_module.id
351 AND ir_module_module.name in %s351 AND ir_module_module.name in %s
352 """, (tuple(module_list),))352 AND dep.name not in %s
353 dependencies = [x[0] for x in cr.fetchall()]353 """, (tuple(dependencies), tuple(module_list),))
354 return list(set(module_list + dependencies))354 dependencies = [x[0] for x in cr.fetchall()]
355 module_list += dependencies
356 return module_list
355357
356def migrate():358def migrate():
357 """359 """

Subscribers

People subscribed via source and target branches