git.iko.soy/typeable/nixpkgs
on master help sign in
graalvmXX-ce: remove graalvmXX-ce-dev and use dev version in graalvmXX-ce on aarch64-darwin
commit4b4d3759e96624c72fc7dfe9a52295998fb0cf49 authorThibault Gagnaux <tgagnaux@gmail.com> dateFri 1 Apr 2022, 12:59 (5 years ago) parent50f6c0d
7 files changed+83−60
pkgs/development/compilers/graalvm/community-edition/default.nix+26−13 pkgs/development/compilers/graalvm/community-edition/graalvm11-ce-sources.json+10 pkgs/development/compilers/graalvm/community-edition/graalvm17-ce-dev-sources.json−12 pkgs/development/compilers/graalvm/community-edition/graalvm17-ce-sources.json+10 pkgs/development/compilers/graalvm/community-edition/mkGraal.nix+10−12 pkgs/development/compilers/graalvm/community-edition/update.nix+27−22 pkgs/top-level/all-packages.nix−1
pkgs/development/compilers/graalvm/community-edition/default.nix+26−13
@@ -1,7 +1,7 @@
1−{ lib, callPackage, Foundation }:
1+{ callPackage, Foundation }:
22/*
3−Add new graal versions and products here and then see update.nix on how to
4−generate the sources.
3+ Add new graal versions and products here and then see update.nix on how to
4+ generate the sources.
55*/
66
77let
@@ -16,6 +16,15 @@ let
1616 "wasm-installable-svm"
1717 ];
1818
19+ /*
20+ Looks a bit ugly but makes version update in the update script using sed
21+ much easier
22+ */
23+ graalvm11-ce-release-version = "22.0.0.2";
24+ graalvm17-ce-release-version = "22.0.0.2";
25+ graalvm11-ce-dev-version = "22.2.0-dev-20220331_1955";
26+ graalvm17-ce-dev-version = "22.2.0-dev-20220331_1955";
27+
1928in
2029{
2130 inherit mkGraal;
@@ -25,17 +34,27 @@ in
2534 x86_64-darwin = {
2635 arch = "darwin-amd64";
2736 products = commonProducts ++ [ "python-installable-svm" ];
37+ version = graalvm11-ce-release-version;
2838 };
2939 x86_64-linux = {
3040 arch = "linux-amd64";
3141 products = commonProducts ++ [ "python-installable-svm" ];
42+ version = graalvm11-ce-release-version;
3243 };
3344 aarch64-linux = {
3445 arch = "linux-aarch64";
3546 products = commonProducts;
47+ version = graalvm11-ce-release-version;
48+ };
49+ aarch64-darwin = {
50+ arch = "darwin-aarch64";
51+ products = [
52+ "graalvm-ce"
53+ "native-image-installable-svm"
54+ ];
55+ version = graalvm11-ce-dev-version;
3656 };
3757 };
38− version = "22.0.0.2";
3958 javaVersion = "11";
4059 platforms = builtins.attrNames config;
4160 };
@@ -50,28 +69,22 @@ in
5069 x86_64-darwin = {
5170 arch = "darwin-amd64";
5271 products = commonProducts ++ [ "python-installable-svm" ];
72+ version = graalvm17-ce-release-version;
5373 };
5474 x86_64-linux = {
5575 arch = "linux-amd64";
5676 products = commonProducts ++ [ "python-installable-svm" ];
77+ version = graalvm17-ce-release-version;
5778 };
58− };
59− version = "22.0.0.2";
60− javaVersion = "17";
61− platforms = builtins.attrNames config;
62− };
63−
64− graalvm17-ce-dev = mkGraal rec {
65− config = {
6679 aarch64-darwin = {
6780 arch = "darwin-aarch64";
6881 products = [
6982 "graalvm-ce"
7083 "native-image-installable-svm"
7184 ];
85+ version = graalvm17-ce-dev-version;
7286 };
7387 };
74− version = "22.2.0-dev-20220330_2302";
7588 javaVersion = "17";
7689 platforms = builtins.attrNames config;
7790 };
pkgs/development/compilers/graalvm/community-edition/graalvm11-ce-sources.json+10
@@ -1,4 +1,14 @@
11{
2+ "darwin-aarch64": {
3+ "graalvm-ce|java11|22.2.0-dev-20220331_1955": {
4+ "sha256": "a1229931575bd90256f5453ce9c880cf2286db117d4cbfec92c033813b017035",
5+ "url": "https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/22.2.0-dev-20220331_1955/graalvm-ce-java11-darwin-aarch64-dev.tar.gz"
6+ },
7+ "native-image-installable-svm|java11|22.2.0-dev-20220331_1955": {
8+ "sha256": "813f9cc417415801e3d7d6468bb06e45487c76fe35b56202b66b6c9fa3ce3456",
9+ "url": "https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/22.2.0-dev-20220331_1955/native-image-installable-svm-java11-darwin-aarch64-dev.jar"
10+ }
11+ },
212 "darwin-amd64": {
313 "graalvm-ce|java11|22.0.0.2": {
414 "sha256": "8280159b8a66c51a839c8079d885928a7f759d5da0632f3af7300df2b63a6323",
pkgs/development/compilers/graalvm/community-edition/graalvm17-ce-dev-sources.jsondeleted−12
@@ -1,12 +0,0 @@
1−{
2− "darwin-aarch64": {
3− "graalvm-ce|java17|22.2.0-dev-20220330_2302": {
4− "sha256": "e072cdcdf1dcc7884cfe53806e997649ae829a30e1efe19b0b77a91800da79c3",
5− "url": "https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/22.2.0-dev-20220330_2302/graalvm-ce-java17-darwin-aarch64-dev.tar.gz"
6− },
7− "native-image-installable-svm|java17|22.2.0-dev-20220330_2302": {
8− "sha256": "fb554d9de8252630e8bde122ca98a75d39e200390384ddb410b3c3af3898ba6a",
9− "url": "https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/22.2.0-dev-20220330_2302/native-image-installable-svm-java17-darwin-aarch64-dev.jar"
10− }
11− }
12−}
pkgs/development/compilers/graalvm/community-edition/graalvm17-ce-sources.json+10
@@ -1,4 +1,14 @@
11{
2+ "darwin-aarch64": {
3+ "graalvm-ce|java17|22.2.0-dev-20220331_1955": {
4+ "sha256": "bb217a3bd53a488ef3672920fd47b9a0d800243eb385a7ceae9ddbd4350c0b27",
5+ "url": "https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/22.2.0-dev-20220331_1955/graalvm-ce-java17-darwin-aarch64-dev.tar.gz"
6+ },
7+ "native-image-installable-svm|java17|22.2.0-dev-20220331_1955": {
8+ "sha256": "eee405e704792794f45e619372e72e0343ba2caf8ace0e4c7abd8baa69e56bcf",
9+ "url": "https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/22.2.0-dev-20220331_1955/native-image-installable-svm-java17-darwin-aarch64-dev.jar"
10+ }
11+ },
212 "darwin-amd64": {
313 "graalvm-ce|java17|22.0.0.2": {
414 "sha256": "d54af9d1f4d0d351827395a714ed84d2489b023b74a9c13a431cc9d31d1e8f9a",
pkgs/development/compilers/graalvm/community-edition/mkGraal.nix+10−12
@@ -1,5 +1,4 @@
1−{ version
2−, javaVersion
1+{ javaVersion
32, platforms
43, config
54, useMusl ? false
@@ -33,20 +32,17 @@
3332, cairo
3433, glib
3534, gtk3
36−, writeScript
35+, writeShellScript
3736, jq
38−, runtimeShell
39−, gawk
37+, gnused
4038}:
4139
4240assert useMusl -> stdenv.isLinux;
4341
4442let
4543 platform = config.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
46− name =
47− if lib.hasInfix "dev" version
48− then "graalvm${javaVersion}-ce-dev"
49− else "graalvm${javaVersion}-ce";
44+ version = platform.version;
45+ name = "graalvm${javaVersion}-ce";
5046 sourcesFilename = "${name}-sources.json";
5147 sources = builtins.fromJSON (builtins.readFile (./. + "/${sourcesFilename}"));
5248
@@ -63,7 +59,8 @@ let
6359 ]);
6460
6561 graalvmXXX-ce = stdenv.mkDerivation rec {
66− inherit version name;
62+ inherit version;
63+ pname = name;
6764
6865 srcs = map fetchurl (builtins.attrValues sources.${platform.arch});
6966
@@ -81,7 +78,8 @@ let
8178 zlib
8279 ];
8380
84− nativeBuildInputs = [ unzip perl makeWrapper ] ++ lib.optional stdenv.isLinux [ autoPatchelfHook ];
81+ nativeBuildInputs = [ unzip perl makeWrapper ]
82+ ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
8583
8684 unpackPhase = ''
8785 unpack_jar() {
@@ -294,7 +292,7 @@ let
294292 passthru = {
295293 home = graalvmXXX-ce;
296294 updateScript = import ./update.nix {
297− inherit lib writeScript jq runtimeShell sourcesFilename name config gawk;
295+ inherit lib writeShellScript jq sourcesFilename name config gnused;
298296 graalVersion = version;
299297 javaVersion = "java${javaVersion}";
300298 };
pkgs/development/compilers/graalvm/community-edition/update.nix+27−22
@@ -4,10 +4,9 @@
44, sourcesFilename
55, name
66, lib
7−, writeScript
7+, writeShellScript
88, jq
9−, runtimeShell
10−, gawk
9+, gnused
1110}:
1211
1312/*
@@ -32,7 +31,7 @@
3231*/
3332
3433let
35− productJavaVersionGraalVersionSep = "|";
34+ separator = "|";
3635
3736 # isDev :: String -> Boolean
3837 isDev = version:
@@ -131,7 +130,7 @@ let
131130 genProductJavaVersionGraalVersionAttrSet = product_javaVersion_graalVersion:
132131 let
133132 attrNames = [ "product" "javaVersion" "graalVersion" ];
134− attrValues = lib.splitString productJavaVersionGraalVersionSep product_javaVersion_graalVersion;
133+ attrValues = lib.splitString separator product_javaVersion_graalVersion;
135134 in
136135 zipListsToAttrs attrNames attrValues;
137136
@@ -153,23 +152,23 @@ let
153152 };
154153
155154 # genArchProductVersionPairs :: String -> AttrSet -> [AttrSet]
156− genArchProductVersionList = javaGraalVersion: archProducts:
155+ genArchProductVersionList = javaVersion: archProducts:
157156 let
158157 arch = archProducts.arch;
159158 products = archProducts.products;
159+ javaGraalVersion = javaVersion + separator + (getLatestVersion archProducts.version);
160160 productJavaGraalVersionList =
161− cartesianZipListsWith (a: b: a + productJavaVersionGraalVersionSep + b)
161+ cartesianZipListsWith (a: b: a + separator + b)
162162 products [ javaGraalVersion ];
163163 in
164164 cartesianZipListsWith (genUrlAndSha256) [ arch ] productJavaGraalVersionList;
165165
166166
167− # genSources :: String -> String -> AttrSet -> Path String
168− genSources = graalVersion: javaVersion: config:
167+ # genSources :: String -> AttrSet -> Path String
168+ genSources = javaVersion: config:
169169 let
170− javaGraalVersion = javaVersion + productJavaVersionGraalVersionSep + graalVersion;
171170 archProducts = builtins.attrValues config;
172− sourcesList = builtins.concatMap (genArchProductVersionList javaGraalVersion) archProducts;
171+ sourcesList = builtins.concatMap (genArchProductVersionList javaVersion) archProducts;
173172 sourcesAttr = builtins.foldl' (lib.recursiveUpdate) { } sourcesList;
174173 in
175174 builtins.toFile "sources.json" (builtins.toJSON sourcesAttr);
@@ -183,32 +182,38 @@ let
183182 }.${builtins.toString (builtins.compareVersions newVersion currentVersion)};
184183
185184 newVersion = getLatestVersion graalVersion;
186− sourcesJson = genSources newVersion javaVersion config;
185+ sourcesJson = genSources javaVersion config;
187186 sourcesJsonPath = lib.strings.escapeShellArg ././${sourcesFilename};
188− defaultNixPath = lib.strings.escapeShellArg ././default.nix;
187+
188+ # versionKeyInDefaultNix String -> String
189+ versionKeyInDefaultNix = graalVersion:
190+ if isDev graalVersion
191+ then "${name}-dev-version"
192+ else "${name}-release-version";
189193
190194 /*
191195 updateScriptText :: String -> String -> String
192− Writes the json file, finds the line number of the current derivation
193− name, which wants to update with awk and replace the first version match
194− after that line.
196+ Writes the json file and updates the version in default.nix using sed
197+ because update-source-version does not work srcs.
195198 */
196199 updateScriptText = newVersion: currentVersion:
200+
197201 if isNew newVersion currentVersion
198202 then
203+ let
204+ versionKey = versionKeyInDefaultNix currentVersion;
205+ in
199206 ''
200207 echo "New version found. Updating ${currentVersion} -> ${newVersion}".
201− export PATH="${lib.makeBinPath [ jq gawk ]}:$PATH"
208+ export PATH="${lib.makeBinPath [ jq gnused ]}:$PATH"
202209 jq . ${sourcesJson} > ${sourcesJsonPath}
203− drvName=$(awk '/${name}/{ print NR; exit }' ${defaultNixPath})
204− awk -v drvName="$drvName" -i inplace \
205− 'NR>drvName {sub(/${graalVersion}/, "${newVersion}")} 1' ${defaultNixPath}
210+ sed -i 's|${versionKey} = "${currentVersion}";|${versionKey} = "${newVersion}";|' \
211+ ${lib.strings.escapeShellArg ././default.nix}
206212 ''
207213 else ''echo "No new version found. Skip updating."'';
208214
209215in
210−writeScript "update-graal.sh" ''
211− #!${runtimeShell}
216+writeShellScript "update-graal.sh" ''
212217 set -o errexit
213218 set -o nounset
214219 set -o pipefail
pkgs/top-level/all-packages.nix−1
@@ -12864,7 +12864,6 @@ with pkgs;
1286412864 });
1286512865 graalvm11-ce = graalvmCEPackages.graalvm11-ce;
1286612866 graalvm17-ce = graalvmCEPackages.graalvm17-ce;
12867− graalvm17-ce-dev = graalvmCEPackages.graalvm17-ce-dev;
1286812867 buildGraalvmNativeImage = callPackage ../build-support/build-graalvm-native-image { };
1286912868
1287012869 inherit (callPackages ../development/compilers/graalvm/enterprise-edition.nix { })