diff options
author | Maciej Krüger <mkg20001@gmail.com> | 2024-06-19 18:31:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-19 18:31:53 +0200 |
commit | 27e0947a1d098053ef8d1d66dbeedde173908527 (patch) | |
tree | 72df433db428905bd4f17c2e5cb789380f38af34 | |
parent | 2bfe2058a3e96f2141f0e82318688649d2b7847a (diff) | |
parent | 6c10cfba34a151fceed537b4b8642ad033301d7d (diff) |
Merge pull request #312060 from siriobalmelli/fix/odoo
odoo: fix odoo16; add odoo17
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2405.section.md | 1 | ||||
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/odoo.nix | 12 | ||||
-rwxr-xr-x | pkgs/applications/finance/odoo/update.sh | 27 | ||||
-rw-r--r-- | pkgs/by-name/od/odoo/package.nix | 111 | ||||
-rwxr-xr-x | pkgs/by-name/od/odoo/update.sh | 26 | ||||
-rw-r--r-- | pkgs/by-name/od/odoo15/package.nix (renamed from pkgs/applications/finance/odoo/odoo15.nix) | 0 | ||||
-rw-r--r-- | pkgs/by-name/od/odoo16/package.nix (renamed from pkgs/applications/finance/odoo/default.nix) | 4 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 3 |
9 files changed, 154 insertions, 31 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index 165e3e13a78ef..8fa59863bf782 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -822,3 +822,4 @@ Module System: ### Internal {#sec-release-24.05-lib-internal} - `lib` now has [Readme for contributing](https://github.com/NixOS/nixpkgs/tree/master/lib#readme). - Some function's documentation is now written using the [accepted doc comment syntax](https://github.com/NixOS/rfcs/pull/145). +- `odoo` has been updated from `16.0.20231024` to `17.0.20240507`. diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 6b5ee429f9a22..8d5b865891e4a 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -414,6 +414,7 @@ in { pyload = handleTest ./pyload.nix {}; oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {}; odoo = handleTest ./odoo.nix {}; + odoo16 = handleTest ./odoo.nix { package = pkgs.odoo16; }; odoo15 = handleTest ./odoo.nix { package = pkgs.odoo15; }; # 9pnet_virtio used to mount /nix partition doesn't support # hibernation. This test happens to work on x86_64-linux but diff --git a/nixos/tests/odoo.nix b/nixos/tests/odoo.nix index 00ae4a2137d10..45ec7b7d7a6b7 100644 --- a/nixos/tests/odoo.nix +++ b/nixos/tests/odoo.nix @@ -14,6 +14,18 @@ import ./make-test-python.nix ({ pkgs, lib, package ? pkgs.odoo, ...} : { package = package; domain = "localhost"; }; + + # odoo does not automatically initialize its database, + # even if passing what _should_ be the equivalent of these options: + # settings = { + # options = { + # database = "odoo"; + # init = "base"; + # }; + # }; + systemd.services.odoo.preStart = '' + HOME=$STATE_DIRECTORY ${package}/bin/odoo -d odoo -i base --stop-after-init --without-demo all + ''; }; }; diff --git a/pkgs/applications/finance/odoo/update.sh b/pkgs/applications/finance/odoo/update.sh deleted file mode 100755 index 0f7ee144cf8a2..0000000000000 --- a/pkgs/applications/finance/odoo/update.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch - -set -euo pipefail - -DOCKER=$(curl -s https://raw.githubusercontent.com/odoo/docker/master/16.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| hash.+ # odoo| hash = \"$(nix-prefetch -q fetchzip --url "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.zip")\"; # odoo|g" default.nix -sed -ri "s| odoo_version.+| odoo_version = \"$VERSION\";|" default.nix -sed -ri "s| odoo_release.+| odoo_release = \"$RELEASE\";|" default.nix diff --git a/pkgs/by-name/od/odoo/package.nix b/pkgs/by-name/od/odoo/package.nix new file mode 100644 index 0000000000000..f2239bd5d59e3 --- /dev/null +++ b/pkgs/by-name/od/odoo/package.nix @@ -0,0 +1,111 @@ +{ stdenv +, lib +, fetchgit +, fetchzip +, python310 +, rtlcss +, wkhtmltopdf +, nixosTests +, odoo_version ? "17.0" +, odoo_release ? "20240610" +}: + +let + python = python310.override { + packageOverrides = final: prev: { + # requirements.txt fixes docutils at 0.17; the default 0.21.1 tested throws exceptions + docutils-0_17 = prev.docutils.overridePythonAttrs (old: rec { + version = "0.17"; + src = fetchgit { + url = "git://repo.or.cz/docutils.git"; + rev = "docutils-${version}"; + hash = "sha256-O/9q/Dg1DBIxKdNBOhDV16yy5ez0QANJYMjeovDoWX8="; + }; + buildInputs = with prev; [setuptools]; + }); + }; + }; +in python.pkgs.buildPythonApplication rec { + pname = "odoo"; + version = "${odoo_version}.${odoo_release}"; + + format = "setuptools"; + + src = fetchzip { + # find latest version on https://nightly.odoo.com/${odoo_version}/nightly/src + url = "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.zip"; + name = "${pname}-${version}"; + hash = "sha256-blibGJyaz+MxMazOXhPbGBAJWZoGubirwSnjVYyLBJs="; # odoo + }; + + # needs some investigation + doCheck = false; + + makeWrapperArgs = [ + "--prefix" "PATH" ":" "${lib.makeBinPath [ wkhtmltopdf rtlcss ]}" + ]; + + propagatedBuildInputs = with python.pkgs; [ + babel + chardet + cryptography + decorator + docutils-0_17 # sphinx has a docutils requirement >= 18 + ebaysdk + freezegun + gevent + greenlet + idna + jinja2 + libsass + lxml + markupsafe + num2words + ofxparse + passlib + pillow + polib + psutil + psycopg2 + pydot + pyopenssl + pypdf2 + pyserial + python-dateutil + python-ldap + python-stdnum + pytz + pyusb + qrcode + reportlab + requests + rjsmin + urllib3 + vobject + werkzeug + xlrd + xlsxwriter + xlwt + zeep + + setuptools + mock + ]; + + # takes 5+ minutes and there are not files to strip + dontStrip = true; + + passthru = { + updateScript = ./update.sh; + tests = { + inherit (nixosTests) odoo; + }; + }; + + meta = with lib; { + description = "Open Source ERP and CRM"; + homepage = "https://www.odoo.com/"; + license = licenses.lgpl3Only; + maintainers = with maintainers; [ mkg20001 siriobalmelli ]; + }; +} diff --git a/pkgs/by-name/od/odoo/update.sh b/pkgs/by-name/od/odoo/update.sh new file mode 100755 index 0000000000000..e9c50ccb50815 --- /dev/null +++ b/pkgs/by-name/od/odoo/update.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch + +set -euo pipefail + +VERSION="17.0" # must be incremented manually + +RELEASE="$( + curl "https://nightly.odoo.com/$VERSION/nightly/src/" | + sed -nE 's/.*odoo_'"$VERSION"'.(20[0-9]{6}).tar.gz.*/\1/p' | + tail -n 1 +)" + +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| hash.+ # odoo| hash = \"$(nix-prefetch -q fetchzip --url "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.zip")\"; # odoo|g" package.nix +sed -ri "s|, odoo_version \? .+|, odoo_version ? \"$VERSION\"|" package.nix +sed -ri "s|, odoo_release \? .+|, odoo_release ? \"$RELEASE\"|" package.nix diff --git a/pkgs/applications/finance/odoo/odoo15.nix b/pkgs/by-name/od/odoo15/package.nix index a3255c4aa101c..a3255c4aa101c 100644 --- a/pkgs/applications/finance/odoo/odoo15.nix +++ b/pkgs/by-name/od/odoo15/package.nix diff --git a/pkgs/applications/finance/odoo/default.nix b/pkgs/by-name/od/odoo16/package.nix index b9829326768a5..6e68228d73479 100644 --- a/pkgs/applications/finance/odoo/default.nix +++ b/pkgs/by-name/od/odoo16/package.nix @@ -23,6 +23,9 @@ let inherit version; hash = "sha256-K4wORHtLnbzIXdl7butNy69si2w74L1lTiVVPgohV9g="; }; + disabledTests = old.disabledTests ++ [ + "test_response_body" + ]; }); }; }; @@ -99,7 +102,6 @@ in python.pkgs.buildPythonApplication rec { dontStrip = true; passthru = { - updateScript = ./update.sh; tests = { inherit (nixosTests) odoo; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4888500c7c945..772d44ba5dabc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5968,9 +5968,6 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) AppKit Security; }; - odoo = callPackage ../applications/finance/odoo { }; - odoo15 = callPackage ../applications/finance/odoo/odoo15.nix { }; - odafileconverter = libsForQt5.callPackage ../applications/graphics/odafileconverter { }; oil-buku = callPackage ../applications/misc/oil-buku { }; |