From cfb71b45a0512f85e870575ed8563a5d118eed19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sun, 15 May 2022 08:46:00 +0200 Subject: [PATCH 1/3] odoo: add update script --- pkgs/applications/finance/odoo/update.sh | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 pkgs/applications/finance/odoo/update.sh diff --git a/pkgs/applications/finance/odoo/update.sh b/pkgs/applications/finance/odoo/update.sh new file mode 100755 index 000000000000..3b49727867c0 --- /dev/null +++ b/pkgs/applications/finance/odoo/update.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl gnused nix coreutils + +set -euo pipefail + +DOCKER=$(curl -s https://raw.githubusercontent.com/odoo/docker/master/15.0/Dockerfile) + +get_var() { + echo "$DOCKER" | grep -E "^[A-Z][A-Z][A-Z] ODOO_$1" | sed -r "s|^[A-Z]{3} ODOO_$1.||g" +} + +VERSION=$(get_var VERSION) +RELEASE=$(get_var RELEASE) + +latestVersion="$VERSION.$RELEASE" +currentVersion=$(nix-instantiate --eval -E "with import ./. {}; odoo.version or (lib.getVersion odoo)" | tr -d '"') + +if [[ "$currentVersion" == "$latestVersion" ]]; then + echo "odoo is up-to-date: $currentVersion" + exit 0 +fi + +cd "$(dirname "${BASH_SOURCE[0]}")" + +sed -ri "s| sha256.+ # odoo| sha256 = \"$(nix-prefetch-url --type sha256 "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.tar.gz")\"; # odoo|g" default.nix +sed -ri "s| odoo_version.+| odoo_version = \"$VERSION\";|" default.nix +sed -ri "s| odoo_release.+| odoo_release = \"$RELEASE\";|" default.nix From ae72a2d3dd6e1b88bd1ffd7b11ace98e3e209262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sun, 15 May 2022 08:46:30 +0200 Subject: [PATCH 2/3] odoo: 15.0.20220126 -> 15.0.20220506 --- pkgs/applications/finance/odoo/default.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/finance/odoo/default.nix b/pkgs/applications/finance/odoo/default.nix index 38719de371aa..9e1c9955c08c 100644 --- a/pkgs/applications/finance/odoo/default.nix +++ b/pkgs/applications/finance/odoo/default.nix @@ -72,19 +72,18 @@ let in python.pkgs.buildPythonApplication rec { pname = "odoo"; - major = "15"; - minor = "0"; - patch = "20220126"; + odoo_version = "15.0"; + odoo_release = "20220506"; - version = "${major}.${minor}.${patch}"; + version = "${odoo_version}.${odoo_release}"; format = "setuptools"; # latest release is at https://github.com/odoo/docker/blob/master/15.0/Dockerfile src = fetchurl { - url = "https://nightly.odoo.com/${major}.${minor}/nightly/src/odoo_${version}.tar.gz"; + url = "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.tar.gz"; name = "${pname}-${version}"; - hash = "sha256-mofV0mNCdyzJecp0XegZBR/5NzHjis9kbpsUA/KJbZg="; + sha256 = "0mwlmfz5nhvg483ldrmlrjhwaf284c0c0pxf0fb0sfx2dnjjj3ib"; # odoo }; # needs some investigation @@ -140,6 +139,10 @@ in python.pkgs.buildPythonApplication rec { cd odoo* ''; + passthru = { + updateScript = ./update.sh; + }; + meta = with lib; { description = "Open Source ERP and CRM"; homepage = "https://www.odoo.com/"; From 87889d80309f2a10ac15dfdbde3a4d4200b86960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sun, 15 May 2022 08:51:07 +0200 Subject: [PATCH 3/3] odoo: expose tests --- pkgs/applications/finance/odoo/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/finance/odoo/default.nix b/pkgs/applications/finance/odoo/default.nix index 9e1c9955c08c..3ef105234827 100644 --- a/pkgs/applications/finance/odoo/default.nix +++ b/pkgs/applications/finance/odoo/default.nix @@ -4,6 +4,7 @@ , python3 , nodePackages , wkhtmltopdf +, nixosTests }: let @@ -141,6 +142,9 @@ in python.pkgs.buildPythonApplication rec { passthru = { updateScript = ./update.sh; + tests = { + inherit (nixosTests) odoo; + }; }; meta = with lib; {