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
generate the sources.
Add new graal versions and products here and then see update.nix on how to
generate the sources.
*/
let
@ -16,6 +16,15 @@ let
"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
{
inherit mkGraal;
@ -25,17 +34,27 @@ in
x86_64-darwin = {
arch = "darwin-amd64";
products = commonProducts ++ [ "python-installable-svm" ];
version = graalvm11-ce-release-version;
};
x86_64-linux = {
arch = "linux-amd64";
products = commonProducts ++ [ "python-installable-svm" ];
version = graalvm11-ce-release-version;
};
aarch64-linux = {
arch = "linux-aarch64";
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";
platforms = builtins.attrNames config;
};
@ -50,28 +69,22 @@ in
x86_64-darwin = {
arch = "darwin-amd64";
products = commonProducts ++ [ "python-installable-svm" ];
version = graalvm17-ce-release-version;
};
x86_64-linux = {
arch = "linux-amd64";
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 = {
arch = "darwin-aarch64";
products = [
"graalvm-ce"
"native-image-installable-svm"
];
version = graalvm17-ce-dev-version;
};
};
version = "22.2.0-dev-20220330_2302";
javaVersion = "17";
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": {
"graalvm-ce|java11|22.0.0.2": {
"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": {
"graalvm-ce|java17|22.0.0.2": {
"sha256": "d54af9d1f4d0d351827395a714ed84d2489b023b74a9c13a431cc9d31d1e8f9a",

View File

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

View File

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

View File

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