diff --git a/Makefile b/Makefile
index a51f333..5a6645e 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,26 @@ else
endif
endif
+###################
+# Configuration #
+###################
+# generate new config.conf
+.PHONY: config_install
+config_install:
+ ./script/install_locally.sh
+
+# generate config all repo
+.PHONY: config_gen_all
+config_gen_all:
+ ./script/git_repo_update_group.py
+ ./script/install_locally.sh
+
+# generate config repo code_generator
+.PHONY: config_gen_code_generator
+config_gen_code_generator:
+ ./script/git_repo_update_group.py --group base,code_generator
+ ./script/install_locally.sh
+
###################
# Documentation #
###################
diff --git a/doc/DEVELOPMENT.md b/doc/DEVELOPMENT.md
index f4ee5ac..2938b6f 100644
--- a/doc/DEVELOPMENT.md
+++ b/doc/DEVELOPMENT.md
@@ -102,6 +102,19 @@ Check if manifest contains "auto_install" and change the value to False.
./script/repo_remove_auto_install.py
```
+# Execution
+## Config file
+You can limit your addons in ERPlibre config file depending on a group of your actual manifest.
+```bash
+./script/git_repo_update_group.py --group base,code_generator
+./script/install_locally.sh
+```
+Or go back to normal
+```bash
+./script/git_repo_update_group.py
+./script/install_locally.sh
+```
+
# Coding
## Create module scaffold
```bash
diff --git a/manifest/default.dev.xml b/manifest/default.dev.xml
index 13b0544..6aeb033 100644
--- a/manifest/default.dev.xml
+++ b/manifest/default.dev.xml
@@ -58,18 +58,18 @@
-
+
-
+
-
-
+
+
@@ -80,18 +80,18 @@
-
+
-
+
-
-
+
+
-
-
-
+
+
+
@@ -109,7 +109,7 @@
-
+
@@ -133,11 +133,11 @@
-
+
-
+
-
+
@@ -145,9 +145,9 @@
-
+
-
+
diff --git a/script/git_repo_update_group.py b/script/git_repo_update_group.py
new file mode 100755
index 0000000..5c160f5
--- /dev/null
+++ b/script/git_repo_update_group.py
@@ -0,0 +1,50 @@
+#!./.venv/bin/python
+import os
+import sys
+import argparse
+import logging
+from git import Repo
+import git
+
+new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
+sys.path.append(new_path)
+
+from script.git_tool import GitTool
+
+_logger = logging.getLogger(__name__)
+
+
+def get_config():
+ """Parse command line arguments, extracting the config file name,
+ returning the union of config file and command line arguments
+
+ :return: dict of config file settings and command line arguments
+ """
+ config = GitTool.get_project_config()
+
+ # TODO update description
+ parser = argparse.ArgumentParser(
+ formatter_class=argparse.RawDescriptionHelpFormatter,
+ description='''\
+ Update config.conf file with group specified in manifest file.
+''',
+ epilog='''\
+'''
+ )
+ parser.add_argument('--group', default="",
+ help="Prod by default, use 'dev' for manifest/default.dev.xml")
+ args = parser.parse_args()
+ return args
+
+
+def main():
+ config = get_config()
+ git_tool = GitTool()
+
+ filter_group = config.group if config.group else None
+
+ git_tool.generate_install_locally(filter_group=filter_group)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/script/git_tool.py b/script/git_tool.py
index ba50331..327d865 100644
--- a/script/git_tool.py
+++ b/script/git_tool.py
@@ -133,10 +133,10 @@ class GitTool:
return d
def get_repo_info(self, repo_path: str = "./",
- add_root: bool = False, is_manifest: bool = True):
+ add_root: bool = False, is_manifest: bool = True, filter_group=None):
if is_manifest:
return self.get_repo_info_manifest_xml(repo_path=repo_path,
- add_root=add_root)
+ add_root=add_root, filter_group=filter_group)
return self.get_repo_info_submodule(repo_path=repo_path, add_root=add_root)
def get_repo_info_submodule(self, repo_path: str = "./",
@@ -221,11 +221,12 @@ class GitTool:
return lst_repo
def get_repo_info_manifest_xml(self, repo_path: str = "./",
- add_root: bool = False) -> list:
+ add_root: bool = False, filter_group=None) -> list:
"""
Get information about manifest of Repo from repo_path
:param repo_path: path of repo to get information about submodule
:param add_root: add information about root repository
+ :param filter_group: filter manifest by group if exist, separate by comma for multiple group
:return:
[{
"url": original_url,
@@ -236,6 +237,7 @@ class GitTool:
"name": name of the submodule
}]
"""
+ lst_filter_group = filter_group.split(",") if filter_group else []
manifest_file = self.get_manifest_file(repo_path=repo_path)
filename = f"{repo_path}{manifest_file}"
lst_repo = []
@@ -252,6 +254,17 @@ class GitTool:
lst_project = [lst_project]
dct_remote = {a.get("@name"): a.get("@fetch") for a in lst_remote}
for project in lst_project:
+ groups = project.get("@groups")
+ lst_group = groups.split(',') if groups else []
+ # Continue if lst_filter exist and group in filter
+ for group in lst_group:
+ if lst_filter_group and group not in lst_filter_group:
+ continue
+ else:
+ break
+ else:
+ continue
+
# get name and remote .git
path = project.get("@path")
name = path
@@ -268,6 +281,7 @@ class GitTool:
"path": path,
"relative_path": f"{repo_path}/{path}",
"name": name,
+ "group": group,
}
lst_repo.append(data)
@@ -350,9 +364,9 @@ class GitTool:
if url:
webbrowser.open_new_tab(url)
- def generate_install_locally(self, repo_path="./"):
+ def generate_install_locally(self, repo_path="./", filter_group=None):
filename_locally = f"{repo_path}script/install_locally.sh"
- lst_repo = self.get_repo_info(repo_path=repo_path)
+ lst_repo = self.get_repo_info(repo_path=repo_path, filter_group=filter_group)
lst_result = []
for repo in lst_repo:
# Exception, ignore addons/OCA_web and root