diff --git a/.gitignore b/.gitignore index cdc6b22..abc3b2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -.vscode -**.pyc +*.pyc *.pyo +.vscode diff --git a/.python-files/addons-install b/.python-files/addons-install new file mode 100644 index 0000000..b1de590 --- /dev/null +++ b/.python-files/addons-install @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# Version: v.23.08.03 +# -*- coding: utf-8 -*- + +import __future__ +import argparse +import ast +import sys +try: + from venvodoolib import * +except IOError: + print("( ERROR ) : Run 'addons-install' python script in '.venv' virtual environment.") + exit(1) + +# Define CLI options +parser = ArgumentParser(description="Install addons in current environment") +parser.add_argument("action", choices=("init", "update", "list"), help="What to do with the matched addons.",) +parser.add_argument("-c", "--core", action="store_true", help="Use all Odoo core addons") +parser.add_argument("-d", "--dependencies", action="store_true", help="Use only dependencies of selected addons",) +parser.add_argument("-e", "--extra", action="store_true", help="Use all extra addons") +parser.add_argument("-f", "--fullpath", action="store_true", help="Print addon's full path, only useful with list mode",) +parser.add_argument("-i", "--installable", action="store_true", help="Include only installable addons") +parser.add_argument("-l", "--leftout", action="append", default=[], help="Addons to exclude always.") +parser.add_argument("-s", "--separator", type=str, default=",", help="String that separates addons only useful with list mode",) +parser.add_argument("-t", "--test", action="store_true", help="Run unit tests for these addons, usually combined with update",) +parser.add_argument("-w", "--with", action="append", dest="with_", default=[], help="Addons to include always.",) +parser.add_argument("-x", "--explicit", action="store_true", help="Fail if any addon is explicitly declared but not found",) + +# Generate the matching addons set +command_arguments = parser.parse_args() +dependencies = {"base"} +addons_with = set(command_arguments.with_) +addons_left_out = set(command_arguments.leftout) +addons_set = set() + +if addons_with & addons_left_out: + sys.exit("Cannot include and exclude the same addon!") +if command_arguments.dependencies and command_arguments.fullpath: + sys.exit("Unsupported combination of --dependencies and --fullpath") +try: + for addon_name, addons_repo_item_path in addons_config(strict_running=command_arguments.explicit): + if addon_name in addons_left_out: + continue + core_ok = command_arguments.core and addons_repo_item_path == "odoo/addons" + extra_ok = command_arguments.extra and addons_repo_item_path not in {"odoo/addons"} + manual_ok = addon_name in addons_with + if core_ok or extra_ok or manual_ok: + addon_full_path = os.path.join(REPOSITORIES_DIRECTORY, addons_repo_item_path, addon_name) + manifest_code = {} + for manifest_name in ("__manifest__.py", "__openerp__.py"): + try: + manifest_path = os.path.join(addon_full_path, manifest_name) + with open(manifest_path, "r") as code: + manifest_code = ast.literal_eval(code.read()) + break + except IOError: + continue + if command_arguments.installable and not manifest_code.get("installable", True): + continue + dependencies.update(manifest_code.get("depends", [])) + if command_arguments.fullpath and command_arguments.action == "list": + addons_set.add(addon_full_path) + else: + addons_set.add(addon_name) +except AddonsConfigError as error: + sys.exit(error.message) + +# Use dependencies instead, if requested +if command_arguments.dependencies: + addons_set = dependencies - addons_set +addons_set -= addons_left_out + +# Do the required action +if not addons_set: + print("No addons found.", file=sys.stderr) + sys.exit("Error: Nothing to do.") +addons_sorted_set = command_arguments.separator.join(sorted(addons_set)) + +if command_arguments.action == "list": + print(addons_sorted_set) +else: + command = ["odoo", "--stop-after-init", "--{}".format(command_arguments.action), addons_sorted_set] + if command_arguments.test: + command += ["--test-enable", "--workers", "0"] + if os.environ.get("PGDATABASE"): + command += ["--db-filter", u"^{}$".format(os.environ.get("PGDATABASE"))] + logger.info("Executing %s", " ".join(command)) + check_call(command) diff --git a/bin/translate-modules.py b/.python-files/modules-translate old mode 100755 new mode 100644 similarity index 94% rename from bin/translate-modules.py rename to .python-files/modules-translate index 4a9ed7a..ab640fe --- a/bin/translate-modules.py +++ b/.python-files/modules-translate @@ -1,12 +1,17 @@ -# Version: v.22.05.30 +#!/usr/bin/env python +# Version: v.23.08.03 # -*- coding: utf-8 -*- -import os -import sys + import getopt import polib import shutil +import sys import tempfile - +try: + from venvodoolib import * +except IOError: + print("( ERROR ) : Run 'modules-translate' python script in '.venv' virtual environment.") + exit(1) HELP_TEXT = """ This script will generate new .po files for certain modules, and certain @@ -20,7 +25,7 @@ --database NAME -d NAME Specifies the name of the database that the Odoo instance is running on. This is optional, but if used, will override what's set - in .env-shared or .env-secret . + in config/env-shared or .env-secret . --help -h Show this help message. --languages LANGS @@ -202,7 +207,7 @@ def main(): if 'module-folder' in args and len(args['module-folder']) > 0: addon_folder = args['module-folder'] - addons = os.listdir(os.path.join(SRC_DIR, addon_folder)) + addons = os.listdir(os.path.join(REPOSITORIES_DIRECTORY, addon_folder)) elif 'module' in args and len(args['module']) > 0: addon_name = args['module'] addons = [addon_name] @@ -230,11 +235,11 @@ def main(): # Initialize # FIXME: Only works if odoo is actually placed in this directory print("Loading exising Odoo translations...", file=sys.stderr) - compendium = load_compendium(os.path.join(ODOO_DIR), langs) + compendium = load_compendium(os.path.join(ODOO_MAIN_CODE_DIRECTORY), langs) temp_file = tempfile.mkstemp(prefix='trans', suffix='.po')[1] for module_name in addons: - module_path = os.path.join(ADDONS_DIR, module_name) + module_path = os.path.join(EVENTUAL_ADDONS_DIRECTORY, module_name) upgrade_module_translations(module_name, module_path) diff --git a/.python-files/waft-build b/.python-files/waft-build new file mode 100644 index 0000000..ad565a8 --- /dev/null +++ b/.python-files/waft-build @@ -0,0 +1,258 @@ +#!/usr/bin/env python +# Version: v.23.08.03 +# -*- coding: utf-8 -*- + +try: + from venvwaftlib import * +except Exception: + print("( ERROR ) : Run 'build' python script in '.waft-venv' virtual environment.") + exit(1) +import sys +import shutil +from multiprocessing import cpu_count +from contextlib import closing +from string import Template +from io import StringIO +from configparser import RawConfigParser +parser = RawConfigParser(strict=False) + +for addons_repo_full_path in waft_auto_yaml_dict: + if os.path.exists(addons_repo_full_path): + if not os.path.isdir(os.path.join(addons_repo_full_path, '.git')): + shutil.rmtree(addons_repo_full_path) + logger.warning( + "'%s' does not exist in '%s', waft removed existed '%s'!", + os.path.isdir(os.path.join(addons_repo_full_path, '.git')), addons_repo_full_path, addons_repo_full_path + ) + continue + if not os.path.isdir(os.path.join(addons_repo_full_path, '.git/refs')): + shutil.rmtree(addons_repo_full_path) + logger.warning( + "'%s' does not exist in '%s', waft removed existed '%s'!", + os.path.isdir(os.path.join(addons_repo_full_path, '.git/refs')), addons_repo_full_path, addons_repo_full_path + ) + continue + if not os.path.isdir(os.path.join(addons_repo_full_path, '.git/objects')): + shutil.rmtree(addons_repo_full_path) + logger.warning( + "'%s' does not exist in '%s', waft removed existed '%s'!", + os.path.isdir(os.path.join(addons_repo_full_path, '.git/objects')), addons_repo_full_path, addons_repo_full_path + ) + continue + try: + check_call( + [ "git", "-C", addons_repo_full_path, "reset", "--hard", "HEAD", ], + cwd=REPOSITORIES_DIRECTORY, + stderr=sys.stderr, + stdout=sys.stdout, + ) + except Exception: + shutil.rmtree(addons_repo_full_path) + logger.warning( + "'git -C %s reset --hard HEAD' failed, waft removed existed '%s'!", + addons_repo_full_path, addons_repo_full_path + ) + try: + check_call( + [ "git", "-C", addons_repo_full_path, "clean", "-fd", ], + cwd=REPOSITORIES_DIRECTORY, + stderr=sys.stderr, + stdout=sys.stdout, + ) + except Exception: + shutil.rmtree(addons_repo_full_path) + logger.warning( + "'git -C %s clean -fd' failed, waft removed existed '%s'!", + addons_repo_full_path, addons_repo_full_path + ) + +CODE_DUMPPED_YAML_FILE = os.path.join(IGNORE_DIRECTORY, "config/code.yaml") +gitaggregate_addons_failures = [] +for addons_repo_full_path in waft_auto_yaml_dict: + addons_repo_dump_dict = dict() + addons_repo_dump_dict['remotes'] = addons_repo_full_path['remotes'] + addons_repo_dump_dict['merges'] = addons_repo_full_path['merges'] + addons_repo_dump_dict['target'] = addons_repo_full_path['target'] + waft_auto_yaml_dump_dict = dict() + waft_auto_yaml_dump_dict[addons_repo_full_path] = addons_repo_dump_dict + if os.path.exists(CODE_DUMPPED_YAML_FILE): + shutil.rmtree(CODE_DUMPPED_YAML_FILE) + code_dumpped_yaml_file = open(CODE_DUMPPED_YAML_FILE, "w") + code_dumpped_yaml_file.write(yaml.safe_dump(waft_auto_yaml_dump_dict, explicit_start='---', + default_flow_style=False, sort_keys=False)) + code_dumpped_yaml_file.close() + try: + logger.info( + "Running gitaggregate with '%s' for '%s'", + CODE_DUMPPED_YAML_FILE, addons_repo_full_path + ) + gitaggregate_cmd = ["gitaggregate", "--expand-env", "--config", CODE_DUMPPED_YAML_FILE, "--log-level", + WAFT_LOG_LEVEL, "--jobs", str(cpu_count() or 1), "aggregate"] + logger.info("Running '%s' in '%s'", ' '.join(gitaggregate_cmd), REPOSITORIES_DIRECTORY) + check_call( + gitaggregate_cmd, + cwd=REPOSITORIES_DIRECTORY, + stderr=sys.stderr, + stdout=sys.stdout, + ) + except Exception: + gitaggregate_addons_failures.append(addons_repo_full_path) +addons_repo_dump_dict = dict() +waft_auto_yaml_dump_dict = dict() + + + + + + + + + +# Get the enabled paths +addons_full_paths = {} +for addon_name, addons_subpath_repo in addons_config(): + addons_repo_full_path = os.path.realpath(os.path.join(REPOSITORIES_DIRECTORY, addons_subpath_repo)) + addons_full_paths.setdefault(addons_repo_full_path, set()) + addons_full_paths[addons_repo_full_path].add(addon_name) +logger.debug("Addon paths enabled: %s", addons_full_paths) + +addons_subpath_repo = '' +# Traverse src dir and remove anything not explicitly enabled +for directory, subdirectories, subfiles in os.walk(REPOSITORIES_DIRECTORY): + if False == True: + print(subfiles) + logger.debug("Checking for cleanup directory %s", directory) + # Skip main src directory + if directory == REPOSITORIES_DIRECTORY: + continue + # Inside the odoo dir, skip all but addons dir + if directory == ODOO_MAIN_CODE_DIRECTORY: + subdirectories[:] = ["addons"] + continue + # Leave .git directories unless we are really CLEAN-ing + if directory.endswith("/.git"): + subdirectories[:] = [] + continue + # Leave .github directories unless we are really CLEAN-ing + if directory.endswith("/.github"): + subdirectories[:] = [] + continue + # Leave '__xxxxxxx__' folders unless we are really CLEAN-ing + if directory.endswith("__"): + subdirectories[:] = [] + continue + # Leave 'setup' directories unless we are really CLEAN-ing + if directory.endswith("/setup"): + subdirectories[:] = [] + continue + try: + # Get addons enabled in current directory + enabled_addons = addons_full_paths[directory] + except KeyError: + # This isn't an addon; is there anything inside to preserve? + directory += os.path.sep + if any(addons_full_path.startswith(directory) for addons_full_path in addons_full_paths): + # Then, let's walk in; we'll remove later if needed + continue + else: + # This is an addons repo; do not walk into the enabled ones + for enabled_addon in enabled_addons: + subdirectories.remove(enabled_addon) + continue + # Remove every other directory + logger.info("Removing directory %s", directory) + shutil.rmtree(directory) + +addons_links = glob(os.path.join(EVENTUAL_ADDONS_DIRECTORY, "*")) +for addon_link in addons_links: + os.remove(addon_link) +addons_full_paths_list = [] +for addons_repo_full_path in waft_auto_yaml_dict: + addons_full_paths_tmp_list = [] + if waft_auto_yaml_dict[addons_repo_full_path][addons] == [os.path.join(addons_repo_full_path, '*')]: + if addons_repo_full_path == ODOO_MAIN_CODE_DIRECTORY: + for addon_partial_full_path in glob(os.path.join(ODOO_MAIN_CODE_DIRECTORY, 'addons/*')): + addons_full_paths_tmp_list.append(addon_partial_full_path) + if ODOO_VERSION not in {'8.0', '9.0'}: + for addon_partial_full_path in glob(os.path.join(ODOO_MAIN_CODE_DIRECTORY, 'openerp/addons/*')): + addons_full_paths_tmp_list.append(addon_partial_full_path) + else: + for addon_partial_full_path in glob(os.path.join(ODOO_MAIN_CODE_DIRECTORY, 'odoo/addons/*')): + addons_full_paths_tmp_list.append(addon_partial_full_path) + else: + for addon_partial_full_path in glob(os.path.join(addons_repo_full_path, '*')): + addons_full_paths_tmp_list.append(addon_partial_full_path) + else: + for addon_full_tmp_path in waft_auto_yaml_dict[addons_repo_full_path][addons]: + for addon_partial_full_path in glob(addon_full_tmp_path): + addons_full_paths_tmp_list.append(addon_partial_full_path) + if waft_auto_yaml_dict[addons_repo_full_path][addons_except] == '': + addons_full_paths_list = addons_full_paths_tmp_list + else: + for addon_full_tmp_path in addons_full_paths_tmp_list: + if addon_full_tmp_path not in waft_auto_yaml_dict[addons_repo_full_path][addons_except]: + addons_full_paths_list.append(addon_full_tmp_path) + for addon_full_path in addons_full_paths_list: + auto_directory_addon_relpath = os.path.relpath(addon_full_path, EVENTUAL_ADDONS_DIRECTORY) + addon_link = os.path.join(EVENTUAL_ADDONS_DIRECTORY, os.path.join(os.path.relpath(addon_full_path, addons_repo_full_path))) + os.symlink(auto_directory_addon_relpath, addon_link) + logger.debug("Linked %s in %s", addon_full_path, addon_link) + +for addon_full_path in addon_found_path: + if not os.path.isdir(addon_full_path): + continue + manifests = (os.path.join(addon_full_path, manifest_file_name) for manifest_file_name in + ("__manifest__.py", "__openerp__.py")) + if not any(os.path.isfile(manifest_file_name) for manifest_file_name in manifests): + addons_missing_manifest_paths.add(addon_full_path) + logger.debug( + "Skipping '%s' as it is not a valid Odoo module.", + addon_full_path + ) + continue + logger.debug( + "Registering addon %s", + addon_full_path + ) + addon_name = os.path.basename(addon_full_path) + addons_info.setdefault(addon_name, set()) + addons_info[addon_name].add(addons_subpath_repo) + +AUTO_ODOO_CONF_FILE = os.path.join(WORK_DIRECTORY, ".ignore/config/odoo.conf") + +# Read the configurations files. +logger.info("Import %s configuration file.", os.path.join(WORK_DIRECTORY, "config/odoo-default.conf")) +parser.read(os.path.join(WORK_DIRECTORY, "config/odoo-default.conf")) +logger.info("Import %s configuration file.", os.path.join(WORK_DIRECTORY, "config/odoo-override.conf")) +parser.read(os.path.join(WORK_DIRECTORY, "config/odoo-override.conf")) + +# Write it to a memory string object +with closing(StringIO()) as generating_odoo_conf_file: + parser.write(generating_odoo_conf_file) + generating_odoo_conf_file.seek(0) + # Obtain the config string + generated_odoo_conf_file = generating_odoo_conf_file.read() + # Expand environment variables found within + generated_odoo_conf_file = Template(generated_odoo_conf_file).substitute(os.environ) + logger.debug("Resulting configuration:\n%s", AUTO_ODOO_CONF_FILE) + # Write it to destination + with open(AUTO_ODOO_CONF_FILE, "w") as auto_odoo_conf_file: + auto_odoo_conf_file.write(generated_odoo_conf_file) + +if os.listdir(REPOSITORIES_DIRECTORY): + for scrap in os.listdir(REPOSITORIES_DIRECTORY): + scrap_path = os.path.join(REPOSITORIES_DIRECTORY, scrap) + if os.path.isfile(scrap_path): + try: + os.remove(scrap_path) + except IOError: + logger.error("Can't remove '%s' file.", scrap_path) + exit(1) + elif os.path.isdir(scrap_path): + try: + shutil.rmtree(scrap_path) + except IOError: + logger.error("Can't remove '%s' directory.", scrap_path) + exit(1) +else: + logger.info("The %s directory is already empty.", REPOSITORIES_DIRECTORY) diff --git a/.python-files/waft-update-depths b/.python-files/waft-update-depths new file mode 100644 index 0000000..8259543 --- /dev/null +++ b/.python-files/waft-update-depths @@ -0,0 +1,202 @@ +#!/usr/bin/env python +# Version: v.23.08.03 +# -*- coding: utf-8 -*- + +import argparse +from string import Template +try: + from venvwaftlib import * +except IOError: + print("( ERROR ) : Run 'waft-update-depths' python script in '.waft-venv' virtual environment.") + exit(1) + +def split_line(line): + split_lines = line.split(" ") + for sl in split_lines: + if sl == "": + split_lines.pop(split_lines.index(sl)) + return split_lines + + +def is_in_history(value, history): + for commit in history: + if commit[:8] == value[:8]: + return True + return False + + +def decode_variables(decode_string_variables): + """ + pass a string and return variables replaced in it. + @returns string + """ + # may be int, str + decode_string_variables = str(decode_string_variables) + yaml_substituted = Template(decode_string_variables) + return yaml_substituted.substitute(os.environ) + + +def preprocess_merge(addons_repositories_paths, addons_subpath_repo, addons_repo_merge): + remotes = addons_repositories_paths[addons_subpath_repo]["remotes"].keys() + addons_repo_split_merge = [x for x in addons_repo_merge.split(" ") if x != ""] + if addons_repo_split_merge[0] not in remotes: + logger.debug("Invalid Remote on line: %s" % addons_repo_merge) + raise ValueError + repo_path = os.path.abspath(os.path.join(REPOSITORIES_DIRECTORY, addons_subpath_repo)) + return repo_path, addons_repo_split_merge + +def get_branch_name(addons_repo_split_merge, merge_type): + if merge_type in (1, 3): + return decode_variables(addons_repo_split_merge[1]) + return False + +def get_merge_type(addons_repo_split_merge, addons_subpath_repo): + """ + Possible syntaxes for merges: + + merge_type=1 + merge_type=2 + merge_type=3 + merge_type=0 "invalid" + """ + all_commits = {} + if len(addons_repo_split_merge) == 3: + return 3 + else: + if is_in_history(addons_repo_split_merge[1], all_commits.get(addons_subpath_repo, [])): + return 2 + else: + return 1 + return 0 # unreachable. + + +def process_depth(addons_repo_split_merge, branchname, main_branch, main_branch_name, repo_path): + os.chdir(repo_path) + # make sure we have the latest branch available. + run( + [ + "git", + "fetch", + addons_repo_split_merge[0], + branchname, + ], + stdout=PIPE, + stderr=PIPE, + ) + # look at most recent common commit. + lastrev = ( + run( + [ + "git", + "merge-base", + "".join([main_branch[0], "/", main_branch_name]), + "".join([addons_repo_split_merge[0], "/", branchname]), + ], + stdout=PIPE, + stderr=PIPE, + ) + .stdout.decode("utf-8") + .replace("\n", "") + ) + if not lastrev: + return 1024 # Can happen when remote not yet added. + # we now calculate the needed depth of this branch + mindepth = ( + run( + [ + "git", + "rev-list", + "".join([main_branch[0], "/", main_branch_name]), + "^" + lastrev, + "--count", + ], + stdout=PIPE, + stderr=PIPE, + ) + .stdout.decode("utf-8") + .replace("\n", "") + ) + try: + return int(mindepth) + except Exception: + # Should log/print some error here. + return 1024 + + +def main(): + """ + parsing directly repos.yaml, if something is not in code.yaml, branch will still + be in folder, but may not be included in addons. Nothing changes. + """ + repo_min_depth = {} + changes = '' + with open(REPOS_YAML) as yaml_file: + for addons_repositories_paths in yaml.safe_load_all(yaml_file): + for addons_subpath_repo in addons_repositories_paths: + print("===>processing repo %s" % addons_subpath_repo) + repo_min_depth[addons_subpath_repo] = 0 + if addons_subpath_repo in {"ONLY", "ENV"}: + continue + target = addons_repositories_paths[addons_subpath_repo].get("target") or False + # main branch is defined as target or in absence of target, merge[0] + main_branch = split_line(target or addons_repositories_paths[addons_subpath_repo]["merges"][0]) + merge_type = get_merge_type(main_branch, addons_subpath_repo) + main_branch_name = get_branch_name(main_branch, merge_type) + for merge in addons_repositories_paths[addons_subpath_repo]["merges"]: + repo_path, addons_repo_split_merge = preprocess_merge(addons_repositories_paths, addons_subpath_repo, merge) + # this script cannot work on new ./builds it is written to keep + # depths of instances that have been built at least once with + # if one source folder is missing we skip it. + if not os.path.exists(repo_path): + continue + merge_type = get_merge_type(addons_repo_split_merge, addons_subpath_repo) + branchname = get_branch_name(saddons_repo_plitted_merge, merge_type) + if branchname: + # compute depth only for merges with branchname + min_depth = process_depth( + addons_repo_split_merge, + branchname, + main_branch, + main_branch_name, + repo_path, + ) + repo_min_depth[addons_subpath_repo] = ( + min_depth > repo_min_depth[addons_subpath_repo] + and min_depth + or repo_min_depth[addons_subpath_repo] + ) + if repo_min_depth[addons_subpath_repo] > 0: + waft_depth = decode_variables( + addons_repositories_paths[addons_subpath_repo]["defaults"].get("depth") + ) + # just in case the substitution didn't happen because variables + # are not explicitly loaded in env... + if waft_depth == "${WAFT_DEPTH_MERGE}": + # waft_depth_merge, if not specified in env defaults to 100 + waft_depth = os.environ.get("WAFT_DEPTH_MERGE") or 100 + if waft_depth == "${WAFT_DEPTH_DEFAULT}": + waft_depth = os.environ.get("WAFT_DEPTH_DEFAULT") or 1 + waft_depth = int(waft_depth) + if repo_min_depth[addons_subpath_repo] > waft_depth: + changes += ("\n\t Increasing depth of %s from %s to %s" + % ( + addons_subpath_repo, + addons_repositories_paths[addons_subpath_repo]["defaults"]["depth"], + str(repo_min_depth[addons_subpath_repo]), + ) + ) + addons_repositories_paths[addons_subpath_repo]["defaults"]["depth"] = repo_min_depth[addons_subpath_repo] + + if changes: + print("========Applying Depth changes to repos.yaml:") + print(changes) + print("=======================================") + yaml_file = open(REPOS_YAML, "w") + yaml_file.write(yaml.dump(addons_repositories_paths, default_flow_style=True, default_style='|', sort_keys=False)) + yaml_file.close() + +if os.path.isfile(REPOS_YAML) and __name__ == "__main__": + main() +else: + logger.debug("no %s repository file found" % REPOS_YAML) + raise ValueError diff --git a/README.md b/README.md index 50a3e2d..1c0f4bd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Waft Odoo installation method -Waft is a wrapper for installing [Odoo](https://github.com/odoo/odoo). +Waft is a wrapper for installing [Odoo](https://github.com/odoo/odoo)/[OCB](https://github.com/OCA/OCB). In this, it is similar to: @@ -16,12 +16,14 @@ We needed a tool that could replace buildout, but did not want to switch to a Do ## What does it do -- Install the Python version in `.python-version` using `pyenv` -- Install Python dependencies from `requirements.txt` in a virtual environment in `.venv` -- Use `gitaggregrator` to collect Odoo modules from different `git` repositories and branches as defined in `repos.yaml` in `custom/src/XXX/YYY` folders -- Select some modules and not others (addons.yaml) -- Generate the Odoo config file in `auto/odoo.conf` -- Offer some handy scripts to do things: `./upgrade`, `./install`, `./shell`, `waftlib/bin/reset-password`, ... +- Build `.venv` virtual environment with Python version in `config/.python-version` using `pyenv` for Odoo code. +- Build `.waft-venv` virtual environment with Python version in `config/.waft-python-version` using `pyenv` for some waft tools. +- Install Python dependencies from `requirements-install-default.txt` in `.venv` virtual environment. +- Install Python dependencies from `waft-requirements-install-default.txt` in `.waft-venv` virtual environment. +- Use `gitaggregrator` to collect Odoo modules from different `git` repositories and branches as defined in `config/code.yaml`. +- Select some modules and not others that defined in `config/code.yaml`. +- Generate the Odoo config file in `.ignore/config/odoo.conf` +- Offer some handy scripts in `scripts/`. ## What it does not do (or: prerequisites) @@ -36,7 +38,7 @@ As for the system requirements, take a look at the files in [this folder](https: Note: when you do want to use an existing python version or system python, you can create a virtual environment in the root directory by using `$ python -m venv .venv` or -if you have an existing virtualenv binary: `$ virtualenv .venv. +if you have an existing virtualenv binary: `$ virtualenv .venv`. ## Setup a waft project @@ -52,24 +54,24 @@ Select an Odoo version that you want to use, for example 13.0 Create your secret environment variables file from default environment variables template file and rerun bootstrap: ``` -cp waftlib/templates/13.0/.env-shared .env-secret +cp waftlib/templates/.env-secret .env-secret +vi .env-secret ./bootstrap ``` When successful, now we can prepare for building Odoo: -- Take a look at default odoo config file `vi common/conf.d/odoo.conf`. -- Override odoo config variables as you like `vi common/conf.d/override-odoo.conf`. You can use ENVIRONMENT variables here -- Take a look at defaults shared variables `vi .env-shared` that apply for all clones of this instance, you can replace the link to templet file with a regular file and modify it as you like. NOTE: don't put secret variables values in this file. -- You can override variables in `.env-shared` by putting it in `.env-secret` such as DBFILTER, PGDATABASE, PGUSER etc -- Take a look at default [`custom/src/repos.yaml`](https://github.com/Tecnativa/doodba#optodoocustomsrcreposyaml), if you like to modify it replace the link with a regular file. -- Take a look at default [`custom/sec/addons.yaml`](https://github.com/Tecnativa/doodba#optodoocustomsrcaddonsyaml), if you like to modify it replace the link with a regular file. +- Take a look at default odoo config file `vi config/odoo-code.conf`. +- Override odoo config variables as you like `vi config/odoo-override.conf`. You can use ENVIRONMENT variables here. +- Take a look at defaults shared variables `vi config/env-shared` that apply for all clones of this instance. NOTE: don't put secret variables values in this file. +- You can override variables in `config/env-shared` by putting it in `.env-secret` such as DBFILTER, PGDATABASE, PGUSER etc. +- Take a look at default `config/code.yaml`. - Issue build script `./build` Now we can create database and run Odoo: ``` -./install mydatabase web -./run +./scripts/database-install-new-empty mydatabase web +./config/run ``` At this point when you know the project configuration is complete, you can push it back to Git, but not to the `waft` repository, but to your project's repository, for example to a branch named `build`: @@ -95,30 +97,34 @@ Now everyone who wants to work with your project can: To add a new Python module: ``` -# edit requirements.txt, add the module you want +# Edit config/requirements-override-install.txt, add the module you want, then: ./build OR: -# edit requirements.txt, add the module you want +# Edit config/requirements-override-install.txt, add the module you want, then: +./scripts/requirements-install + +OR: + +# Edit config/requirements-override-install.txt, add the module you want, then: source .venv/bin/activate -pip install -r requirements.txt +pip install -r config/requirements-override-install.txt -# Then commit and push to share the new requirements.txt with colleagues +# Then commit and push to share the new config/requirements-override-install.txt with colleagues. ``` To add a new Odoo module: ``` -vi custom/src/repos.yaml -vi custom/src/addons.yaml +vi config/code.yaml ./build ``` To start an Odoo shell: ``` -./shell +./config/python-shell # Now you get a shell that has `env` object ``` @@ -126,14 +132,14 @@ To start a [click-odoo](https://github.com/acsone/click-odoo) script: ``` source .venv/bin/activate -click-odoo -c ./auto/odoo.conf my-script.sh +click-odoo -c .ignore/config/odoo.conf my-script.sh ``` To run any other custom Odoo command: ``` source .venv/bin/activate -odoo -c auto/odoo.conf --help +odoo -c .ignore/config/odoo.conf --help ``` ## Upgrade waftlib from `v.21.05.10` to `v.21.09.22` version: @@ -145,10 +151,9 @@ odoo -c auto/odoo.conf --help - Remove `Pipfile`. - Remove `Pipfile.lock`. - Remove `.venv` directory. -- If you didn't modify the default `.env-shared` remove it. +- If you didn't modify the default `env-shared` remove it. - If you didn't modify the default `common/conf.d/odoo.cfg` remove it. -- If you didn't modify the default `custom/src/addons.yaml` remove it. -- If you didn't modify the default `custom/src/repos.yaml` remove it. +- If you didn't modify the default `custom/src/code.yaml` remove it. - Issue `/usr/bin/curl https://raw.githubusercontent.com/sunflowerit/waft/fec170fd456a371b3468b8d9eef505bf079af40c/bootstrap -o bootstrap` - Issue `/usr/bin/curl https://raw.githubusercontent.com/sunflowerit/waft/fec170fd456a371b3468b8d9eef505bf079af40c/.gitignore -o .gitignore` - Issue `./bootstrap` @@ -165,13 +170,13 @@ You can! All scripts are symlinks pointing into waftlib, and the symlinks are st ``` git rm ./bootstrap -cp waftlib/bootstrap . +cp .ignore/waftlib/bootstrap . vi bootstrap # edit like you wish git add bootstrap git commit -m "[UPD] use modified Bootstrap script" ``` -Note that when you do this, you won't subscribe to Waft updates anymore, so if there is a change or fix in `waftlib/bootstrap`, you will need to update it in your project manually. +Note that when you do this, you won't subscribe to Waft updates anymore, so if there is a change or fix in `.ignore/waftlib/bootstrap`, you will need to update it in your project manually. ## Setting up a Development Environment (PyCharm) diff --git a/bin/addons b/bin/addons deleted file mode 100755 index c33f0a4..0000000 --- a/bin/addons +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -from __future__ import print_function - -import ast -import os -import sys -from dotenv import load_dotenv -from argparse import ArgumentParser -from subprocess import check_call - -from waftlib import ( - CORE, - ENTERPRISE, - MANIFESTS, - PRIVATE, - SRC_DIR, - AddonsConfigError, - addons_config, - logger, -) - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -# Exit codes -EXIT_NO_ADDONS = 0x4 - -# Define CLI options -parser = ArgumentParser(description="Install addons in current environment") -parser.add_argument( - "action", - choices=("init", "update", "list"), - help="What to do with the matched addons.", -) -parser.add_argument( - "-c", "--core", action="store_true", help="Use all Odoo core addons" -) -parser.add_argument( - "-d", - "--dependencies", - action="store_true", - help="Use only dependencies of selected addons", -) -parser.add_argument("-e", "--extra", action="store_true", help="Use all extra addons") -parser.add_argument( - "-f", - "--fullpath", - action="store_true", - help="Print addon's full path, only useful with list mode", -) -parser.add_argument( - "-i", "--installable", action="store_true", help="Include only installable addons" -) -parser.add_argument( - "-n", "--enterprise", action="store_true", help="Use all enterprise addons" -) -parser.add_argument( - "-p", "--private", action="store_true", help="Use all private addons" -) -parser.add_argument( - "-s", - "--separator", - type=str, - default=",", - help="String that separates addons only useful with list mode", -) -parser.add_argument( - "-t", - "--test", - action="store_true", - help="Run unit tests for these addons, usually combined with update", -) -parser.add_argument( - "-x", - "--explicit", - action="store_true", - help="Fail if any addon is explicitly declared but not found", -) -parser.add_argument( - "-w", - "--with", - action="append", - dest="with_", - default=[], - help="Addons to include always.", -) -parser.add_argument( - "-W", "--without", action="append", default=[], help="Addons to exclude always." -) - -# Generate the matching addons set -args = parser.parse_args() -dependencies = {"base"} -addons = set(args.with_) -without = set(args.without) -if addons & without: - sys.exit("Cannot include and exclude the same addon!") -if args.dependencies and args.fullpath: - sys.exit("Unsupported combination of --dependencies and --fullpath") -try: - for addon, repo in addons_config(strict=args.explicit): - if addon in without: - continue - core_ok = args.core and repo == CORE - enterprise_ok = args.enterprise and repo == ENTERPRISE - extra_ok = args.extra and repo not in {CORE, ENTERPRISE, PRIVATE} - private_ok = args.private and repo == PRIVATE - manual_ok = addon in addons - if private_ok or core_ok or extra_ok or enterprise_ok or manual_ok: - addon_path = os.path.join(SRC_DIR, repo, addon) - manifest = {} - for manifest_name in MANIFESTS: - try: - manifest_path = os.path.join(addon_path, manifest_name) - with open(manifest_path, "r") as code: - manifest = ast.literal_eval(code.read()) - break - except IOError: - continue - if args.installable and not manifest.get("installable", True): - continue - dependencies.update(manifest.get("depends", [])) - if args.fullpath and args.action == "list": - addon = addon_path - addons.add(addon) -except AddonsConfigError as error: - sys.exit(error.message) -# Use dependencies instead, if requested -if args.dependencies: - addons = dependencies - addons -addons -= without - -# Do the required action -if not addons: - print("No addons found", file=sys.stderr) - sys.exit(EXIT_NO_ADDONS) -addons = args.separator.join(sorted(addons)) -if args.action == "list": - print(addons) -else: - command = ["odoo", "--stop-after-init", "--{}".format(args.action), addons] - if args.test: - command += ["--test-enable", "--workers", "0"] - if os.environ.get("PGDATABASE"): - command += ["--db-filter", u"^{}$".format(os.environ.get("PGDATABASE"))] - logger.info("Executing %s", " ".join(command)) - check_call(command) diff --git a/bin/autoaggregate b/bin/autoaggregate deleted file mode 100755 index 5d3e09c..0000000 --- a/bin/autoaggregate +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -import os -import sys -from dotenv import load_dotenv -from multiprocessing import cpu_count -from subprocess import check_call - -import yaml -from waftlib import ( - ADDONS_YAML, - AUTO_REPOS_YAML, - CORE, - LOG_LEVELS, - ODOO_DIR, - PRIVATE, - REPOS_YAML, - SRC_DIR, - logger, -) - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -UMASK = os.environ.get("UMASK") -UID = int(os.environ.get("UID") or -1) -GID = int(os.environ.get("GID") or -1) -log_level = os.environ.get("WAFT_LOG_LEVEL", "INFO") - - -def aggregate(config): - """Execute git aggregator to pull git code. - - :param str config: - Path where to find the ``repos.yaml`` file. - """ - logger.info("Running gitaggregate with %s", config) - old_umask = None - try: - # Download git code with the specified umask, if any - if UMASK: - old_umask = os.umask(int(UMASK)) - cmd = [ - "gitaggregate", - "--expand-env", - "--config", - config, - "--log-level", - log_level, - "--jobs", - str(cpu_count() or 1), - "aggregate", - ] - logger.info("Running '%s' in '%s'", ' '.join(cmd), SRC_DIR) - check_call( - cmd, - cwd=SRC_DIR, - stderr=sys.stderr, - stdout=sys.stdout, - ) - finally: - # Restore umask, if changed - if old_umask is not None: - os.umask(old_umask) - # Chown recursively, if UID or GID are specified - if ~UID or ~GID: - for root, dirs, files in os.walk(SRC_DIR): - for target in dirs + files: - try: - target_path = os.path.join(root, target) - if not os.path.islink(target_path): - # if target_path is a link we would only chown the - # target, as the target should be chowned separately - # we can skip all symlinks and prevent showing - # unclear errors - os.chown(target_path, UID, GID) - except Exception: - logger.debug( - "Error trying to chown on file. Skipping...", exc_info=True - ) - -def missing_repos_config(): - """Find the undefined repositories and return their default configuration. - - :return dict: - git-aggregator-ready configuration dict for undefined repositories. - """ - defined, expected = set(), {ODOO_DIR} - # Find the repositories defined by hand - try: - with open(REPOS_YAML) as yaml_file: - for doc in yaml.safe_load_all(yaml_file): - for repo in doc: - defined.add(os.path.abspath(os.path.join(SRC_DIR, repo))) - except (IOError, AttributeError): - logger.debug("No repositories defined by hand") - addons_env = {} - # Find the repositories that should be present - try: - with open(ADDONS_YAML) as yaml_file: - for doc in yaml.safe_load_all(yaml_file): - env = dict(os.environ, **doc.get("ENV", {})) - for repo in doc: - if repo in {PRIVATE, "ONLY", "ENV"}: - continue - if repo == CORE: - repo_path = ODOO_DIR - else: - repo_path = os.path.abspath(os.path.join(SRC_DIR, repo)) - if not os.path.exists(repo_path): - expected.add(repo_path) - else: - if os.path.isdir(repo_path): - if len(os.listdir(repo_path)) == 0: - expected.add(repo_path) - else: - expected.add(repo_path) - except (IOError, AttributeError): - logger.debug("No addons are expected to be present") - # Find the undefined repositories and generate a config for them - missing = expected - defined - if missing: - for repo_path in missing: - if not os.path.exists(repo_path): - print("\n\nERROR: " + repo_path + " addons directory does not exist!") - else: - if os.path.isdir(repo_path): - if len(os.listdir(repo_path)) == 0: - print("\n\nERROR: " + repo_path + " addons directory is empty!") - else: - print("\n\nERROR: " + repo_path + " addons not a directory!") - sys.exit("\n\n\n compare addons.yaml with repos.yaml and correct them.\n\n\n") - -# Aggregate user-specified repos -if os.path.isfile(REPOS_YAML): - aggregate(REPOS_YAML) - -# Aggregate unspecified repos -missing_config = missing_repos_config() diff --git a/bin/autoupdate b/bin/autoupdate deleted file mode 100755 index 50512f0..0000000 --- a/bin/autoupdate +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python-odoo-shell -# Version: v.22.05.30 -import logging -import os -from dotenv import load_dotenv - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -_logger = logging.getLogger("autoupdate") - -# TODO Delete this script at some point -_logger.warning("`autoupdate` is DEPRECATED, " - "use instead: click-odoo-update" -) - -# Note: ``module_auto_update`` must be installed in Odoo for this to work. -try: - env["ir.module.module"].upgrade_changed_checksum -except AttributeError: - env["base.module.upgrade"].upgrade_module() -else: - # Disable deprecated stuff - env["ir.config_parameter"].set_param( - "module_auto_update.enable_deprecated", - "0", - ) - # Newer versions of ``module_auto_update`` recommend this approach - env["ir.module.module"].upgrade_changed_checksum( - os.environ.get("I18N_OVERWRITE") == "1", - ) -env.cr.commit() diff --git a/bin/config-generate b/bin/config-generate deleted file mode 100755 index 43d8f47..0000000 --- a/bin/config-generate +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -"""Generate Odoo server configuration from templates""" - -import os -from dotenv import load_dotenv -from contextlib import closing -from string import Template - -from waftlib import logger - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -try: - # Python 2, where io.StringIO fails because it is unicode-only - from StringIO import StringIO -except ImportError: - from io import StringIO - -try: - from configparser import RawConfigParser - - parser = RawConfigParser(strict=False) -except ImportError: - # Python 2, where strict=True doesn't exist - from ConfigParser import RawConfigParser - - parser = RawConfigParser() - -ODOO_VERSION = os.environ.get("ODOO_VERSION") -odoo_auto_conf_path = os.path.join(os.environ["ODOO_WORK_DIR"], "auto/odoo.conf") -odoo_common_conf_d_path = os.path.join(os.environ["ODOO_WORK_DIR"], "common/conf.d") -odoo_custom_conf_d_path = os.path.join(os.environ["ODOO_WORK_DIR"], "custom/conf.d") -TARGET_FILE = os.environ.get("OPENERP_SERVER", odoo_auto_conf_path) -if ODOO_VERSION not in {"8.0", "9.0"}: - TARGET_FILE = os.environ.get("ODOO_RC", TARGET_FILE) -CONFIG_DIRS = (odoo_common_conf_d_path, odoo_custom_conf_d_path) -CONFIG_FILES = [] - -# Read all configuraiton files found in those folders -logger.info("Merging found configuration files in %s", TARGET_FILE) -for dir_ in CONFIG_DIRS: - try: - for file_ in sorted(os.listdir(dir_)): - parser.read(os.path.join(dir_, file_)) - except OSError: # TODO Use FileNotFoundError when we drop python 2 - continue - -# Write it to a memory string object -with closing(StringIO()) as resultfp: - parser.write(resultfp) - resultfp.seek(0) - # Obtain the config string - result = resultfp.read() - # Expand environment variables found within - result = Template(result).substitute(os.environ) - logger.debug("Resulting configuration:\n%s", result) - # Write it to destination - with open(TARGET_FILE, "w") as targetfp: - targetfp.write(result) diff --git a/bin/direxec b/bin/direxec deleted file mode 100755 index e179eb1..0000000 --- a/bin/direxec +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- - -import os -import subprocess -import sys -from dotenv import load_dotenv -from logging import DEBUG, INFO, WARNING -from psycopg2 import connect, OperationalError -from waftlib import logger, which - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -# Call this file linked from another file called `build` or `entrypoint` -mode = os.path.basename(__file__) - -odoo_bin_path = os.path.join(os.environ["ODOO_WORK_DIR"], ".venv/bin/odoo") -dir_odoo = os.environ["ODOO_WORK_DIR"] -dir_common = os.path.join(dir_odoo, "common", "%s.d" % mode) -dir_custom = os.path.join(dir_odoo, "custom", "%s.d" % mode) - -# Find scripts -files = [(d, dir_common) for d in os.listdir(dir_common)] -try: - files += [(d, dir_custom) for d in os.listdir(dir_custom)] -except OSError: - pass - -# Run scripts -for executable, folder in sorted(files): - command = os.path.join(folder, executable) - if os.access(command, os.X_OK): - logger.debug("Executing %s", command) - subprocess.check_call(command) - -# Allow to omit 1st command and default to `odoo` -extra_command = sys.argv[1:] -if extra_command: - if extra_command[0] == "shell" or extra_command[0].startswith("-"): - extra_command.insert(0, "odoo") - # Set the DB creation language, if needed - if extra_command[0] in {"odoo", odoo_bin_path}: - if os.environ.get("INITIAL_LANG"): - from psycopg2 import OperationalError, connect - - try: - connection = connect(dbname=os.environ.get("PGDATABASE")) - connection.close() - except OperationalError: - # No DB exists, set initial language - extra_command += ["--load-language", os.environ["INITIAL_LANG"]] - elif os.environ["DEBUGPY_ENABLE"] == "1": - # See `python -m debugpy -h` to understand this - extra_command[0] = os.path.realpath(which(extra_command[0])) - extra_command = ( - ["python", "-m", "debugpy"] - + os.environ["DEBUGPY_ARGS"].split() - + extra_command - ) - os.execvp(extra_command[0], extra_command) diff --git a/bin/log b/bin/log deleted file mode 100755 index bb7f144..0000000 --- a/bin/log +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import os -from dotenv import load_dotenv - -import argparse -import logging - -from waftlib import LOG_LEVELS, logger - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -parser = argparse.ArgumentParser(description="Easy logging for scripts") -parser.add_argument("level", choices=LOG_LEVELS) -parser.add_argument("message", nargs="+") -arguments = parser.parse_args() - -logger.log(getattr(logging, arguments.level), " ".join(arguments.message)) diff --git a/bin/pot b/bin/pot deleted file mode 100755 index 51c839e..0000000 --- a/bin/pot +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 -# Shortcut to run Odoo in unit testing mode -set -e - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -addons="${1}" -shift -log INFO Executing Odoo in i18n export mode for addons "${addons}" -# HACK Odoo needs a *.po file to guess the output format -/bin/ln -sf /dev/stdout /tmp/stdout.po -set -x -exec odoo --stop-after-init -d "${PGDATABASE}" --i18n-export /tmp/stdout.po \ - --modules "${addons}" --update "${addons}" --workers 0 "${@}" diff --git a/bin/preparedb b/bin/preparedb deleted file mode 100755 index 99a409f..0000000 --- a/bin/preparedb +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -# Script to prepare the database with initial data - -import os -from dotenv import load_dotenv - -import click -import click_odoo - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -@click.command() -@click_odoo.env_options(default_log_level="info", database_must_exist=True) -def main(env): - """Set report.url in the database to be pointing at localhost.""" - env["ir.config_parameter"].set_param("report.url", "http://localhost:8069") - env.cr.commit() - - -if __name__ == "__main__": - main() diff --git a/bin/python-odoo-shell b/bin/python-odoo-shell deleted file mode 100755 index 8b7393b..0000000 --- a/bin/python-odoo-shell +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -log WARNING python-odoo-shell is deprecated, use instead: click-odoo -exec odoo shell -d "${PGDATABASE}" < "${1}" diff --git a/bin/unittest b/bin/unittest deleted file mode 100755 index abdc520..0000000 --- a/bin/unittest +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -log WARNING unittest is deprecated, use instead: addons update --test "${@}" -# Shortcut to run Odoo in unit testing mode -set -e -addons="${1}" -shift -log INFO Executing Odoo in unittest mode for addons "${addons}" -# HACK `--workers 0`: https://github.com/odoo/odoo/pull/14809 -set -x -exec odoo --workers 0 --test-enable --stop-after-init --update "${addons}" "${@}" diff --git a/bootstrap b/bootstrap index bf806a2..ad8b466 100755 --- a/bootstrap +++ b/bootstrap @@ -1,375 +1,350 @@ #!/bin/sh -# Version: v.22.05.30 +# Version: v.23.08.03 set -e -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" -cd "${ODOO_WORK_DIR}" - - if [ "$(id -u)" -eq 0 ]; then - /bin/echo "Please don't use sudo command with script" - exit 1 - fi +if [ "$(/bin/id -u)" -eq 0 ] ; then + /bin/echo "( ERROR ) : Please refrain from using the sudo command with the script." + exit 1 +fi -if [ -z "${LIBRARIES_VERSION_BRANCH}" ]; then - if [ "$(/usr/bin/sha1sum "${ODOO_WORK_DIR}/bootstrap" | /usr/bin/awk '{ print $1}')" = "7b53eaced73cc36675859da32bdfb6c2c1c428fe" ] || [ "$(/usr/bin/sha1sum "${ODOO_WORK_DIR}/bootstrap" | /usr/bin/awk '{ print $1}')" = "56f5b836e417fa9c6b1d8cdc2afe5a96c91205a5" ]; then - /bin/echo "INFO: Update bootstrap script." - /usr/bin/curl https://raw.githubusercontent.com/sunflowerit/waft/40fa1701a3bd29dd623c2a5a76dedfe66398c28e/bootstrap -o "${ODOO_WORK_DIR}/bootstrap" - /bin/echo "INFO: Run bootstrap script again." - "${ODOO_WORK_DIR}/bootstrap" - /bin/echo "INFO: END" +export SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +export WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" +export DEFAULT_PATH="${PATH}" +cd "${WORK_DIRECTORY}" + +if [ -z "${LIBRARIES_VERSION_BRANCH}" ] ; then + if [ "$(/usr/bin/sha1sum "${WORK_DIRECTORY}/bootstrap" | /usr/bin/awk '{ print $1}')" = "7b53eaced73cc36675859da32bdfb6c2c1c428fe" ] || \ + [ "$(/usr/bin/sha1sum "${WORK_DIRECTORY}/bootstrap" | /usr/bin/awk '{ print $1}')" = "56f5b836e417fa9c6b1d8cdc2afe5a96c91205a5" ] ; then + /bin/echo "( INFO ) : Update bootstrap script." + /usr/bin/curl https://raw.githubusercontent.com/sunflowerit/waft/40fa1701a3bd29dd623c2a5a76dedfe66398c28e/bootstrap -o "${WORK_DIRECTORY}/bootstrap" + /bin/echo "( INFO ) : Run bootstrap script again." + "${WORK_DIRECTORY}/bootstrap" + /bin/echo "( INFO ) : END." exit 0 else - /bin/echo "ERROR: ${ODOO_WORK_DIR}/bootstrap files does not have 'LIBRARIES_VERSION_BRANCH' variable! update it by this command:" - /bin/echo " /usr/bin/curl https://raw.githubusercontent.com/sunflowerit/waft/master/bootstrap -o ${ODOO_WORK_DIR}/bootstrap" + /bin/echo "( ERROR ) : ${WORK_DIRECTORY}/bootstrap file does not have 'LIBRARIES_VERSION_BRANCH' variable! update it by this command:" + /bin/echo " /usr/bin/curl https://raw.githubusercontent.com/sunflowerit/waft/master/bootstrap -o ${WORK_DIRECTORY}/bootstrap" exit 1 fi fi -/bin/mkdir -p "${ODOO_WORK_DIR}/auto/addons" -/bin/mkdir -p "${ODOO_WORK_DIR}/common/build.d" -/bin/mkdir -p "${ODOO_WORK_DIR}/common/conf.d" -/bin/mkdir -p "${ODOO_WORK_DIR}/common/entrypoint.d" -/bin/mkdir -p "${ODOO_WORK_DIR}/custom/src/private" -/bin/mkdir -p "${ODOO_WORK_DIR}/logfile" - -if [ -f "${ODOO_WORK_DIR}/.env-shared" ]; then - if [ -f "${ODOO_WORK_DIR}/.env-default" ]; then - if [ -L "${ODOO_WORK_DIR}/.env-default" ]; then - . "${ODOO_WORK_DIR}/.env-shared" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-shared"!" && exit 1) - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.env-default to ${ODOO_WORK_DIR}/.env-default" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf "waftlib/templates/${ODOO_VERSION}/.env-default" - . "${ODOO_WORK_DIR}/.env-default" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-default"!" && exit 1) - . "${ODOO_WORK_DIR}/.env-shared" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-shared"!" && exit 1) +/bin/mkdir -p "${WORK_DIRECTORY}/config" +/bin/mkdir -p "${WORK_DIRECTORY}/addons" +/bin/mkdir -p "${WORK_DIRECTORY}/.ignore/odoo" +/bin/mkdir -p "${WORK_DIRECTORY}/.ignore/waft" +/bin/mkdir -p "${WORK_DIRECTORY}/logfiles" +/bin/mkdir -p "${WORK_DIRECTORY}/.python-files" +/bin/mkdir -p "${WORK_DIRECTORY}/scripts" +/bin/mkdir -p "${WORK_DIRECTORY}/.ignore/code" + +if [ -f "${WORK_DIRECTORY}/config/env-shared" ] ; then + if [ -f "${WORK_DIRECTORY}/config/env-default" ] ; then + if [ -L "${WORK_DIRECTORY}/config/env-default" ] ; then + . "${WORK_DIRECTORY}/config/env-shared" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-shared!" && exit 1) + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/env-default to ${WORK_DIRECTORY}/config/env-default ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/${ODOO_VERSION}/env-default" + . "${WORK_DIRECTORY}/config/env-default" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-default!" && exit 1) + . "${WORK_DIRECTORY}/config/env-shared" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-shared!" && exit 1) else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.env-default not a default link!" - . "${ODOO_WORK_DIR}/.env-default" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-default"!" && exit 1) - . "${ODOO_WORK_DIR}/.env-shared" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-shared"!" && exit 1) + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/env-default not the default link!" + . "${WORK_DIRECTORY}/config/env-default" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-default!" && exit 1) + . "${WORK_DIRECTORY}/config/env-shared" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-shared!" && exit 1) fi else - . "${ODOO_WORK_DIR}/.env-shared" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-shared"!" && exit 1) - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.env-default to ${ODOO_WORK_DIR}/.env-default" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf "waftlib/templates/${ODOO_VERSION}/.env-default" - . "${ODOO_WORK_DIR}/.env-default" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-default"!" && exit 1) - . "${ODOO_WORK_DIR}/.env-shared" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-shared"!" && exit 1) + . "${WORK_DIRECTORY}/config/env-shared" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-shared!" && exit 1) + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/env-default to ${WORK_DIRECTORY}/config/env-default ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/${ODOO_VERSION}/env-default" + . "${WORK_DIRECTORY}/config/env-default" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-default!" && exit 1) + . "${WORK_DIRECTORY}/config/env-shared" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-shared!" && exit 1) fi - if [ -f "${ODOO_WORK_DIR}/.env-secret" ]; then - . "${ODOO_WORK_DIR}/.env-secret" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-secret"!" && exit 1) + if [ -f "${WORK_DIRECTORY}/.env-secret" ] ; then + . "${WORK_DIRECTORY}/.env-secret" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/.env-secret!" && exit 1) else - /bin/echo "INFO: Copy ${ODOO_WORK_DIR}/waftlib/templates/.env-secret to ${ODOO_WORK_DIR}/." - /bin/cp "${ODOO_WORK_DIR}/waftlib/templates/.env-secret" "${ODOO_WORK_DIR}/" - . "${ODOO_WORK_DIR}/.env-secret" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-secret"!" && exit 1) + /bin/echo "( INFO ) : Copy ${WORK_DIRECTORY}/.ignore/waftlib/templates/.env-secret to ${WORK_DIRECTORY}/ ." + /bin/cp "${WORK_DIRECTORY}/.ignore/waftlib/templates/.env-secret" "${WORK_DIRECTORY}/config/" + . "${WORK_DIRECTORY}/.env-secret" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/.env-secret!" && exit 1) fi else - if [ -f "${ODOO_WORK_DIR}/.env-default" ]; then - ODOO_VERSION="$(/bin/ls -lha | /bin/grep "${ODOO_WORK_DIR}/.env-default" | /usr/bin/cut -d '/' -f3)" - . "${ODOO_WORK_DIR}/.env-default" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-default"!" && exit 1) + if [ -f "${WORK_DIRECTORY}/config/env-default" ] ; then + export ODOO_VERSION="$(/bin/ls -lha | /bin/grep "${WORK_DIRECTORY}/config/env-default" | /usr/bin/cut -d '/' -f3)" + . "${WORK_DIRECTORY}/config/env-default" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-default!" && exit 1) fi - if [ -f "${ODOO_WORK_DIR}/.env-secret" ]; then - . "${ODOO_WORK_DIR}/.env-secret" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-secret"!" && exit 1) + if [ -f "${WORK_DIRECTORY}/.env-secret" ] ; then + . "${WORK_DIRECTORY}/.env-secret" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/.env-secret!" && exit 1) else - /bin/echo "INFO: Copy ${ODOO_WORK_DIR}/waftlib/templates/.env-secret to ${ODOO_WORK_DIR}/." - /bin/cp "${ODOO_WORK_DIR}/waftlib/templates/.env-secret" "${ODOO_WORK_DIR}/" - . "${ODOO_WORK_DIR}/.env-secret" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-secret"!" && exit 1) + /bin/echo "( INFO ) : Copy ${WORK_DIRECTORY}/.ignore/waftlib/templates/.env-secret to ${WORK_DIRECTORY}/ ." + /bin/cp "${WORK_DIRECTORY}/.ignore/waftlib/templates/.env-secret" "${WORK_DIRECTORY}/config/" + . "${WORK_DIRECTORY}/.env-secret" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/.env-secret!" && exit 1) fi if [ "${ODOO_VERSION}" = '' ] ; then - /bin/echo "ERROR: You should define 'ODOO_VERSION' variable in "${ODOO_WORK_DIR}/.env-secret"." + /bin/echo "( ERROR ) : You should define 'ODOO_VERSION' variable in ${WORK_DIRECTORY}/.env-secret!" exit 1 else if [ "$(/bin/echo "${ODOO_VERSION}" | /bin/sed 's/^[0-9]\+'\.'[0-9]\+$//')" != '' ] ; then - /bin/echo "ERROR: 'ODOO_VERSION' does not a floating number!" + /bin/echo "( ERROR ) : 'ODOO_VERSION' is not a floating number!" exit 1 else - if [ ! -f "${ODOO_WORK_DIR}/.env-default" ] || [ -L "${ODOO_WORK_DIR}/.env-default" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.env-default to ${ODOO_WORK_DIR}/.env-default" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf "waftlib/templates/${ODOO_VERSION}/.env-default" + if [ ! -f "${WORK_DIRECTORY}/config/env-default" ] || [ -L "${WORK_DIRECTORY}/config/env-default" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/env-default to ${WORK_DIRECTORY}/config/env-default ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/${ODOO_VERSION}/env-default" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.env-default not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/env-default not the default link!" fi - /bin/echo "INFO: Copy ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.env-shared to ${ODOO_WORK_DIR}/." - /bin/cp "${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.env-shared" "${ODOO_WORK_DIR}/" - . "${ODOO_WORK_DIR}/.env-default" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-default"!" && exit 1) - . "${ODOO_WORK_DIR}/.env-shared" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-shared"!" && exit 1) - . "${ODOO_WORK_DIR}/.env-secret" || (/bin/echo "ERROR: Can't load "${ODOO_WORK_DIR}/.env-secret"!" && exit 1) + /bin/echo "( INFO ) : Copy ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/env-shared to ${WORK_DIRECTORY}/ ." + /bin/cp "${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/env-shared" "${WORK_DIRECTORY}/config/" + . "${WORK_DIRECTORY}/config/env-default" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-default!" && exit 1) + . "${WORK_DIRECTORY}/config/env-shared" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/config/env-shared!" && exit 1) + . "${WORK_DIRECTORY}/.env-secret" || (/bin/echo "( ERROR ) : Can't load ${WORK_DIRECTORY}/.env-secret!" && exit 1) fi fi fi if [ "${ODOO_VERSION}" = '' ] ; then - /bin/echo "ERROR: You should define 'ODOO_VERSION' variable in "${ODOO_WORK_DIR}/.env-secret"" + /bin/echo "( ERROR ) : You should define 'ODOO_VERSION' variable in ${WORK_DIRECTORY}/.env-secret!" exit 1 else if [ "$(/bin/echo "${ODOO_VERSION}" | /bin/sed 's/^[0-9]\+'\.'[0-9]\+$//')" != '' ] ; then - /bin/echo "ERROR: 'ODOO_VERSION' does not a floating number!" + /bin/echo "( ERROR ) : 'ODOO_VERSION' is not a floating number!" exit 1 fi fi -if [ "$(/bin/echo "${ODOO_VERSION}" | /usr/bin/cut -d'.' -f1)" -lt '8' ]; then - /bin/echo "ERROR: Waft does not support ${ODOO_VERSION} yet." +if [ "$(/bin/echo "${ODOO_VERSION}" | /usr/bin/cut -d'.' -f1)" -lt '8' ] ; then + /bin/echo "( ERROR ) : Waft does not support ${ODOO_VERSION} anymore!" exit 1 fi -if [ "$(/bin/echo ${ODOO_VERSION} | /usr/bin/cut -d'.' -f1)" -gt '17' ]; then - /bin/echo "ERROR: Waft does not support ${ODOO_VERSION} yet." +if [ "$(/bin/echo ${ODOO_VERSION} | /usr/bin/cut -d'.' -f1)" -gt '17' ] ; then + /bin/echo "( ERROR ) : Waft does not support ${ODOO_VERSION} yet!" exit 1 fi -if [ ! -f "${ODOO_WORK_DIR}/.python-version" ] || [ -L "${ODOO_WORK_DIR}/.python-version" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/.python-version to ${ODOO_WORK_DIR}/.python-version" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf "waftlib/templates/${ODOO_VERSION}/.python-version" +if [ ! -f "${WORK_DIRECTORY}/config/waft-python-version" ] || [ -L "${WORK_DIRECTORY}/config/waft-python-version" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/waft-python-version to ${WORK_DIRECTORY}/config/waft-python-version ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf ../.ignore/waftlib/templates/waft-python-version else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/.python-version not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/waft-python-version not the default link!" fi -if [ ! -f "${ODOO_WORK_DIR}/.python-version" ]; then - /bin/echo "ERROR: You should create .python-version variable file in ${ODOO_WORK_DIR}" +if [ ! -f "${WORK_DIRECTORY}/config/waft-python-version" ] ; then + /bin/echo "( ERROR ) : ${WORK_DIRECTORY}/config/waft-python-version should be a file or a link!" + exit 1 +fi + +if [ ! -f "${WORK_DIRECTORY}/config/python-version" ] || [ -L "${WORK_DIRECTORY}/config/python-version" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/python-version to ${WORK_DIRECTORY}/config/python-version ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/${ODOO_VERSION}/python-version" +else + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/python-version not the default link!" +fi +if [ ! -f "${WORK_DIRECTORY}/config/python-version" ] ; then + /bin/echo "( ERROR ) : ${WORK_DIRECTORY}/config/python-version should be a file or a link!" exit 1 fi # If user pre-installed a virtual-environment and .venv already exists, # we do not need pyenv to install python, nor do we need virtualenv, # instead the pre-installed version will be used. -if [ -d "${ODOO_WORK_DIR}/.venv" ]; then - /bin/echo "INFO: ${ODOO_WORK_DIR}/.venv exist!" +if [ -d "${WORK_DIRECTORY}/.waft-venv" ] ; then + /bin/echo "( INFO ) : ${WORK_DIRECTORY}/.waft-venv exist!" else - if [ -f "${ODOO_WORK_DIR}/.venv" ]; then - /bin/echo "ERROR: ${ODOO_WORK_DIR}/.venv not a directory!" + export CFLAGS="-O2" + if [ -f "${WORK_DIRECTORY}/.waft-venv" ] ; then + /bin/echo "( ERROR ) : ${WORK_DIRECTORY}/.waft-venv is not a directory!" exit 1 fi # Install pyenv - export CFLAGS="-O2" - export PYENV_ROOT="${ODOO_WORK_DIR}"/.pyenv - if [ -f "${ODOO_WORK_DIR}/.pyenv" ]; then - /bin/echo "ERROR: ${ODOO_WORK_DIR}/.pyenv not a directory!" + if [ -f "${WORK_DIRECTORY}/.ignore/waft/pyenv" ] ; then + /bin/echo "( ERROR ) : ${WORK_DIRECTORY}/.ignore/waft/pyenv is not a directory!" exit 1 fi - if [ ! -d "${ODOO_WORK_DIR}/.pyenv" ]; then - /bin/echo "INFO: Clone https://github.com/pyenv/pyenv in ${PYENV_ROOT}" - /usr/bin/git clone https://github.com/pyenv/pyenv "${PYENV_ROOT}" + /bin/rm -fr "${WORK_DIRECTORY}/.ignore/waft/.python-version" + cd "${WORK_DIRECTORY}/.ignore/waft" && /bin/ln -sf ../../config/waft-python-version .python-version + if [ ! -d "${WORK_DIRECTORY}/.ignore/waft/pyenv" ] ; then + /bin/echo "( INFO ) : Clone https://github.com/pyenv/pyenv in ${WORK_DIRECTORY}/.ignore/waft/pyenv ." + /usr/bin/git clone https://github.com/pyenv/pyenv "${WORK_DIRECTORY}/.ignore/waft/pyenv" else - /bin/echo "INFO: ${ODOO_WORK_DIR}/.pyenv exist! Upgrading to latest..." - cd "${PYENV_ROOT}" && /usr/bin/git checkout master && /usr/bin/git pull origin master && cd - || { /bin/echo 'Failed to upgrade pyenv'; exit 1; } + /bin/echo "( INFO ) : ${WORK_DIRECTORY}/.ignore/waft/pyenv exist! Upgrading to latest..." + cd "${WORK_DIRECTORY}/.ignore/waft/pyenv" && \ + /usr/bin/git checkout master && \ + /usr/bin/git pull origin master || (/bin/echo 'Failed to upgrade pyenv!'; exit 1) fi - PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}" - PYENV="${PYENV_ROOT}/bin/pyenv" - eval "$("${PYENV}" init -)" - "${PYENV}" install -s - - PYVERSION="$(python -V 2>&1 | /bin/sed 's/^Python //; s/\.[0-9]*$//')" - /bin/echo "Python version is ${PYVERSION}" - + cd "${WORK_DIRECTORY}/.ignore/waft" && \ + export PATH="${WORK_DIRECTORY}/.ignore/waft/pyenv/shims:${WORK_DIRECTORY}/.ignore/waft/pyenv/bin:${PATH}" && \ + eval "$("${WORK_DIRECTORY}/.ignore/waft/pyenv/bin/pyenv" init -)" && \ + "${WORK_DIRECTORY}/.ignore/waft/pyenv/bin/pyenv" install -s # Install virtualenv - VIRTUALENV="${PYENV_ROOT}/bin/virtualenv.pyz" - /bin/echo "INFO: Download ${VIRTUALENV}" - /usr/bin/wget --no-check-certificate "https://bootstrap.pypa.io/virtualenv/${PYVERSION}/virtualenv.pyz" -O "${VIRTUALENV}" || { /bin/echo 'Download of virtualenv package failed' ; exit 1; } - /bin/echo "INFO: Build virtual environment in ${ODOO_WORK_DIR}/.venv" - python "${VIRTUALENV}" .venv || { /bin/echo 'Virtualenv creation failed' ; exit 1; } + export PYTHON_SYSTEM_VERSIONN="$(python -V 2>&1 | /bin/sed 's/^Python //; s/\.[0-9]*$//')" + /bin/echo "( INFO ) : Python version is ${PYTHON_SYSTEM_VERSIONN}." + /bin/echo "( INFO ) : Download ${WORK_DIRECTORY}/.ignore/waft/pyenv/bin/virtualenv.pyz ." + /usr/bin/wget --no-check-certificate "https://bootstrap.pypa.io/virtualenv/${PYTHON_SYSTEM_VERSIONN}/virtualenv.pyz" -O "${WORK_DIRECTORY}/.ignore/waft/pyenv/bin/virtualenv.pyz" || \ + (/bin/echo '( ERROR ) : Download of virtualenv package failed.' ; exit 1) + /bin/echo "( INFO ) : Build virtual environment in ${WORK_DIRECTORY}/.waft-venv ." + cd "${WORK_DIRECTORY}/.ignore/waft" && python "${WORK_DIRECTORY}/.ignore/waft/pyenv/bin/virtualenv.pyz" "${WORK_DIRECTORY}/.waft-venv" || (/bin/echo '( ERROR ) : Virtualenv creation failed.' ; exit 1) fi -if [ ! -f "${ODOO_WORK_DIR}/build" ] || [ -L "${ODOO_WORK_DIR}/build" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/build to ${ODOO_WORK_DIR}/build" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/build -else - /bin/echo "WARNING: "${ODOO_WORK_DIR}/build" not a default link!" -fi +export PATH="${DEFAULT_PATH}" -for fiLe in $(/bin/ls -1 "${ODOO_WORK_DIR}/waftlib/build.d/"); do - if [ ! -f "${ODOO_WORK_DIR}/common/build.d/${fiLe}" ] || [ -L "${ODOO_WORK_DIR}/common/build.d/${fiLe}" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/build.d/${fiLe} to ${ODOO_WORK_DIR}/common/build.d/${fiLe}" - cd "${ODOO_WORK_DIR}/common/build.d" && /bin/ln -sf "../../waftlib/build.d/${fiLe}" - cd "${ODOO_WORK_DIR}" +if [ -d "${WORK_DIRECTORY}/.venv" ] ; then + /bin/echo "( INFO ) : ${WORK_DIRECTORY}/.venv exist!" +else + if [ -f "${WORK_DIRECTORY}/.venv" ] ; then + /bin/echo "( ERROR ) : ${WORK_DIRECTORY}/.venv is not a directory!" + exit 1 + fi + # Install pyenv + if [ -f "${WORK_DIRECTORY}/.ignore/odoo/pyenv" ] ; then + /bin/echo "( ERROR ) : ${WORK_DIRECTORY}/.ignore/odoo/pyenv is not a directory!" + exit 1 + fi + /bin/rm -fr "${WORK_DIRECTORY}/.ignore/odoo/.python-version" + cd "${WORK_DIRECTORY}/.ignore/odoo" && /bin/ln -sf ../../config/python-version .python-version + if [ ! -d "${WORK_DIRECTORY}/.ignore/odoo/pyenv" ] ; then + /bin/echo "( INFO ) : Clone https://github.com/pyenv/pyenv in ${WORK_DIRECTORY}/.ignore/odoo/pyenv ." + /usr/bin/git clone https://github.com/pyenv/pyenv "${WORK_DIRECTORY}/.ignore/odoo/pyenv" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/common/build.d/${fiLe} not a default link!" + /bin/echo "( INFO ) : ${WORK_DIRECTORY}/.ignore/odoo/pyenv exist! Upgrading to latest..." + cd "${WORK_DIRECTORY}/.ignore/odoo/pyenv" && \ + /usr/bin/git checkout master && \ + /usr/bin/git pull origin master || (/bin/echo '( ERROR ) : Failed to upgrade pyenv!'; exit 1) fi -done - -if [ ! -f "${ODOO_WORK_DIR}/common/build" ] || [ -L "${ODOO_WORK_DIR}/common/build" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/bin/direxec to ${ODOO_WORK_DIR}/common/build" - cd "${ODOO_WORK_DIR}/common" && /bin/ln -sf ../waftlib/bin/direxec build - cd "${ODOO_WORK_DIR}" -else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/common/build not a default link!" + cd "${WORK_DIRECTORY}/.ignore/odoo" && \ + export PATH="${WORK_DIRECTORY}/.ignore/odoo/pyenv/shims:${WORK_DIRECTORY}/.ignore/odoo/pyenv/bin:${PATH}" && \ + eval "$("${WORK_DIRECTORY}/.ignore/odoo/pyenv/bin/pyenv" init -)" && \ + "${WORK_DIRECTORY}/.ignore/odoo/pyenv/bin/pyenv" install -s + # Install virtualenv + export PYTHON_SYSTEM_VERSIONN="$(python -V 2>&1 | /bin/sed 's/^Python //; s/\.[0-9]*$//')" + /bin/echo "( INFO ) : Python version is ${PYTHON_SYSTEM_VERSIONN} ." + /bin/echo "( INFO ) : Download ${WORK_DIRECTORY}/.ignore/odoo/pyenv/bin/virtualenv.pyz ." + /usr/bin/wget --no-check-certificate "https://bootstrap.pypa.io/virtualenv/${PYTHON_SYSTEM_VERSIONN}/virtualenv.pyz" -O "${WORK_DIRECTORY}/.ignore/odoo/pyenv/bin/virtualenv.pyz" || \ + (/bin/echo '( ERROR ) : Download of virtualenv package failed.' ; exit 1) + /bin/echo "( INFO ) : Build virtual environment in ${WORK_DIRECTORY}/.venv ." + cd "${WORK_DIRECTORY}/.ignore/odoo" && python "${WORK_DIRECTORY}/.ignore/odoo/pyenv/bin/virtualenv.pyz" "${WORK_DIRECTORY}/.venv" || (/bin/echo '( ERROR ) : Virtualenv creation failed.' ; exit 1) fi -if [ ! -f "${ODOO_WORK_DIR}/common/conf.d/odoo.cfg" ] || [ -L "${ODOO_WORK_DIR}/common/conf.d/odoo.cfg" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/odoo.cfg to ${ODOO_WORK_DIR}/common/conf.d/odoo.cfg" - cd "${ODOO_WORK_DIR}/common/conf.d" && /bin/ln -sf "../../waftlib/templates/${ODOO_VERSION}/odoo.cfg" - cd "${ODOO_WORK_DIR}" -else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/common/conf.d/odoo.cfg not a default link!" -fi +export PATH="${DEFAULT_PATH}" -if [ ! -f "${ODOO_WORK_DIR}/common/conf.d/override-odoo.cfg" ]; then - /bin/echo "INFO: Copy ${ODOO_WORK_DIR}/waftlib/templates/override-odoo.cfg to ${ODOO_WORK_DIR}/common/conf.d/override-odoo.cfg" - /bin/cp "${ODOO_WORK_DIR}/waftlib/templates/override-odoo.cfg" "${ODOO_WORK_DIR}/common/conf.d/" +if [ ! -f "${WORK_DIRECTORY}/build" ] || [ -L "${WORK_DIRECTORY}/build" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/build to ${WORK_DIRECTORY}/build ." + cd "${WORK_DIRECTORY}" && /bin/ln -sf .ignore/waftlib/build +else + /bin/echo "( WARNING ) : "${WORK_DIRECTORY}/build" not the default link!" fi -for fiLe in $(/bin/ls -1 "${ODOO_WORK_DIR}/waftlib/entrypoint.d/"); do - if [ ! -f "${ODOO_WORK_DIR}/common/entrypoint.d/${fiLe}" ] || [ -L "${ODOO_WORK_DIR}/common/entrypoint.d/${fiLe}" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/entrypoint.d/${fiLe} to ${ODOO_WORK_DIR}/common/entrypoint.d/${fiLe}" - cd "${ODOO_WORK_DIR}/common/entrypoint.d" && /bin/ln -sf "../../waftlib/entrypoint.d/${fiLe}" - cd "${ODOO_WORK_DIR}" +for fiLe in $(/bin/ls -1 "${WORK_DIRECTORY}/.ignore/waftlib/scripts/"); do + if [ ! -f "${WORK_DIRECTORY}/scripts/${fiLe}" ] || [ -L "${WORK_DIRECTORY}/scripts/${fiLe}" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/scripts/${fiLe} to ${WORK_DIRECTORY}/scripts/${fiLe} ." + cd "${WORK_DIRECTORY}/scripts" && /bin/ln -sf "../.ignore/waftlib/scripts/${fiLe}" + cd "${WORK_DIRECTORY}" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/common/entrypoint.d/${fiLe} not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/scripts/${fiLe} not the default link!" fi done -if [ ! -f "${ODOO_WORK_DIR}/common/entrypoint" ] || [ -L "${ODOO_WORK_DIR}/common/entrypoint" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/bin/direxec to ${ODOO_WORK_DIR}/common/entrypoint" - cd "${ODOO_WORK_DIR}/common" && /bin/ln -sf ../waftlib/bin/direxec entrypoint - cd "${ODOO_WORK_DIR}" -else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/common/entrypoint not a default link!" -fi - -if [ ! -f "${ODOO_WORK_DIR}/custom/src/addons.yaml" ]; then - /bin/echo "INFO: Copy ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/addons.yaml to ${ODOO_WORK_DIR}/custom/src/addons.yaml" - /bin/cp "${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/addons.yaml" "${ODOO_WORK_DIR}/custom/src/" - cd "${ODOO_WORK_DIR}" -fi - -if [ ! -f "${ODOO_WORK_DIR}/custom/src/repos.yaml" ]; then - /bin/echo "INFO: Copy ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/repos.yaml to ${ODOO_WORK_DIR}/custom/src/repos.yaml" - /bin/cp "${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/repos.yaml" "${ODOO_WORK_DIR}/custom/src/" - cd "${ODOO_WORK_DIR}" -fi +for fiLe in $(/bin/ls -1 "${WORK_DIRECTORY}/.ignore/waftlib/.python-files/"); do + if [ ! -f "${WORK_DIRECTORY}/.python-files/${fiLe}" ] || [ -L "${WORK_DIRECTORY}/.python-files/${fiLe}" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/.python-files/${fiLe} to ${WORK_DIRECTORY}/.python-files/${fiLe} ." + cd "${WORK_DIRECTORY}/.python-files" && /bin/ln -sf "../.ignore/waftlib/.python-files/${fiLe}" + cd "${WORK_DIRECTORY}" + else + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/.python-files/${fiLe} not the default link!" + fi +done -if [ ! -f "${ODOO_WORK_DIR}/initial-database" ] || [ -L "${ODOO_WORK_DIR}/initial-database" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/initial-database to ${ODOO_WORK_DIR}/initial-database" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/initial-database +if [ ! -f "${WORK_DIRECTORY}/config/odoo-default.conf" ] || [ -L "${WORK_DIRECTORY}/config/odoo-default.conf" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/odoo-default.conf to ${WORK_DIRECTORY}/config/odoo-default.conf ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/${ODOO_VERSION}/odoo-default.conf" + cd "${WORK_DIRECTORY}" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/initial-database not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/odoo-default.conf not the default link!" fi -if [ ! -f "${ODOO_WORK_DIR}/install" ] || [ -L "${ODOO_WORK_DIR}/install" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/install to ${ODOO_WORK_DIR}/install" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/install -else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/install not a default link!" +if [ ! -f "${WORK_DIRECTORY}/config/odoo-override.conf" ] ; then + /bin/echo "( INFO ) : Copy ${WORK_DIRECTORY}/.ignore/waftlib/templates/odoo-override.conf to ${WORK_DIRECTORY}/config/override-default.conf ." + /bin/cp "${WORK_DIRECTORY}/.ignore/waftlib/templates/odoo-override.conf" "${WORK_DIRECTORY}/config/" fi -if [ ! -f "${ODOO_WORK_DIR}/odoo-service" ] || [ -L "${ODOO_WORK_DIR}/odoo-service" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/odoo-service to ${ODOO_WORK_DIR}/odoo-service" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/odoo-service -else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/odoo-service not a default link!" +if [ ! -f "${WORK_DIRECTORY}/config/code.yaml" ] ; then + /bin/echo "( INFO ) : Copy ${WORK_DIRECTORY}/.ignore/waftlib/templates/code.yaml to ${WORK_DIRECTORY}/config/code.yaml ." + /bin/cp "${WORK_DIRECTORY}/.ignore/waftlib/templates/code.yaml" "${WORK_DIRECTORY}/config/" + cd "${WORK_DIRECTORY}" fi -if [ -f "${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/requirements-remove-default.txt" ]; then - if [ ! -f "${ODOO_WORK_DIR}/requirements-remove-default.txt" ] || [ -L "${ODOO_WORK_DIR}/requirements-remove-default.txt" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/requirements-remove-default.txt to ${ODOO_WORK_DIR}/requirements-remove-default.txt" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf "waftlib/templates/${ODOO_VERSION}/requirements-remove-default.txt" +if [ -f "${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/requirements-clean.txt" ] ; then + if [ ! -f "${WORK_DIRECTORY}/config/requirements-clean.txt" ] || [ -L "${WORK_DIRECTORY}/config/requirements-clean.txt" ]; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/requirements-clean.txt to ${WORK_DIRECTORY}/config/requirements-clean.txt ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/${ODOO_VERSION}/requirements-clean.txt" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/requirements-remove-default.txt not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/requirements-clean.txt not the default link!" fi fi -if [ ! -f "${ODOO_WORK_DIR}/requirements-default.txt" ] || [ -L "${ODOO_WORK_DIR}/requirements-default.txt" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/templates/${ODOO_VERSION}/requirements-default.txt to ${ODOO_WORK_DIR}/requirements-default.txt" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf "waftlib/templates/${ODOO_VERSION}/requirements-default.txt" +if [ ! -f "${WORK_DIRECTORY}/config/requirements-install-default.txt" ] || [ -L "${WORK_DIRECTORY}/config/requirements-install-default.txt" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/${ODOO_VERSION}/requirements-install-default.txt to ${WORK_DIRECTORY}/config/requirements-install-default.txt ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/${ODOO_VERSION}/requirements-install-default.txt" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/requirements-default.txt not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/requirements-install-default.txt not the default link!" fi -if [ ! -f "${ODOO_WORK_DIR}/requirements.txt" ]; then - /bin/echo "INFO: Copy ${ODOO_WORK_DIR}/waftlib/templates/requirements.txt to ${ODOO_WORK_DIR}/." - /bin/cp "${ODOO_WORK_DIR}/waftlib/templates/requirements.txt" "${ODOO_WORK_DIR}/" +if [ ! -f "${WORK_DIRECTORY}/config/requirements-override-install.txt" ] ; then + /bin/echo "( INFO ) : Copy ${WORK_DIRECTORY}/.ignore/waftlib/templates/requirements-override-install.txt to ${WORK_DIRECTORY}/ ." + /bin/cp "${WORK_DIRECTORY}/.ignore/waftlib/templates/requirements-override-install.txt" "${WORK_DIRECTORY}/config/" fi -if [ ! -f "${ODOO_WORK_DIR}/run" ] || [ -L "${ODOO_WORK_DIR}/run" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/run to ${ODOO_WORK_DIR}/run" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/run -else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/run not a default link!" +if [ -f "${WORK_DIRECTORY}/.ignore/waftlib/templates/waft-requirements-pre-install-default.txt" ] ; then + if [ ! -f "${WORK_DIRECTORY}/config/waft-requirements-pre-install-default.txt" ] || [ -L "${WORK_DIRECTORY}/config/waft-requirements-pre-install-default.txt" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/waft-requirements-pre-install-default.txt to ${WORK_DIRECTORY}/config/waft-requirements-pre-install-default.txt ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf "../.ignore/waftlib/templates/waft-requirements-pre-install-default.txt" + else + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/waft-requirements-pre-install-default.txt not the default link!" + fi fi -if [ ! -f "${ODOO_WORK_DIR}/shell" ] || [ -L "${ODOO_WORK_DIR}/shell" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/shell to ${ODOO_WORK_DIR}/shell" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/shell +if [ ! -f "${WORK_DIRECTORY}/config/waft-requirements-install-default.txt" ] || [ -L "${WORK_DIRECTORY}/config/waft-requirements-install-default.txt" ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/templates/waft-requirements-install-default.txt to ${WORK_DIRECTORY}/config/waft-requirements-install-default.txt ." + cd "${WORK_DIRECTORY}/config" && /bin/ln -sf ../.ignore/waftlib/templates/waft-requirements-install-default.txt else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/shell not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/config/waft-requirements-install-default.txt not the default link!" fi -if [ ! -f "${ODOO_WORK_DIR}/translate-modules" ] || [ -L "${ODOO_WORK_DIR}/translate-modules" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/translate-modules to ${ODOO_WORK_DIR}/translate-modules" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/translate-modules +cd "${WORK_DIRECTORY}/.waft-venv/lib/"*"/site-packages" && /bin/mkdir -p venvwaftlib +cd "${WORK_DIRECTORY}" +if [ ! -f "${WORK_DIRECTORY}/.waft-venv/lib/"*/site-packages/venvwaftlib/__init__.py ] || [ -L "${WORK_DIRECTORY}/.waft-venvt/lib/"*/site-packages/venvwaftlib/__init__.py ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/waftlib/venvwaftlib/__init__.py to ${WORK_DIRECTORY}/.waft-venv/lib/*/site-packages/venvwaftlib/__init__.py ." + cd "${WORK_DIRECTORY}/.waft-venv/lib/"*"/site-packages/venvwaftlib" && /bin/ln -sf ../../../../../.ignore/waftlib/venvwaftlib/__init__.py + cd "${WORK_DIRECTORY}" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/translate-modules not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/.venv/lib/*/site-packages/venvwaftlib/__init__.py not the default link!" fi -if [ ! -f "${ODOO_WORK_DIR}/upgrade" ] || [ -L "${ODOO_WORK_DIR}/upgrade" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/upgrade to ${ODOO_WORK_DIR}/upgrade" - cd "${ODOO_WORK_DIR}" && /bin/ln -sf waftlib/upgrade +cd "${WORK_DIRECTORY}/.venv/lib/"*"/site-packages" && /bin/mkdir -p venvodoolib +if [ ! -f "${WORK_DIRECTORY}/.venv/lib/"*/site-packages/venvodoolib/__init__.py ] || [ -L "${WORK_DIRECTORY}/.venv/lib/"*/site-packages/venvodoolib/__init__.py ] ; then + /bin/echo "( INFO ) : Link ${WORK_DIRECTORY}/.ignore/odoolib/venvodoolib/__init__.py to ${WORK_DIRECTORY}/.venv/lib/*/site-packages/venvodoolib/__init__.py ." + cd "${WORK_DIRECTORY}/.venv/lib/"*"/site-packages/venvodoolib" && /bin/ln -sf ../../../../../.ignore/waftlib/venvodoolib/__init__.py + cd "${WORK_DIRECTORY}" else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/upgrade not a default link!" + /bin/echo "( WARNING ) : ${WORK_DIRECTORY}/.venv/lib/*/site-packages/venvodoolib/__init__.py not the default link!" fi -for fiLe in $(/bin/ls -1 "${ODOO_WORK_DIR}/waftlib/bin/"); do - if [ ! -f "${ODOO_WORK_DIR}/.venv/bin/${fiLe}" ] || [ -L "${ODOO_WORK_DIR}/.venv/bin/${fiLe}" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/bin/${fiLe} to ${ODOO_WORK_DIR}/.venv/bin/${fiLe}" - cd "${ODOO_WORK_DIR}/.venv/bin" && /bin/ln -sf "../../waftlib/bin/${fiLe}" - cd "${ODOO_WORK_DIR}" - else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/.venv/bin/${fiLe} not a default link!" - fi -done -/bin/rm -fr "${ODOO_WORK_DIR}/.venv/bin/direxec" - -cd "${ODOO_WORK_DIR}/.venv/lib/"*"/site-packages" && /bin/mkdir -p waftlib -cd "${ODOO_WORK_DIR}" -for fiLe in $(/bin/ls -1 "${ODOO_WORK_DIR}/waftlib/waftlib/"); do - if [ ! -f "${ODOO_WORK_DIR}/.venv/lib/"*"/site-packages/waftlib/${fiLe}" ] || [ -L "${ODOO_WORK_DIR}/.venv/lib/"*"/site-packages/waftlib/${fiLe}" ]; then - /bin/echo "INFO: Link ${ODOO_WORK_DIR}/waftlib/waftlib/${fiLe} to ${ODOO_WORK_DIR}/.venv/lib/"*"/site-packages/waftlib/${fiLe}" - cd "${ODOO_WORK_DIR}/.venv/lib/"*"/site-packages/waftlib" && /bin/ln -sf "../../../../../waftlib/waftlib/${fiLe}" - cd "${ODOO_WORK_DIR}" - else - /bin/echo "WARNING: ${ODOO_WORK_DIR}/.venv/lib/"*"/site-packages/waftlib/${fiLe} not a default link!" - fi -done - # set permissions -/bin/echo "INFO: Fix files permissions" -/bin/chmod 750 "${ODOO_WORK_DIR}" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/auto" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/auto/addons" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/bootstrap" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/build" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/common" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/common/conf.d" || true -/bin/chmod -f 640 "${ODOO_WORK_DIR}/common/conf.d/odoo.cfg" || true -/bin/chmod -f 640 "${ODOO_WORK_DIR}/common/conf.d/override-odoo.cfg" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/common/entrypoint.d" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/common/entrypoint.d/"* || true -/bin/chmod 750 "${ODOO_WORK_DIR}/common/build.d" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/common/build.d/"* || true -/bin/chmod 750 "${ODOO_WORK_DIR}/custom" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/custom/src" || true -/bin/chmod -f 640 "${ODOO_WORK_DIR}/custom/src/addons.yaml" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/custom/src/private/" || true -/bin/chmod -f 640 "${ODOO_WORK_DIR}/custom/src/repos.yaml" || true -/bin/chmod -f 600 "${ODOO_WORK_DIR}/.env-default" || true -/bin/chmod -f 600 "${ODOO_WORK_DIR}/.env-shared" || true -/bin/chmod -f 600 "${ODOO_WORK_DIR}/.env-secret" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/initial-database" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/install" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/odoo-service" || true -/bin/chmod 640 "${ODOO_WORK_DIR}/.python-version" || true -/bin/chmod 640 "${ODOO_WORK_DIR}/requirements-default.txt" || true -/bin/chmod 640 "${ODOO_WORK_DIR}/requirements.txt" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/run" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/bin" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/waftlib/bin/"* || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/build" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/initial-database" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/install" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/odoo-service" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/run" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/shell" || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/upgrade" || true -/bin/chmod 640 "${ODOO_WORK_DIR}/waftlib/templates/"* || true -/bin/chmod 740 "${ODOO_WORK_DIR}/waftlib/templates/"*.0 || true -/bin/chmod 640 "${ODOO_WORK_DIR}/waftlib/templates/"*/* || true -/bin/chmod 750 "${ODOO_WORK_DIR}/waftlib/waftlib" || true -/bin/chmod 740 "${ODOO_WORK_DIR}/waftlib/waftlib/"* || true -/bin/echo "INFO: END of bootstrap ${ODOO_WORK_DIR}/script" +/bin/echo "( INFO ) : Fix files permissions." +/bin/chmod -f 700 "${WORK_DIRECTORY}" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/config" +/bin/chmod -f 600 "${WORK_DIRECTORY}/config/"* || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.ignore" +/bin/chmod -f 700 "${WORK_DIRECTORY}/logfiles" +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files" +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files/addons-install" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files/waft-addons-link" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files/waft-code-aggregate" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files/waft-code-clean" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files/waft-conf-generate" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files/waft-code-pre-clean" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.python-files/modules-translate" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/scripts" +/bin/chmod -f 700 "${WORK_DIRECTORY}/scripts/"* || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/.ignore/code" +/bin/chmod -f 700 "${WORK_DIRECTORY}/bootstrap" || /bin/true +/bin/chmod -f 700 "${WORK_DIRECTORY}/build" || /bin/true +/bin/chmod -f 600 "${WORK_DIRECTORY}/.gitignore" || /bin/true +/bin/echo "( INFO ) : END of ${WORK_DIRECTORY}/bootstrap script." diff --git a/build b/build index 5355006..f68c63d 100755 --- a/build +++ b/build @@ -1,34 +1,46 @@ #!/bin/sh -# Version: v.22.05.30 +# Version: v.23.08.03 -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" +set -e -if [ "$(id -u)" -eq 0 ]; then - /bin/echo "Please dont use sudo command with script" +if [ "$(/bin/id -u)" -eq 0 ] ; then + /bin/echo "( ERROR ) : Please refrain from using the sudo command with the script." exit 1 fi -#rm -fr ./auto/odoo.conf -#rm -fr ./auto/addons/* -#/bin/bash -c "$(/bin/ls -1 ./custom/src | grep -Ev 'private|repos.yaml|addons.yaml' | /usr/bin/awk '{print("rm -fr ./custom/src/" $1)}')" +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="${SCRIPT_PATH}" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +#rm -fr ./config/odoo.conf +#rm -fr ./addons/* +#/bin/bash -c "$(/bin/ls -1 ./custom/src | grep -Ev 'private|code.yaml' | /usr/bin/awk '{print("rm -fr ./custom/src/" $1)}')" + +if [ ! -d "${WORK_DIRECTORY}/.venv" ] ; then + /bin/echo '( ERROR ) : run ./bootstrap first!' + exit 1 +fi -if [ ! -d "${ODOO_WORK_DIR}/.venv" ]; then - /bin/echo 'run ./bootstrap first!' +if [ ! -d "${WORK_DIRECTORY}/.waft-venv" ] ; then + /bin/echo '( ERROR ) : run ./bootstrap first!' exit 1 fi -# pip 20.3 has a neat depenency resolver -# https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020 -. .venv/bin/activate && \ -pip install --quiet "setuptools<58" && \ -pip install --quiet "pip>=20.3" && \ -(pip uninstall --yes -r "${ODOO_WORK_DIR}/requirements-remove-default.txt" 2>/dev/null || /bin/true) && \ -pip install --quiet --exists-action w -r "${ODOO_WORK_DIR}/requirements-default.txt" && \ -pip install --quiet --exists-action w -r "${ODOO_WORK_DIR}/requirements.txt" && \ -"${ODOO_WORK_DIR}/common/build" && \ -python "${ODOO_WORK_DIR}/common/entrypoint" +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/waft-requirements-install' script." && \ +"${WORK_DIRECTORY}/scripts/waft-requirements-install" && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/requirements-install' script." && \ +"${WORK_DIRECTORY}/scripts/requirements-install" && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/waft-build' script." && \ +"${WORK_DIRECTORY}/scripts/waft-build" && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/waft-code-compile' script." && \ +"${WORK_DIRECTORY}/scripts/waft-code-compile" && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/code-install' script." && \ +"${WORK_DIRECTORY}/scripts/code-install" && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/waft-database-postgresql-wait' script." && \ +"${WORK_DIRECTORY}/scripts/waft-database-postgresql-wait" && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/waft-database-unaccent-install' script." && \ +"${WORK_DIRECTORY}/scripts/waft-database-unaccent-install" && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/build' script: Running '${WORK_DIRECTORY}/scripts/waft-addons-link' script." && \ diff --git a/build.d/050-pre-clean b/build.d/050-pre-clean deleted file mode 100755 index a373a50..0000000 --- a/build.d/050-pre-clean +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -import os -import shutil -import sys -import yaml - -from dotenv import load_dotenv -from subprocess import check_call - -from waftlib import ODOO_DIR, PRIVATE_DIR, SRC_DIR, addons_config, logger, REPOS_YAML - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -repos = set([ODOO_DIR]) -with open(REPOS_YAML) as yaml_file: - for doc in yaml.safe_load_all(yaml_file): - for repo in doc: - repos.add(os.path.abspath(os.path.join(SRC_DIR, repo))) - -for directory in repos: - print(directory) - if not os.path.isdir(directory): - continue - if not os.path.isdir(os.path.join(directory, '.git')): - shutil.rmtree(directory) - continue - if not os.path.isdir(os.path.join(directory, '.git/refs')): - shutil.rmtree(directory) - continue - if not os.path.isdir(os.path.join(directory, '.git/objects')): - shutil.rmtree(directory) - continue - try: - check_call( - [ - "git", - "-C", - directory, - "reset", - "--hard", - "HEAD", - ], - cwd=SRC_DIR, - stderr=sys.stderr, - stdout=sys.stdout, - ) - check_call( - [ - "git", - "-C", - directory, - "clean", - "-fd", - ], - cwd=SRC_DIR, - stderr=sys.stderr, - stdout=sys.stdout, - ) - except: - shutil.rmtree(directory) diff --git a/build.d/100-repos-aggregate b/build.d/100-repos-aggregate deleted file mode 100755 index 744aa0c..0000000 --- a/build.d/100-repos-aggregate +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 - -set -e - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -exec autoaggregate diff --git a/build.d/400-clean b/build.d/400-clean deleted file mode 100755 index 5bfb091..0000000 --- a/build.d/400-clean +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -import os -import shutil -import sys - -from dotenv import load_dotenv - -from waftlib import WAFT_CLEAN, ODOO_DIR, PRIVATE_DIR, SRC_DIR, addons_config, logger - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -# Get the enabled paths -repos_addons = {} -for addon, repo in addons_config(filtered=False): - repo_path = os.path.realpath(os.path.join(SRC_DIR, repo)) - repos_addons.setdefault(repo_path, set()) - repos_addons[repo_path].add(addon) -logger.debug("Addon paths enabled: %s", repos_addons) - -# Traverse src dir and remove anything not explicitly enabled -for directory, subdirectories, subfiles in os.walk(SRC_DIR): - logger.debug("Checking for cleanup directory %s", directory) - # Skip main src directory - if directory == SRC_DIR: - continue - # Always skip private/* - if directory == PRIVATE_DIR: - subdirectories[:] = [] - continue - # Leave .git directories unless we are really CLEAN-ing - if directory.endswith("/.git") and not WAFT_CLEAN: - subdirectories[:] = [] - continue - # Leave .github directories unless we are really CLEAN-ing - if directory.endswith("/.github") and not WAFT_CLEAN: - subdirectories[:] = [] - continue - # Leave '__xxxxxxx__' folders unless we are really CLEAN-ing - if directory.endswith("__") and not WAFT_CLEAN: - subdirectories[:] = [] - continue - # Leave 'setup' directories unless we are really CLEAN-ing - if directory.endswith("/setup") and not WAFT_CLEAN: - subdirectories[:] = [] - continue - # Inside the odoo dir, skip all but addons dir - if directory == ODOO_DIR: - subdirectories[:] = ["addons"] - continue - try: - # Get addons enabled in current directory - enabled_addons = repos_addons[directory] - except KeyError: - # This isn't a repo; is there anything inside to preserve? - directory += os.path.sep - if any(repo.startswith(directory) for repo in repos_addons): - # Then, let's walk in; we'll remove later if needed - continue - else: - if not WAFT_CLEAN: - continue - else: - # This is an addons repo; do not walk into the enabled ones - for addon in enabled_addons: - subdirectories.remove(addon) - continue - # Remove every other directory - logger.info("Removing directory %s", directory) - shutil.rmtree(directory) diff --git a/build.d/500-compile b/build.d/500-compile deleted file mode 100755 index f267d14..0000000 --- a/build.d/500-compile +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 -set -e - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -if [ "${WAFT_COMPILE}" != true ]; then - log WARNING Not compiling Python code - exit 0 -fi - -log INFO Compiling all Python code in "${ODOO_WORK_DIR}" -python -m compileall -q "${ODOO_WORK_DIR}/custom" diff --git a/build.d/700-odoo-install b/build.d/700-odoo-install deleted file mode 100755 index 891820c..0000000 --- a/build.d/700-odoo-install +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 -set -e - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -src="${ODOO_WORK_DIR}/custom/src/odoo" -log INFO Installing Odoo from "${src}" - -# Odoo v8 dependencies could crash at install, so we don't use them -if [ "${ODOO_VERSION}" == "8.0" ]; then - pip install --no-cache-dir --no-deps --editable "${src}" -else - pip install --no-cache-dir --editable "${src}" -fi - -# Make version 8.0 and 9.0 have an `odoo` executable -if [ "${ODOO_VERSION}" == "8.0" -o "${ODOO_VERSION}" == "9.0" ]; then - /bin/rm -fr "${ODOO_WORK_DIR}/.venv/bin/odoo" - /bin/ln -s "${ODOO_WORK_DIR}/.venv/bin/odoo.py" "${ODOO_WORK_DIR}/.venv/bin/odoo" -fi diff --git a/entrypoint.d/20-postgres-wait b/entrypoint.d/20-postgres-wait deleted file mode 100755 index a6f3ae6..0000000 --- a/entrypoint.d/20-postgres-wait +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -if [ "${WAFT_WAIT_DB}" != true ]; then - log INFO Not waiting for a postgres server - exit 0 -fi - -log INFO Waiting until postgres is listening at "${PGHOST}"... -while true; do - /usr/bin/psql --list > /dev/null 2>&1 && break - sleep 1 -done diff --git a/entrypoint.d/30-unaccent-install b/entrypoint.d/30-unaccent-install deleted file mode 100755 index c79ced6..0000000 --- a/entrypoint.d/30-unaccent-install +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -if [ "${ODOO_UNACCENT}" == true ]; then - result="$(/usr/bin/psql -qc 'CREATE EXTENSION IF NOT EXISTS unaccent' 2>&1)" - ok="${?}" - if [ "${ok}" -eq 0 -a -z "${result}" ]; then - log INFO Unaccent extension installed - elif [ "${ok}" -ne 0 ]; then - log WARNING Attempt to install unaccent in "${PGDATABASE}@${PGHOST}" failed with this message: "${result}" - fi -fi diff --git a/entrypoint.d/40-addons-link b/entrypoint.d/40-addons-link deleted file mode 100755 index 637d836..0000000 --- a/entrypoint.d/40-addons-link +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# Version: v.22.05.30 -# -*- coding: utf-8 -*- -import os -from dotenv import load_dotenv -from glob import iglob - -from waftlib import ADDONS_DIR, ADDONS_YAML, SRC_DIR, addons_config, logger - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -logger.info("Linking all addons from %s in %s", ADDONS_YAML, ADDONS_DIR) - -# Remove all links in addons dir -for link in iglob(os.path.join(ADDONS_DIR, "*")): - os.remove(link) -# Add new links -for addon, repo in addons_config(): - src = os.path.relpath(os.path.join(SRC_DIR, repo, addon), ADDONS_DIR) - dst = os.path.join(ADDONS_DIR, addon) - os.symlink(src, dst) - logger.debug("Linked %s in %s", src, dst) diff --git a/entrypoint.d/50-config-generate b/entrypoint.d/50-config-generate deleted file mode 100755 index 6d72ed1..0000000 --- a/entrypoint.d/50-config-generate +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="$(cd "${SCRIPT_PATH}/../.." && /bin/pwd)" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -log INFO Generating "${OPENERP_SERVER}" file. Overriding any existing... - -config-generate diff --git a/initial-database b/initial-database deleted file mode 100755 index 9710cca..0000000 --- a/initial-database +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -. .venv/bin/activate && odoo -i base -c ./auto/odoo.conf --without-demo=all --stop-after-init diff --git a/install b/install deleted file mode 100755 index 530990d..0000000 --- a/install +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# Version: v.22.05.30 - -set -e - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -if [ "${#}" -le 1 ]; then - /bin/echo "Installs a new empty database" - /bin/echo "Usage: ./install databasename modulename [nodemo]" - exit -fi - -if [ "${3}" = "nodemo" ] -then - WITHOUT_DEMO="--without-demo=1" - /bin/echo "Without demo data" -else - WITHOUT_DEMO="--without-demo=" - /bin/echo "With demo data" -fi - -if [ "$(/usr/bin/psql -d template1 -tAc "SELECT 1 FROM pg_database WHERE datname='${1}'" )" = '1' ] -then - /bin/echo "Database '${1}' already exists. If you want to drop it: 'dropdb ${1}'" - exit 1 -else - createdb "${1}" -fi - -cd "${ODOO_WORK_DIR}" && . .venv/bin/activate && odoo \ - -c ./auto/odoo.conf \ - --load-language=en_US,nl_NL \ - -i "${2}" \ - -d "${1}" \ - --stop-after-init \ - "${WITHOUT_DEMO}" diff --git a/migrate b/migrate deleted file mode 100755 index 8252fdc..0000000 --- a/migrate +++ /dev/null @@ -1,356 +0,0 @@ -#!/bin/bash -# Version: v.22.05.30 - -exit 0 - -################################################################ -###### ###### -###### Don't change variables after this line ###### -###### ###### -################################################################ - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -ODOO_MAIN_WORK_DIR="${SCRIPT_PATH}" -cd "${ODOO_WORK_DIR}" -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -ODOO_EXIST_VERSION="${ODOO_VERSION}" - -ODOO_DESTINATION_VERSION="${ODOO_DESTINATION_VERSION:-$(("$(/bin/echo "${ODOO_VERSION}" | /usr/bin/cut -d'.' -f1)" + 1)).0}" -BACKUP_BEFORE_MIGRATION="${BACKUP_BEFORE_MIGRATION:-true}" -RUN_MIGRATION_DEFAULT_SCRIPT="${RUN_MIGRATION_DEFAULT_SCRIPT:-true}" - -if [ -f "${ODOO_WORK_DIR}/.env-migrate" ]; then - . "${ODOO_WORK_DIR}/.env-migrate" -fi - -ODOO_START_FROM_VERSION="${ODOO_VERSION}" - -if [ "$(/bin/echo "${ODOO_START_FROM_VERSION}" | /usr/bin/cut -d'.' -f1)" -lt '8' ]; then - /bin/echo "Waft does not support migration from ${ODOO_START_FROM_VERSION}" - exit 1 -fi - -if [ "$(/bin/echo "${ODOO_START_FROM_VERSION}" | /usr/bin/cut -d'.' -f1)" -ge '14' ]; then - /bin/echo "Waft does not support migration from "${ODOO_START_FROM_VERSION}" yet" - exit 1 -fi - -if [ "${ODOO_DESTINATION_VERSION}" == "" ]; then - /bin/echo "ODOO_DESTINATION_VERSION variable should be defined" -else - if [ ! -n "$(/bin/echo "${ODOO_DESTINATION_VERSION}" | /usr/bin/cut -d'.' -f1)" ]; then - /bin/echo "ODOO_DESTINATION_VERSION variable should be a number xx.x" - exit 1 - else - if [ "$(/bin/echo "${ODOO_DESTINATION_VERSION}" | /usr/bin/cut -d'.' -f1)" -gt '14' ]; then - /bin/echo "Waft does not support migration to ${ODOO_DESTINATION_VERSION} yet" - exit 1 - else - if [ "$(/bin/echo "${ODOO_START_FROM_VERSION}" | /usr/bin/cut -d'.' -f1)" -ge "$(/bin/echo "${ODOO_DESTINATION_VERSION}" | /usr/bin/cut -d'.' -f1)" ]; then - /bin/echo "ODOO_DESTINATION_VERSION variable should be greater than ODOO_START_FROM_VERSION variable" - exit 1 - fi - fi - fi -fi - -if [ ! -f "${ODOO_WORK_DIR}/.slide" ]; then - /bin/echo "this script will migrate your odoo from ${ODOO_START_FROM_VERSION} to ${ODOO_DESTINATION_VERSION}, if you are sure please touch ${ODOO_WORK_DIR}/.slide file and run ${ODOO_WORK_DIR}/migrate script again" - /bin/echo "/usr/bin/touch ${ODOO_WORK_DIR}/.slide" - /bin/echo "${ODOO_WORK_DIR}/migrate" - exit 1 -else - /bin/rm -fr "${ODOO_WORK_DIR}/.slide" -fi - -if [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" != 'true' ] && [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" != 'TRUE' ] && [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" != 'True' ] ; then - if [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" != 'false' ] || [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" != 'FALSE' ] || [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" != 'False' ] ; then - eval RUN_MIGRATION_DEFAULT_SCRIPT='false' - else - /bin/echo "RUN_MIGRATION_DEFAULT_SCRIPT variable should be true or false" - exit 1 - fi -else - if [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" == 'true' ] || [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" == 'TRUE' ] || [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" == 'True' ] ; then - eval RUN_MIGRATION_DEFAULT_SCRIPT='true' - else - /bin/echo "RUN_MIGRATION_DEFAULT_SCRIPT variable should be true or false" - exit 1 - fi -fi - -if [ "$(/bin/echo "${ODOO_EXIST_VERSION}" | /usr/bin/cut -d'.' -f1)" -eq "$(/bin/echo "${ODOO_START_FROM_VERSION}" | /usr/bin/cut -d'.' -f1)" ]; then - if [ "${BACKUP_BEFORE_MIGRATION}" != 'true' ] && [ "${BACKUP_BEFORE_MIGRATION}" != 'TRUE' ] && [ "${BACKUP_BEFORE_MIGRATION}" != 'True' ] ; then - if [ "${BACKUP_BEFORE_MIGRATION}" != 'false' ] || [ "${BACKUP_BEFORE_MIGRATION}" != 'FALSE' ] || [ "${BACKUP_BEFORE_MIGRATION}" != 'False' ] ; then - eval BACKUP_BEFORE_MIGRATION='false' - else - /bin/echo "BACKUP_BEFORE_MIGRATION variable should be true or false" - exit 1 - fi - else - if [ "${BACKUP_BEFORE_MIGRATION}" == 'true' ] || [ {${BACKUP_BEFORE_MIGRATION}} == 'TRUE' ] || [ "${BACKUP_BEFORE_MIGRATION}" == 'True' ] ; then - eval BACKUP_BEFORE_MIGRATION='true' - else - /bin/echo "BACKUP_BEFORE_MIGRATION variable should be true or false" - exit 1 - fi - fi -fi - -/bin/mkdir -p "${ODOO_WORK_DIR}/migrate-logfiles" -if [ -f "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" ] ; then - if [ -f "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.1" ] ; then - if [ -f "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.2" ] ; then - if [ -f "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.3" ] ; then - if [ -f "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.4" ] ; then - if [ -f "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.5" ] ; then - if [ -f "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.6" ] ; then - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.6" - fi - /bin/mv "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.5" "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.6" - fi - /bin/mv "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.4" "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.5" - fi - /bin/mv "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.3" "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.4" - fi - /bin/mv "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.2" "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.3" - fi - /bin/mv "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.1" "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.2" - fi - /bin/mv "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" "${ODOO_WORK_DIR}/migrate-logfiles/migration.log.1" -fi -/usr/bin/touch "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" - -newline() { - printf %${1}s | tr " " "\n" -} - -logexec() { - newline 4 >> "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" - /bin/echo "${@}" >> "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" - "${@}" >> "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" 2>&1 -} - -/usr/bin/sudo /bin/systemctl stop monit || True -/usr/bin/sudo /bin/systemctl stop odoo || True - -CURRENTLY_DATE_STRING="$(/bin/date "+%d-%H-%M-%S")" - -if [ "$(/bin/echo "${ODOO_EXIST_VERSION}" | /usr/bin/cut -d'.' -f1)" -eq "$(/bin/echo "${ODOO_START_FROM_VERSION}" | /usr/bin/cut -d'.' -f1)" ] ; then - if [ "${BACKUP_BEFORE_MIGRATION}" == 'true' ] ; then - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-backup" - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/code" - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/filestore" - for DATA in $(/bin/ls -1a "${ODOO_WORK_DIR}/") ; do - if [ "${DATA}" != '.' ] && [ "${DATA}" != '..' ] && [ "${DATA}" != '.env-secret' ] && [ "${DATA}" != '.git' ] && [ "${DATA}" != '.gitignore' ] && [ "${DATA}" != 'migrate-backup' ] && [ "${DATA}" != 'migrate-logfiles' ] && [ "${DATA}" != 'migrate-templates' ] && [ "${DATA}" != 'migrate-temporary' ] && [ "${DATA}" != 'waftlib' ] ; then - logexec /bin/cp -rp "${ODOO_WORK_DIR}/${DATA}" "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/code/" || exit 1 - fi - - done - logexec /bin/cp -rp "${HOME}/.local/share/Odoo/filestore/${PGDATABASE}" "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/filestore/" || exit 1 - /bin/echo -e "\n\n\n\n/usr/bin/pg_dump" >> "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" - /bin/echo "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" >> "${ODOO_WORK_DIR}/migrate-logfiles/migration.log" - /usr/bin/pg_dump "${PGDATABASE}" -O -x > "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/${PGDATABASE}.sql" || exit 1 - fi -fi - -errors_deal() { - if [ "$(/bin/echo "${ODOO_EXIST_VERSION}" | /usr/bin/cut -d'.' -f1)" -eq "$(/bin/echo "${ODOO_START_FROM_VERSION}" | /usr/bin/cut -d'.' -f1)" ]; then - if [ "${BACKUP_BEFORE_MIGRATION}" == 'true' ] ; then - for DATA in $(/bin/ls -1a "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/code/") ; do - if [ "${DATA}" != '.' ] && [ "${DATA}" != '..' ] ; then - /bin/rm -fr "${ODOO_WORK_DIR}/${DATA}" - logexec /bin/mv "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/code/${DATA}" "${ODOO_WORK_DIR}/" - fi - done - if [ -d "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/filestore/${PGDATABASE}" ]; then - /bin/rm -fr "${HOME}/.local/share/Odoo/filestore/${PGDATABASE}" - logexec /bin/mv "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/filestore/${PGDATABASE}" "${HOME}/.local/share/Odoo/filestore/" - fi - if [ -f "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/${PGDATABASE}.sql" ]; then - /usr/bin/dropdb "${PGDATABASE}" - logexec /usr/bin/psql "${PGDATABASE}" < "${ODOO_WORK_DIR}/migrate-backup/${ODOO_START_FROM_VERSION}-${CURRENTLY_DATE_STRING}/${PGDATABASE}.sql" - fi - if [ "$(/bin/echo "${ODOO_EXIST_VERSION}" | /usr/bin/cut -d'.' -f1)" -ne "$(/bin/echo "${ODOO_DESTINATION_VERSION}" | /usr/bin/cut -d'.' -f1)" ]; then - logexec /bin/sed -i 's|^ODOO_VERSION=.*|ODOO_VERSION="'${ODOO_EXIST_VERSION}'"|g' "${ODOO_WORK_DIR}/.env-secret" - fi - fi - fi - logexec /usr/bin/sudo /bin/systemctl start odoo || True - logexec /usr/bin/sudo /bin/systemctl start monit || True - exit 1 -} - -trap 'errors_deal' ERR - -/bin/mkdir -p "${ODOO_WORK_DIR}/migrate-temporary" - -MIGRATION_TEMPORARY_NAME="${ODOO_START_FROM_VERSION}" - -if [ "$(/bin/echo "${ODOO_EXIST_VERSION}" | /usr/bin/cut -d'.' -f1)" -eq "$(/bin/echo "${ODOO_START_FROM_VERSION}" | /usr/bin/cut -d'.' -f1)" ]; then - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}" - /bin/cp -pf "${ODOO_WORK_DIR}/bootstrap" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/" - if [ ! -f "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/.env-secret" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/.env-secret" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/" - fi - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/.env-shared" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/.env-shared" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/" - else - if [ ! -L "${ODOO_WORK_DIR}/.env-shared" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/.env-shared" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/.env-shared" - fi - fi - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/requirements.txt" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/requirements.txt" "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/" - else - if [ ! -L "${ODOO_WORK_DIR}/requirements.txt" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/requirements.txt" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/requirements.txt" - fi - fi - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/common/conf.d" - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/override-odoo.cfg" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/override-odoo.cfg" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/common/conf.d/" - else - if [ -f "${ODOO_WORK_DIR}/common/conf.d/override-odoo.cfg" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/common/conf.d/override-odoo.cfg" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/common/conf.d/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/common/conf.d/override-odoo.cfg" - fi - fi - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/custom/src" - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/repos.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/repos.yaml" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/custom/src/" - else - if [ ! -L "${ODOO_WORK_DIR}/custom/src/repos.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/custom/src/repos.yaml" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/custom/src/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/custom/src/repos.yaml" - fi - fi - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/addons.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_START_FROM_VERSION}/addons.yaml" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/custom/src/" - else - if [ ! -L "${ODOO_WORK_DIR}/custom/src/addons.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/custom/src/addons.yaml" "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/custom/src/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/custom/src/addons.yaml" - fi - fi - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/.venv" - logexec "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/bootstrap" - logexec "${ODOO_WORK_DIR}/migrate-temporary/${ODOO_START_FROM_VERSION}/build" - eval MIGRATION_TEMPORARY_NAME="$(("$(/bin/echo "${MIGRATION_TEMPORARY_NAME}" | /usr/bin/cut -d'.' -f1)" + 1 )).0" - eval ODOO_WORK_DIR="${ODOO_MAIN_WORK_DIR}" -fi - -until [ "$(/bin/echo "${MIGRATION_TEMPORARY_NAME}" | /usr/bin/cut -d'.' -f1)" -eq "$(/bin/echo "${ODOO_DESTINATION_VERSION}" | /usr/bin/cut -d'.' -f1)" ] ; do - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}" - /bin/cp -pf "${ODOO_WORK_DIR}/bootstrap" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/" - if [ ! -f "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/.env-secret" ]; then - /bin/cp -p "${ODOO_WORK_DIR}/.env-secret" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/" - /bin/sed -i 's|^ODOO_VERSION=.*|ODOO_VERSION="'${MIGRATION_TEMPORARY_NAME}'"|g' "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/.env-secret" - fi - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/.env-shared" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/.env-shared" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/.env-secret" - fi - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/requirements.txt" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/requirements.txt" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/requirements.txt" - fi - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/common/conf.d" - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/override-odoo.cfg" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/override-odoo.cfg" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/common/conf.d/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/common/conf.d/override-odoo.cfg" - fi - /bin/mkdir -p "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/custom/src" - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/repos.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/repos.yaml" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/custom/src/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/custom/src/repos.yaml" - fi - fi - if [ -f "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/addons.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/addons.yaml" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/custom/src/" - else - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/custom/src/addons.yaml" - fi - if [ -d "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/migrate-scripts" ]; then - /bin/cp -frp "${ODOO_WORK_DIR}/migrate-templates/${MIGRATION_TEMPORARY_NAME}/migrate-scripts" "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/" - fi - /bin/rm -fr "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/.venv" - logexec "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/bootstrap" - logexec "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/build" - if [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" == 'true' ] ; then - if [ -d "${ODOO_WORK_DIR}/waftlib/templates/to-${MIGRATION_TEMPORARY_NAME}-default-migrate-scripts" ]; then - for MIGRATION_SCRIPT in $(/bin/ls -1 "${ODOO_WORK_DIR}/waftlib/templates/to-${MIGRATION_TEMPORARY_NAME}-default-migrate-scripts/"); do - if [ -x "${ODOO_WORK_DIR}/waftlib/templates/to-${MIGRATION_TEMPORARY_NAME}-default-migrate-scripts/${MIGRATION_SCRIPT}" ]; then - logexec "${ODOO_WORK_DIR}/waftlib/templates/to-${MIGRATION_TEMPORARY_NAME}-default-migrate-scripts/${MIGRATION_SCRIPT}" - fi - done - fi - fi - if [ -d "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/migrate-scripts" ]; then - for MIGRATION_SCRIPT in $(/bin/ls -1 "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/migrate-scripts/"); do - if [ -x "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/migrate-scripts/${MIGRATION_SCRIPT}" ]; then - logexec "${ODOO_WORK_DIR}/migrate-temporary/${MIGRATION_TEMPORARY_NAME}/migrate-scripts/${MIGRATION_SCRIPT}" - fi - done - fi - eval MIGRATION_TEMPORARY_NAME="$(("$(/bin/echo "${MIGRATION_TEMPORARY_NAME}" | /usr/bin/cut -d'.' -f1)" + 1 )).0" - eval ODOO_WORK_DIR="${ODOO_MAIN_WORK_DIR}" -done - -if [ "$(/bin/echo "${ODOO_EXIST_VERSION}" | /usr/bin/cut -d'.' -f1)" -ne "$(/bin/echo "${ODOO_DESTINATION_VERSION}" | /usr/bin/cut -d'.' -f1)" ]; then - /bin/sed -i 's|^ODOO_VERSION=.*|ODOO_VERSION="'${ODOO_DESTINATION_VERSION}'"|g' "${ODOO_WORK_DIR}/.env-secret" -fi -if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/.env-shared" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/.env-shared" "${ODOO_WORK_DIR}/" -fi -if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/requirements.txt" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/requirements.txt" "${ODOO_WORK_DIR}/" -fi -if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/override-odoo.cfg" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/override-odoo.cfg" "${ODOO_WORK_DIR}/common/conf.d/" -fi -if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/repos.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/repos.yaml" "${ODOO_WORK_DIR}/custom/src/" -fi -if [ -f "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/addons.yaml" ]; then - /bin/cp -fp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/addons.yaml" "${ODOO_WORK_DIR}/custom/src/" -fi -if [ -d "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/migrate-scripts" ]; then - /bin/cp -frp "${ODOO_WORK_DIR}/migrate-templates/${ODOO_DESTINATION_VERSION}/migrate-scripts" "${ODOO_WORK_DIR}/" -fi -/bin/rm -fr "${ODOO_WORK_DIR}/.venv" -logexec "${ODOO_WORK_DIR}/bootstrap" -logexec "${ODOO_WORK_DIR}/build" -if [ "${RUN_MIGRATION_DEFAULT_SCRIPT}" == 'true' ] ; then - if [ -d "${ODOO_WORK_DIR}/waftlib/templates/to-${ODOO_DESTINATION_VERSION}-default-migrate-scripts" ]; then - for MIGRATION_SCRIPT in $(/bin/ls -1 "${ODOO_WORK_DIR}/waftlib/templates/to-${ODOO_DESTINATION_VERSION}-default-migrate-scripts/"); do - if [ -x "${ODOO_WORK_DIR}/waftlib/templates/to-${ODOO_DESTINATION_VERSION}-default-migrate-scripts/${MIGRATION_SCRIPT}" ]; then - logexec "${ODOO_WORK_DIR}/waftlib/templates/to-${ODOO_DESTINATION_VERSION}-default-migrate-scripts/${MIGRATION_SCRIPT}" - fi - done - fi -fi -if [ -d "${ODOO_WORK_DIR}/migrate-scripts" ]; then - for MIGRATION_SCRIPT in $(/bin/ls -1 "${ODOO_WORK_DIR}/migrate-scripts/"); do - if [ -x "${ODOO_WORK_DIR}/migrate-scripts/${MIGRATION_SCRIPT}" ]; then - logexec "${ODOO_WORK_DIR}/migrate-scripts/${MIGRATION_SCRIPT}" - fi - done -fi - -/usr/bin/sudo /bin/systemctl start odoo || True -/usr/bin/sudo /bin/systemctl start monit || True - diff --git a/odoo-service b/odoo-service deleted file mode 100755 index 8ea070e..0000000 --- a/odoo-service +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -. "${ODOO_WORK_DIR}/.venv/bin/activate" - -export ODOO_WORKERS="${ODOO_WORKERS:-8}" -if [ "${ODOO_WORKERS}" -eq '0' ]; then - export ODOO_XMLRPC_PORT="${ODOO_XMLRPC_PORT:-8069}" - export ODOO_LONGPOLLING_PORT="${ODOO_LONGPOLLING_PORT:-8072}" - /usr/bin/socat "TCP-LISTEN:${ODOO_LONGPOLLING_PORT},reuseaddr,fork" "TCp:127.0.0.1:${ODOO_XMLRPC_PORT}" & -fi - -${ODOO_WORK_DIR}/.venv/bin/odoo --logfile "${ODOO_WORK_DIR}/logfile/odoo.log" -c "${ODOO_WORK_DIR}/auto/odoo.conf" diff --git a/run b/run deleted file mode 100755 index 41912c8..0000000 --- a/run +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -. "${ODOO_WORK_DIR}/.venv/bin/activate" && odoo -c ./auto/odoo.conf --workers=0 $* diff --git a/scripts/addons-i18n b/scripts/addons-i18n new file mode 100644 index 0000000..04926b0 --- /dev/null +++ b/scripts/addons-i18n @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +ADDON_NAME="${1}" +shift +/bin/echo "( INFO ) '${WORK_DIRECTORY}/scripts/addons-i18n' script: Executing Odoo in i18n export mode for addon ${ADDON_NAME}" +# HACK Odoo needs a *.po file to guess the output format +/bin/ln -sf /dev/stdout /tmp/stdout.po +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +odoo --stop-after-init -d "${PGDATABASE}" --i18n-export /tmp/stdout.po --modules "${ADDON_NAME}" --update "${ADDON_NAME}" --workers 0 "${@}" diff --git a/scripts/addons-install b/scripts/addons-install new file mode 100644 index 0000000..6efd56c --- /dev/null +++ b/scripts/addons-install @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +cd "${WORK_DIRECTORY}" && \ +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +"${WORK_DIRECTORY}/.python-files/addons-install" diff --git a/scripts/addons-test b/scripts/addons-test new file mode 100644 index 0000000..2308871 --- /dev/null +++ b/scripts/addons-test @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +/bin/echo "( WARNING ) '${WORK_DIRECTORY}/scripts/addons-test' script: addons-test is deprecated, use instead: addons update --test ${@}" +# Shortcut to run Odoo in addons testing mode +set -e +addons="${1}" +shift +/bin/echo "( INFO ) '${WORK_DIRECTORY}/scripts/addons-test' script: Executing Odoo in addons-test mode for addons ${addons}" +# HACK `--workers 0`: https://github.com/odoo/odoo/pull/14809 +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +odoo --workers 0 --test-enable --stop-after-init --update "${addons}" "${@}" diff --git a/scripts/code-install b/scripts/code-install new file mode 100644 index 0000000..37cc07c --- /dev/null +++ b/scripts/code-install @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" && \ +. "${WORK_DIRECTORY}/.venv/bin/activate" + +ODOO_MAIN_CODE_DIRECTORY="${WORK_DIRECTORY}/.ignore/code/odoo" +/bin/echo "( INFO ) '${WORK_DIRECTORY}/scripts/code-install' script: Installing Odoo from ${ODOO_MAIN_CODE_DIRECTORY} ." + +# Odoo v8 dependencies could crash at install, so we don't use them +if [ "${ODOO_VERSION}" == "8.0" ] ; then + pip install --no-cache-dir --no-deps --editable "${ODOO_MAIN_CODE_DIRECTORY}" +else + pip install --no-cache-dir --editable "${ODOO_MAIN_CODE_DIRECTORY}" +fi + +# Make version 8.0 and 9.0 have an `odoo` executable +if [ "${ODOO_VERSION}" == "8.0" -o "${ODOO_VERSION}" == "9.0" ] ; then + /bin/rm -fr "${WORK_DIRECTORY}/.venv/bin/odoo" + /bin/ln -s "${WORK_DIRECTORY}/.venv/bin/odoo.py" "${WORK_DIRECTORY}/.venv/bin/odoo" +fi diff --git a/scripts/database-initial b/scripts/database-initial new file mode 100644 index 0000000..7bc67c0 --- /dev/null +++ b/scripts/database-initial @@ -0,0 +1,11 @@ +#!/bin/sh +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" && \ +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +odoo -i base -c "${WORK_DIRECTORY}/.ignore/config/odoo.conf" --without-demo=all --stop-after-init diff --git a/scripts/database-install-new-empty b/scripts/database-install-new-empty new file mode 100644 index 0000000..38d333c --- /dev/null +++ b/scripts/database-install-new-empty @@ -0,0 +1,36 @@ +#!/bin/sh +# Version: v.23.08.03 + +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +if [ "${#}" -le 1 ] ; then + /bin/echo "Installs a new empty database" + /bin/echo "Usage: ${WORK_DIRECTORY}/scripts/database-install-new-empty databasename modulename [nodemo]" + exit +fi + +if [ "${3}" = "nodemo" ] ; then + WITHOUT_DEMO="--without-demo=1" + /bin/echo "( INFO ) : Without demo data" +else + WITHOUT_DEMO="--without-demo=" + /bin/echo "( INFO ) : With demo data" +fi + +if [ "$(/usr/bin/psql -d template1 -tAc "SELECT 1 FROM pg_database WHERE datname='${1}'" )" = '1' ] ; then + /bin/echo "( ERROR ) : Database '${1}' already exists. If you want to drop it: 'dropdb ${1}'" + exit 1 +else + createdb "${1}" +fi + +cd "${WORK_DIRECTORY}" && \ +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +odoo -c "${WORK_DIRECTORY}/.ignore/config/odoo.conf" --load-language=en_US,nl_NL -i "${2}" -d "${1}" --stop-after-init "${WITHOUT_DEMO}" diff --git a/scripts/module-upgrade b/scripts/module-upgrade new file mode 100644 index 0000000..ac87406 --- /dev/null +++ b/scripts/module-upgrade @@ -0,0 +1,18 @@ +#!/bin/sh +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" + +if [ "${#}" -eq 0 ] ; then + /bin/echo "Upgrade a module" + /bin/echo "Usage: ${WORK_DIRECTORY}/scripts/module-upgrade modulename" + exit +fi + +cd "${WORK_DIRECTORY}" && \ +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +odoo -c "${WORK_DIRECTORY}/.ignore/config/odoo.conf" -u "${1}" --xmlrpc-port 18069 --stop-after-init --i18n-overwrite diff --git a/scripts/modules-translate b/scripts/modules-translate new file mode 100644 index 0000000..63e4535 --- /dev/null +++ b/scripts/modules-translate @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 +# Shortcut to run Odoo in unit testing mode +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +cd "${WORK_DIRECTORY}" && \ +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +"${WORK_DIRECTORY}/.python-files/modules-translate" diff --git a/scripts/odoo-service b/scripts/odoo-service new file mode 100644 index 0000000..82f09f9 --- /dev/null +++ b/scripts/odoo-service @@ -0,0 +1,20 @@ +#!/bin/bash +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +. "${WORK_DIRECTORY}/.venv/bin/activate" + +export ODOO_WORKERS="${ODOO_WORKERS:-8}" +if [ "${ODOO_WORKERS}" -eq '0' ] ; then + export ODOO_XMLRPC_PORT="${ODOO_XMLRPC_PORT:-8069}" + export ODOO_LONGPOLLING_PORT="${ODOO_LONGPOLLING_PORT:-8072}" + /usr/bin/socat "TCP-LISTEN:${ODOO_LONGPOLLING_PORT},reuseaddr,fork" "TCp:127.0.0.1:${ODOO_XMLRPC_PORT}" & +fi + +${WORK_DIRECTORY}/.venv/bin/odoo --logfile "${WORK_DIRECTORY}/logfiles/odoo.log" -c "${WORK_DIRECTORY}/.ignore/config/odoo.conf" diff --git a/scripts/python-shell b/scripts/python-shell new file mode 100644 index 0000000..d111e45 --- /dev/null +++ b/scripts/python-shell @@ -0,0 +1,13 @@ +#!/bin/sh +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +# Note: in Odoo 8.0 this requires OCA 'shell' module to be installed. +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +odoo --addons-path="${WORK_DIRECTORY}/addons" shell -c "${WORK_DIRECTORY}/.ignore/config/odoo.conf" --xmlrpc-port=18080 diff --git a/scripts/requirements-install b/scripts/requirements-install new file mode 100644 index 0000000..2d99614 --- /dev/null +++ b/scripts/requirements-install @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +cd "${WORK_DIRECTORY}" +# pip 20.3 has a neat dependency resolver +# https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020 +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +pip install "setuptools<58" && \ +pip install "pip>=20.3" && \ +(pip uninstall --yes -r "${WORK_DIRECTORY}/config/requirements-clean.txt" 2>/dev/null || /bin/true) && \ +pip install --exists-action w -r "${WORK_DIRECTORY}/config/requirements-install-default.txt" && \ +pip install --exists-action w -r "${WORK_DIRECTORY}/config/requirements-override-install.txt" diff --git a/scripts/run b/scripts/run new file mode 100644 index 0000000..87fb42b --- /dev/null +++ b/scripts/run @@ -0,0 +1,12 @@ +#!/bin/sh +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +odoo -c "${WORK_DIRECTORY}/.ignore/config/odoo.conf" --workers=0 $* diff --git a/scripts/waft-code-compile b/scripts/waft-code-compile new file mode 100644 index 0000000..0b66185 --- /dev/null +++ b/scripts/waft-code-compile @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +. "${WORK_DIRECTORY}/.venv/bin/activate" && \ +if [ "${WAFT_COMPILE,,}" != 'true' ] ; then + /bin/echo "( WARNING ) '${WORK_DIRECTORY}/scripts/waft-code-compile' script: Not compiling Python code" + exit 0 +fi && \ +/bin/echo "( INFO ) '${WORK_DIRECTORY}/scripts/waft-code-compile' script: Compiling all Python code in ${WORK_DIRECTORY}" && \ +python -m compileall -q "${WORK_DIRECTORY}/.ignore/code" diff --git a/scripts/waft-database-postgresql-wait b/scripts/waft-database-postgresql-wait new file mode 100644 index 0000000..7ba712c --- /dev/null +++ b/scripts/waft-database-postgresql-wait @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +if [ "${WAFT_WAIT_DB,,}" != 'true' ] ; then + /bin/echo "( WARNING ) '${WORK_DIRECTORY}/scripts/waft-database-postgresql-wait' script: Not waiting for a postgres server." + exit 0 +fi + +/bin/echo "( INFO ) '${WORK_DIRECTORY}/scripts/waft-database-postgresql-wait' script: Waiting until postgres is listening at ${PGHOST}..." +while true; do + /usr/bin/psql --list > /dev/null 2>&1 && break + sleep 1 +done diff --git a/scripts/waft-database-unaccent-install b/scripts/waft-database-unaccent-install new file mode 100644 index 0000000..5cc01e8 --- /dev/null +++ b/scripts/waft-database-unaccent-install @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" + +if [ "${ODOO_UNACCENT,,}" == 'true' ] ; then + psql_unaccent_output="$(/usr/bin/psql -qc 'CREATE EXTENSION IF NOT EXISTS unaccent' 2>&1)" + ok="${?}" + if [ "${ok}" -eq 0 -a -z "${psql_unaccent_output}" ] ; then + /bin/echo "( INFO ) '${WORK_DIRECTORY}/scripts/waft-database-unaccent-install' script: Unaccent extension installed" + elif [ "${ok}" -ne 0 ] ; then + /bin/echo "( WARNING ) '${WORK_DIRECTORY}/scripts/waft-database-unaccent-install' script: Attempt to install unaccent in ${PGDATABASE}@${PGHOST} failed with this message: ${psql_unaccent_output}" + fi +fi diff --git a/bin/reset-password b/scripts/waft-password-reset old mode 100755 new mode 100644 similarity index 55% rename from bin/reset-password rename to scripts/waft-password-reset index 96e0d29..c760a37 --- a/bin/reset-password +++ b/scripts/waft-password-reset @@ -1,7 +1,7 @@ #!/bin/sh -# Version: v.22.05.30 +# Version: v.23.08.03 -if [ "${#}" -le 1 ]; then +if [ "${#}" -le 1 ] ; then /bin/echo "Resets password of Odoo user" /bin/echo "Usage: ${0} login newpassword" exit @@ -11,16 +11,17 @@ USER="${1}" NEWPASSWORD="${2}" SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}/../.." -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +. "${WORK_DIRECTORY}/config/env-default" && \ +. "${WORK_DIRECTORY}/config/env-shared" && \ +. "${WORK_DIRECTORY}/.env-secret" && \ +cd "${WORK_DIRECTORY}" -CRYPT="$("${ODOO_WORK_DIR}/.venv/bin/python" -c "from passlib.context import CryptContext; print(CryptContext(['pbkdf2_sha512']).encrypt('${NEWPASSWORD}'))")" +CRYPT="$(. "${WORK_DIRECTORY}/.waft-venv/bin/activate" && "${WORK_DIRECTORY}/.waft-venv/bin/python" -c "from passlib.context import CryptContext; print(CryptContext(['pbkdf2_sha512']).encrypt('${NEWPASSWORD}'))")" COLEXISTS="$(/usr/bin/psql -XAt -d "${PGDATABASE}" -c "SELECT 1 FROM information_schema.columns WHERE table_name='res_users' AND column_name='password_crypt';")" -if [ "${COLEXISTS}" = "1" ]; then +if [ "${COLEXISTS}" = "1" ] ; then /usr/bin/psql -d "${PGDATABASE}" -c "update res_users set password_crypt = '${CRYPT}', active = 't' where login = '${USER}';" else /usr/bin/psql -d "${PGDATABASE}" -c "update res_users set password = '${CRYPT}', active = 't' where login = '${USER}';" diff --git a/scripts/waft-requirements-install b/scripts/waft-requirements-install new file mode 100644 index 0000000..42b7ea3 --- /dev/null +++ b/scripts/waft-requirements-install @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Version: v.23.08.03 + +set -e + +SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" +WORK_DIRECTORY="$(cd "${SCRIPT_PATH}/.." && /bin/pwd)" +cd "${WORK_DIRECTORY}" && \ +. "${WORK_DIRECTORY}/.waft-venv/bin/activate" && \ +(pip uninstall --yes -r "${WORK_DIRECTORY}/config/waft-requirements-pre-install-default.txt" 2>/dev/null || /bin/true) && \ +pip install --exists-action w -r "${WORK_DIRECTORY}/config/waft-requirements-install-default.txt" diff --git a/shell b/shell deleted file mode 100755 index cc129c4..0000000 --- a/shell +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -cd "${ODOO_WORK_DIR}" - -# Note: in Odoo 8.0 this requires OCA 'shell' module to be installed. -cd "${ODOO_WORK_DIR}" && . .venv/bin/activate && odoo --addons-path=auto/addons shell -c ./auto/odoo.conf --xmlrpc-port=18080 diff --git a/templates/.env-secret b/templates/.env-secret index 918099a..36b62de 100644 --- a/templates/.env-secret +++ b/templates/.env-secret @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Secret variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default and .env-shared +# this variables will override the variables in config/env-default and config/env-shared # Don't push this file to your own repository #ODOO_VERSION="x.x" @@ -36,8 +36,6 @@ ODOO_ADMIN_PASSWORD="" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -67,16 +65,17 @@ ODOO_ADMIN_PASSWORD="" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/10.0/.python-version b/templates/10.0/.python-version deleted file mode 100644 index a616492..0000000 --- a/templates/10.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -2.7.18 diff --git a/templates/10.0/addons.yaml b/templates/10.0/addons.yaml deleted file mode 100644 index f28ebc0..0000000 --- a/templates/10.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/odoo/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/10.0/.env-default b/templates/10.0/env-default similarity index 90% rename from templates/10.0/.env-default rename to templates/10.0/env-default index f6d2781..da897f9 100644 --- a/templates/10.0/.env-default +++ b/templates/10.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="10.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/10.0/.env-shared b/templates/10.0/env-shared similarity index 90% rename from templates/10.0/.env-shared rename to templates/10.0/env-shared index d81115d..916376d 100644 --- a/templates/10.0/.env-shared +++ b/templates/10.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="10.0" @@ -23,8 +24,6 @@ ODOO_VERSION="10.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="10.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/10.0/odoo.cfg b/templates/10.0/odoo-default.conf similarity index 96% rename from templates/10.0/odoo.cfg rename to templates/10.0/odoo-default.conf index 813c7ba..f2faed9 100644 --- a/templates/10.0/odoo.cfg +++ b/templates/10.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} auth_admin_passkey_password = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , diff --git a/templates/10.0/python-version b/templates/10.0/python-version new file mode 100644 index 0000000..6905d95 --- /dev/null +++ b/templates/10.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +2.7.18 diff --git a/templates/10.0/repos.yaml b/templates/10.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/10.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/10.0/requirements-clean.txt b/templates/10.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/10.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/10.0/requirements-default.txt b/templates/10.0/requirements-install-default.txt similarity index 85% rename from templates/10.0/requirements-default.txt rename to templates/10.0/requirements-install-default.txt index 12f6630..74c3b9e 100644 --- a/templates/10.0/requirements-default.txt +++ b/templates/10.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 appdirs==1.4.4 argcomplete==1.12.3 @@ -36,7 +37,6 @@ geographiclib==1.52 geojson==2.5.0 geopy==1.23.0 gevent==1.3.4 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==0.4.13 html2text==2016.9.19 diff --git a/templates/11.0/.python-version b/templates/11.0/.python-version deleted file mode 100644 index cd33751..0000000 --- a/templates/11.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.6.15 diff --git a/templates/11.0/addons.yaml b/templates/11.0/addons.yaml deleted file mode 100644 index f28ebc0..0000000 --- a/templates/11.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/odoo/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/11.0/.env-default b/templates/11.0/env-default similarity index 90% rename from templates/11.0/.env-default rename to templates/11.0/env-default index 1a44f5a..577f2a7 100644 --- a/templates/11.0/.env-default +++ b/templates/11.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="11.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/11.0/.env-shared b/templates/11.0/env-shared similarity index 90% rename from templates/11.0/.env-shared rename to templates/11.0/env-shared index 84bb959..dcf323f 100644 --- a/templates/11.0/.env-shared +++ b/templates/11.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="11.0" @@ -23,8 +24,6 @@ ODOO_VERSION="11.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="11.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/11.0/odoo.cfg b/templates/11.0/odoo-default.conf similarity index 97% rename from templates/11.0/odoo.cfg rename to templates/11.0/odoo-default.conf index 595ed07..ddf4694 100644 --- a/templates/11.0/odoo.cfg +++ b/templates/11.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} auth_admin_passkey_password = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , diff --git a/templates/11.0/python-version b/templates/11.0/python-version new file mode 100644 index 0000000..b59e222 --- /dev/null +++ b/templates/11.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +3.6.15 diff --git a/templates/11.0/repos.yaml b/templates/11.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/11.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/11.0/requirements-clean.txt b/templates/11.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/11.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/11.0/requirements-default.txt b/templates/11.0/requirements-install-default.txt similarity index 83% rename from templates/11.0/requirements-default.txt rename to templates/11.0/requirements-install-default.txt index ea7a838..3670bc2 100644 --- a/templates/11.0/requirements-default.txt +++ b/templates/11.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 appdirs==1.4.4 argcomplete==1.12.3 @@ -29,7 +30,6 @@ geographiclib==1.52 geojson==2.5.0 geopy==1.23.0 gevent==1.3.4 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==0.4.13 html2text==2016.9.19 diff --git a/templates/12.0/.python-version b/templates/12.0/.python-version deleted file mode 100644 index cd33751..0000000 --- a/templates/12.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.6.15 diff --git a/templates/12.0/addons.yaml b/templates/12.0/addons.yaml deleted file mode 100644 index f28ebc0..0000000 --- a/templates/12.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/odoo/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/12.0/.env-default b/templates/12.0/env-default similarity index 90% rename from templates/12.0/.env-default rename to templates/12.0/env-default index d49d28f..1a43ac7 100644 --- a/templates/12.0/.env-default +++ b/templates/12.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="12.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/12.0/.env-shared b/templates/12.0/env-shared similarity index 90% rename from templates/12.0/.env-shared rename to templates/12.0/env-shared index 1f99a77..8681a8b 100644 --- a/templates/12.0/.env-shared +++ b/templates/12.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="12.0" @@ -23,8 +24,6 @@ ODOO_VERSION="12.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="12.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/12.0/odoo.cfg b/templates/12.0/odoo-default.conf similarity index 96% rename from templates/12.0/odoo.cfg rename to templates/12.0/odoo-default.conf index e9172ed..d001c0d 100644 --- a/templates/12.0/odoo.cfg +++ b/templates/12.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} auth_admin_passkey_password = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , diff --git a/templates/12.0/python-version b/templates/12.0/python-version new file mode 100644 index 0000000..b59e222 --- /dev/null +++ b/templates/12.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +3.6.15 diff --git a/templates/12.0/repos.yaml b/templates/12.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/12.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/12.0/requirements-clean.txt b/templates/12.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/12.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/12.0/requirements-default.txt b/templates/12.0/requirements-install-default.txt similarity index 84% rename from templates/12.0/requirements-default.txt rename to templates/12.0/requirements-install-default.txt index f50a1b4..20bb16b 100644 --- a/templates/12.0/requirements-default.txt +++ b/templates/12.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 appdirs==1.4.4 argcomplete==1.12.3 @@ -33,7 +34,6 @@ geographiclib==1.52 geojson==2.5.0 geopy==2.2.0 gevent==1.3.4 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==0.4.13 html2text==2016.9.19 diff --git a/templates/13.0/.python-version b/templates/13.0/.python-version deleted file mode 100644 index cd33751..0000000 --- a/templates/13.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.6.15 diff --git a/templates/13.0/addons.yaml b/templates/13.0/addons.yaml deleted file mode 100644 index f28ebc0..0000000 --- a/templates/13.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/odoo/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/13.0/.env-default b/templates/13.0/env-default similarity index 90% rename from templates/13.0/.env-default rename to templates/13.0/env-default index 0cc3ff2..110ee6b 100644 --- a/templates/13.0/.env-default +++ b/templates/13.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="13.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/13.0/.env-shared b/templates/13.0/env-shared similarity index 90% rename from templates/13.0/.env-shared rename to templates/13.0/env-shared index 01229b7..50a3fda 100644 --- a/templates/13.0/.env-shared +++ b/templates/13.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="13.0" @@ -23,8 +24,6 @@ ODOO_VERSION="13.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="13.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/13.0/odoo.cfg b/templates/13.0/odoo-default.conf similarity index 96% rename from templates/13.0/odoo.cfg rename to templates/13.0/odoo-default.conf index e9172ed..d001c0d 100644 --- a/templates/13.0/odoo.cfg +++ b/templates/13.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} auth_admin_passkey_password = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , diff --git a/templates/13.0/python-version b/templates/13.0/python-version new file mode 100644 index 0000000..b59e222 --- /dev/null +++ b/templates/13.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +3.6.15 diff --git a/templates/13.0/repos.yaml b/templates/13.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/13.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/13.0/requirements-clean.txt b/templates/13.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/13.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/13.0/requirements-default.txt b/templates/13.0/requirements-install-default.txt similarity index 85% rename from templates/13.0/requirements-default.txt rename to templates/13.0/requirements-install-default.txt index 7a07ff4..8f3a68b 100644 --- a/templates/13.0/requirements-default.txt +++ b/templates/13.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 appdirs==1.4.4 argcomplete==1.12.3 @@ -38,7 +39,6 @@ geographiclib==1.52 geojson==2.5.0 geopy==2.2.0 gevent==1.3.4 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib gitlab==1.0.2 greenlet==0.4.13 diff --git a/templates/14.0/.python-version b/templates/14.0/.python-version deleted file mode 100644 index cd33751..0000000 --- a/templates/14.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.6.15 diff --git a/templates/14.0/addons.yaml b/templates/14.0/addons.yaml deleted file mode 100644 index f28ebc0..0000000 --- a/templates/14.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/odoo/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/14.0/.env-default b/templates/14.0/env-default similarity index 90% rename from templates/14.0/.env-default rename to templates/14.0/env-default index 09cbd5d..f4c2c53 100644 --- a/templates/14.0/.env-default +++ b/templates/14.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="14.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/14.0/.env-shared b/templates/14.0/env-shared similarity index 90% rename from templates/14.0/.env-shared rename to templates/14.0/env-shared index 1dd1d22..a955a39 100644 --- a/templates/14.0/.env-shared +++ b/templates/14.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="14.0" @@ -23,8 +24,6 @@ ODOO_VERSION="14.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="14.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/14.0/odoo.cfg b/templates/14.0/odoo-default.conf similarity index 96% rename from templates/14.0/odoo.cfg rename to templates/14.0/odoo-default.conf index 0d499fb..a228e04 100644 --- a/templates/14.0/odoo.cfg +++ b/templates/14.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , data_dir = ${HOME}/.local/share/Odoo diff --git a/templates/14.0/python-version b/templates/14.0/python-version new file mode 100644 index 0000000..b59e222 --- /dev/null +++ b/templates/14.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +3.6.15 diff --git a/templates/14.0/repos.yaml b/templates/14.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/14.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/14.0/requirements-clean.txt b/templates/14.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/14.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/14.0/requirements-default.txt b/templates/14.0/requirements-install-default.txt similarity index 82% rename from templates/14.0/requirements-default.txt rename to templates/14.0/requirements-install-default.txt index b5bb755..7136886 100644 --- a/templates/14.0/requirements-default.txt +++ b/templates/14.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 appdirs==1.4.4 argcomplete==1.12.3 @@ -30,7 +31,6 @@ feedparser==5.2.1 geojson==2.5.0 freezegun==0.3.15 gevent==1.4.0 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==0.4.15 html2text==2018.1.9 diff --git a/templates/15.0/.python-version b/templates/15.0/.python-version deleted file mode 100644 index 2e14a95..0000000 --- a/templates/15.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.8.6 diff --git a/templates/15.0/addons.yaml b/templates/15.0/addons.yaml deleted file mode 100644 index f28ebc0..0000000 --- a/templates/15.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/odoo/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/15.0/.env-default b/templates/15.0/env-default similarity index 90% rename from templates/15.0/.env-default rename to templates/15.0/env-default index 55c2da1..9c0acda 100644 --- a/templates/15.0/.env-default +++ b/templates/15.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="15.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/15.0/.env-shared b/templates/15.0/env-shared similarity index 90% rename from templates/15.0/.env-shared rename to templates/15.0/env-shared index 02842bc..c090539 100644 --- a/templates/15.0/.env-shared +++ b/templates/15.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="15.0" @@ -23,8 +24,6 @@ ODOO_VERSION="15.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="15.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/15.0/odoo.cfg b/templates/15.0/odoo-default.conf similarity index 97% rename from templates/15.0/odoo.cfg rename to templates/15.0/odoo-default.conf index d80053d..0ff6142 100644 --- a/templates/15.0/odoo.cfg +++ b/templates/15.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , data_dir = ${HOME}/.local/share/Odoo diff --git a/templates/15.0/python-version b/templates/15.0/python-version new file mode 100644 index 0000000..99ccd9c --- /dev/null +++ b/templates/15.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +3.8.6 diff --git a/templates/15.0/repos.yaml b/templates/15.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/15.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/15.0/requirements-clean.txt b/templates/15.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/15.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/15.0/requirements-default.txt b/templates/15.0/requirements-install-default.txt similarity index 82% rename from templates/15.0/requirements-default.txt rename to templates/15.0/requirements-install-default.txt index 023677b..5e28d98 100644 --- a/templates/15.0/requirements-default.txt +++ b/templates/15.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 appdirs==1.4.4 argcomplete==1.12.3 @@ -30,7 +31,6 @@ feedparser==5.2.1 freezegun==0.3.15 geojson==2.5.0 gevent==20.9.0 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==0.4.17 html2text==2020.1.16 diff --git a/templates/16.0/.python-version b/templates/16.0/.python-version deleted file mode 100644 index ac957df..0000000 --- a/templates/16.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.10.6 diff --git a/templates/16.0/addons.yaml b/templates/16.0/addons.yaml deleted file mode 100644 index f28ebc0..0000000 --- a/templates/16.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/odoo/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/16.0/.env-default b/templates/16.0/env-default similarity index 90% rename from templates/16.0/.env-default rename to templates/16.0/env-default index 8cde387..fc118f8 100644 --- a/templates/16.0/.env-default +++ b/templates/16.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="16.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/16.0/.env-shared b/templates/16.0/env-shared similarity index 90% rename from templates/16.0/.env-shared rename to templates/16.0/env-shared index 99fe762..cdc0557 100644 --- a/templates/16.0/.env-shared +++ b/templates/16.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="16.0" # this variable will set 'dbfilter = ${ODOO_DBFILTER}' odoo.cfg variable. @@ -22,8 +23,6 @@ ODOO_VERSION="16.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -53,16 +52,17 @@ ODOO_VERSION="16.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/16.0/odoo.cfg b/templates/16.0/odoo-default.conf similarity index 96% rename from templates/16.0/odoo.cfg rename to templates/16.0/odoo-default.conf index 89e6270..edc70e2 100644 --- a/templates/16.0/odoo.cfg +++ b/templates/16.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , data_dir = ${HOME}/.local/share/Odoo diff --git a/templates/16.0/python-version b/templates/16.0/python-version new file mode 100644 index 0000000..f7f5d0e --- /dev/null +++ b/templates/16.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +3.10.6 diff --git a/templates/16.0/repos.yaml b/templates/16.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/16.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/16.0/requirements-clean.txt b/templates/16.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/16.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/16.0/requirements-default.txt b/templates/16.0/requirements-install-default.txt similarity index 81% rename from templates/16.0/requirements-default.txt rename to templates/16.0/requirements-install-default.txt index df7f164..55d9143 100644 --- a/templates/16.0/requirements-default.txt +++ b/templates/16.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==6.0.1 appdirs==1.4.4 argcomplete==1.12.3 @@ -30,7 +31,6 @@ feedparser==5.2.1 freezegun==0.3.15 geojson==2.5.0 gevent==21.8.0 --e git+https://github.com/sunflowerit/git-aggregator.git@b459aee4f35c5b4b8fc2bc4fd826bf4f2639bd3d#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==1.1.2 html2text==2020.1.16 diff --git a/templates/16.0/requirements-remove-default.txt b/templates/16.0/requirements-remove-default.txt deleted file mode 100644 index 9744efe..0000000 --- a/templates/16.0/requirements-remove-default.txt +++ /dev/null @@ -1 +0,0 @@ -kaptan \ No newline at end of file diff --git a/templates/8.0/.python-version b/templates/8.0/.python-version deleted file mode 100644 index a616492..0000000 --- a/templates/8.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -2.7.18 diff --git a/templates/8.0/addons.yaml b/templates/8.0/addons.yaml deleted file mode 100644 index f72b135..0000000 --- a/templates/8.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/openerp/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/8.0/.env-default b/templates/8.0/env-default similarity index 90% rename from templates/8.0/.env-default rename to templates/8.0/env-default index 2cb4809..428a4da 100644 --- a/templates/8.0/.env-default +++ b/templates/8.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="8.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/8.0/.env-shared b/templates/8.0/env-shared similarity index 90% rename from templates/8.0/.env-shared rename to templates/8.0/env-shared index 2dfcfd0..5260a0e 100644 --- a/templates/8.0/.env-shared +++ b/templates/8.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="8.0" @@ -23,8 +24,6 @@ ODOO_VERSION="8.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="8.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/8.0/odoo.cfg b/templates/8.0/odoo-default.conf similarity index 97% rename from templates/8.0/odoo.cfg rename to templates/8.0/odoo-default.conf index b2cf7e1..6c6f626 100644 --- a/templates/8.0/odoo.cfg +++ b/templates/8.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} auth_admin_passkey_password = ${ODOO_ADMIN_PASSWORD} auto_reload = False diff --git a/templates/8.0/python-version b/templates/8.0/python-version new file mode 100644 index 0000000..6905d95 --- /dev/null +++ b/templates/8.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +2.7.18 diff --git a/templates/8.0/repos.yaml b/templates/8.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/8.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/8.0/requirements-clean.txt b/templates/8.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/8.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/8.0/requirements-default.txt b/templates/8.0/requirements-install-default.txt similarity index 83% rename from templates/8.0/requirements-default.txt rename to templates/8.0/requirements-install-default.txt index 497a576..a2862e1 100644 --- a/templates/8.0/requirements-default.txt +++ b/templates/8.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override the a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 argcomplete==1.12.3 argh==0.26.2 @@ -27,7 +28,6 @@ feedparser==5.1.3 gdata==2.0.18 geojson==2.5.0 gevent==1.0.2 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==0.4.7 idna==2.10 diff --git a/templates/9.0/.python-version b/templates/9.0/.python-version deleted file mode 100644 index a616492..0000000 --- a/templates/9.0/.python-version +++ /dev/null @@ -1 +0,0 @@ -2.7.18 diff --git a/templates/9.0/addons.yaml b/templates/9.0/addons.yaml deleted file mode 100644 index f72b135..0000000 --- a/templates/9.0/addons.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -odoo/addons: - - "*" - -odoo/openerp/addons: - - "*" - -OCA/web: - - "*" diff --git a/templates/9.0/.env-default b/templates/9.0/env-default similarity index 90% rename from templates/9.0/.env-default rename to templates/9.0/env-default index 4a2f55b..bbec811 100644 --- a/templates/9.0/.env-default +++ b/templates/9.0/env-default @@ -1,7 +1,7 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default variables # This file linked to a template file, don't change it or replace it -# If you like to override these variables put it in .env-share or .env-secret. +# If you like to override these variables put it in config/env-share or .env-secret. ODOO_VERSION="9.0" @@ -35,8 +35,6 @@ ODOO_WITHOUT_DEMO="all" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. diff --git a/templates/9.0/.env-shared b/templates/9.0/env-shared similarity index 90% rename from templates/9.0/.env-shared rename to templates/9.0/env-shared index 982a40b..73b9d3b 100644 --- a/templates/9.0/.env-shared +++ b/templates/9.0/env-shared @@ -1,8 +1,9 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Shared variables # Feel free to tune the variables in this file as you like -# this variables will override the variables in .env-default +# This variables will override the variables in config/env-default # Push this file to your own repository +# The variables in .env-secret will override the variables here, so, use .env-secret for sensitive variables. ODOO_VERSION="9.0" @@ -23,8 +24,6 @@ ODOO_VERSION="9.0" # this variable will set 'workers = ${ODOO_WORKERS}' odoo.cfg variable. #ODOO_WORKERS="8" -# this variable will not effect odoo.cfg variables, it will just effect waft build scripts. -#WAFT_CLEAN="false" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. #WAFT_COMPILE="true" # this variable will not effect odoo.cfg variables, it will just effect waft build scripts. @@ -54,16 +53,17 @@ ODOO_VERSION="9.0" #MONITORING_WORKER_EXHAUSTION_NAP_BETWEEN_CHECK=2 # Seconds #MONITORING_WORKER_EXHAUSTION_CHECK_OVER_WORKERS_NUMBER=4 #MONITORING_WORKER_EXHAUSTION_ODOO_PORT=8069 -#ODOO_FULL_UPDATE_LOGFILE= -#ODOO_FULL_UPDATE_MAILTO= +#ODOO_DEVELOP_LOGFILE= +#ODOO_DEVELOP_MAILTO= #ODOO_UPDATE_CODE= +#ODOO_I18N_OVERWRITE= #ODOO_WAFT_PROJECT_REPOSITORY_BRANCH= #ODOO_WAFT_PROJECT_GIT_COMMANDS= -#ODOO_WORK_DIRECTORY_PATH= +#WORK_DIRECTORY_PATH= #SOURCE_ODOO_HOST_NAME= #SOURCE_ODOO_DATABASE_NAME= #ODOO_RESTORE_AS_SUPERUSER_DATABASE= -#ODOO_DOMESTICATION_DATABASE= +#ODOO_DEFUSE_DATABASE= #ODOO_RIBBON_KEY_STRING= #ODOO_ADMIN_RESET_PASSWORD= #SOURCE_ODOO_SYSTEM_USER_NAME= diff --git a/templates/9.0/odoo.cfg b/templates/9.0/odoo-default.conf similarity index 96% rename from templates/9.0/odoo.cfg rename to templates/9.0/odoo-default.conf index 5018f6a..2613678 100644 --- a/templates/9.0/odoo.cfg +++ b/templates/9.0/odoo-default.conf @@ -1,5 +1,5 @@ [options] -addons_path = ${ODOO_WORK_DIR}/auto/addons +addons_path = ${WORK_DIRECTORY}/addons admin_passwd = ${ODOO_ADMIN_PASSWORD} auth_admin_passkey_password = ${ODOO_ADMIN_PASSWORD} csv_internal_sep = , diff --git a/templates/9.0/python-version b/templates/9.0/python-version new file mode 100644 index 0000000..6905d95 --- /dev/null +++ b/templates/9.0/python-version @@ -0,0 +1,2 @@ +#.venv python version. +2.7.18 diff --git a/templates/9.0/repos.yaml b/templates/9.0/repos.yaml deleted file mode 100644 index 35253a9..0000000 --- a/templates/9.0/repos.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -odoo: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/odoo/odoo.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} - -OCA/web: - defaults: - depth: ${WAFT_DEPTH_DEFAULT} - remotes: - origin: https://github.com/OCA/web.git - target: origin ${ODOO_VERSION} - merges: - - origin ${ODOO_VERSION} diff --git a/templates/9.0/requirements-clean.txt b/templates/9.0/requirements-clean.txt new file mode 100644 index 0000000..b857168 --- /dev/null +++ b/templates/9.0/requirements-clean.txt @@ -0,0 +1,5 @@ +# Version: v.23.08.03 +# we use this file to remove an PyPI package if already installed before running install the packages in requirements-install-default.txt. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it again to requirements-override-install.txt. diff --git a/templates/9.0/requirements-default.txt b/templates/9.0/requirements-install-default.txt similarity index 84% rename from templates/9.0/requirements-default.txt rename to templates/9.0/requirements-install-default.txt index 665013a..0d2f86d 100644 --- a/templates/9.0/requirements-default.txt +++ b/templates/9.0/requirements-install-default.txt @@ -1,7 +1,8 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Default PyPI packages versions. -# Don't change this file -# To override a package version in this file add it to requirements.txt file. +# Don't change this file because this file is a link and your changes will back default after next running 'bootstrap'. +# To override this file replace the link with a new file (rm requirements-install-default.txt && vi requirements-install-default.txt). +# To override an existing package version in this file add it to requirements-override-default.txt. pyyaml==5.4.1 acme-tiny==4.1.0 appdirs==1.4.4 @@ -37,7 +38,6 @@ future==0.18.2 gdata==2.0.18 geojson==2.5.0 gevent==1.0.2 --e git+https://github.com/janverb/git-aggregator.git@d1685abb2776d255730e90fd22ae3363d83a9e89#egg=git_aggregator -e git+https://github.com/OCA/openupgradelib.git@6d97dfc0af2f528889f4a491c71129ef0f7cf82f#egg=openupgradelib greenlet==0.4.7 idna==2.10 diff --git a/templates/apt-jammy-recomended-packages.txt b/templates/apt-jammy-recomended-packages.txt new file mode 100644 index 0000000..09d6c61 --- /dev/null +++ b/templates/apt-jammy-recomended-packages.txt @@ -0,0 +1,21 @@ +## Our project fully tested on ubuntu 22.04 +## we advise to install these apt packages: +# 'adduser antiword apt-transport-https autossh bash-completion bc build-essential bzip2 ca-certificates cmdtest curl direnv file +# fontconfig fonts-liberation gettext gettext-base ghostscript git graphviz imagemagick iputils-ping libbz2-dev libc6 libffi-dev +# libfontconfig1 libfreetype6 libfreetype6-dev libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev liblcms2-2 liblcms2-dev libldap-2.5-0 +# libldap2-dev liblzma-dev libmagickwand-dev libmupdf-dev libmysqlclient-dev libncurses5-dev libncursesw5-dev libopenjp2-7-dev +# libpoppler-cpp-dev libpq-dev libpq5 libreadline-dev libsasl2-2 libsasl2-dev libsqlite3-dev libssl-dev libssl3 libstdc++6 +# libtiff5-dev libtinfo-dev libwebp-dev libx11-6 libxext6 libxml2 libxml2-dev libxmlsec1-dev libxrender1 libxslt1-dev libxslt1.1 +# linux-headers-generic llvm locales-all locate lsb-base lsb-release lsof make man-db mariadb-client mariadb-server mlocate monit +# moreutils mupdf mupdf-tools nano ncurses-doc net-tools nmap nodejs npm openssh-server poppler-utils poppler-utils postgis +# postgresql-15 python-decorator python-xlwt-doc python2-dbg python2-dev python2-doc python2-minimal python2-pip-whl +# python2-setuptools-whl python3-babel python3-chardet python3-dateutil python3-decorator python3-dev python3-docutils +# python3-feedparser python3-gevent python3-html2text python3-jinja2 python3-ldap python3-libsass python3-libxml2 python3-lxml +# python3-mako python3-mock python3-mysqldb python3-openid python3-passlib python3-pil python3-pip python3-polib python3-psutil +# python3-psycopg2 python3-pydot python3-pyldap python3-pyparsing python3-pypdf2 python3-qrcode python3-reportlab python3-requests +# python3-simplejson python3-stdnum python3-suds python3-tz python3-unittest2 python3-venv python3-vobject python3-werkzeug +# python3-xlsxwriter python3-yaml rsync ruby-full ruby-sass screen software-properties-common ssl-cert sudo swig tcl-dev telnet +# tk-dev ufw unzip vim wget xmlsec1 xz-utils zlib1g zlib1g-dev wkhtmltox_0.12.6.1-2.jammy_amd64.deb' +# npm: less<4.0.0 + + diff --git a/templates/apt-jammy.txt b/templates/apt-jammy.txt deleted file mode 100644 index 40ef92f..0000000 --- a/templates/apt-jammy.txt +++ /dev/null @@ -1 +0,0 @@ -adduser antiword apt-transport-https autossh bash-completion bc build-essential bzip2 ca-certificates cmdtest curl direnv file fontconfig fonts-liberation gettext gettext-base ghostscript git graphviz imagemagick iputils-ping libbz2-dev libc6 libffi-dev libfontconfig1 libfreetype6 libfreetype6-dev libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev liblcms2-2 liblcms2-dev libldap-2.5-0 libldap2-dev liblzma-dev libmysqlclient-dev libncurses5-dev libncursesw5-dev libopenjp2-7-dev libpq-dev libpq5 libreadline-dev libsasl2-2 libsasl2-dev libsqlite3-dev libssl-dev libssl3 libstdc++6 libtiff5-dev libtinfo-dev libwebp-dev libx11-6 libxext6 libxml2 libxml2-dev libxmlsec1-dev libxrender1 libxslt1-dev libxslt1.1 linux-headers-generic llvm locales-all locate lsb-base lsb-release lsof make man-db mariadb-client mariadb-server mlocate monit moreutils nano ncurses-doc net-tools nmap nodejs npm openssh-server poppler-utils python-decorator python-xlwt-doc python2-dbg python2-dev python2-doc python2-minimal python2-pip-whl python2-setuptools-whl python3-babel python3-chardet python3-dateutil python3-decorator python3-dev python3-docutils python3-feedparser python3-gevent python3-html2text python3-jinja2 python3-ldap python3-libsass python3-libxml2 python3-lxml python3-mako python3-mock python3-mysqldb python3-openid python3-passlib python3-pil python3-pip python3-polib python3-psutil python3-psycopg2 python3-pydot python3-pyldap python3-pyparsing python3-pypdf2 python3-qrcode python3-reportlab python3-requests python3-simplejson python3-stdnum python3-suds python3-tz python3-unittest2 python3-venv python3-vobject python3-werkzeug python3-xlsxwriter python3-yaml rsync ruby-full ruby-sass screen software-properties-common ssl-cert sudo tcl-dev telnet tk-dev ufw unzip vim wget xz-utils zlib1g zlib1g-dev diff --git a/templates/code-examples.yaml b/templates/code-examples.yaml new file mode 100644 index 0000000..1087129 --- /dev/null +++ b/templates/code-examples.yaml @@ -0,0 +1,31 @@ +--- +# Next two examples will git main odoo code from "https://github.com/odoo/odoo/tree/${ODOO_VERSION}" +odoo: + +# or + +odoo/odoo: + +# Next three examples will git main odoo code from "https://github.com/oca/ocb/tree/${ODOO_VERSION}" +oca: + +# or +ocb: + +# or +oca/ocb: + + + +############################ +odoo: + merges: + - + remote: https://github.com/odoo/odoo.git + refs: + - ${ODOO_VERSION} + - test + depth: 111 +# hard_addons: +# - "*" + diff --git a/templates/code.yaml b/templates/code.yaml new file mode 100644 index 0000000..a0c96b4 --- /dev/null +++ b/templates/code.yaml @@ -0,0 +1,4 @@ +--- +odoo: + +OCA/web: diff --git a/templates/override-odoo.cfg b/templates/odoo-override.conf similarity index 89% rename from templates/override-odoo.cfg rename to templates/odoo-override.conf index 0ef2105..d2fb451 100644 --- a/templates/override-odoo.cfg +++ b/templates/odoo-override.conf @@ -1,5 +1,5 @@ [options] -# Version: v.22.05.30 +# Version: v.23.08.03 # Configure odoo options # Feel free to tune the variables in this file as you like # These variables here will override the variables in odoo.cfg diff --git a/templates/odoo.service b/templates/odoo.service index 9ab687d..4860c51 100644 --- a/templates/odoo.service +++ b/templates/odoo.service @@ -1,5 +1,5 @@ [Unit] -# Version: v.22.05.30 +# Version: v.23.08.03 Description=odoo After=network.target After=postgresql.service @@ -9,7 +9,7 @@ Requires=postgresql.service Type=simple User=ubuntu WorkingDirectory=/home/ubuntu/odoo -ExecStart=/home/ubuntu/odoo/odoo-service +ExecStart=/home/ubuntu/odoo/scripts/odoo-service KillMode=mixed [Install] diff --git a/templates/requirements.txt b/templates/requirements-override-install.txt similarity index 81% rename from templates/requirements.txt rename to templates/requirements-override-install.txt index f7f7ca6..2f82217 100644 --- a/templates/requirements.txt +++ b/templates/requirements-override-install.txt @@ -1,3 +1,3 @@ -# Version: v.22.05.30 +# Version: v.23.08.03 # Special PyPI packages versions. # Add packages here to override requirements-default.txt file. diff --git a/templates/waft-python-version b/templates/waft-python-version new file mode 100644 index 0000000..14fc9e9 --- /dev/null +++ b/templates/waft-python-version @@ -0,0 +1 @@ +3.10.6 \ No newline at end of file diff --git a/templates/waft-requirements-install-default.txt b/templates/waft-requirements-install-default.txt new file mode 100644 index 0000000..acde503 --- /dev/null +++ b/templates/waft-requirements-install-default.txt @@ -0,0 +1,9 @@ +# Version: v.23.08.03 +# Default PyPI packages versions for gitaggregator virtual environment. +pyyaml==6.0.1 +argcomplete==1.12.3 +colorama==0.4.4 +requests==2.26.0 +psycopg2==2.8.6 +python-dotenv==0.17.1 +-e git+https://github.com/acsone/git-aggregator.git@4a706d77269ea428a41900da59a9f929eb00a971#egg=git_aggregator diff --git a/translate-modules b/translate-modules deleted file mode 100755 index e861af7..0000000 --- a/translate-modules +++ /dev/null @@ -1,9 +0,0 @@ -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -export ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" -export DEEPL_SECRET=$DEEPL_SECRET -export PGDATABASE=$PGDATABASE - -${ODOO_WORK_DIR}/.venv/bin/python "$SCRIPT_PATH/waftlib/bin/translate-modules.py" $@ diff --git a/upgrade b/upgrade deleted file mode 100755 index a868260..0000000 --- a/upgrade +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Version: v.22.05.30 - -SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)" -ODOO_WORK_DIR="${SCRIPT_PATH}" -. "${ODOO_WORK_DIR}/.env-default" && \ -. "${ODOO_WORK_DIR}/.env-shared" && \ -. "${ODOO_WORK_DIR}/.env-secret" - -if [ "${#}" -eq 0 ]; then - /bin/echo "Upgrade a module" - /bin/echo "Usage: ./upgrade-module modulename" - exit -fi - -cd "${ODOO_WORK_DIR}" && . .venv/bin/activate && odoo -c ./auto/odoo.conf -u "${1}" --xmlrpc-port 18069 --stop-after-init --i18n-overwrite diff --git a/venvodoolib/__init__.py b/venvodoolib/__init__.py new file mode 100644 index 0000000..0400f03 --- /dev/null +++ b/venvodoolib/__init__.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python +# Version: v.23.08.03 +# -*- coding: utf-8 -*- + +from dotenv import load_dotenv +from glob import glob +from importlib import reload +import logging +import os +from subprocess import check_output, check_call +import yaml +try: + from shutil import which +except ImportError: + # Custom which implementation for Python 2 + def which(binary): + return check_output(["which", binary]).strip() + +SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) +WORK_DIRECTORY = os.path.realpath(os.path.join(SCRIPT_PATH, "../../../../..")) +os.environ['WORK_DIRECTORY'] = WORK_DIRECTORY +CONFIGURATIONS_DIRECTORY = os.path.join(WORK_DIRECTORY, "config") +os.environ['CONFIGURATIONS_DIRECTORY'] = CONFIGURATIONS_DIRECTORY +load_dotenv(os.path.join(CONFIGURATIONS_DIRECTORY, "env-default")) +load_dotenv(os.path.join(CONFIGURATIONS_DIRECTORY, "env-shared"), override=True) +load_dotenv(os.path.join(WORK_DIRECTORY, ".env-secret"), override=True) + +# Customize Waft logging +logging.shutdown() +reload(logging) +WAFT_LOG_LEVEL = os.environ["WAFT_LOG_LEVEL"] +logger = logging.getLogger("Waft") +log_handler = logging.StreamHandler() +log_formatter = logging.Formatter("%(name)s %(levelname)s: %(message)s") +log_handler.setFormatter(log_formatter) +logger.addHandler(log_handler) +if WAFT_LOG_LEVEL not in {"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}: + logger.warning( + "The 'WAFT_LOG_LEVEL' variable is incorrect; resetting to default WAFT_LOG_LEVEL='INFO'." + ) + WAFT_LOG_LEVEL = 'INFO' + os.environ["WAFT_LOG_LEVEL"] = 'INFO' +logger_level = getattr(logging, WAFT_LOG_LEVEL) + +ODOO_ADMIN_PASSWORD = os.environ["ODOO_ADMIN_PASSWORD"] +if ODOO_ADMIN_PASSWORD == '': + logger.warning( + "The 'ODOO_ADMIN_PASSWORD' variable is empty; resetting to default ODOO_ADMIN_PASSWORD='password'." + ) + ODOO_ADMIN_PASSWORD = 'password' + os.environ["ODOO_ADMIN_PASSWORD"] = 'password' + +ODOO_DBFILTER = os.environ["ODOO_DBFILTER"] +if ODOO_DBFILTER == '': + logger.warning( + "The 'ODOO_DBFILTER' variable is empty; resetting to default ODOO_DBFILTER='.*'." + ) + ODOO_DBFILTER = '.*' + os.environ["ODOO_DBFILTER"] = '.*' + +ODOO_INITIAL_LANG = os.environ["ODOO_INITIAL_LANG"] +if ODOO_INITIAL_LANG not in { + 'en_US', 'am_ET', 'ar_001', 'ar_SY', 'az_AZ', 'eu_ES', 'bn_IN', 'bs_BA', 'bg_BG', 'ca_ES', 'zh_CN', 'zh_HK', 'zh_TW', + 'hr_HR', 'cs_CZ', 'da_DK', 'nl_BE', 'nl_NL', 'en_AU', 'en_CA', 'en_GB', 'en_IN', 'et_EE', 'fi_FI', 'fr_BE', 'fr_CA', + 'fr_CH', 'fr_FR', 'gl_ES', 'ka_GE', 'de_DE', 'de_CH', 'el_GR', 'gu_IN', 'he_IL', 'hi_IN', 'hu_HU', 'id_ID', 'it_IT', + 'ja_JP', 'kab_DZ', 'km_KH', 'ko_KP', 'ko_KR', 'lo_LA', 'lv_LV', 'lt_LT', 'lb_LU', 'mk_MK', 'ml_IN', 'mn_MN', 'ms_MY', + 'my_MM', 'nb_NO', 'fa_IR', 'pl_PL', 'pt_AO', 'pt_BR', 'pt_PT', 'ro_RO', 'ru_RU', 'sr_RS', 'sr@latin', 'sk_SK', 'sl_SI', + 'es_AR', 'es_BO', 'es_CL', 'es_CO', 'es_CR', 'es_DO', 'es_EC', 'es_GT', 'es_MX', 'es_PA', 'es_PE', 'es_PY', 'es_UY', + 'es_VE', 'es_ES', 'sv_SE', 'th_TH', 'tl_PH', 'tr_TR', 'uk_UA', 'vi_VN', 'sq_AL', 'te_IN' + }: + logger.warning( + "The 'ODOO_INITIAL_LANG' variable is not in the standard languages list; resetting to default ODOO_INITIAL_LANG='nl_NL'." + ) + ODOO_INITIAL_LANG = 'nl_NL' + os.environ["ODOO_INITIAL_LANG"] = 'nl_NL' + +ODOO_LIMIT_MEMORY_HARD = os.environ["ODOO_LIMIT_MEMORY_HARD"] +if not ODOO_LIMIT_MEMORY_HARD.isdigit(): + logger.warning( + "The 'ODOO_LIMIT_MEMORY_HARD' variable is incorrect; resetting to default ODOO_LIMIT_MEMORY_HARD='2684354560'." + ) + ODOO_LIMIT_MEMORY_HARD = '2684354560' + os.environ["ODOO_LIMIT_MEMORY_HARD"] = '2684354560' + +ODOO_LIMIT_MEMORY_SOFT = os.environ["ODOO_LIMIT_MEMORY_SOFT"] +if not ODOO_LIMIT_MEMORY_SOFT.isdigit(): + logger.warning( + "The 'ODOO_LIMIT_MEMORY_SOFT' variable is incorrect; resetting to default ODOO_LIMIT_MEMORY_SOFT='2147483648'." + ) + ODOO_LIMIT_MEMORY_SOFT = '2147483648' + os.environ["ODOO_LIMIT_MEMORY_SOFT"] = '2147483648' + +ODOO_LIST_DB = os.environ["ODOO_LIST_DB"] +if ODOO_LIST_DB.lower() not in {"true", "false"}: + logger.warning( + "The 'ODOO_LIST_DB' variable is incorrect; resetting to default ODOO_LIST_DB='false'." + ) + ODOO_LIST_DB = 'false' + os.environ["ODOO_LIST_DB"] = 'false' + +ODOO_UNACCENT = os.environ["ODOO_UNACCENT"] +if ODOO_UNACCENT.lower() not in {"true", "false"}: + logger.warning( + "The 'ODOO_UNACCENT' variable is incorrect; resetting to default ODOO_UNACCENT='false'." + ) + ODOO_UNACCENT = 'false' + os.environ["ODOO_UNACCENT"] = 'false' + +ODOO_VERSION = os.environ["ODOO_VERSION"] +if ODOO_VERSION not in {'8.0', '9.0', '10.0', '11.0', '12.0', '13.0', '14.0', '15.0', '16.0'}: + logger.error( + "The 'ODOO_VERSION' variable is incorrect!" + ) + exit(1) + +ODOO_WITHOUT_DEMO = os.environ["ODOO_WITHOUT_DEMO"] +if ODOO_WITHOUT_DEMO == '': + logger.warning( + "The 'ODOO_WITHOUT_DEMO' variable is empty; resetting to default ODOO_WITHOUT_DEMO='all'." + ) + ODOO_WITHOUT_DEMO = 'all' + os.environ["ODOO_WITHOUT_DEMO"] = 'all' + +ODOO_WORKERS = os.environ["ODOO_WORKERS"] +if not ODOO_WORKERS.isdigit(): + logger.warning( + "The 'ODOO_WORKERS' variable is incorrect; resetting to default ODOO_WORKERS='0'." + ) + ODOO_WORKERS = '0' + os.environ["ODOO_WORKERS"] = '0' + +PGDATABASE = os.environ["PGDATABASE"] +if PGDATABASE == '': + logger.warning( + "The 'PGDATABASE' variable is empty; resetting to default PGDATABASE='odoodatabase'." + ) + PGDATABASE = 'odoodatabase' + os.environ["PGDATABASE"] = 'odoodatabase' + +PGHOST = os.environ["PGHOST"] +if PGHOST == '': + logger.warning( + "The 'PGHOST' variable is empty; resetting to default PGHOST='localhost'." + ) + PGHOST = 'localhost' + os.environ["PGHOST"] = 'localhost' + +PGPASSWORD = os.environ["PGPASSWORD"] + +PGPORT = os.environ["PGPORT"] +if not PGPORT.isdigit(): + logger.warning( + "The 'PGPORT' variable is incorrect; resetting to default PGPORT='5432'." + ) + PGPORT = '5432' + os.environ["PGPORT"] = '5432' + +PGUSER = os.environ["PGUSER"] +if PGUSER == '': + logger.warning( + "The 'PGUSER' variable is incorrect; resetting to default PGUSER='odoo'." + ) + PGUSER = 'odoo' + os.environ["PGUSER"] = 'odoo' + +WAFT_COMPILE = os.environ["WAFT_COMPILE"] +if WAFT_COMPILE.lower() not in {"true", "false"}: + logger.warning( + "The 'WAFT_COMPILE' variable is incorrect; resetting to default WAFT_COMPILE='true'." + ) + WAFT_COMPILE = 'true' + os.environ["WAFT_COMPILE"] = 'true' + +WAFT_DEPTH_DEFAULT = os.environ["WAFT_DEPTH_DEFAULT"] +if not WAFT_DEPTH_DEFAULT.isdigit(): + logger.warning( + "The 'WAFT_DEPTH_DEFAULT' variable is incorrect; resetting to default WAFT_DEPTH_DEFAULT='1'." + ) + WAFT_DEPTH_DEFAULT = '1' + os.environ["WAFT_DEPTH_DEFAULT"] = '1' + +WAFT_DEPTH_MERGE = os.environ["WAFT_DEPTH_MERGE"] +if not WAFT_DEPTH_MERGE.isdigit(): + logger.warning( + "The 'WAFT_DEPTH_MERGE' variable is incorrect; resetting to default WAFT_DEPTH_MERGE='100'." + ) + WAFT_DEPTH_MERGE = '100' + os.environ["WAFT_DEPTH_MERGE"] = '100' + +WAFT_WAIT_DB = os.environ["WAFT_WAIT_DB"] +if WAFT_WAIT_DB.lower() not in {"true", "false"}: + logger.warning( + "The 'WAFT_WAIT_DB' variable is incorrect; resetting to default WAFT_WAIT_DB='false'." + ) + WAFT_WAIT_DB = 'false' + os.environ["WAFT_WAIT_DB"] = 'false' + +REPOSITORIES_DIRECTORY = os.path.join(WORK_DIRECTORY, ".ignore/code") +CODE_YAML_FILE = os.path.join(CONFIGURATIONS_DIRECTORY, "code.yaml") +ODOO_MAIN_CODE_DIRECTORY = os.path.join(WORK_DIRECTORY, ".ignore/code/odoo") +IGNORE_DIRECTORY = os.path.join(WORK_DIRECTORY, ".ignore") +EVENTUAL_ADDONS_DIRECTORY = os.path.join(WORK_DIRECTORY, "addons") diff --git a/venvwaftlib/__init__.py b/venvwaftlib/__init__.py new file mode 100644 index 0000000..f1a3f7d --- /dev/null +++ b/venvwaftlib/__init__.py @@ -0,0 +1,877 @@ +#!/usr/bin/env python +# Version: v.23.08.03 +# -*- coding: utf-8 -*- + +from dotenv import load_dotenv +from glob import glob +from importlib import reload +import logging +import os +import re +from subprocess import check_output, check_call, run, PIPE +import yaml +from shutil import which + +SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) +WORK_DIRECTORY = os.path.realpath(os.path.join(SCRIPT_PATH, "../../../../..")) +os.environ['WORK_DIRECTORY'] = WORK_DIRECTORY +CONFIGURATIONS_DIRECTORY = os.path.join(WORK_DIRECTORY, "config") +os.environ['CONFIGURATIONS_DIRECTORY'] = CONFIGURATIONS_DIRECTORY +load_dotenv(os.path.join(CONFIGURATIONS_DIRECTORY, "env-default")) +load_dotenv(os.path.join(CONFIGURATIONS_DIRECTORY, "env-shared"), override=True) +load_dotenv(os.path.join(WORK_DIRECTORY, ".env-secret"), override=True) + +# Customize Waft logging +logging.shutdown() +reload(logging) +WAFT_LOG_LEVEL = os.environ["WAFT_LOG_LEVEL"] +logger = logging.getLogger("Waft") +log_handler = logging.StreamHandler() +log_formatter = logging.Formatter("%(name)s %(levelname)s: %(message)s") +log_handler.setFormatter(log_formatter) +logger.addHandler(log_handler) +if WAFT_LOG_LEVEL not in {"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}: + logger.warning( + "The 'WAFT_LOG_LEVEL' variable is incorrect; resetting to default WAFT_LOG_LEVEL='INFO'." + ) + WAFT_LOG_LEVEL = 'INFO' + os.environ["WAFT_LOG_LEVEL"] = 'INFO' + +logger_level = getattr(logging, WAFT_LOG_LEVEL) + +ODOO_ADMIN_PASSWORD = os.environ["ODOO_ADMIN_PASSWORD"] +if ODOO_ADMIN_PASSWORD == '': + logger.warning( + "The 'ODOO_ADMIN_PASSWORD' variable is empty; resetting to default ODOO_ADMIN_PASSWORD='password'." + ) + ODOO_ADMIN_PASSWORD = 'password' + os.environ["ODOO_ADMIN_PASSWORD"] = 'password' + +ODOO_DBFILTER = os.environ["ODOO_DBFILTER"] +if ODOO_DBFILTER == '': + logger.warning( + "The 'ODOO_DBFILTER' variable is empty; resetting to default ODOO_DBFILTER='.*'." + ) + ODOO_DBFILTER = '.*' + os.environ["ODOO_DBFILTER"] = '.*' + +ODOO_INITIAL_LANG = os.environ["ODOO_INITIAL_LANG"] +if ODOO_INITIAL_LANG not in { + 'en_US', 'am_ET', 'ar_001', 'ar_SY', 'az_AZ', 'eu_ES', 'bn_IN', 'bs_BA', 'bg_BG', 'ca_ES', 'zh_CN', 'zh_HK', 'zh_TW', + 'hr_HR', 'cs_CZ', 'da_DK', 'nl_BE', 'nl_NL', 'en_AU', 'en_CA', 'en_GB', 'en_IN', 'et_EE', 'fi_FI', 'fr_BE', 'fr_CA', + 'fr_CH', 'fr_FR', 'gl_ES', 'ka_GE', 'de_DE', 'de_CH', 'el_GR', 'gu_IN', 'he_IL', 'hi_IN', 'hu_HU', 'id_ID', 'it_IT', + 'ja_JP', 'kab_DZ', 'km_KH', 'ko_KP', 'ko_KR', 'lo_LA', 'lv_LV', 'lt_LT', 'lb_LU', 'mk_MK', 'ml_IN', 'mn_MN', 'ms_MY', + 'my_MM', 'nb_NO', 'fa_IR', 'pl_PL', 'pt_AO', 'pt_BR', 'pt_PT', 'ro_RO', 'ru_RU', 'sr_RS', 'sr@latin', 'sk_SK', 'sl_SI', + 'es_AR', 'es_BO', 'es_CL', 'es_CO', 'es_CR', 'es_DO', 'es_EC', 'es_GT', 'es_MX', 'es_PA', 'es_PE', 'es_PY', 'es_UY', + 'es_VE', 'es_ES', 'sv_SE', 'th_TH', 'tl_PH', 'tr_TR', 'uk_UA', 'vi_VN', 'sq_AL', 'te_IN' + }: + logger.warning( + "The 'ODOO_INITIAL_LANG' variable is not in the standard languages list; resetting to default ODOO_INITIAL_LANG='nl_NL'." + ) + ODOO_INITIAL_LANG = 'nl_NL' + os.environ["ODOO_INITIAL_LANG"] = 'nl_NL' + +ODOO_LIMIT_MEMORY_HARD = os.environ["ODOO_LIMIT_MEMORY_HARD"] +if not ODOO_LIMIT_MEMORY_HARD.isdigit(): + logger.warning( + "The 'ODOO_LIMIT_MEMORY_HARD' variable is incorrect; resetting to default ODOO_LIMIT_MEMORY_HARD='2684354560'." + ) + ODOO_LIMIT_MEMORY_HARD = '2684354560' + os.environ["ODOO_LIMIT_MEMORY_HARD"] = '2684354560' + +ODOO_LIMIT_MEMORY_SOFT = os.environ["ODOO_LIMIT_MEMORY_SOFT"] +if not ODOO_LIMIT_MEMORY_SOFT.isdigit(): + logger.warning( + "The 'ODOO_LIMIT_MEMORY_SOFT' variable is incorrect; resetting to default ODOO_LIMIT_MEMORY_SOFT='2147483648'." + ) + ODOO_LIMIT_MEMORY_SOFT = '2147483648' + os.environ["ODOO_LIMIT_MEMORY_SOFT"] = '2147483648' + +ODOO_LIST_DB = os.environ["ODOO_LIST_DB"] +if ODOO_LIST_DB.lower() not in {"true", "false"}: + logger.warning( + "The 'ODOO_LIST_DB' variable is incorrect; resetting to default ODOO_LIST_DB='false'." + ) + ODOO_LIST_DB = 'false' + os.environ["ODOO_LIST_DB"] = 'false' + +ODOO_UNACCENT = os.environ["ODOO_UNACCENT"] +if ODOO_UNACCENT.lower() not in {"true", "false"}: + logger.warning( + "The 'ODOO_UNACCENT' variable is incorrect; resetting to default ODOO_UNACCENT='false'." + ) + ODOO_UNACCENT = 'false' + os.environ["ODOO_UNACCENT"] = 'false' + +ODOO_VERSION = os.environ["ODOO_VERSION"] +if ODOO_VERSION not in {'8.0', '9.0', '10.0', '11.0', '12.0', '13.0', '14.0', '15.0', '16.0'}: + logger.error( + "The 'ODOO_VERSION' variable is incorrect!" + ) + exit(1) + +ODOO_WITHOUT_DEMO = os.environ["ODOO_WITHOUT_DEMO"] +if ODOO_WITHOUT_DEMO == '': + logger.warning( + "The 'ODOO_WITHOUT_DEMO' variable is empty; resetting to default ODOO_WITHOUT_DEMO='all'." + ) + ODOO_WITHOUT_DEMO = 'all' + os.environ["ODOO_WITHOUT_DEMO"] = 'all' + +ODOO_WORKERS = os.environ["ODOO_WORKERS"] +if not ODOO_WORKERS.isdigit(): + logger.warning( + "The 'ODOO_WORKERS' variable is incorrect; resetting to default ODOO_WORKERS='0'." + ) + ODOO_WORKERS = '0' + os.environ["ODOO_WORKERS"] = '0' + +PGDATABASE = os.environ["PGDATABASE"] +if PGDATABASE == '': + logger.warning( + "The 'PGDATABASE' variable is empty; resetting to default PGDATABASE='odoodatabase'." + ) + PGDATABASE = 'odoodatabase' + os.environ["PGDATABASE"] = 'odoodatabase' + +PGHOST = os.environ["PGHOST"] +if PGHOST == '': + logger.warning( + "The 'PGHOST' variable is empty; resetting to default PGHOST='localhost'." + ) + PGHOST = 'localhost' + os.environ["PGHOST"] = 'localhost' + +PGPASSWORD = os.environ["PGPASSWORD"] + +PGPORT = os.environ["PGPORT"] +if not PGPORT.isdigit(): + logger.warning( + "The 'PGPORT' variable is incorrect; resetting to default PGPORT='5432'." + ) + PGPORT = '5432' + os.environ["PGPORT"] = '5432' + +PGUSER = os.environ["PGUSER"] +if PGUSER == '': + logger.warning( + "The 'PGUSER' variable is incorrect; resetting to default PGUSER='odoo'." + ) + PGUSER = 'odoo' + os.environ["PGUSER"] = 'odoo' + +WAFT_COMPILE = os.environ["WAFT_COMPILE"] +if WAFT_COMPILE.lower() not in {"true", "false"}: + logger.warning( + "The 'WAFT_COMPILE' variable is incorrect; resetting to default WAFT_COMPILE='true'." + ) + WAFT_COMPILE = 'true' + os.environ["WAFT_COMPILE"] = 'true' + +WAFT_DEPTH_DEFAULT = os.environ["WAFT_DEPTH_DEFAULT"] +if not WAFT_DEPTH_DEFAULT.isdigit(): + logger.warning( + "The 'WAFT_DEPTH_DEFAULT' variable is incorrect; resetting to default WAFT_DEPTH_DEFAULT='1'." + ) + WAFT_DEPTH_DEFAULT = '1' + os.environ["WAFT_DEPTH_DEFAULT"] = '1' + +WAFT_DEPTH_MERGE = os.environ["WAFT_DEPTH_MERGE"] +if not WAFT_DEPTH_MERGE.isdigit(): + logger.warning( + "The 'WAFT_DEPTH_MERGE' variable is incorrect; resetting to default WAFT_DEPTH_MERGE='100'." + ) + WAFT_DEPTH_MERGE = '100' + os.environ["WAFT_DEPTH_MERGE"] = '100' + +WAFT_WAIT_DB = os.environ["WAFT_WAIT_DB"] +if WAFT_WAIT_DB.lower() not in {"true", "false"}: + logger.warning( + "The 'WAFT_WAIT_DB' variable is incorrect; resetting to default WAFT_WAIT_DB='false'." + ) + WAFT_WAIT_DB = 'false' + os.environ["WAFT_WAIT_DB"] = 'false' + +REPOSITORIES_DIRECTORY = os.path.join(WORK_DIRECTORY, ".ignore/code") +CODE_YAML_FILE = os.path.join(CONFIGURATIONS_DIRECTORY, "code.yaml") +ODOO_MAIN_CODE_DIRECTORY = os.path.join(WORK_DIRECTORY, ".ignore/code/odoo") +IGNORE_DIRECTORY = os.path.join(WORK_DIRECTORY, ".ignore") +EVENTUAL_ADDONS_DIRECTORY = os.path.join(WORK_DIRECTORY, "addons") + +# Check if CODE_YAML_FILE exist. +if not os.path.exists(CODE_YAML_FILE): + logger.error( + "Could not find '%s' Odoo code configuration file.", + CODE_YAML_FILE + ) + exit(1) + +# Load CODE_YAML_FILE yaml file as code_file_yaml dictionary. +try: + with open(CODE_YAML_FILE) as code_FILE_yaml: + code_file_yaml = yaml.safe_load(code_FILE_yaml) +except IOError: + logger.error( + "Could not load '%s' Odoo code configuration file.", + CODE_YAML_FILE + ) + exit(1) + +# Convert code_file_yaml to waft_code_auto_tmp_yaml_dict +code_addons_yaml_original_entries_dict = dict() +code_addons_yaml_fixed_entries_dict = dict() +waft_code_auto_tmp_yaml_dict = dict() +for code_addons_yaml_original_repo in code_file_yaml: + if type(code_file_yaml[code_addons_yaml_original_repo]) != dict: + logger.warning( + "In '%s' file:" + " Waft found unexpected '%' that should be a dictionary!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + continue + if code_addons_yaml_original_repo in code_addons_yaml_original_entries_dict or \ + code_addons_yaml_original_repo in code_addons_yaml_fixed_entries_dict: + logger.warning( + "In '%s' file:" + " Waft found a duplicated addons repository configuration '%s'!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + continue + addons_subpath_repo = re.sub("[^\.\-\_\/a-z0-9]", "", code_addons_yaml_original_repo.lower()) + if addons_subpath_repo in {'', '/'}: + logger.warning( + "In '%s' file:" + " Waft found unacceptable addons repository configuration '%s' string!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + continue + subdirs_elements_list = list() + waft_main_auto_code_default_remote = str() + if addons_subpath_repo in {'odoo', 'odoo/odoo', 'oca', 'ocb', 'oca/ocb'}: + if 'odoo' in waft_code_auto_tmp_yaml_dict: + logger.warning( + "In '%s' file:" + " Waft found a duplicated 'odoo' addons repository configuration '%s'!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + continue + else: + if addons_subpath_repo in {'odoo', 'odoo/odoo'}: + waft_main_auto_code_default_remote = 'https://github.com/odoo/odoo.git' + else: + waft_main_auto_code_default_remote = 'https://github.com/oca/ocb.git' + addons_subpath_repo = 'odoo' + else: + for subdir_element in addons_subpath_repo.split('/'): + if subdir_element != '': + subdirs_elements_list.append(subdir_element) + if len(subdirs_elements_list) != 1: + addons_subpath_repo = '/'.join(subdirs_elements_list[-2:]) + else: + if addons_subpath_repo != 'odoo': + addons_subpath_repo = os.path.join('oca', subdirs_elements_list[0]) + if addons_subpath_repo in code_addons_yaml_fixed_entries_dict: + logger.warning( + "In '%s' file:" + " Waft found a duplicated addons repository configuration '%s'!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + continue + if code_addons_yaml_original_repo != addons_subpath_repo: + logger.info( + "Waft took '%s' addons repository configuration name form '%S' file and convert it to '%s'.", + code_addons_yaml_original_repo, CODE_YAML_FILE, addons_subpath_repo + ) + waft_addons_auto_repo_tmp_dict = dict() + code_addons_repo_yaml_original_dict = code_file_yaml[code_addons_yaml_original_repo] + waft_addons_auto_repo_tmp_dict['code_addons_repo_yaml_original_dict'] = code_addons_repo_yaml_original_dict + code_addons_yaml_original_entries_dict[code_addons_yaml_original_repo] = addons_subpath_repo + code_addons_yaml_fixed_entries_dict[addons_subpath_repo] = code_addons_yaml_original_repo + waft_addons_auto_repo_tmp_dict['code_addons_yaml_original_repo'] = code_addons_yaml_original_repo + waft_addons_auto_repo_tmp_dict['addons_subpath_repo'] = addons_subpath_repo + default_generate_merges = True + waft_addons_auto_repo_tmp_dict['code_merges_yaml_original_list'] = list() + code_merges_yaml_original_list = list() + waft_merge_auto_remote = str() + waft_merge_auto_tmp_dict = dict() + waft_merges_auto_no_depth_tmp_list = list() + if 'merges' in code_addons_repo_yaml_original_dict: + if type(code_addons_repo_yaml_original_dict['merges']) != list: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found unexpected '%' that should be a list!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, code_addons_repo_yaml_original_dict['merges'] + ) + else: + code_merges_yaml_original_list = code_addons_repo_yaml_original_dict['merges'] + if len(code_merges_yaml_original_list) == 0: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found an empty 'merges:' list!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + code_merges_yaml_original_list = list() + else: + default_generate_merges = False + waft_addons_auto_repo_tmp_dict['code_merges_yaml_original_list'] = code_merges_yaml_original_list + if addons_subpath_repo == 'odoo': + waft_merge_auto_remote = waft_main_auto_code_default_remote + else: + waft_merge_auto_remote = "https://github.com/oca/{}.git".format(addons_subpath_repo) + waft_merges_auto_tmp_list = list() + for code_merge_yaml_dict in code_merges_yaml_original_list if not default_generate_merges else []: + default_generate_remote = True + code_merge_yaml_original_remote = str() + waft_merge_auto_depth = str() + if type(code_merge_yaml_dict) != dict: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found unexpected '%' that should be a dictionary!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + continue + elif 'remote' not in code_merge_yaml_dict: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft didn't find 'remote' key!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + elif type(code_merge_yaml_dict['remote']) != str: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found unexpected 'remote: %s' that should be a string!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, + code_merge_yaml_dict['remote'] + ) + else: + code_merge_yaml_original_remote = code_merge_yaml_dict['remote'] + code_merge_yaml_fixed_remote = re.sub("[^\.\-\_\:\/a-z0-9]", "", code_merge_yaml_original_remote.lower()) + if code_merge_yaml_fixed_remote == '': + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found 'remote' key with an empty value!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + else: + default_generate_remote = False + waft_merge_auto_remote = code_merge_yaml_fixed_remote + if code_merge_yaml_original_remote != waft_merge_auto_remote: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft took 'remote: %s' and convert it to 'remote: %s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, + code_merge_yaml_original_remote, waft_merge_auto_remote + ) + else: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft set 'remote: %s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, + waft_merge_auto_remote + ) + if 'refs' not in code_merge_yaml_dict: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft didn't find 'refs' list!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + elif type(code_merge_yaml_dict['refs']) != list: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found unexpected '%' that should be a list!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, code_merge_yaml_dict['refs'] + ) + elif len(code_merge_yaml_dict['refs']) == 0: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found an empty 'refs:' list!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + else: + for code_merge_yaml_ref in code_merge_yaml_dict['refs']: + if type(code_merge_yaml_ref) != str: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found unexpected value that should be a string!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + continue + code_merge_yaml_original_ref = code_merge_yaml_ref + for odoo_variable_version in {'"${ODOO_VERSION}"', '${ODOO_VERSION}', '"$ODOO_VERSION"', '$ODOO_VERSION'}: + code_merge_yaml_ref = code_merge_yaml_ref.replace(odoo_variable_version, ODOO_VERSION) + code_merge_yaml_fixed_ref = re.sub("[^\.\-\_\ a-z0-9]", "", code_merge_yaml_ref.lower()) + waft_merge_auto_branch = str() + waft_merge_auto_pin = str() + if code_merge_yaml_fixed_ref == '': + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found an empty value!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, ODOO_VERSION + ) + else: + if code_merge_yaml_original_ref != code_merge_yaml_fixed_ref: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft took '%s' and convert it to '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, + code_merge_yaml_original_ref, code_merge_yaml_fixed_ref + ) + else: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft set '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + for ref_element in code_merge_yaml_fixed_ref.split(' '): + if ref_element == '': + continue + if waft_merge_auto_branch == '': + waft_merge_auto_branch = ref_element + else: + waft_merge_auto_pin = ref_element + break + if waft_merge_auto_branch == '' and default_generate_remote: + continue + elif waft_merge_auto_branch == '': + waft_merge_auto_branch = ODOO_VERSION + waft_merge_auto_no_depth_tmp_dict = dict() + waft_merge_auto_no_depth_tmp_dict['code_merge_yaml_original_remote'] = code_merge_yaml_original_remote + waft_merge_auto_no_depth_tmp_dict['waft_merge_auto_remote'] = waft_merge_auto_remote + waft_merge_auto_no_depth_tmp_dict['code_merge_yaml_original_ref'] = code_merge_yaml_original_ref + waft_merge_auto_no_depth_tmp_dict['code_merge_yaml_fixed_ref'] = code_merge_yaml_fixed_ref + waft_merge_auto_no_depth_tmp_dict['remote'] = waft_merge_auto_remote + waft_merge_auto_no_depth_tmp_dict['branch'] = waft_merge_auto_branch + waft_merge_auto_no_depth_tmp_dict['pin'] = waft_merge_auto_pin + waft_merges_auto_no_depth_tmp_list.append(waft_merge_auto_no_depth_tmp_dict) + code_merge_yaml_original_depth = int() + code_merge_yaml_fixed_depth = int() + if 'depth' not in code_merge_yaml_dict: + waft_merge_auto_depth = 0 + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft didn't find 'depth' key!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + elif type(code_merge_yaml_dict['depth']) != str and type(code_merge_yaml_dict['depth']) != int: + waft_merge_auto_depth = 0 + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found unexpected 'depth: %s' that should be a number!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, + code_merge_yaml_dict['depth'] + ) + else: + code_merge_yaml_original_depth = code_merge_yaml_dict['depth'] + code_merge_yaml_fixed_depth = re.sub("[^0-9]", "", code_merge_yaml_original_depth) + code_merge_yaml_fixed_depth = int(code_merge_yaml_fixed_depth) + if code_merge_yaml_fixed_depth == '': + waft_merge_auto_depth = 0 + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft found 'depth' key with an empty value!" + " Waft will set it later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict + ) + else: + waft_merge_auto_depth = code_merge_yaml_fixed_depth + if code_merge_yaml_original_depth != waft_merge_auto_depth and code_merge_yaml_original_depth != str(waft_merge_auto_depth): + logger.info( + "In '%s' file, '%s' dictionary, '%s' list, '%s' dictionary:" + " Waft took 'depth: %s' and convert it to 'depth: %s'." + " Waft will set depth later.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_merges_yaml_original_list, code_merge_yaml_dict, + code_merge_yaml_original_depth, waft_merge_auto_depth + ) + if waft_merge_auto_depth == 0: + waft_merge_auto_depth = 77 + if len(waft_merges_auto_no_depth_tmp_list) == 1: + waft_merge_auto_no_depth_tmp_dict = waft_merges_auto_no_depth_tmp_list[0] + if waft_merge_auto_no_depth_tmp_dict['pin'] == '': + waft_merge_auto_depth = 1 + waft_merge_auto_no_depth_tmp_dict = dict() + waft_merges_auto_tmp_list = list() + waft_merge_auto_tmp_dict = dict() + for waft_merge_auto_no_depth_tmp_loop_dict in waft_merges_auto_no_depth_tmp_list: + waft_merge_auto_tmp_dict['code_merge_yaml_original_remote'] = waft_merge_auto_no_depth_tmp_loop_dict['code_merge_yaml_original_remote'] + waft_merge_auto_tmp_dict['waft_merge_auto_remote'] = waft_merge_auto_no_depth_tmp_loop_dict['waft_merge_auto_remote'] + waft_merge_auto_tmp_dict['code_merge_yaml_original_ref'] = waft_merge_auto_no_depth_tmp_loop_dict['code_merge_yaml_original_ref'] + waft_merge_auto_tmp_dict['code_merge_yaml_fixed_ref'] = waft_merge_auto_no_depth_tmp_loop_dict['code_merge_yaml_fixed_ref'] + waft_merge_auto_tmp_dict['code_merge_yaml_original_depth'] = code_merge_yaml_original_depth + waft_merge_auto_tmp_dict['code_merge_yaml_fixed_depth'] = code_merge_yaml_fixed_depth + waft_merge_auto_tmp_dict['remote'] = waft_merge_auto_no_depth_tmp_loop_dict['remote'] + waft_merge_auto_tmp_dict['branch'] = waft_merge_auto_no_depth_tmp_loop_dict['branch'] + waft_merge_auto_tmp_dict['pin'] = waft_merge_auto_no_depth_tmp_loop_dict['pin'] + if len(waft_merges_auto_tmp_list) > 0 and waft_merge_auto_depth == 1: + waft_merge_auto_tmp_dict['depth'] = 77 + else: + waft_merge_auto_tmp_dict['depth'] = waft_merge_auto_depth + waft_merges_auto_tmp_list.append(waft_merge_auto_tmp_dict) + if len(waft_merges_auto_tmp_list) == 0: + waft_merge_auto_tmp_dict = dict() + waft_merge_auto_tmp_dict['code_merge_yaml_original_remote'] = str() + waft_merge_auto_tmp_dict['waft_merge_auto_remote'] = waft_merge_auto_remote + waft_merge_auto_tmp_dict['code_merge_yaml_original_ref'] = str() + waft_merge_auto_tmp_dict['code_merge_yaml_fixed_ref'] = str() + waft_merge_auto_tmp_dict['code_merge_yaml_original_depth'] = int() + waft_merge_auto_tmp_dict['code_merge_yaml_fixed_depth'] = int() + waft_merge_auto_tmp_dict['remote'] = waft_merge_auto_remote + waft_merge_auto_tmp_dict['branch'] = ODOO_VERSION + waft_merge_auto_tmp_dict['pin'] = str() + waft_merge_auto_tmp_dict['depth'] = 1 + waft_merges_auto_tmp_list.append(waft_merge_auto_tmp_dict) + waft_addons_auto_repo_tmp_dict['merges'] = waft_merges_auto_tmp_list + code_hard_addons_yaml_original_list = list() + waft_hard_addons_auto_tmp_list = list() + default_generate_hard_addons = True + if 'hard_addons' in code_addons_repo_yaml_original_dict: + if type(code_addons_repo_yaml_original_dict['hard_addons']) != list: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found unexpected '%' that should be a list!" + " Waft reset it to list().", + CODE_YAML_FILE, code_addons_yaml_original_repo, code_addons_repo_yaml_original_dict['hard_addons'] + ) + else: + code_hard_addons_yaml_original_list = code_addons_repo_yaml_original_dict['hard_addons'] + if len(code_hard_addons_yaml_original_list) == 0: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found an empty 'hard_addons:' list!" + " Waft reset it to list().", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + code_hard_addons_yaml_original_list = list() + else: + default_generate_hard_addons = False + else: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft didn't find 'hard_addons' list!" + " Waft set it to list().", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + code_hard_addons_yaml_original_list = list() + waft_addons_auto_repo_tmp_dict['code_hard_addons_yaml_original_list'] = code_hard_addons_yaml_original_list + for code_hard_addons_yaml_value in code_hard_addons_yaml_original_list if not default_generate_hard_addons else []: + if type(code_hard_addons_yaml_value) != str: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found unexpected value that should be a string!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_hard_addons_yaml_original_list + ) + continue + code_hard_addons_yaml_original_value = code_hard_addons_yaml_value + code_hard_addons_yaml_fixed_value = re.sub("[^\.\-\_\*a-z0-9]", "", code_hard_addons_yaml_original_value.lower()) + if code_hard_addons_yaml_fixed_value == '*': + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found '*' as a value!" + " Waft ignored all other entries in 'hard_addons' list and reset it to '*'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_hard_addons_yaml_original_list + ) + waft_hard_addons_auto_tmp_list = ['*'] + break + code_hard_addons_yaml_fixed_value = re.sub("[^\.\-\_a-z0-9]", "", code_hard_addons_yaml_original_value.lower()) + if code_hard_addons_yaml_fixed_value == '': + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found an empty value!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_hard_addons_yaml_original_list + ) + continue + else: + if code_hard_addons_yaml_original_value != code_hard_addons_yaml_fixed_value: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft took '%s' and convert it to '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_hard_addons_yaml_original_list, code_hard_addons_yaml_original_value, + code_hard_addons_yaml_fixed_value + ) + else: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft set '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_hard_addons_yaml_original_list, code_hard_addons_yaml_original_value + ) + waft_hard_addons_auto_tmp_list.append(code_hard_addons_yaml_fixed_value) + if len(waft_hard_addons_auto_tmp_list) == 0: + waft_addons_auto_repo_tmp_dict['hard_addons'] = list() + else: + waft_addons_auto_repo_tmp_dict['hard_addons'] = waft_hard_addons_auto_tmp_list + code_soft_addons_yaml_original_list = list() + if waft_hard_addons_auto_tmp_list == ['*']: + waft_soft_addons_auto_tmp_default_list = list() + else: + waft_soft_addons_auto_tmp_default_list = ['*'] + waft_soft_addons_auto_tmp_list = waft_soft_addons_auto_tmp_default_list + default_generate_soft_addons = True + if 'soft_addons' in code_addons_repo_yaml_original_dict: + if type(code_addons_repo_yaml_original_dict['soft_addons']) != list: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found unexpected '%' that should be a list!" + " Waft reset it to '%'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, code_addons_repo_yaml_original_dict['soft_addons'], + waft_soft_addons_auto_tmp_list + ) + else: + code_soft_addons_yaml_original_list = code_addons_repo_yaml_original_dict['soft_addons'] + if len(code_soft_addons_yaml_original_list) == 0: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found an empty 'soft_addons:' list!" + " Waft reset it to '%'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, waft_soft_addons_auto_tmp_list + ) + code_soft_addons_yaml_original_list = list() + else: + default_generate_soft_addons = False + else: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft didn't find 'soft_addons' list!" + " Waft set it to '%'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, waft_soft_addons_auto_tmp_list + ) + code_soft_addons_yaml_original_list = list() + waft_addons_auto_repo_tmp_dict['code_soft_addons_yaml_original_list'] = code_soft_addons_yaml_original_list + for code_soft_addons_yaml_value in code_soft_addons_yaml_original_list if not default_generate_soft_addons else []: + if type(code_soft_addons_yaml_value) != str: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found unexpected value that should be a string!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_soft_addons_yaml_original_list + ) + continue + code_soft_addons_yaml_original_value = code_soft_addons_yaml_value + code_soft_addons_yaml_fixed_value = re.sub("[^\.\-\_\*a-z0-9]", "", code_soft_addons_yaml_original_value.lower()) + if code_soft_addons_yaml_fixed_value == '*': + if waft_hard_addons_auto_tmp_list != ['*']: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found '*' as a value!" + " Waft ignored all other entries in 'soft_addons' list and reset it to '*'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_soft_addons_yaml_original_list + ) + waft_soft_addons_auto_tmp_list = ['*'] + break + else: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found '*' as a value, and 'hard_addons' already set to '*'!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_soft_addons_yaml_original_list + ) + continue + code_soft_addons_yaml_fixed_value = re.sub("[^\.\-\_a-z0-9]", "", code_soft_addons_yaml_original_value.lower()) + if code_soft_addons_yaml_fixed_value == '': + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found an empty value!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_soft_addons_yaml_original_list + ) + continue + else: + if code_soft_addons_yaml_original_value != code_soft_addons_yaml_fixed_value: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft took '%s' and convert it to '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_soft_addons_yaml_original_list, code_soft_addons_yaml_original_value, + code_soft_addons_yaml_fixed_value + ) + else: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft set '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_soft_addons_yaml_original_list, code_soft_addons_yaml_original_value + ) + waft_soft_addons_auto_tmp_list.append(code_soft_addons_yaml_fixed_value) + if len(waft_soft_addons_auto_tmp_list) == 0: + waft_addons_auto_repo_tmp_dict['soft_addons'] = waft_soft_addons_auto_tmp_default_list + else: + waft_addons_auto_repo_tmp_dict['soft_addons'] = waft_soft_addons_auto_tmp_list + code_ignore_addons_yaml_original_list = list() + waft_ignore_addons_auto_tmp_list = list() + default_generate_ignore_addons = True + if 'ignore_addons' in code_addons_repo_yaml_original_dict: + if type(code_addons_repo_yaml_original_dict['ignore_addons']) != list: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found unexpected '%' that should be a list!" + " Waft reset it to list().", + CODE_YAML_FILE, code_addons_yaml_original_repo, code_addons_repo_yaml_original_dict['ignore_addons'] + ) + else: + code_ignore_addons_yaml_original_list = code_addons_repo_yaml_original_dict['ignore_addons'] + if len(code_ignore_addons_yaml_original_list) == 0: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft found an empty 'ignore_addons:' list!" + " Waft reset it to list().", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + code_ignore_addons_yaml_original_list = list() + else: + if waft_hard_addons_auto_tmp_list == ['*'] or waft_soft_addons_auto_tmp_list == ['*']: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft reset 'ignore_addons:' to list(), because 'hard_addons' or 'soft_addons' already '*'.", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + waft_ignore_addons_auto_tmp_list = list() + default_generate_ignore_addons = True + else: + default_generate_ignore_addons = False + else: + logger.warning( + "In '%s' file, '%s' dictionary:" + " Waft didn't find 'ignore_addons' list!" + " Waft set it to list().", + CODE_YAML_FILE, code_addons_yaml_original_repo + ) + code_ignore_addons_yaml_original_list = list() + waft_addons_auto_repo_tmp_dict['code_ignore_addons_yaml_original_list'] = code_ignore_addons_yaml_original_list + for code_ignore_addons_yaml_value in code_ignore_addons_yaml_original_list if not default_generate_ignore_addons else []: + if type(code_ignore_addons_yaml_value) != str: + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found unexpected value that should be a string!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_ignore_addons_yaml_original_list + ) + continue + code_ignore_addons_yaml_original_value = code_ignore_addons_yaml_value + code_ignore_addons_yaml_fixed_value = re.sub("[^\.\-\_\*a-z0-9]", "", code_ignore_addons_yaml_original_value.lower()) + if code_ignore_addons_yaml_fixed_value == '*': + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found '*' as a value!" + " Waft ignored all other entries in 'ignore_addons' list and reset it to '*'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_ignore_addons_yaml_original_list + ) + waft_ignore_addons_auto_tmp_list = ['*'] + break + code_ignore_addons_yaml_fixed_value = re.sub("[^\.\-\_a-z0-9]", "", code_ignore_addons_yaml_original_value.lower()) + if code_ignore_addons_yaml_fixed_value == '': + logger.warning( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft found an empty value!" + " Waft ignored it.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_ignore_addons_yaml_original_list + ) + continue + else: + if code_ignore_addons_yaml_original_value != code_ignore_addons_yaml_fixed_value: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft took '%s' and convert it to '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_ignore_addons_yaml_original_list, code_ignore_addons_yaml_original_value, + code_ignore_addons_yaml_fixed_value + ) + else: + logger.info( + "In '%s' file, '%s' dictionary, '%s' list:" + " Waft set '%s'.", + CODE_YAML_FILE, code_addons_yaml_original_repo, + code_ignore_addons_yaml_original_list, code_ignore_addons_yaml_original_value + ) + waft_ignore_addons_auto_tmp_list.append(code_ignore_addons_yaml_fixed_value) + if len(waft_ignore_addons_auto_tmp_list) == 0: + waft_addons_auto_repo_tmp_dict['ignore_addons'] = list() + else: + waft_addons_auto_repo_tmp_dict['ignore_addons'] = waft_ignore_addons_auto_tmp_list + for code_tmp_yaml_key in code_addons_repo_yaml_original_dict: + if code_tmp_yaml_key not in {'code_addons_repo_yaml_original_dict', 'code_addons_yaml_original_repo', + 'addons_subpath_repo', 'code_merges_yaml_original_list', 'merges', 'code_hard_addons_yaml_original_list', + 'hard_addons', 'code_soft_addons_yaml_original_list', 'soft_addons', 'code_ignore_addons_yaml_original_list', + 'ignore_addons'}: + waft_addons_auto_repo_tmp_dict[code_tmp_yaml_key] = code_addons_repo_yaml_original_dict[code_tmp_yaml_key] + waft_code_auto_tmp_yaml_dict[addons_subpath_repo] = waft_addons_auto_repo_tmp_dict +waft_code_auto_yaml_dict = dict() +if len(waft_code_auto_tmp_yaml_dict) == 0 or 'odoo' not in waft_code_auto_tmp_yaml_dict: + waft_merge_auto_tmp_dict = dict() + waft_merges_auto_tmp_list = list() + waft_addons_auto_main_repo_tmp_dict = dict() + waft_merge_auto_tmp_dict['code_merge_yaml_original_remote'] = str() + waft_merge_auto_tmp_dict['waft_merge_auto_remote'] = 'https://github.com/oca/ocb.git' + waft_merge_auto_tmp_dict['code_merge_yaml_original_ref'] = str() + waft_merge_auto_tmp_dict['code_merge_yaml_fixed_ref'] = str() + waft_merge_auto_tmp_dict['code_merge_yaml_original_depth'] = int() + waft_merge_auto_tmp_dict['code_merge_yaml_fixed_depth'] = int() + waft_merge_auto_tmp_dict['remote'] = 'https://github.com/oca/ocb.git' + waft_merge_auto_tmp_dict['branch'] = ODOO_VERSION + waft_merge_auto_tmp_dict['pin'] = str() + waft_merge_auto_tmp_dict['depth'] = 1 + waft_merges_auto_tmp_list.append(waft_merge_auto_tmp_dict) + waft_addons_auto_main_repo_tmp_dict['code_addons_repo_yaml_original_dict'] = dict() + waft_addons_auto_main_repo_tmp_dict['code_addons_yaml_original_repo'] = '' + waft_addons_auto_main_repo_tmp_dict['addons_subpath_repo'] = 'odoo' + waft_addons_auto_main_repo_tmp_dict['code_merges_yaml_original_list'] = list() + waft_addons_auto_main_repo_tmp_dict['merges'] = waft_merges_auto_tmp_list + waft_addons_auto_main_repo_tmp_dict['code_hard_addons_yaml_original_list'] = list() + waft_addons_auto_main_repo_tmp_dict['hard_addons'] = list() + waft_addons_auto_main_repo_tmp_dict['code_soft_addons_yaml_original_list'] = list() + waft_addons_auto_main_repo_tmp_dict['soft_addons'] = ['*'] + waft_addons_auto_main_repo_tmp_dict['code_ignore_addons_yaml_original_list'] = list() + waft_addons_auto_main_repo_tmp_dict['ignore_addons'] = list() + if len(waft_code_auto_tmp_yaml_dict) != 0: + waft_code_auto_yaml_dict['odoo'] = waft_addons_auto_main_repo_tmp_dict + for waft_tmp_auto_key in waft_code_auto_tmp_yaml_dict: + waft_code_auto_yaml_dict[waft_tmp_auto_key] = waft_code_auto_tmp_yaml_dict[waft_tmp_auto_key] + else: + waft_code_auto_yaml_dict['odoo'] = waft_addons_auto_main_repo_tmp_dict +else: + waft_code_auto_yaml_dict = waft_code_auto_tmp_yaml_dict diff --git a/waftlib/__init__.py b/waftlib/__init__.py deleted file mode 100755 index 97e87b1..0000000 --- a/waftlib/__init__.py +++ /dev/null @@ -1,191 +0,0 @@ -# -*- coding: utf-8 -*- -import logging -import os -from dotenv import load_dotenv -from glob import glob -from pprint import pformat -from subprocess import check_output - -import yaml - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../../../../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -# Constants needed in scripts -CUSTOM_DIR = os.path.join(os.environ["ODOO_WORK_DIR"], "custom") -AUTO_DIR = os.path.join(os.environ["ODOO_WORK_DIR"], "auto") -ADDONS_DIR = os.path.join(AUTO_DIR, "addons") -SRC_DIR = os.path.join(CUSTOM_DIR, "src") - -ADDONS_YAML = os.path.join(SRC_DIR, "addons") -if os.path.isfile("%s.yaml" % ADDONS_YAML): - ADDONS_YAML = "%s.yaml" % ADDONS_YAML -else: - ADDONS_YAML = "%s.yml" % ADDONS_YAML - -REPOS_YAML = os.path.join(SRC_DIR, "repos") -if os.path.isfile("%s.yaml" % REPOS_YAML): - REPOS_YAML = "%s.yaml" % REPOS_YAML -else: - REPOS_YAML = "%s.yml" % REPOS_YAML - -AUTO_REPOS_YAML = os.path.join(AUTO_DIR, "repos") -if os.path.isfile("%s.yml" % AUTO_REPOS_YAML): - AUTO_REPOS_YAML = "%s.yml" % AUTO_REPOS_YAML -else: - AUTO_REPOS_YAML = "%s.yaml" % AUTO_REPOS_YAML - -WAFT_CLEAN = os.environ.get("WAFT_CLEAN") == "true" -LOG_LEVELS = frozenset({"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}) -PRIVATE = "private" -CORE = "odoo/addons" -ENTERPRISE = "enterprise" -PRIVATE_DIR = os.path.join(SRC_DIR, PRIVATE) -CORE_DIR = os.path.join(SRC_DIR, CORE) -ODOO_DIR = os.path.join(SRC_DIR, "odoo") -ODOO_VERSION = os.environ["ODOO_VERSION"] -MANIFESTS = ("__manifest__.py", "__openerp__.py") - -# Customize logging for build -logger = logging.getLogger("Waft") -log_handler = logging.StreamHandler() -log_formatter = logging.Formatter("%(name)s %(levelname)s: %(message)s") -log_handler.setFormatter(log_formatter) -logger.addHandler(log_handler) -_log_level = os.environ.get("WAFT_LOG_LEVEL", "") -if _log_level.isdigit(): - _log_level = int(_log_level) -elif _log_level in LOG_LEVELS: - _log_level = getattr(logging, _log_level) -else: - if _log_level: - logger.warning("Wrong value in $WAFT_LOG_LEVEL, falling back to INFO") - _log_level = logging.INFO -logger.setLevel(_log_level) - - -class AddonsConfigError(Exception): - def __init__(self, message, *args): - super(AddonsConfigError, self).__init__(message, *args) - self.message = message - - -def addons_config(filtered=True, strict=False): - """Yield addon name and path from ``ADDONS_YAML``. - - :param bool filtered: - Use ``False`` to include all addon definitions. Use ``True`` (default) - to include only those matched by ``ONLY`` clauses, if any. - - :param bool strict: - Use ``True`` to raise an exception if any declared addon is not found. - - :return Iterator[str, str]: - A generator that yields ``(addon, repo)`` pairs. - """ - config = dict() - missing_glob = set() - missing_manifest = set() - all_globs = addons_in_repos_config() - try: - with open(ADDONS_YAML) as addons_file: - for doc in yaml.safe_load_all(addons_file): - # Skip sections with ONLY and that don't match - only = doc.pop("ONLY", {}) - if not filtered: - doc.setdefault(CORE, ["*"]) - doc.setdefault(PRIVATE, ["*"]) - elif any( - os.environ.get(key) not in values for key, values in only.items() - ): - logger.debug("Skipping section with ONLY %s", only) - continue - # Flatten all sections in a single dict - for repo, partial_globs in doc.items(): - if repo == "ENV": - continue - logger.debug("Processing %s repo", repo) - all_globs[repo] = partial_globs - except IOError: - logger.debug("Could not find addons configuration yaml.") - # Add default values for special sections - for repo in (CORE, PRIVATE): - all_globs.setdefault(repo, {"*"}) - logger.debug("Merged addons definition before expanding: %r", all_globs) - # Expand all globs and store config - for repo, partial_globs in all_globs.items(): - for partial_glob in partial_globs: - logger.debug("Expanding in repo %s glob %s", repo, partial_glob) - full_glob = os.path.join(SRC_DIR, repo, partial_glob) - found = glob(full_glob) - if not found: - # Projects without private addons should never fail - if (repo, partial_glob) != (PRIVATE, "*"): - missing_glob.add(full_glob) - logger.debug("Skipping unexpandable glob '%s'", full_glob) - continue - for addon in found: - if not os.path.isdir(addon): - continue - manifests = (os.path.join(addon, m) for m in MANIFESTS) - if not any(os.path.isfile(m) for m in manifests): - missing_manifest.add(addon) - logger.debug( - "Skipping '%s' as it is not a valid Odoo " "module", addon - ) - continue - logger.debug("Registering addon %s", addon) - addon = os.path.basename(addon) - config.setdefault(addon, set()) - config[addon].add(repo) - # Fail now if running in strict mode - if strict: - error = [] - if missing_glob: - error += ["Addons not found:", pformat(missing_glob)] - if missing_manifest: - error += ["Addons without manifest:", pformat(missing_manifest)] - if error: - raise AddonsConfigError("\n".join(error), missing_glob, missing_manifest) - logger.debug("Resulting configuration after expanding: %r", config) - for addon, repos in config.items(): - # Private addons are most important - if PRIVATE in repos: - yield addon, PRIVATE - continue - # Odoo core addons are least important - if repos == {CORE}: - yield addon, CORE - continue - repos.discard(CORE) - # Other addons fall in between - if filtered and len(repos) != 1: - raise AddonsConfigError( - "Addon {} defined in several repos {}".format(addon, repos) - ) - for repo in repos: - yield addon, repo - - -try: - from shutil import which -except ImportError: - # Custom which implementation for Python 2 - def which(binary): - return check_output(["which", binary]).strip() - - -def addons_in_repos_config(): - globs = {} - try: - with open(REPOS_YAML) as repos_file: - for doc in yaml.safe_load_all(repos_file): - for repo, object in doc.items(): - globs[repo] = ["*"] - except IOError: - logger.error("Could not find repos configuration yaml.") - exit(1) - return globs diff --git a/waftlib/installer.py b/waftlib/installer.py deleted file mode 100755 index ac54afb..0000000 --- a/waftlib/installer.py +++ /dev/null @@ -1,126 +0,0 @@ -# -*- coding: utf-8 -*- -import os -from dotenv import load_dotenv -from collections import OrderedDict -from os.path import exists -from subprocess import check_call - -from waftlib import logger - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -os.environ['ODOO_WORK_DIR'] = os.path.realpath(os.path.join(SCRIPT_PATH, "../../../../..")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-default")) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-shared"), override=True) -load_dotenv(os.path.join(os.environ["ODOO_WORK_DIR"], ".env-secret"), override=True) - -class Installer(object): - """Base class to install packages with some package system.""" - - _cleanup_commands = [] - _install_command = None - _remove_command = None - - def __init__(self, file_path): - self.file_path = file_path - self._requirements = self.requirements() - - def _run_command(self, command): - logger.info("Executing: %s", command) - return check_call(command, shell=isinstance(command, str)) - - def cleanup(self): - """Remove cache and other garbage produced by the installer engine.""" - for command in self._cleanup_commands: - self._run_command(command) - - def install(self): - """Install the requirements from the given file.""" - if self._requirements: - return not self._run_command(self._install_command + self._requirements) - else: - logger.info("No installable requirements found in %s", self.file_path) - return False - - def remove(self): - """Uninstall the requirements from the given file.""" - if not self._remove_command: - return - if self._requirements: - self._run_command(self._remove_command + self._requirements) - else: - logger.info("No removable requirements found in %s", self.file_path) - - def requirements(self): - """Get a list of requirements from the given file.""" - requirements = [] - try: - with open(self.file_path, "r") as fh: - for line in fh: - line = line.strip() - if not line or line.startswith("#"): - continue - requirements += line.split() - except IOError: - # No requirements file - pass - return requirements - - -class AptInstaller(Installer): - _cleanup_commands = [["apt-get", "-y", "autoremove"], "rm -Rf /var/lib/apt/lists/*"] - _install_command = [ - "apt-get", - "-o", - "Dpkg::Options::=--force-confdef", - "-o", - "Dpkg::Options::=--force-confold", - "-y", - "--no-install-recommends", - "install", - ] - _remove_command = ["apt-get", "purge", "-y"] - - def _dirty(self): - return exists("/var/lib/apt/lists/lock") - - def cleanup(self): - if self._dirty(): - super(AptInstaller, self).cleanup() - - def install(self): - if not self._dirty() and self._requirements: - self._run_command(["apt-get", "update"]) - return super(AptInstaller, self).install() - - -class GemInstaller(Installer): - _cleanup_commands = ["rm -Rf ~/.gem /var/lib/gems/*/cache/"] - _install_command = ["gem", "install", "--no-rdoc", "--no-ri", "--no-update-sources"] - - -class NpmInstaller(Installer): - _cleanup_commands = ["rm -Rf ~/.npm /tmp/*"] - _install_command = ["npm", "install", "-g"] - - -class PipInstaller(Installer): - _install_command = ["pip", "install", "--no-cache-dir", "-r"] - - def requirements(self): - """Pip will use its ``--requirements`` feature.""" - return [self.file_path] if exists(self.file_path) else [] - - -INSTALLERS = OrderedDict( - [ - ("apt", AptInstaller), - ("gem", GemInstaller), - ("npm", NpmInstaller), - ("pip", PipInstaller), - ] -) - - -def install(installer, file_path): - """Perform a given type of installation from a given file.""" - return INSTALLERS[installer](file_path).install()