From 62787c041b08844bcb15b6e30ff1fcff8515597a Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 30 Jun 2021 22:26:20 -0400 Subject: [PATCH 01/13] [UPD] docker: move script in ./script/docker - Fix make docker_exec_erplibre --- Makefile | 6 +++--- doc/RELEASE.md | 2 +- docker/README.md | 4 ++-- script/{ => docker}/docker_build.sh | 0 script/docker/docker_exec.sh | 6 ++++++ script/{ => docker}/docker_update_version.py | 0 6 files changed, 12 insertions(+), 6 deletions(-) rename script/{ => docker}/docker_build.sh (100%) create mode 100755 script/docker/docker_exec.sh rename script/{ => docker}/docker_update_version.py (100%) diff --git a/Makefile b/Makefile index 44dcce4..afd5e07 100644 --- a/Makefile +++ b/Makefile @@ -305,17 +305,17 @@ docker_show_process: .PHONY: docker_exec_erplibre docker_exec_erplibre: - docker exec -u root -ti erplibre_ERPLibre_1 bash + ./script/docker/docker_exec.sh # build docker .PHONY: docker_build docker_build: - ./script/docker_build.sh + ./script/docker/docker_build.sh # build docker release .PHONY: docker_build_release docker_build_release: - ./script/docker_build.sh --release + ./script/docker/docker_build.sh --release # docker clean all .PHONY: docker_clean_all diff --git a/doc/RELEASE.md b/doc/RELEASE.md index 9fef491..ff283f3 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -77,7 +77,7 @@ git push --tags Important to generate container after push git tags, otherwise the git version will be wrong. When building your docker with script -> ./script/docker_build.sh --release +> make docker_build_release List your docker version > docker images diff --git a/docker/README.md b/docker/README.md index f5bc314..8b78e64 100644 --- a/docker/README.md +++ b/docker/README.md @@ -114,10 +114,10 @@ And restart docker service. You can delete or move all older locations of docker # Update docker When building your docker with script -> ./script/docker_build.sh +> make docker_build List your docker version -> docker image +> docker images You need to push your docker image and update your tag, like 1.0.1: > docker push technolibre/erplibre:VERSION diff --git a/script/docker_build.sh b/script/docker/docker_build.sh similarity index 100% rename from script/docker_build.sh rename to script/docker/docker_build.sh diff --git a/script/docker/docker_exec.sh b/script/docker/docker_exec.sh new file mode 100755 index 0000000..31e027e --- /dev/null +++ b/script/docker/docker_exec.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +CURRENT=$(pwd) +BASENAME=$(basename "${CURRENT}") + +docker exec -u root -ti ${BASENAME}_ERPLibre_1 bash diff --git a/script/docker_update_version.py b/script/docker/docker_update_version.py similarity index 100% rename from script/docker_update_version.py rename to script/docker/docker_update_version.py From 85ba1fc6644821edab75c5104fecd3daa4ee0e7b Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 30 Jun 2021 22:26:42 -0400 Subject: [PATCH 02/13] [UPD] changelog add geospatial featured --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50fd137..d247c93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve git repo usage, filter repo by use case #### Makefile + - Format code - Code generator test - Addons installation @@ -25,8 +26,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Docker execution #### Code generator + - Code generator for Odoo module, depending of ERPLibre -- Support map geoengine +- Support map geospatial - Support i18n - Script to transform Python and XML to Python code writer script to regenerate themselves @@ -45,6 +47,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Ubuntu installation - Poetry installation +- Geospatial with postgis can be installed ## [1.1.1] - 2020-12-11 From 511c722bbc2f9fcc5a0fe24a5ff00dd2b594e49b Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 1 Jul 2021 00:52:15 -0400 Subject: [PATCH 03/13] [ADD] support make docker test and gen config - fix running test in docker - use odoo user in docker - Makefile add repo_show_status - docker repo show status - Support older git version 2.20 --- Makefile | 17 ++++++ run.sh | 17 ++++-- .../install_and_test_code_generator.sh | 10 +++- script/db_restore.py | 53 +++++++++++++++---- script/docker/docker_gen_config.sh | 9 ++++ script/docker/docker_make_test.sh | 9 ++++ script/docker/docker_repo_show_status.sh | 9 ++++ 7 files changed, 108 insertions(+), 16 deletions(-) create mode 100755 script/docker/docker_gen_config.sh create mode 100755 script/docker/docker_make_test.sh create mode 100755 script/docker/docker_repo_show_status.sh diff --git a/Makefile b/Makefile index afd5e07..d99e354 100644 --- a/Makefile +++ b/Makefile @@ -307,6 +307,18 @@ docker_show_process: docker_exec_erplibre: ./script/docker/docker_exec.sh +.PHONY: docker_exec_erplibre_gen_config +docker_exec_erplibre_gen_config: + ./script/docker/docker_gen_config.sh + +.PHONY: docker_exec_erplibre_make_test +docker_exec_erplibre_make_test: + ./script/docker/docker_make_test.sh + +.PHONY: docker_exec_erplibre_repo_show_status +docker_exec_erplibre_repo_show_status: + ./script/docker/docker_repo_show_status.sh + # build docker .PHONY: docker_build docker_build: @@ -340,6 +352,11 @@ repo_configure_all: repo_configure_group_code_generator: ./script/update_manifest_local_dev_code_generator.sh +# configure only group code_generator +.PHONY: repo_show_status +repo_show_status: + ./.venv/repo forall -pc "git status -s" + # change all repo to ssh on all remote .PHONY: repo_use_all_ssh repo_use_all_ssh: diff --git a/run.sh b/run.sh index 67d8bb3..1659f04 100755 --- a/run.sh +++ b/run.sh @@ -1,8 +1,19 @@ #!/usr/bin/env bash source ./.venv/bin/activate -python3 ./odoo/odoo-bin -c ./config.conf --limit-time-real 99999 --limit-time-cpu 99999 $@ + +CONFIG_PATH="./config.conf" +ORIGIN_CONFIG_PATH=CONFIG_PATH +if [ ! -f "${CONFIG_PATH}" ]; then + CONFIG_PATH="/etc/odoo/odoo.conf" + if [ ! -f "${CONFIG_PATH}" ]; then + echo "Cannot find ERPLibre configuration ${ORIGIN_CONFIG_PATH}, did you install ERPLibre? > make install" + exit 1 + fi +fi + +python3 ./odoo/odoo-bin -c ${CONFIG_PATH} --limit-time-real 99999 --limit-time-cpu 99999 $@ retVal=$? if [[ $retVal -ne 0 ]]; then - echo "Error run.sh" - exit 1 + echo "Error run.sh" + exit 1 fi diff --git a/script/code_generator/install_and_test_code_generator.sh b/script/code_generator/install_and_test_code_generator.sh index 58f66bb..c6e71fc 100755 --- a/script/code_generator/install_and_test_code_generator.sh +++ b/script/code_generator/install_and_test_code_generator.sh @@ -12,8 +12,14 @@ fi ./script/repo_revert_git_diff_date_from_code_generator.py # Remove pot and po diff cd $3 -BRANCH=$(git branch --show-current) -git restore --source="${BRANCH}" "*.po*" +# git 2.22 and more, else use next command +#BRANCH=$(git branch --show-current) +BRANCH=$(git rev-parse --abbrev-ref HEAD) + +# Support old version git < 2.23.0 +# git restore --source="${BRANCH}" "*.po*" +git checkout -- "*.po*" + cd - ./script/maintenance/black.sh $3 echo "TEST ${2}" diff --git a/script/db_restore.py b/script/db_restore.py index bb49972..91dfa71 100755 --- a/script/db_restore.py +++ b/script/db_restore.py @@ -3,6 +3,8 @@ import os import sys import argparse import logging +import configparser +import getpass from subprocess import check_output new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) @@ -49,11 +51,46 @@ def get_config(): return args +def get_master_password(): + try: + # _logger.info("You have 5 secondes to add master password...") + pa = getpass.getpass( + prompt="\nEnter master password... " + ) + return pa + except getpass.GetPassWarning: + _logger.error("Password echoed, danger!") + + def main(): config = get_config() + arg_base = "./.venv/bin/python3 ./odoo/odoo-bin db" + + # check if need master password from config file + has_config_file = True + config_path = "./config.py" + if not os.path.isfile(config_path): + config_path = "/etc/odoo/odoo.conf" + if not os.path.isfile(config_path): + has_config_file = False + if has_config_file: + config_parser = configparser.ConfigParser() + config_parser.read(config_path) + + has_admin_password = config_parser.get("options", "admin_passwd") + if has_admin_password: + master_password = get_master_password() + if not master_password: + _logger.error("Missing master password, cancel transaction.") + sys.exit(1) + else: + arg_base += f" --master_password={master_password}" + else: + _logger.info("No master password needed... Continue") + # Get list of database - arg = "./.venv/bin/python3 ./odoo/odoo-bin db --list" + arg = f"{arg_base} --list" out = check_output(arg.split(" ")).decode() lst_db = out.strip().split("\n") lst_db_cache = [a for a in lst_db if a.startswith("_cache_")] @@ -61,10 +98,7 @@ def main(): if config.clean_cache: for db in lst_db_cache: _logger.info(f"## Delete {db} ##") - arg = ( - "./.venv/bin/python3 ./odoo/odoo-bin db --drop --database" - f" {db}" - ) + arg = f"{arg_base} --drop --database {db}" out = check_output(arg.split(" ")).decode() print(out) @@ -73,10 +107,7 @@ def main(): # Drop db if config.database in lst_db: _logger.info(f"## Drop {config.database} ##") - arg = ( - "./.venv/bin/python3 ./odoo/odoo-bin db --drop --database" - f" {config.database}" - ) + arg = f"{arg_base} --drop --database {config.database}" out = check_output(arg.split(" ")).decode() print(out) # Check cache exist @@ -86,7 +117,7 @@ def main(): f" {config.image} ##" ) arg = ( - "./.venv/bin/python3 ./odoo/odoo-bin db --restore" + f"{arg_base} --restore" f" --restore_image {config.image} --database {cache_database}" ) out = check_output(arg.split(" ")).decode() @@ -96,7 +127,7 @@ def main(): f"## Clone cache {cache_database} to database {config.database} ##" ) arg = ( - "./.venv/bin/python3 ./odoo/odoo-bin db --clone --from_database" + f"{arg_base} --clone --from_database" f" {cache_database} --database {config.database}" ) out = check_output(arg.split(" ")).decode() diff --git a/script/docker/docker_gen_config.sh b/script/docker/docker_gen_config.sh new file mode 100755 index 0000000..4bba8f4 --- /dev/null +++ b/script/docker/docker_gen_config.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +CURRENT=$(pwd) +BASENAME=$(basename "${CURRENT}") + +docker exec -u root -ti ${BASENAME}_ERPLibre_1 /bin/bash -c "\ +cd /ERPLibre; \ +./docker/repo_manifest_gen_org_prefix_path.py /ERPLibre/addons /etc/odoo/odoo.conf /etc/odoo/odoo.conf; \ +" diff --git a/script/docker/docker_make_test.sh b/script/docker/docker_make_test.sh new file mode 100755 index 0000000..06805dd --- /dev/null +++ b/script/docker/docker_make_test.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +CURRENT=$(pwd) +BASENAME=$(basename "${CURRENT}") + +docker exec -u root -ti ${BASENAME}_ERPLibre_1 /bin/bash -c "\ +cd /ERPLibre; \ +time make test; \ +" diff --git a/script/docker/docker_repo_show_status.sh b/script/docker/docker_repo_show_status.sh new file mode 100755 index 0000000..a5951bf --- /dev/null +++ b/script/docker/docker_repo_show_status.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +CURRENT=$(pwd) +BASENAME=$(basename "${CURRENT}") + +docker exec -u root -ti ${BASENAME}_ERPLibre_1 /bin/bash -c "\ +cd /ERPLibre; \ +./.venv/repo forall -pc 'git status -s'; \ +" From 4782f4f77a54504b258990a3226f87a06c4e812b Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 1 Jul 2021 03:18:56 -0400 Subject: [PATCH 04/13] [ADD] script repo forall diff last version and stat - Add erplibre status for docker repo show status --- Makefile | 12 +++++++++++- doc/RELEASE.md | 8 ++++++++ script/docker/docker_repo_show_status.sh | 1 + script/repo_diff_last_version.sh | 7 +++++++ script/repo_diff_stat_last_version.sh | 7 +++++++ 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 script/repo_diff_last_version.sh create mode 100755 script/repo_diff_stat_last_version.sh diff --git a/Makefile b/Makefile index d99e354..30bc7d8 100644 --- a/Makefile +++ b/Makefile @@ -352,11 +352,21 @@ repo_configure_all: repo_configure_group_code_generator: ./script/update_manifest_local_dev_code_generator.sh -# configure only group code_generator +# Show git status for all repo .PHONY: repo_show_status repo_show_status: ./.venv/repo forall -pc "git status -s" +# Show git diff for all repo from last tag version release +.PHONY: repo_diff_from_last_version +repo_diff_from_last_version: + ./script/repo_diff_last_version.sh + +# Show git diff statistique for all repo from last tag version release +.PHONY: repo_diff_stat_from_last_version +repo_diff_stat_from_last_version: + ./script/repo_diff_stat_last_version.sh + # change all repo to ssh on all remote .PHONY: repo_use_all_ssh repo_use_all_ssh: diff --git a/doc/RELEASE.md b/doc/RELEASE.md index ff283f3..48a624b 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -49,6 +49,14 @@ git diff v#.#.#..HEAD ./.venv/repo forall -pc "git diff ERPLibre/v#.#.#..HEAD" ``` +Simplification tools: +```bash +# Short version with statistique +make repo_diff_stat_from_last_version +# Long version +make repo_diff_from_last_version +``` + Update file [CHANGELOG.md](../CHANGELOG.md) and create a section with new version, use next command to read all changes. Create a branch release/#.#.# and create a pull request to branch master with your commit: diff --git a/script/docker/docker_repo_show_status.sh b/script/docker/docker_repo_show_status.sh index a5951bf..ba55bb5 100755 --- a/script/docker/docker_repo_show_status.sh +++ b/script/docker/docker_repo_show_status.sh @@ -6,4 +6,5 @@ BASENAME=$(basename "${CURRENT}") docker exec -u root -ti ${BASENAME}_ERPLibre_1 /bin/bash -c "\ cd /ERPLibre; \ ./.venv/repo forall -pc 'git status -s'; \ +git status -s; \ " diff --git a/script/repo_diff_last_version.sh b/script/repo_diff_last_version.sh new file mode 100755 index 0000000..6a13911 --- /dev/null +++ b/script/repo_diff_last_version.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) +./.venv/repo forall -pc "git diff ERPLibre/${LAST_TAG}..HEAD" + +# For actual repo +git diff ${LAST_TAG}..HEAD diff --git a/script/repo_diff_stat_last_version.sh b/script/repo_diff_stat_last_version.sh new file mode 100755 index 0000000..1ffac71 --- /dev/null +++ b/script/repo_diff_stat_last_version.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) +./.venv/repo forall -pc "git diff --stat ERPLibre/${LAST_TAG}..HEAD" + +# For actual repo +git diff --stat ${LAST_TAG}..HEAD From 11e07fddf3f5ad2a1ab746f1a55f936dfe40d347 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 1 Jul 2021 03:19:29 -0400 Subject: [PATCH 05/13] [UPD] add return line in bash script --- script/docker/docker_repo_show_status.sh | 1 + script/repo_diff_stat_last_version.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/script/docker/docker_repo_show_status.sh b/script/docker/docker_repo_show_status.sh index ba55bb5..db38b97 100755 --- a/script/docker/docker_repo_show_status.sh +++ b/script/docker/docker_repo_show_status.sh @@ -6,5 +6,6 @@ BASENAME=$(basename "${CURRENT}") docker exec -u root -ti ${BASENAME}_ERPLibre_1 /bin/bash -c "\ cd /ERPLibre; \ ./.venv/repo forall -pc 'git status -s'; \ +echo ''; \ git status -s; \ " diff --git a/script/repo_diff_stat_last_version.sh b/script/repo_diff_stat_last_version.sh index 1ffac71..1dac192 100755 --- a/script/repo_diff_stat_last_version.sh +++ b/script/repo_diff_stat_last_version.sh @@ -3,5 +3,7 @@ LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) ./.venv/repo forall -pc "git diff --stat ERPLibre/${LAST_TAG}..HEAD" +echo "" + # For actual repo git diff --stat ${LAST_TAG}..HEAD From 7d704b7910cc56035c26d17adcfe64e8d0792adb Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 1 Jul 2021 03:37:25 -0400 Subject: [PATCH 06/13] [UPD] changelog with migration note - release note propose to update image_db --- CHANGELOG.md | 24 ++++++++++++++++++++++++ Makefile | 3 +++ doc/RELEASE.md | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d247c93..5e7bc54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +**Migration note** + +Because addons repository has change, config file need to be updated. +- When upgrading to version 1.2.0: + - From docker + - Run script `make docker_exec_erplibre_gen_config` + - Restart the docker `make docker_restart_daemon` + - From vanilla + - Run script `make install_dev` + - Restart your daemon + - Regenerate master password manually + ### Added - Adapt script to give an execution status @@ -15,6 +27,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Script to check git diff and ignore date - Repo with ERPLibre image - Improve git repo usage, filter repo by use case +- ERPLibre theme website of TechnoLibre +- ERPLibre website snippet + - Basic HTML snippets + - Snippet card + - Snippet timelines +- Module contract_digitized_signature with contract_portal +- Module disable auto_backup +- Odoo cli db command to manipulate restoration db +- Odoo cli i18n command to generate i18n pot files #### Makefile @@ -36,6 +57,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Update Python dependency with Poetry - Format all Python code with black +- Module auto_backup with sftp host key +- Module muk_website_branding use ERPLibre branding +- Update docs with vscode support, custom document layout, custom email template and trick to use params to share variable #### Docker diff --git a/Makefile b/Makefile index 30bc7d8..ab31ac7 100644 --- a/Makefile +++ b/Makefile @@ -295,6 +295,9 @@ docker_run_daemon: docker_stop: docker-compose down +.PHONY: docker_restart_daemon +docker_restart_daemon: docker_stop docker_run_daemon + .PHONY: docker_show_logs_live docker_show_logs_live: docker-compose logs -f diff --git a/doc/RELEASE.md b/doc/RELEASE.md index 48a624b..c90b98f 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -18,6 +18,10 @@ And update all from dev to merge into prod. ./script/install_locally_dev.sh ``` +## Update image_db + +Change all default image to improve speed when restoring database. Recreate it manually. Check directory `./image_db`. + ## Generate new prod and release Generate production manifest and freeze all repos versions. From 1bf8d7da9f36e78dc455abb88e66ee27dff344de Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 16 Jul 2021 00:13:05 -0400 Subject: [PATCH 07/13] [UPD] add repo_diff_manifest_production in documentation release.md - add bold color in bash - add default manifest - fix print color --- Makefile | 5 ++ doc/RELEASE.md | 2 + poetry.lock | 4 +- requirements.txt | 1 + script/db_restore.py | 4 +- script/git_show_code_diff_repo_manifest.py | 75 ++++++++++++++++++---- script/repo_diff_stat_last_version.sh | 4 ++ 7 files changed, 79 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index ab31ac7..65bbc35 100644 --- a/Makefile +++ b/Makefile @@ -360,6 +360,11 @@ repo_configure_group_code_generator: repo_show_status: ./.venv/repo forall -pc "git status -s" +# Show divergence between actual repository and production manifest +.PHONY: repo_diff_manifest_production +repo_diff_manifest_production: + ./script/git_show_code_diff_repo_manifest.py + # Show git diff for all repo from last tag version release .PHONY: repo_diff_from_last_version repo_diff_from_last_version: diff --git a/doc/RELEASE.md b/doc/RELEASE.md index c90b98f..06f8ac5 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -55,6 +55,8 @@ git diff v#.#.#..HEAD Simplification tools: ```bash +# Show all divergence repository with production +make repo_diff_manifest_production # Short version with statistique make repo_diff_stat_from_last_version # Long version diff --git a/poetry.lock b/poetry.lock index 982ad3a..503360f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -191,6 +191,7 @@ uvloop = ["uvloop (>=0.15.2)"] reference = "93c10bf9ebccf8d7cc686b0b9579f2e5e41c5328" type = "git" url = "https://github.com/psf/black.git" + [[package]] category = "main" description = "Interactive plots and applications in the browser from Python" @@ -1774,6 +1775,7 @@ whichcraft = "*" reference = "455ac91d2d6d651bf67ec8eae7dae516f11b1dec" type = "git" url = "https://github.com/oca/pylint-odoo.git" + [[package]] category = "main" description = "Utilities and helpers for writing Pylint plugins" @@ -2970,7 +2972,7 @@ python-versions = "*" version = "4.4.28" [metadata] -content-hash = "8f717dd4d3138e704720a02bc6ca7efb301108825e0cfc0dcd16c2a8d3822b6c" +content-hash = "8de9276db75ff5d36eae0441c17e9c88134de99323ae57b2c09d8ded790012af" lock-version = "1.0" python-versions = "^3.7.7" diff --git a/requirements.txt b/requirements.txt index f847d19..63daa43 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,7 @@ retrying xmltodict openupgradelib unidiff +colorama # For OSX cython diff --git a/script/db_restore.py b/script/db_restore.py index 91dfa71..35f5885 100755 --- a/script/db_restore.py +++ b/script/db_restore.py @@ -54,9 +54,7 @@ def get_config(): def get_master_password(): try: # _logger.info("You have 5 secondes to add master password...") - pa = getpass.getpass( - prompt="\nEnter master password... " - ) + pa = getpass.getpass(prompt="\nEnter master password... ") return pa except getpass.GetPassWarning: _logger.error("Password echoed, danger!") diff --git a/script/git_show_code_diff_repo_manifest.py b/script/git_show_code_diff_repo_manifest.py index 429c186..62edd8a 100755 --- a/script/git_show_code_diff_repo_manifest.py +++ b/script/git_show_code_diff_repo_manifest.py @@ -4,7 +4,10 @@ import sys import argparse import logging from git import Repo -from git.exc import GitCommandError +from git.exc import GitCommandError, NoSuchPathError +from colorama import Fore +from colorama import Style +from collections import defaultdict new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) sys.path.append(new_path) @@ -30,7 +33,7 @@ def get_config(): parser.add_argument( "-m", "--manifest", - required=True, + default="./default.xml", help="The manifest to compare with actual code.", ) args = parser.parse_args() @@ -47,6 +50,7 @@ def main(): default_branch_name = default_remote.get( "@revision", git_tool.default_branch ) + dct_result = defaultdict(int) i = 0 total = len(dct_project) for name, project in dct_project.items(): @@ -54,12 +58,18 @@ def main(): path = project.get("@path") print(f"{i}/{total} - {path}") branch_name = project.get("@revision", default_branch_name) - organization = project.get("@remote") - if not organization: - print(f"ERROR missing @remote on project {path}.") + organization = project.get("@remote", git_tool.default_project_name) + + try: + git_repo = Repo(path) + except NoSuchPathError: + print( + f"{Fore.YELLOW}Warning{Style.RESET_ALL} missing project" + f" {path}." + ) + dct_result["WARNING"] += 1 continue - git_repo = Repo(path) value = git_repo.git.branch("--show-current") if not value: # TODO maybe need to check divergence with local branch and not remote branch @@ -69,19 +79,60 @@ def main(): f"{organization}/{branch_name}" ) except GitCommandError: - print("ERROR Something wrong with this repo.") + # Cannot get information + if branch_name == commit_head: + print( + f"{Fore.GREEN}PASS{Style.RESET_ALL} Not on specified" + " branch, no divergence" + ) + dct_result["PASS"] += 1 + else: + print( + f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision" + f" is {branch_name} and commit {commit_head}." + ) + dct_result["ERROR"] += 1 continue if commit_branch != commit_head: - print("WARNING Not on specified branch, got a divergence.") + print( + f"{Fore.YELLOW}WARNING{Style.RESET_ALL} Not on specified" + " branch, got a divergence." + ) + dct_result["WARNING"] += 1 else: - print("PASS Not on specified branch, no divergence.") + print( + f"{Fore.GREEN}PASS{Style.RESET_ALL} Not on specified" + " branch, no divergence" + ) + dct_result["PASS"] += 1 elif branch_name != value: print( - f"ERROR, manifest revision is {branch_name} and actual" - f" revision is {value}." + f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision is" + f" {branch_name} and actual revision is {value}." ) + dct_result["ERROR"] += 1 else: - print("PASS") + print(f"{Fore.GREEN}PASS{Style.RESET_ALL}") + dct_result["PASS"] += 1 + + str_result = "" + if dct_result["PASS"]: + str_result += ( + f"{Fore.GREEN}PASS: {dct_result['PASS']}{Style.RESET_ALL}" + ) + if dct_result["WARNING"]: + if str_result: + str_result += " " + str_result += ( + f"{Fore.YELLOW}WARNING: {dct_result['WARNING']}{Style.RESET_ALL}" + ) + if dct_result["ERROR"]: + if str_result: + str_result += " " + str_result += ( + f"{Fore.RED}ERROR: {dct_result['ERROR']}{Style.RESET_ALL}" + ) + print(str_result) if __name__ == "__main__": diff --git a/script/repo_diff_stat_last_version.sh b/script/repo_diff_stat_last_version.sh index 1dac192..40ebae1 100755 --- a/script/repo_diff_stat_last_version.sh +++ b/script/repo_diff_stat_last_version.sh @@ -1,9 +1,13 @@ #!/usr/bin/env bash +Color_Off='\033[0m' # Text Reset +BOLD='\033[1m' # Black + LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) ./.venv/repo forall -pc "git diff --stat ERPLibre/${LAST_TAG}..HEAD" echo "" +echo -e "${BOLD}project /${Color_Off}" # For actual repo git diff --stat ${LAST_TAG}..HEAD From b4ca6161047700486764e325a927d6c723b4a80e Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 16 Jul 2021 00:56:30 -0400 Subject: [PATCH 08/13] [ADD] script: tag push all - git can push all tags with different organization from manifest - Add documentation git repo before clean all repo manifest --- Makefile | 7 +++++ doc/DEVELOPMENT.md | 6 ++++ doc/GIT_REPO.md | 12 ++++++++ doc/RELEASE.md | 2 +- script/tag_push_all.py | 70 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100755 script/tag_push_all.py diff --git a/Makefile b/Makefile index 65bbc35..dbbb61c 100644 --- a/Makefile +++ b/Makefile @@ -241,6 +241,13 @@ test_code_generator_code_i18n_extra: # To support i18n in auto_backup ./script/code_generator/check_git_change_code_generator.sh ./addons/OCA_server-tools/auto_backup +############## +# tag # +############## +.PHONY: tag_push_all +tag_push_all: + ./script/tag_push_all.py + ############## # terminal # ############## diff --git a/doc/DEVELOPMENT.md b/doc/DEVELOPMENT.md index fcc92e3..74c07fc 100644 --- a/doc/DEVELOPMENT.md +++ b/doc/DEVELOPMENT.md @@ -66,6 +66,12 @@ Tools to display the differences between the repo and another project. ./script/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync ``` +## Showing repo differences with manifest develop +To understand the divergence with the dev manifest. +```bash +./script/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml +``` + ## Sync repo with another project Tools to synchronise the repo with another project. This will show differences and try to checkout on the same commit in all repos. ```bash diff --git a/doc/GIT_REPO.md b/doc/GIT_REPO.md index 23d9660..05e9254 100644 --- a/doc/GIT_REPO.md +++ b/doc/GIT_REPO.md @@ -82,6 +82,18 @@ git commit -am "[#ticket] subject: short sentence" ``` ### Clean all +Before, check changed file in all repos. + +```bash +./.venv/repo forall -pc "git status -s" +``` + +Check the changed branch, and push changed if needed. + +```bash +./script/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml +``` + Maybe, some version diverge from your manifest. Simply clean all and relaunch your installation. ```bash ./script/clean_repo_manifest.sh diff --git a/doc/RELEASE.md b/doc/RELEASE.md index 06f8ac5..e912ce9 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -83,7 +83,7 @@ git tag v#.#.# git push --tags # Add tags for all repo ./.venv/repo forall -pc "git tag ERPLibre/v#.#.#" -./.venv/repo forall -pc "git push ERPLibre --tags" +make tag_push_all ``` ## Generate and push docker diff --git a/script/tag_push_all.py b/script/tag_push_all.py new file mode 100755 index 0000000..ed24d6e --- /dev/null +++ b/script/tag_push_all.py @@ -0,0 +1,70 @@ +#!./.venv/bin/python +import os +import sys +import argparse +import logging +from git import Repo # pip install gitpython +from retrying import retry # pip install retrying +from colorama import Fore +from colorama import Style + +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 + """ + # TODO update description + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description="""Push all addons git.""", + epilog="""\ +""", + ) + parser.add_argument( + "-m", + "--manifest", + default="./default.xml", + help="The manifest to compare with actual code.", + ) + args = parser.parse_args() + return args + + +def main(): + config = get_config() + git_tool = GitTool() + + dct_remote, dct_project, default_remote = git_tool.get_manifest_xml_info( + filename=config.manifest, add_root=True + ) + i = 0 + total = len(dct_project) + for name, project in dct_project.items(): + i += 1 + path = project.get("@path") + print(f"{i}/{total} - {path}") + organization = project.get("@remote", git_tool.default_project_name) + + try: + git_repo = Repo(path) + retry(wait_exponential_multiplier=1000, stop_max_delay=15000)( + git_repo.git.push + )(organization, "--tags") + except: + print( + f"{Fore.RED}ERROR{Style.RESET_ALL} cannot push --tags for path" + f" {path} organization {organization}" + ) + + +if __name__ == "__main__": + main() From f91b62d3d7366ae4eda55a2b9f9da57be4e1bd6a Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 16 Jul 2021 04:32:17 -0400 Subject: [PATCH 09/13] [FIX] script db_restore: force exit when clean cache database --- Makefile | 4 ++++ script/db_restore.py | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dbbb61c..7dbc913 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,10 @@ db_drop_db_code_generator: db_drop_db_template: ./.venv/bin/python3 ./odoo/odoo-bin db --drop --database template +.PHONY: db_clean_cache +db_clean_cache: + ./script/db_restore.py --clean_cache + .PHONY: db_restore_erplibre_base_db_test db_restore_erplibre_base_db_test: ./script/db_restore.py --database test diff --git a/script/db_restore.py b/script/db_restore.py index 35f5885..e688410 100755 --- a/script/db_restore.py +++ b/script/db_restore.py @@ -60,6 +60,14 @@ def get_master_password(): _logger.error("Password echoed, danger!") +def get_list_db_cache(arg_base): + arg = f"{arg_base} --list" + out = check_output(arg.split(" ")).decode() + lst_db = out.strip().split("\n") + lst_db_cache = [a for a in lst_db if a.startswith("_cache_")] + return lst_db, lst_db_cache + + def main(): config = get_config() @@ -88,10 +96,7 @@ def main(): _logger.info("No master password needed... Continue") # Get list of database - arg = f"{arg_base} --list" - out = check_output(arg.split(" ")).decode() - lst_db = out.strip().split("\n") - lst_db_cache = [a for a in lst_db if a.startswith("_cache_")] + lst_db, lst_db_cache = get_list_db_cache(arg_base) if config.clean_cache: for db in lst_db_cache: @@ -99,6 +104,7 @@ def main(): arg = f"{arg_base} --drop --database {db}" out = check_output(arg.split(" ")).decode() print(out) + lst_db, lst_db_cache = get_list_db_cache(arg_base) if config.database: cache_database = f"_cache_{config.image}" From 3cf91837d6935cb2de0b9c28a046f4b94f0105fa Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 16 Jul 2021 04:29:23 -0400 Subject: [PATCH 10/13] [ADD] makefile create database and backup database erplibre_base - Support erplibre_website - Documentation with how test backup --- Makefile | 39 +++++++++++++++++++++++++++++++++++++++ doc/RELEASE.md | 15 +++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Makefile b/Makefile index 7dbc913..6526f73 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,45 @@ db_restore_erplibre_base_db_code_generator: db_restore_erplibre_base_db_template: ./script/db_restore.py --database template +.PHONY: db_create_db_test +db_create_db_test: db_drop_db_test + ./.venv/bin/python3 ./odoo/odoo-bin db --create --database test + +######################## +# Image installation # +######################## +.PHONY: image_db_create_erplibre_base +image_db_create_erplibre_base: + ./script/make.sh db_create_db_test + ./script/addons/install_addons.sh test erplibre_base + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_base + +.PHONY: image_db_create_erplibre_website +image_db_create_erplibre_website: + ./script/make.sh db_create_db_test + ./script/addons/install_addons.sh test erplibre_base,website,erplibre_website_snippets_basic_html,erplibre_website_snippets_cards,erplibre_website_snippets_structures,erplibre_website_snippets_timelines + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website + ./script/addons/install_addons.sh test crm,website_crm + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_crm + ./script/addons/install_addons.sh test website_livechat + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_chat_crm + ./script/addons/install_addons.sh test website_sale,erplibre_base_quebec + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_base + +.PHONY: image_db_create_all +image_db_create_all: + ./script/make.sh db_create_db_test + ./script/addons/install_addons.sh test erplibre_base + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_base + ./script/addons/install_addons.sh test website,erplibre_website_snippets_basic_html,erplibre_website_snippets_cards,erplibre_website_snippets_structures,erplibre_website_snippets_timelines + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website + ./script/addons/install_addons.sh test crm,website_crm + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_crm + ./script/addons/install_addons.sh test website_livechat + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_chat_crm + ./script/addons/install_addons.sh test website_sale,erplibre_base_quebec + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_base + ######################### # Addons installation # ######################### diff --git a/doc/RELEASE.md b/doc/RELEASE.md index e912ce9..352bb8a 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -73,6 +73,21 @@ git commit -am "Release v#.#.#" Review by your peers, test the docker file and merge to master. +## Generate image db to accelerate db installation + +Generate image db before tag, the image is store in directory ./image_db + +```bash +make image_db_create_all +``` + +To test it, you need to clean caches and install it: + +```bash +./script/db_restore.py --clean_cache +./script/db_restore.py --database test --image erplibre_website +``` + ## Create tag Add a tag on the commit in branch master with your release. When adding tag, be sure to update default.xml From 0bb92995f2f626d139343b20cee137e178361efc Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 16 Jul 2021 18:56:58 -0400 Subject: [PATCH 11/13] [FIX] script git show code diff repo manifest: better support - support when different branch same commit - show warning instead error when the branch is different, but it's push --- doc/RELEASE.md | 8 +++++- script/git_show_code_diff_repo_manifest.py | 29 ++++++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/doc/RELEASE.md b/doc/RELEASE.md index 352bb8a..fc2983a 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -6,7 +6,13 @@ Before starting, validate [manifest/default.dev.xml](../manifest/default.dev.xml ## Clean environment before generate new release -Be sure all files are commit and push, this will erase everything in addons. +Before clean, check if existing file not committed, not pushed or in stash. +```bash +./.venv/repo forall -pc "git stash list" +./script/git_show_code_diff_repo_manifest.py +``` + +This will erase everything in addons. Useful before create docker, manifest and do a release. ```bash ./script/clean_repo_manifest.sh diff --git a/script/git_show_code_diff_repo_manifest.py b/script/git_show_code_diff_repo_manifest.py index 62edd8a..c41cdb7 100755 --- a/script/git_show_code_diff_repo_manifest.py +++ b/script/git_show_code_diff_repo_manifest.py @@ -106,11 +106,30 @@ def main(): ) dct_result["PASS"] += 1 elif branch_name != value: - print( - f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision is" - f" {branch_name} and actual revision is {value}." - ) - dct_result["ERROR"] += 1 + value_hash = git_repo.git.rev_parse(value) + if git_repo.git.rev_parse(branch_name) == value_hash: + print( + f"{Fore.GREEN}PASS{Style.RESET_ALL} Not same branch, no" + " divergence" + ) + dct_result["PASS"] += 1 + else: + # Check if the new branch is pushed + commit_branch = git_repo.git.rev_parse( + f"{organization}/{value}" + ) + if commit_branch == value_hash: + print( + f"{Fore.YELLOW}WARNING{Style.RESET_ALL} New branch" + f" '{value}', divergence, but it's push on remote." + ) + dct_result["WARNING"] += 1 + else: + print( + f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision" + f" is {branch_name} and actual revision is {value}." + ) + dct_result["ERROR"] += 1 else: print(f"{Fore.GREEN}PASS{Style.RESET_ALL}") dct_result["PASS"] += 1 From b35d5db6c566b58045b8eea6d79cc881e9ba975f Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 17 Jul 2021 01:32:43 -0400 Subject: [PATCH 12/13] [ADD] script to compare csv and zip manifest from backup - show module difference --- Makefile | 5 ++ script/csv/compare_database_application.py | 67 +++++++++++++++ script/manifest/compare_backup.py | 99 ++++++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100755 script/csv/compare_database_application.py create mode 100755 script/manifest/compare_backup.py diff --git a/Makefile b/Makefile index 6526f73..2f6de51 100644 --- a/Makefile +++ b/Makefile @@ -186,6 +186,11 @@ image_db_create_all: ./script/addons/install_addons.sh test website_sale,erplibre_base_quebec ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_base +.PHONY: image_diff_base_website +image_diff_base_website: + #./script/manifest/compare_backup.py --backup_file_1 ./image_db/erplibre_base.zip --backup_file_2 ./image_db/erplibre_website.zip + ./script/manifest/compare_backup.py --backup_1 erplibre_base --backup_2 erplibre_website + ######################### # Addons installation # ######################### diff --git a/script/csv/compare_database_application.py b/script/csv/compare_database_application.py new file mode 100755 index 0000000..15421a0 --- /dev/null +++ b/script/csv/compare_database_application.py @@ -0,0 +1,67 @@ +#!./.venv/bin/python +import os +import sys +import argparse +import logging +import csv + +new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +sys.path.append(new_path) + +logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) + +_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 + """ + # TODO update description + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description="""\ + Take two csv and show difference, intersection and complementarity +""", + epilog="""\ +""", + ) + parser.add_argument("--csv_1", required=True, help="CSV file first") + parser.add_argument("--csv_2", required=True, help="CSV file second") + parser.add_argument("--compare_key", required=True, help="Key to search and compare with it.") + args = parser.parse_args() + return args + + +def main(): + config = get_config() + + with open(config.csv_1, mode='r') as csv_file_1: + with open(config.csv_2, mode='r') as csv_file_2: + csv_reader_1 = csv.DictReader(csv_file_1) + csv_reader_2 = csv.DictReader(csv_file_2) + lst_csv_1 = [a.get(config.compare_key) for a in csv_reader_1] + lst_csv_2 = [a.get(config.compare_key) for a in csv_reader_2] + set_csv_1 = set(lst_csv_1) + set_csv_2 = set(lst_csv_2) + + total = set_csv_1.union(set_csv_2) + same = set_csv_1.intersection(set_csv_2) + difference_1 = set_csv_1.difference(set_csv_2) + difference_2 = set_csv_2.difference(set_csv_1) + print(f"{len(total)} total") + print(f"{len(same)} same") + if same: + print(same) + print(f"{len(difference_1)} difference csv 1 to csv 2") + if difference_1: + print(difference_1) + print(f"{len(difference_2)} difference csv 2 to csv 1") + if difference_2: + print(difference_2) + + +if __name__ == "__main__": + main() diff --git a/script/manifest/compare_backup.py b/script/manifest/compare_backup.py new file mode 100755 index 0000000..e62a853 --- /dev/null +++ b/script/manifest/compare_backup.py @@ -0,0 +1,99 @@ +#!./.venv/bin/python +import os +import sys +import argparse +import logging +import zipfile +import json +from colorama import Fore +from colorama import Style + +new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +sys.path.append(new_path) + +logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) + +_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 + """ + # TODO update description + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description="""\ + Take two backup and show difference, intersection and complementarity of modules in manifest.json +""", + epilog="""\ +""", + ) + parser.add_argument("--backup_file_1", help="Backup file path first") + parser.add_argument("--backup_file_2", help="Backup file path second") + parser.add_argument("--backup_1", help="Backup name first") + parser.add_argument("--backup_2", help="Backup name second") + args = parser.parse_args() + + die(bool(args.backup_file_1) and bool(args.backup_1), + "Take only --backup_file_1 or --backup_1") + die(not bool(args.backup_file_1) and not bool(args.backup_1), + "Missing --backup_file_1 or --backup_1") + die(bool(args.backup_file_2) and bool(args.backup_2), + "Take only --backup_file_2 or --backup_2") + die(not bool(args.backup_file_2) and not bool(args.backup_2), + "Missing --backup_file_2 or --backup_2") + + return args + + +def main(): + config = get_config() + + if config.backup_file_1: + file_path_1 = config.backup_file_1 + else: + file_path_1 = os.path.join("image_db", f"{config.backup_1}.zip") + + if config.backup_file_2: + file_path_2 = config.backup_file_2 + else: + file_path_2 = os.path.join("image_db", f"{config.backup_2}.zip") + + with zipfile.ZipFile(file_path_1, 'r') as zip_ref: + manifest_file_1 = zip_ref.open("manifest.json") + + with zipfile.ZipFile(file_path_2, 'r') as zip_ref: + manifest_file_2 = zip_ref.open("manifest.json") + + json_manifest_file_1 = json.load(manifest_file_1) + json_manifest_file_2 = json.load(manifest_file_2) + set_1 = set(json_manifest_file_1.get("modules").keys()) + set_2 = set(json_manifest_file_2.get("modules").keys()) + + total = set_1.union(set_2) + same = set_1.intersection(set_2) + difference_1 = set_1.difference(set_2) + difference_2 = set_2.difference(set_1) + print(f"{len(total)} total") + print(f"{len(same)} same") + if same: + print(same) + print(f"{Fore.BLUE}{len(difference_1)}{Style.RESET_ALL} difference manifest 1 to manifest 2") + if difference_1: + print(difference_1) + print(f"{Fore.MAGENTA}{len(difference_2)}{Style.RESET_ALL} difference manifest 2 to manifest 1") + if difference_2: + print(difference_2) + + +def die(cond, message, code=1): + if cond: + print(message, file=sys.stderr) + sys.exit(code) + + +if __name__ == "__main__": + main() From f46c58868f947863b2a853b7784bdf387e2be079 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 17 Jul 2021 01:33:17 -0400 Subject: [PATCH 13/13] [UPD] makefile add other image backup --- Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2f6de51..0e23508 100644 --- a/Makefile +++ b/Makefile @@ -163,7 +163,7 @@ image_db_create_erplibre_base: .PHONY: image_db_create_erplibre_website image_db_create_erplibre_website: ./script/make.sh db_create_db_test - ./script/addons/install_addons.sh test erplibre_base,website,erplibre_website_snippets_basic_html,erplibre_website_snippets_cards,erplibre_website_snippets_structures,erplibre_website_snippets_timelines + ./script/addons/install_addons.sh test erplibre_base,website,erplibre_website_snippets_basic_html,erplibre_website_snippets_cards,erplibre_website_snippets_structures,erplibre_website_snippets_timelines,website_form_builder ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website ./script/addons/install_addons.sh test crm,website_crm ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_crm @@ -171,13 +171,21 @@ image_db_create_erplibre_website: ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_chat_crm ./script/addons/install_addons.sh test website_sale,erplibre_base_quebec ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_base + ./script/addons/install_addons.sh test stock,purchase,website_sale_management + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_advance + ./script/addons/install_addons.sh test project + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_project + ./script/addons/install_addons.sh test pos_sale + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_pos + ./script/addons/install_addons.sh test hr + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_pos_hr .PHONY: image_db_create_all image_db_create_all: ./script/make.sh db_create_db_test ./script/addons/install_addons.sh test erplibre_base ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_base - ./script/addons/install_addons.sh test website,erplibre_website_snippets_basic_html,erplibre_website_snippets_cards,erplibre_website_snippets_structures,erplibre_website_snippets_timelines + ./script/addons/install_addons.sh test website,erplibre_website_snippets_basic_html,erplibre_website_snippets_cards,erplibre_website_snippets_structures,erplibre_website_snippets_timelines,website_form_builder ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website ./script/addons/install_addons.sh test crm,website_crm ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_crm @@ -185,6 +193,14 @@ image_db_create_all: ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_chat_crm ./script/addons/install_addons.sh test website_sale,erplibre_base_quebec ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_base + ./script/addons/install_addons.sh test stock,purchase,website_sale_management + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_advance + ./script/addons/install_addons.sh test project + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_project + ./script/addons/install_addons.sh test pos_sale + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_pos + ./script/addons/install_addons.sh test hr + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_pos_hr .PHONY: image_diff_base_website image_diff_base_website: