Skip to content

Commit e907f6a

Browse files
authored
odoo: fix tests and update to 18.0 (#346397)
2 parents 22adbbb + d48355b commit e907f6a

File tree

12 files changed

+297
-103
lines changed

12 files changed

+297
-103
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ in {
440440
pyload = handleTest ./pyload.nix {};
441441
oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {};
442442
odoo = handleTest ./odoo.nix {};
443+
odoo17 = handleTest ./odoo.nix { package = pkgs.odoo17; };
443444
odoo16 = handleTest ./odoo.nix { package = pkgs.odoo16; };
444445
odoo15 = handleTest ./odoo.nix { package = pkgs.odoo15; };
445446
# 9pnet_virtio used to mount /nix partition doesn't support

pkgs/by-name/od/odoo/package.nix

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
{ lib
22
, fetchgit
33
, fetchzip
4-
, python310
4+
, python312
55
, rtlcss
66
, wkhtmltopdf
77
, nixosTests
8-
, odoo_version ? "17.0"
9-
, odoo_release ? "20240610"
108
}:
119

1210
let
13-
python = python310.override {
11+
odoo_version = "18.0";
12+
odoo_release = "20241010";
13+
python = python312.override {
1414
self = python;
15-
packageOverrides = final: prev: {
16-
# requirements.txt fixes docutils at 0.17; the default 0.21.1 tested throws exceptions
17-
docutils-0_17 = prev.docutils.overridePythonAttrs (old: rec {
18-
version = "0.17";
19-
src = fetchgit {
20-
url = "git://repo.or.cz/docutils.git";
21-
rev = "docutils-${version}";
22-
hash = "sha256-O/9q/Dg1DBIxKdNBOhDV16yy5ez0QANJYMjeovDoWX8=";
23-
};
24-
buildInputs = with prev; [setuptools];
25-
});
26-
};
2715
};
2816
in python.pkgs.buildPythonApplication rec {
2917
pname = "odoo";
@@ -34,13 +22,10 @@ in python.pkgs.buildPythonApplication rec {
3422
src = fetchzip {
3523
# find latest version on https://nightly.odoo.com/${odoo_version}/nightly/src
3624
url = "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.zip";
37-
name = "${pname}-${version}";
38-
hash = "sha256-blibGJyaz+MxMazOXhPbGBAJWZoGubirwSnjVYyLBJs="; # odoo
25+
name = "odoo-${version}";
26+
hash = "sha256-TUfLyB0m8XyEiS493Q/ECgSJutAd1rtWX93f3mwfOK0="; # odoo
3927
};
4028

41-
# needs some investigation
42-
doCheck = false;
43-
4429
makeWrapperArgs = [
4530
"--prefix" "PATH" ":" "${lib.makeBinPath [ wkhtmltopdf rtlcss ]}"
4631
];
@@ -50,7 +35,8 @@ in python.pkgs.buildPythonApplication rec {
5035
chardet
5136
cryptography
5237
decorator
53-
docutils-0_17 # sphinx has a docutils requirement >= 18
38+
docutils
39+
distutils
5440
ebaysdk
5541
freezegun
5642
geoip2

pkgs/by-name/od/odoo/update.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/usr/bin/env nix-shell
22
#!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch
3+
# shellcheck shell=bash
34

45
set -euo pipefail
56

6-
VERSION="17.0" # must be incremented manually
7+
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
8+
PKG=$(basename "$SCRIPT_DIR")
9+
10+
LATEST="18" # increment manually
11+
VERSION="${PKG/#odoo}"
12+
VERSION="${VERSION:-$LATEST}.0"
713

814
RELEASE="$(
915
curl "https://nightly.odoo.com/$VERSION/nightly/src/" |
@@ -12,15 +18,15 @@ RELEASE="$(
1218
)"
1319

1420
latestVersion="$VERSION.$RELEASE"
15-
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; odoo.version or (lib.getVersion odoo)" | tr -d '"')
21+
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; $PKG.version or (lib.getVersion $PKG)" | tr -d '"')
1622

1723
if [[ "$currentVersion" == "$latestVersion" ]]; then
18-
echo "odoo is up-to-date: $currentVersion"
24+
echo "$PKG is up-to-date: $currentVersion"
1925
exit 0
2026
fi
2127

22-
cd "$(dirname "${BASH_SOURCE[0]}")"
28+
cd "$SCRIPT_DIR"
2329

24-
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
25-
sed -ri "s|, odoo_version \? .+|, odoo_version ? \"$VERSION\"|" package.nix
26-
sed -ri "s|, odoo_release \? .+|, odoo_release ? \"$RELEASE\"|" package.nix
30+
sed -ri "s| hash.+ # odoo| hash = \"$(nix-prefetch -q fetchzip --option extra-experimental-features flakes --url "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.zip")\"; # odoo|g" package.nix
31+
sed -ri "s|odoo_version = .+|odoo_version = \"$VERSION\";|" package.nix
32+
sed -ri "s|odoo_release = .+|odoo_release = \"$RELEASE\";|" package.nix

pkgs/by-name/od/odoo15/package.nix

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
{ lib, fetchFromGitHub, fetchzip, python310, rtlcss, wkhtmltopdf
2-
, nixosTests }:
1+
{ lib
2+
, fetchFromGitHub
3+
, fetchzip
4+
, python310
5+
, rtlcss
6+
, wkhtmltopdf
7+
, nixosTests
8+
}:
39

410
let
11+
odoo_version = "15.0";
12+
odoo_release = "20241010";
513
python = python310.override {
614
self = python;
715
packageOverrides = self: super: {
816
pypdf2 = super.pypdf2.overridePythonAttrs (old: rec {
917
version = "1.28.6";
10-
format = "setuptools";
1118

1219
src = fetchFromGitHub {
1320
owner = "py-pdf";
@@ -17,43 +24,25 @@ let
1724
hash = "sha256-WnRbsy/PJcotZqY9mJPLadrYqkXykOVifLIbDyNf4s4=";
1825
};
1926

27+
dependencies = [ self.setuptools ];
28+
2029
nativeCheckInputs = with self; [ pytestCheckHook pillow ];
2130
});
22-
flask = super.flask.overridePythonAttrs (old: rec {
23-
version = "2.1.3";
24-
src = old.src.override {
25-
inherit version;
26-
hash = "sha256-FZcuUBffBXXD1sCQuhaLbbkCWeYgrI1+qBOjlrrVtss=";
27-
};
28-
});
29-
werkzeug = super.werkzeug.overridePythonAttrs (old: rec {
30-
version = "2.1.2";
31-
src = old.src.override {
32-
inherit version;
33-
hash = "sha256-HOCOgJPtZ9Y41jh5/Rujc1gX96gN42dNKT9ZhPJftuY=";
34-
};
35-
});
3631
};
3732
};
38-
39-
odoo_version = "15.0";
40-
odoo_release = "20230816";
4133
in python.pkgs.buildPythonApplication rec {
42-
pname = "odoo15";
34+
pname = "odoo";
4335
version = "${odoo_version}.${odoo_release}";
4436

4537
format = "setuptools";
4638

47-
# latest release is at https://github.com/odoo/docker/blob/master/15.0/Dockerfile
39+
# latest release is at https://github.com/odoo/docker/blob/5fb6a842747c296099d9384587cd89640eb7a615/15.0/Dockerfile#L58
4840
src = fetchzip {
4941
url = "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.zip";
50-
name = "${pname}-${version}";
51-
hash = "sha256-h81JA0o44DVtl/bZ52rGQfg54TigwQcNpcMjQbi0zIQ="; # odoo
42+
name = "odoo-${version}";
43+
hash = "sha256-Hkre6mghEiLrDwfB1BxGbqEm/zruHLwaS+eIFQKjl1o="; # odoo
5244
};
5345

54-
# needs some investigation
55-
doCheck = false;
56-
5746
makeWrapperArgs = [
5847
"--prefix"
5948
"PATH"
@@ -74,6 +63,7 @@ in python.pkgs.buildPythonApplication rec {
7463
jinja2
7564
libsass
7665
lxml
66+
lxml-html-clean
7767
markupsafe
7868
mock
7969
num2words
@@ -108,6 +98,7 @@ in python.pkgs.buildPythonApplication rec {
10898
dontStrip = true;
10999

110100
passthru = {
101+
updateScript = ./update.sh;
111102
tests = { inherit (nixosTests) odoo15; };
112103
};
113104

pkgs/by-name/od/odoo15/update.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch
3+
# shellcheck shell=bash
4+
5+
set -euo pipefail
6+
7+
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
8+
PKG=$(basename "$SCRIPT_DIR")
9+
10+
LATEST="18" # increment manually
11+
VERSION="${PKG/#odoo}"
12+
VERSION="${VERSION:-$LATEST}.0"
13+
14+
RELEASE="$(
15+
curl "https://nightly.odoo.com/$VERSION/nightly/src/" |
16+
sed -nE 's/.*odoo_'"$VERSION"'.(20[0-9]{6}).tar.gz.*/\1/p' |
17+
tail -n 1
18+
)"
19+
20+
latestVersion="$VERSION.$RELEASE"
21+
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; $PKG.version or (lib.getVersion $PKG)" | tr -d '"')
22+
23+
if [[ "$currentVersion" == "$latestVersion" ]]; then
24+
echo "$PKG is up-to-date: $currentVersion"
25+
exit 0
26+
fi
27+
28+
cd "$SCRIPT_DIR"
29+
30+
sed -ri "s| hash.+ # odoo| hash = \"$(nix-prefetch -q fetchzip --option extra-experimental-features flakes --url "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.zip")\"; # odoo|g" package.nix
31+
sed -ri "s|odoo_version = .+|odoo_version = \"$VERSION\";|" package.nix
32+
sed -ri "s|odoo_release = .+|odoo_release = \"$RELEASE\";|" package.nix

pkgs/by-name/od/odoo16/package.nix

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,11 @@
77
}:
88

99
let
10+
odoo_version = "16.0";
11+
odoo_release = "20241010";
1012
python = python310.override {
1113
self = python;
12-
packageOverrides = self: super: {
13-
flask = super.flask.overridePythonAttrs (old: rec {
14-
version = "2.3.3";
15-
src = old.src.override {
16-
inherit version;
17-
hash = "sha256-CcNHqSqn/0qOfzIGeV8w2CZlS684uHPQdEzVccpgnvw=";
18-
};
19-
});
20-
werkzeug = super.werkzeug.overridePythonAttrs (old: rec {
21-
version = "2.3.7";
22-
src = old.src.override {
23-
inherit version;
24-
hash = "sha256-K4wORHtLnbzIXdl7butNy69si2w74L1lTiVVPgohV9g=";
25-
};
26-
disabledTests = old.disabledTests ++ [
27-
"test_response_body"
28-
];
29-
});
30-
};
3114
};
32-
33-
odoo_version = "16.0";
34-
odoo_release = "20231024";
3515
in python.pkgs.buildPythonApplication rec {
3616
pname = "odoo";
3717
version = "${odoo_version}.${odoo_release}";
@@ -41,13 +21,10 @@ in python.pkgs.buildPythonApplication rec {
4121
# latest release is at https://github.com/odoo/docker/blob/master/16.0/Dockerfile
4222
src = fetchzip {
4323
url = "https://nightly.odoo.com/${odoo_version}/nightly/src/odoo_${version}.zip";
44-
name = "${pname}-${version}";
45-
hash = "sha256-Ux8RfA7kWLKissBBY5wrfL+aKKw++5BxjP3Vw0JAOsk="; # odoo
24+
name = "odoo-${version}";
25+
hash = "sha256-ICe5UOy+Ga81fE66SnIhRz3+JEEbGfoz7ag53mkG4UM="; # odoo
4626
};
4727

48-
# needs some investigation
49-
doCheck = false;
50-
5128
makeWrapperArgs = [
5229
"--prefix" "PATH" ":" "${lib.makeBinPath [ wkhtmltopdf rtlcss ]}"
5330
];
@@ -66,6 +43,7 @@ in python.pkgs.buildPythonApplication rec {
6643
jinja2
6744
libsass
6845
lxml
46+
lxml-html-clean
6947
markupsafe
7048
num2words
7149
ofxparse
@@ -102,6 +80,7 @@ in python.pkgs.buildPythonApplication rec {
10280
dontStrip = true;
10381

10482
passthru = {
83+
updateScript = ./update.sh;
10584
tests = {
10685
inherit (nixosTests) odoo;
10786
};

pkgs/by-name/od/odoo16/update.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -i bash -p curl gnused nix coreutils nix-prefetch
3+
# shellcheck shell=bash
4+
5+
set -euo pipefail
6+
7+
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
8+
PKG=$(basename "$SCRIPT_DIR")
9+
10+
LATEST="18" # increment manually
11+
VERSION="${PKG/#odoo}"
12+
VERSION="${VERSION:-$LATEST}.0"
13+
14+
RELEASE="$(
15+
curl "https://nightly.odoo.com/$VERSION/nightly/src/" |
16+
sed -nE 's/.*odoo_'"$VERSION"'.(20[0-9]{6}).tar.gz.*/\1/p' |
17+
tail -n 1
18+
)"
19+
20+
latestVersion="$VERSION.$RELEASE"
21+
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; $PKG.version or (lib.getVersion $PKG)" | tr -d '"')
22+
23+
if [[ "$currentVersion" == "$latestVersion" ]]; then
24+
echo "$PKG is up-to-date: $currentVersion"
25+
exit 0
26+
fi
27+
28+
cd "$SCRIPT_DIR"
29+
30+
sed -ri "s| hash.+ # odoo| hash = \"$(nix-prefetch -q fetchzip --option extra-experimental-features flakes --url "https://nightly.odoo.com/${VERSION}/nightly/src/odoo_${latestVersion}.zip")\"; # odoo|g" package.nix
31+
sed -ri "s|odoo_version = .+|odoo_version = \"$VERSION\";|" package.nix
32+
sed -ri "s|odoo_release = .+|odoo_release = \"$RELEASE\";|" package.nix

0 commit comments

Comments
 (0)