graalvm-ce: remove version file, use nix itself

main
Thiago Kenji Okada 3 years ago
parent f7454b28cb
commit cffe19bdbe
  1. 2
      pkgs/development/compilers/graalvm/community-edition/default.nix
  2. 22
      pkgs/development/compilers/graalvm/community-edition/update.sh
  3. 1
      pkgs/development/compilers/graalvm/community-edition/version

@ -9,7 +9,7 @@ in
inherit mkGraal;
graalvm11-ce = mkGraal rec {
version = lib.fileContents ./version;
version = "21.3.0";
javaVersion = "11";
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
};

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -p curl -i bash coreutils nix common-updater-scripts curl jq
#!nix-shell -p curl -i bash coreutils nix curl jq
set -eou pipefail
@ -13,18 +13,23 @@ verlte() {
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]
}
readonly old_version="$(cat version)"
readonly nixpkgs=../../../../..
readonly old_version="$(nix-instantiate "$nixpkgs" --eval --strict -A graalvm11-ce.version)"
if [[ -z "${1:-}" ]]; then
readonly gh_version="$(curl -s https://api.github.com/repos/graalvm/graalvm-ce-builds/releases/latest | jq --raw-output .tag_name)"
readonly gh_version="$(curl \
${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
-s https://api.github.com/repos/graalvm/graalvm-ce-builds/releases/latest | \
jq --raw-output .tag_name)"
readonly new_version="${gh_version//vm-/}"
else
readonly new_version="$1"
fi
if verlte "$new_version" "$old_version"; then
info "graalvm-ce $old_version is up-to-date. Exiting..."
exit 0
if verlte "$old_version" "$new_version"; then
info "graalvm-ce $old_version is up-to-date."
[[ -z "${FORCE:-}" ]] && exit 0
else
info "graalvm-ce $old_version is out-of-date. Updating..."
fi
@ -66,7 +71,8 @@ done
echo_file "]"
info "Updating 'version' file..."
echo "$new_version" > version
info "Updating graalvm-ce version..."
# update-source-version does not work here since it expects src attribute
sed "s|$old_version|\"$new_version\"|" -i default.nix
info "Done!"

Loading…
Cancel
Save