Commit 75ccaece authored by Arnaud Fontaine's avatar Arnaud Fontaine

TemplateTool: Do not change the resolved depends list when installing bt5s with depends.

Considering erp5_configurator_ung depending on erp5_configurator which in turn
depends on erp5_workflow, if erp5_workflow and erp5_configurator_ung are
specifically added to the list of bt5 installed with depends, then erp5_workflow
ended up being installed *after* erp5_configurator.
parent 31f65011
...@@ -1319,9 +1319,7 @@ class TemplateTool (BaseTool): ...@@ -1319,9 +1319,7 @@ class TemplateTool (BaseTool):
activate_kw = dict(activity="SQLQueue", tag="start_%s" % (time.time())) activate_kw = dict(activity="SQLQueue", tag="start_%s" % (time.time()))
missing_dependency_list.extend([x for x in resolved_template_list if for repository, bt_id in resolved_template_list:
x[1] in template_list])
for repository, bt_id in missing_dependency_list:
bt_url = '%s/%s' % (repository, bt_id) bt_url = '%s/%s' % (repository, bt_id)
param_dict = dict(download_url=bt_url, only_newer=only_newer) param_dict = dict(download_url=bt_url, only_newer=only_newer)
if update_catalog is not _MARKER: if update_catalog is not _MARKER:
......
...@@ -31,6 +31,7 @@ import os ...@@ -31,6 +31,7 @@ import os
import shutil import shutil
import unittest import unittest
import random import random
import transaction
from App.config import getConfiguration from App.config import getConfiguration
from Products.ERP5VCS.WorkingCopy import getVcsTool from Products.ERP5VCS.WorkingCopy import getVcsTool
...@@ -563,8 +564,10 @@ class TestTemplateTool(ERP5TypeTestCase): ...@@ -563,8 +564,10 @@ class TestTemplateTool(ERP5TypeTestCase):
self.assertEquals(bt.getTitle(), bt5_name) self.assertEquals(bt.getTitle(), bt5_name)
def test_installBusinessTemplatesFromRepository_install_dependency(self): def test_installBusinessTemplatesFromRepository_install_dependency(self):
""" Test if update catalog is trigger when needed. """Test if dependencies are automatically installed properly
""" """
# erp5_configurator_{ung,standard} depends on erp5_configurator which in
# turn depends on erp5_workflow
bt5_name_list = ['erp5_configurator_ung', 'erp5_configurator_standard'] bt5_name_list = ['erp5_configurator_ung', 'erp5_configurator_standard']
template_tool = self.portal.portal_templates template_tool = self.portal.portal_templates
for repos in template_tool.getRepositoryList(): for repos in template_tool.getRepositoryList():
...@@ -596,16 +599,33 @@ class TestTemplateTool(ERP5TypeTestCase): ...@@ -596,16 +599,33 @@ class TestTemplateTool(ERP5TypeTestCase):
(repository, bt5_name)) (repository, bt5_name))
self.assertNotEquals(dependency_list, []) self.assertNotEquals(dependency_list, [])
self.tic()
template_tool.installBusinessTemplateListFromRepository( template_tool.installBusinessTemplateListFromRepository(
bt5_name_list, install_dependency=True) bt5_name_list, install_dependency=True)
for bt5_name in bt5_name_list: for bt5_name in bt5_name_list:
bt = template_tool.getInstalledBusinessTemplate(bt5_name) bt = template_tool.getInstalledBusinessTemplate(bt5_name)
self.assertNotEquals(bt, None) self.assertNotEquals(bt, None)
bt = template_tool.getInstalledBusinessTemplate("erp5_configurator")
self.assertNotEquals(bt, None)
bt = template_tool.getInstalledBusinessTemplate("erp5_workflow")
self.assertNotEquals(bt, None)
transaction.abort()
# Same as above but also check that dependencies are properly resolved if
# one of the dependency is explicitly added to the list of bt5 to be
# installed
template_tool.installBusinessTemplateListFromRepository(
bt5_name_list + ['erp5_workflow'],
install_dependency=True)
for bt5_name in bt5_name_list:
bt = template_tool.getInstalledBusinessTemplate(bt5_name)
self.assertNotEquals(bt, None)
bt = template_tool.getInstalledBusinessTemplate("erp5_configurator") bt = template_tool.getInstalledBusinessTemplate("erp5_configurator")
self.assertNotEquals(bt, None) self.assertNotEquals(bt, None)
bt = template_tool.getInstalledBusinessTemplate("erp5_workflow") bt = template_tool.getInstalledBusinessTemplate("erp5_workflow")
self.assertNotEquals(bt, None) self.assertNotEquals(bt, None)
transaction.abort()
def test_sortBusinessTemplateList(self): def test_sortBusinessTemplateList(self):
"""Check sorting of a list of business template by their dependencies """Check sorting of a list of business template by their dependencies
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment