Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
87bcd6d9
Commit
87bcd6d9
authored
Sep 06, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Add recursive migration of BT while updating layers
parent
1c634bbb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+79
-0
No files found.
product/ERP5/Tool/TemplateTool.py
View file @
87bcd6d9
...
...
@@ -827,6 +827,85 @@ class TemplateTool (BaseTool):
# XXX: Add layer=1 and sign=1 for default for all paths
template_path_list
=
[
l
+
' | 1 | 1'
for
l
in
template_path_list
]
def
reduceDependencyList
(
bt
,
template_path_list
):
"""
Used for recursive udpation of layer for dependency in a BT
"""
dependency_list
=
bt
.
getDependencyList
()
if
not
dependency_list
:
return
template_path_list
else
:
# Copy of the initial template list to be used to update the layer
new_template_path_list
=
list
(
template_path_list
)
for
item
in
dependency_list
:
dependency
=
item
.
split
(
' '
,
1
)
if
len
(
dependency
)
>
1
:
version
=
dependency
[
1
]
if
version
:
version
=
version
[
1
:
-
1
]
base_bt
=
self
.
getLastestBTOnRepos
(
dependency
[
0
],
version
)
else
:
try
:
base_bt
=
self
.
getLastestBTOnRepos
(
dependency
[
0
])
except
BusinessTemplateIsMeta
:
bt_list
=
self
.
getProviderList
(
dependency
[
0
])
# We explicilty use the Business Template which is used the most
# while dealing with provision list
repository_list
=
self
.
getRepositoryList
()
if
dependency
[
0
]
==
'erp5_full_text_catalog'
:
base_bt
=
[
repository_list
[
1
],
'erp5_full_text_mroonga_catalog'
]
if
dependency
[
0
]
==
'erp5_view_style'
:
base_bt
=
[
repository_list
[
0
],
'erp5_xhtml_style'
]
if
dependency
[
0
]
==
'erp5_catalog'
:
base_bt
=
[
repository_list
[
0
],
'erp5_mysql_innodb_catalog'
]
# XXX: Create path for the BT(s) here
# Download the base_bt
base_bt_path
=
os
.
path
.
join
(
base_bt
[
0
],
base_bt
[
1
])
base_bt
=
self
.
download
(
base_bt_path
)
# Check for the item list and if the BT is Business Manager,
# if BM, then compare and update layer and if not run migration and
# then do it again
if
base_bt
.
getPortalType
()
==
'Business Manager'
:
# Check for item path which also exists in base_bt
base_path_list
=
base_bt
.
getPathList
()
copy_of_template_path_list
=
new_template_path_list
[:]
# Loop through all the paths in the new_template_path_list and
# check for their existence in base_path_list
for
idx
,
path
in
enumerate
(
new_template_path_list
):
path_list
=
path
.
split
(
' | '
)
item_path
=
path_list
[
0
]
item_layer
=
path_list
[
2
]
if
item_path
in
base_path_list
:
# TODO: Increase the layer of the path item by +1 and save it
# back at updated_template_path_list
item_layer
=
int
(
item_layer
)
+
1
updated_path
=
item_path
+
' | 1 | '
+
str
(
item_layer
)
copy_of_template_path_list
[
idx
]
=
updated_path
new_template_path_list
=
copy_of_template_path_list
if
base_bt
.
getPortalType
()
!=
'Business Manager'
:
# Recursively reduce the base Business Templatem no need to do
# this for Business Manager(s) as it had already been migrated
# with taking care of layer
reduceDependencyList
(
base_bt
,
new_template_path_list
)
# If the base_bt is not Business Manager, run the migration on the
# base_bt
else
:
# XXX: Just calling migrateBTToBM here won't do anything, we need
# to remove the BT from path and then update it with the migrated
# one
base_bt
=
self
.
migrateBTToBM
(
base_bt_path
)
return
new_template_path_list
# Take care about the the dependency_list also and then update the layer
# accordingly for the path(s) that already exists in the dependencies.
template_path_list
=
reduceDependencyList
(
import_template
,
template_path_list
)
# Create new sub-objects instead based on template_path_list
for
path
in
template_path_list
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment