graalvmXX-ce: remove graalvmXX-ce-dev and use dev version in graalvmXX-ce on aarch64-darwin

This commit is contained in:
Thibault Gagnaux 2022-04-01 12:59:37 +02:00
parent 50f6c0dfa7
commit 4b4d3759e9
No known key found for this signature in database
GPG Key ID: 44BD0764ACAE8E25
7 changed files with 83 additions and 60 deletions

View File

@ -1,7 +1,7 @@
{ lib, callPackage, Foundation }: { callPackage, Foundation }:
/* /*
Add new graal versions and products here and then see update.nix on how to Add new graal versions and products here and then see update.nix on how to
generate the sources. generate the sources.
*/ */
let let
@ -16,6 +16,15 @@ let
"wasm-installable-svm" "wasm-installable-svm"
]; ];
/*
Looks a bit ugly but makes version update in the update script using sed
much easier
*/
graalvm11-ce-release-version = "22.0.0.2";
graalvm17-ce-release-version = "22.0.0.2";
graalvm11-ce-dev-version = "22.2.0-dev-20220331_1955";
graalvm17-ce-dev-version = "22.2.0-dev-20220331_1955";
in in
{ {
inherit mkGraal; inherit mkGraal;
@ -25,17 +34,27 @@ in
x86_64-darwin = { x86_64-darwin = {
arch = "darwin-amd64"; arch = "darwin-amd64";
products = commonProducts ++ [ "python-installable-svm" ]; products = commonProducts ++ [ "python-installable-svm" ];
version = graalvm11-ce-release-version;
}; };
x86_64-linux = { x86_64-linux = {
arch = "linux-amd64"; arch = "linux-amd64";
products = commonProducts ++ [ "python-installable-svm" ]; products = commonProducts ++ [ "python-installable-svm" ];
version = graalvm11-ce-release-version;
}; };
aarch64-linux = { aarch64-linux = {
arch = "linux-aarch64"; arch = "linux-aarch64";
products = commonProducts; products = commonProducts;
version = graalvm11-ce-release-version;
};
aarch64-darwin = {
arch = "darwin-aarch64";
products = [
"graalvm-ce"
"native-image-installable-svm"
];
version = graalvm11-ce-dev-version;
}; };
}; };
version = "22.0.0.2";
javaVersion = "11"; javaVersion = "11";
platforms = builtins.attrNames config; platforms = builtins.attrNames config;
}; };
@ -50,28 +69,22 @@ in
x86_64-darwin = { x86_64-darwin = {
arch = "darwin-amd64"; arch = "darwin-amd64";
products = commonProducts ++ [ "python-installable-svm" ]; products = commonProducts ++ [ "python-installable-svm" ];
version = graalvm17-ce-release-version;
}; };
x86_64-linux = { x86_64-linux = {
arch = "linux-amd64"; arch = "linux-amd64";
products = commonProducts ++ [ "python-installable-svm" ]; products = commonProducts ++ [ "python-installable-svm" ];
version = graalvm17-ce-release-version;
}; };
};
version = "22.0.0.2";
javaVersion = "17";
platforms = builtins.attrNames config;
};
graalvm17-ce-dev = mkGraal rec {
config = {
aarch64-darwin = { aarch64-darwin = {
arch = "darwin-aarch64"; arch = "darwin-aarch64";
products = [ products = [
"graalvm-ce" "graalvm-ce"
"native-image-installable-svm" "native-image-installable-svm"
]; ];
version = graalvm17-ce-dev-version;
}; };
}; };
version = "22.2.0-dev-20220330_2302";
javaVersion = "17"; javaVersion = "17";
platforms = builtins.attrNames config; platforms = builtins.attrNames config;
}; };

View File

@ -1,4 +1,14 @@
{ {
"darwin-aarch64": {
"graalvm-ce|java11|22.2.0-dev-20220331_1955": {
"sha256": "a1229931575bd90256f5453ce9c880cf2286db117d4cbfec92c033813b017035",
"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"
},
"native-image-installable-svm|java11|22.2.0-dev-20220331_1955": {
"sha256": "813f9cc417415801e3d7d6468bb06e45487c76fe35b56202b66b6c9fa3ce3456",
"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"
}
},
"darwin-amd64": { "darwin-amd64": {
"graalvm-ce|java11|22.0.0.2": { "graalvm-ce|java11|22.0.0.2": {
"sha256": "8280159b8a66c51a839c8079d885928a7f759d5da0632f3af7300df2b63a6323", "sha256": "8280159b8a66c51a839c8079d885928a7f759d5da0632f3af7300df2b63a6323",

View File

@ -1,12 +0,0 @@
{
"darwin-aarch64": {
"graalvm-ce|java17|22.2.0-dev-20220330_2302": {
"sha256": "e072cdcdf1dcc7884cfe53806e997649ae829a30e1efe19b0b77a91800da79c3",
"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"
},
"native-image-installable-svm|java17|22.2.0-dev-20220330_2302": {
"sha256": "fb554d9de8252630e8bde122ca98a75d39e200390384ddb410b3c3af3898ba6a",
"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"
}
}
}

View File

@ -1,4 +1,14 @@
{ {
"darwin-aarch64": {
"graalvm-ce|java17|22.2.0-dev-20220331_1955": {
"sha256": "bb217a3bd53a488ef3672920fd47b9a0d800243eb385a7ceae9ddbd4350c0b27",
"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"
},
"native-image-installable-svm|java17|22.2.0-dev-20220331_1955": {
"sha256": "eee405e704792794f45e619372e72e0343ba2caf8ace0e4c7abd8baa69e56bcf",
"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"
}
},
"darwin-amd64": { "darwin-amd64": {
"graalvm-ce|java17|22.0.0.2": { "graalvm-ce|java17|22.0.0.2": {
"sha256": "d54af9d1f4d0d351827395a714ed84d2489b023b74a9c13a431cc9d31d1e8f9a", "sha256": "d54af9d1f4d0d351827395a714ed84d2489b023b74a9c13a431cc9d31d1e8f9a",

View File

@ -1,5 +1,4 @@
{ version { javaVersion
, javaVersion
, platforms , platforms
, config , config
, useMusl ? false , useMusl ? false
@ -33,20 +32,17 @@
, cairo , cairo
, glib , glib
, gtk3 , gtk3
, writeScript , writeShellScript
, jq , jq
, runtimeShell , gnused
, gawk
}: }:
assert useMusl -> stdenv.isLinux; assert useMusl -> stdenv.isLinux;
let let
platform = config.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); platform = config.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
name = version = platform.version;
if lib.hasInfix "dev" version name = "graalvm${javaVersion}-ce";
then "graalvm${javaVersion}-ce-dev"
else "graalvm${javaVersion}-ce";
sourcesFilename = "${name}-sources.json"; sourcesFilename = "${name}-sources.json";
sources = builtins.fromJSON (builtins.readFile (./. + "/${sourcesFilename}")); sources = builtins.fromJSON (builtins.readFile (./. + "/${sourcesFilename}"));
@ -63,7 +59,8 @@ let
]); ]);
graalvmXXX-ce = stdenv.mkDerivation rec { graalvmXXX-ce = stdenv.mkDerivation rec {
inherit version name; inherit version;
pname = name;
srcs = map fetchurl (builtins.attrValues sources.${platform.arch}); srcs = map fetchurl (builtins.attrValues sources.${platform.arch});
@ -81,7 +78,8 @@ let
zlib zlib
]; ];
nativeBuildInputs = [ unzip perl makeWrapper ] ++ lib.optional stdenv.isLinux [ autoPatchelfHook ]; nativeBuildInputs = [ unzip perl makeWrapper ]
++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
unpackPhase = '' unpackPhase = ''
unpack_jar() { unpack_jar() {
@ -294,7 +292,7 @@ let
passthru = { passthru = {
home = graalvmXXX-ce; home = graalvmXXX-ce;
updateScript = import ./update.nix { updateScript = import ./update.nix {
inherit lib writeScript jq runtimeShell sourcesFilename name config gawk; inherit lib writeShellScript jq sourcesFilename name config gnused;
graalVersion = version; graalVersion = version;
javaVersion = "java${javaVersion}"; javaVersion = "java${javaVersion}";
}; };

View File

@ -4,10 +4,9 @@
, sourcesFilename , sourcesFilename
, name , name
, lib , lib
, writeScript , writeShellScript
, jq , jq
, runtimeShell , gnused
, gawk
}: }:
/* /*
@ -32,7 +31,7 @@
*/ */
let let
productJavaVersionGraalVersionSep = "|"; separator = "|";
# isDev :: String -> Boolean # isDev :: String -> Boolean
isDev = version: isDev = version:
@ -131,7 +130,7 @@ let
genProductJavaVersionGraalVersionAttrSet = product_javaVersion_graalVersion: genProductJavaVersionGraalVersionAttrSet = product_javaVersion_graalVersion:
let let
attrNames = [ "product" "javaVersion" "graalVersion" ]; attrNames = [ "product" "javaVersion" "graalVersion" ];
attrValues = lib.splitString productJavaVersionGraalVersionSep product_javaVersion_graalVersion; attrValues = lib.splitString separator product_javaVersion_graalVersion;
in in
zipListsToAttrs attrNames attrValues; zipListsToAttrs attrNames attrValues;
@ -153,23 +152,23 @@ let
}; };
# genArchProductVersionPairs :: String -> AttrSet -> [AttrSet] # genArchProductVersionPairs :: String -> AttrSet -> [AttrSet]
genArchProductVersionList = javaGraalVersion: archProducts: genArchProductVersionList = javaVersion: archProducts:
let let
arch = archProducts.arch; arch = archProducts.arch;
products = archProducts.products; products = archProducts.products;
javaGraalVersion = javaVersion + separator + (getLatestVersion archProducts.version);
productJavaGraalVersionList = productJavaGraalVersionList =
cartesianZipListsWith (a: b: a + productJavaVersionGraalVersionSep + b) cartesianZipListsWith (a: b: a + separator + b)
products [ javaGraalVersion ]; products [ javaGraalVersion ];
in in
cartesianZipListsWith (genUrlAndSha256) [ arch ] productJavaGraalVersionList; cartesianZipListsWith (genUrlAndSha256) [ arch ] productJavaGraalVersionList;
# genSources :: String -> String -> AttrSet -> Path String # genSources :: String -> AttrSet -> Path String
genSources = graalVersion: javaVersion: config: genSources = javaVersion: config:
let let
javaGraalVersion = javaVersion + productJavaVersionGraalVersionSep + graalVersion;
archProducts = builtins.attrValues config; archProducts = builtins.attrValues config;
sourcesList = builtins.concatMap (genArchProductVersionList javaGraalVersion) archProducts; sourcesList = builtins.concatMap (genArchProductVersionList javaVersion) archProducts;
sourcesAttr = builtins.foldl' (lib.recursiveUpdate) { } sourcesList; sourcesAttr = builtins.foldl' (lib.recursiveUpdate) { } sourcesList;
in in
builtins.toFile "sources.json" (builtins.toJSON sourcesAttr); builtins.toFile "sources.json" (builtins.toJSON sourcesAttr);
@ -183,32 +182,38 @@ let
}.${builtins.toString (builtins.compareVersions newVersion currentVersion)}; }.${builtins.toString (builtins.compareVersions newVersion currentVersion)};
newVersion = getLatestVersion graalVersion; newVersion = getLatestVersion graalVersion;
sourcesJson = genSources newVersion javaVersion config; sourcesJson = genSources javaVersion config;
sourcesJsonPath = lib.strings.escapeShellArg ././${sourcesFilename}; sourcesJsonPath = lib.strings.escapeShellArg ././${sourcesFilename};
defaultNixPath = lib.strings.escapeShellArg ././default.nix;
# versionKeyInDefaultNix String -> String
versionKeyInDefaultNix = graalVersion:
if isDev graalVersion
then "${name}-dev-version"
else "${name}-release-version";
/* /*
updateScriptText :: String -> String -> String updateScriptText :: String -> String -> String
Writes the json file, finds the line number of the current derivation Writes the json file and updates the version in default.nix using sed
name, which wants to update with awk and replace the first version match because update-source-version does not work srcs.
after that line.
*/ */
updateScriptText = newVersion: currentVersion: updateScriptText = newVersion: currentVersion:
if isNew newVersion currentVersion if isNew newVersion currentVersion
then then
let
versionKey = versionKeyInDefaultNix currentVersion;
in
'' ''
echo "New version found. Updating ${currentVersion} -> ${newVersion}". echo "New version found. Updating ${currentVersion} -> ${newVersion}".
export PATH="${lib.makeBinPath [ jq gawk ]}:$PATH" export PATH="${lib.makeBinPath [ jq gnused ]}:$PATH"
jq . ${sourcesJson} > ${sourcesJsonPath} jq . ${sourcesJson} > ${sourcesJsonPath}
drvName=$(awk '/${name}/{ print NR; exit }' ${defaultNixPath}) sed -i 's|${versionKey} = "${currentVersion}";|${versionKey} = "${newVersion}";|' \
awk -v drvName="$drvName" -i inplace \ ${lib.strings.escapeShellArg ././default.nix}
'NR>drvName {sub(/${graalVersion}/, "${newVersion}")} 1' ${defaultNixPath}
'' ''
else ''echo "No new version found. Skip updating."''; else ''echo "No new version found. Skip updating."'';
in in
writeScript "update-graal.sh" '' writeShellScript "update-graal.sh" ''
#!${runtimeShell}
set -o errexit set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail

View File

@ -12864,7 +12864,6 @@ with pkgs;
}); });
graalvm11-ce = graalvmCEPackages.graalvm11-ce; graalvm11-ce = graalvmCEPackages.graalvm11-ce;
graalvm17-ce = graalvmCEPackages.graalvm17-ce; graalvm17-ce = graalvmCEPackages.graalvm17-ce;
graalvm17-ce-dev = graalvmCEPackages.graalvm17-ce-dev;
buildGraalvmNativeImage = callPackage ../build-support/build-graalvm-native-image { }; buildGraalvmNativeImage = callPackage ../build-support/build-graalvm-native-image { };
inherit (callPackages ../development/compilers/graalvm/enterprise-edition.nix { }) inherit (callPackages ../development/compilers/graalvm/enterprise-edition.nix { })