From 67040a8c9c32bcc1bd39bb6f406d7e36c733fcbb Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 22 Mar 2023 12:32:21 +0100 Subject: [PATCH 1/7] [IMP] update urls, remove warning about oca not being implemented --- manifest.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index fd53710..1808889 100644 --- a/manifest.json +++ b/manifest.json @@ -12,8 +12,8 @@ "license": "LGPL-3.0-only", "website": "https://odoo.com", "demo": "https://www.odoo.com/trial", - "admindoc": "https://www.odoo.com/documentation/15.0/administration.html", - "userdoc": "https://www.odoo.com/documentation/15.0/applications.html", + "admindoc": "https://www.odoo.com/documentation/16.0/administration.html", + "userdoc": "https://www.odoo.com/documentation/16.0/applications.html", "code": "https://github.com/odoo/odoo" }, "license": "LGPL-3.0-only", @@ -52,8 +52,8 @@ "type": "boolean", "default": false, "ask": { - "en": "Do you want to setup OCA instead of LibreERP? (not yet implemented)", - "fr": "Désirez vous installer OCA à la place des sources de LibreERP (pas encore implémenté)" + "en": "Do you want to setup OCA instead of LibreERP?", + "fr": "Désirez vous installer OCA à la place des sources de LibreERP" } }, { From 0dc6a2d27b082f643b710b7bdc546c3112ba7284 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 22 Mar 2023 12:46:53 +0100 Subject: [PATCH 2/7] [UPD] oca sources --- conf/oca-16.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/oca-16.src b/conf/oca-16.src index b8d1ef4..f327da3 100644 --- a/conf/oca-16.src +++ b/conf/oca-16.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/OCA/OCB/archive/f5ffcf7feec5526a483f8ddd240648c084351008.tar.gz -SOURCE_SUM=bf972341c69e5f720162f3d9fa8a93d08ddb9f018c8aea5c4f5d7915c4275c5c +SOURCE_URL=https://github.com/OCA/OCB/archive/9d5ff52da5ec65a21a00a46e21783a2c6188dd80.tar.gz +SOURCE_SUM=3c3a95ec627e3807c85b0b2fd13a484b0b990426efb4905681aaee8768386e39 SOURCE_FILENAME=oca-16.tar.gz SOURCE_FORMAT=tar.gz SOURCE_SUM_PRG=sha256sum From fccd56202968bac65163c2ec0de9ca6c291a5e39 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 22 Mar 2023 17:45:19 +0100 Subject: [PATCH 3/7] [UPD] odoo sources --- conf/16.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/16.src b/conf/16.src index 1985c19..ecb7dae 100644 --- a/conf/16.src +++ b/conf/16.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/f5ffcf7feec5526a483f8ddd240648c084351008.tar.gz -SOURCE_SUM=f9d257058bb7075c2f0b75022fb2ec363ddeed27e3f1a55110ed08dfbee2227b +SOURCE_URL=https://github.com/odoo/odoo/archive/2a88076c1d1df4920bfd139c94862a894d8ef3bc.tar.gz +SOURCE_SUM=39d23f01d9a095d75460829acfd53b74bcfc273a074d6eae163eedcaeeeb58c7 SOURCE_FILENAME=odoo-16.tar.gz SOURCE_FORMAT=tar.gz SOURCE_SUM_PRG=sha256sum From 30396e56e8c33953edbfa25fbc7966bbdfa50092 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 22 Mar 2023 14:28:10 +0100 Subject: [PATCH 4/7] [ADD] gitaggregate action --- config_panel.toml | 39 ++++++++++++++++++ scripts/config | 101 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 config_panel.toml create mode 100755 scripts/config diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..bf4b748 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,39 @@ +version = "1.0" + +[custom_code] +name = "Manage custom code" + + [custom_code.components] + name = "Custom code" + + [custom_code.components.custom_repo] + ask = "Fill in your custom repo" + type = "url" + bind = "null" + help = """\ + It is expected to contain one or more addons, and possibly a [repos.yml](https://github.com/acsone/git-aggregator#configuration-file) and/or a [requirements.txt](https://pip.pypa.io/en/stable/reference/requirements-file-format) which will be installed for this instance when you click 'Update custom code' below.\ + """ + + [custom_code.components.custom_branch] + ask = "Fill in the branch to use" + type = "string" + help = "You should use the repo's main branch for your production instance, and some other branch for testing that you regularly merge into the main branch. Leave empty if unsure" + bind = "null" + visible = "custom_repo" + + [custom_code.components.update_code] + ask = "Update custom code" + type = "button" + help = "This will pull your custom code, run gitaggregate if there's a repos.yml file, install/update requirements.txt, and run a database update if you have the [module_auto_update](https://apps.odoo.com/apps/modules/15.0/module_auto_update) module available" + +[config_file] +name = "Edit the odoo config file" +services = ["__APP__"] + + [config_file.components] + name = "Config file" + + [config_file.components.config_file] + help = "When you change this, you need to restart your app" + type = "text" + bind = "/etc/__APP__/main.conf" diff --git a/scripts/config b/scripts/config new file mode 100755 index 0000000..a81b932 --- /dev/null +++ b/scripts/config @@ -0,0 +1,101 @@ +#!/bin/bash +source /usr/share/yunohost/helpers +ynh_abort_if_errors + +CUSTOM_ADDONS=$final_path/custom-addons +VENV=$final_path/venv +CUSTOM_REPO=$CUSTOM_ADDONS/custom-repo +REPOS_YML=$CUSTOM_REPO/repos.yml +REQUIREMENTS_TXT=$CUSTOM_REPO/requirements.txt + +_setup_git() { + pushd $CUSTOM_ADDONS>/dev/null + ynh_exec_as $app git config --global user.email $app@$(hostname) + ynh_exec_as $app git config --global user.name $app + ynh_exec_as $app git config --global init.defaultBranch main + ynh_exec_as $app git config --global pull.rebase false + popd>/dev/null +} + +get__custom_repo() { + _setup_git + if [ -d $CUSTOM_REPO ]; then + echo '"'$(ynh_exec_as $app git -C $CUSTOM_REPO remote get-url origin)'"' + fi +} + +get__custom_branch() { + _setup_git + if [ -d $CUSTOM_REPO ]; then + echo '"'$(ynh_exec_as $app git -C $CUSTOM_REPO rev-parse --abbrev-ref HEAD)'"' + fi +} + +run__update_code() { + _setup_git + if [ -d $CUSTOM_REPO ]; then + ynh_script_progression --message="Updating custom code" + if [ -z "$custom_repo" ]; then + rm -rf $CUSTOM_REPO + else + pushd $CUSTOM_REPO + if [ ! -z "$custom_branch" ]; then + ynh_exec_as $app git -C $CUSTOM_REPO checkout $custom_branch + fi + ynh_exec_as $app git -C $CUSTOM_REPO reset --hard + ynh_exec_as $app git -C $CUSTOM_REPO pull -X theirs + popd + fi + else + ynh_script_progression --message="Installing custom code from $custom_repo" + pushd $CUSTOM_ADDONS + if [ ! -z "$custom_repo" ]; then + if [ ! -z "$custom_branch" ]; then + CUSTOM_BRANCH="-b $custom_branch" + else + CUSTOM_BRANCH="" + fi + ynh_exec_as $app git clone $custom_repo $CUSTOM_REPO $CUSTOM_BRANCH + fi + popd + fi + if [ ! -f "$REPOS_YML" ]; then + ynh_print_warn --message="Could not find a repos.yml file in $CUSTOM_REPO" + else + ynh_script_progression --message="Resetting repos and running gitaggregate" + pushd $CUSTOM_ADDONS + for GITDIR in $(find $CUSTOM_ADDONS -name .git); do + ynh_exec_as $app git -C $(dirname $GITDIR) reset --hard + done + ynh_exec_as $app $VENV/bin/pip3 install -U git-aggregator + ynh_exec_as $app $VENV/bin/gitaggregate --force --no-color -c $REPOS_YML + popd + fi + pushd $CUSTOM_ADDONS + # link addons to custom-addons + for MANIFEST in $(find $CUSTOM_ADDONS -name __manifest__.py); do + ynh_exec_as $app ln -rsnf $(dirname $MANIFEST) + done + find $CUSTOM_ADDONS -maxdepth 1 -xtype l -delete + popd + if [ -f $REQUIREMENTS_TXT ]; then + ynh_exec_as $app $VENV/bin/pip3 install -Ur $CUSTOM_REPO/requirements.txt + fi + ynh_script_progression --message="Updating odoo addons and restarting the service" + sudo -u $app $VENV/bin/python $final_path/libreerp/odoo-bin shell -d $app -c /etc/$app/main.conf --logfile /proc/self/fd/1 < Date: Wed, 22 Mar 2023 13:20:39 +0100 Subject: [PATCH 5/7] [UPD] bump version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1808889..c9e43f7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Suite of business apps (ERP: CRM, Accounting, Point of Sale, HR, Purchases...)", "fr": "Une collection d'apps de gestion d'entreprise (ERP : CRM, Comptabilité, Point de Vente, RH, Achats...)" }, - "version": "16.0~ynh1", + "version": "16.0~ynh2", "url": "https://odoo.com", "upstream": { "license": "LGPL-3.0-only", From aa728e28a785001a75b040d9915ceb8bfb1f9145 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Fri, 28 Jul 2023 11:36:38 +0200 Subject: [PATCH 6/7] [FIX] fetch branch before checkout --- scripts/config | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/config b/scripts/config index a81b932..92659f2 100755 --- a/scripts/config +++ b/scripts/config @@ -40,6 +40,7 @@ run__update_code() { else pushd $CUSTOM_REPO if [ ! -z "$custom_branch" ]; then + ynh_exec_as $app git -C $CUSTOM_REPO fetch origin $custom_branch ynh_exec_as $app git -C $CUSTOM_REPO checkout $custom_branch fi ynh_exec_as $app git -C $CUSTOM_REPO reset --hard From a74fff6dd386ab0b93be17b77553518400f2fa08 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 14 Nov 2023 18:43:32 +0100 Subject: [PATCH 7/7] [FIX] cleanup --- config_panel.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index bf4b748..72b559c 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -4,7 +4,6 @@ version = "1.0" name = "Manage custom code" [custom_code.components] - name = "Custom code" [custom_code.components.custom_repo] ask = "Fill in your custom repo" @@ -31,9 +30,7 @@ name = "Edit the odoo config file" services = ["__APP__"] [config_file.components] - name = "Config file" [config_file.components.config_file] - help = "When you change this, you need to restart your app" type = "text" bind = "/etc/__APP__/main.conf"