From 28ca61fbbbce889c6b7ce58e56cec4ca78d9d12f Mon Sep 17 00:00:00 2001 From: David McFarland Date: Wed, 11 Jun 2025 15:45:26 -0300 Subject: [PATCH] dotnetCorePackages.dotnet_{8..10}.vmr: fallback to bootstrap pre-release with same sdk version This is necessary because there aren't official releases of all the SDKs listed in global.json. --- pkgs/development/compilers/dotnet/update.nix | 13 +++++++++++-- pkgs/development/compilers/dotnet/update.sh | 11 ++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/dotnet/update.nix b/pkgs/development/compilers/dotnet/update.nix index 3e5f4fffc35f..41df7569be19 100644 --- a/pkgs/development/compilers/dotnet/update.nix +++ b/pkgs/development/compilers/dotnet/update.nix @@ -157,8 +157,17 @@ writeScript "update-dotnet-vmr.sh" '' "artifactsHash": $_2, }' > "${toOutputPath releaseInfoFile}" - ${lib.escapeShellArg (toOutputPath ./update.sh)} \ - -o ${lib.escapeShellArg (toOutputPath bootstrapSdkFile)} --sdk "$sdkVersion" >&2 + updateSDK() { + ${lib.escapeShellArg (toOutputPath ./update.sh)} \ + -o ${lib.escapeShellArg (toOutputPath bootstrapSdkFile)} --sdk "$1" >&2 + } + + updateSDK "$sdkVersion" || if [[ $? == 2 ]]; then + >&2 echo "WARNING: bootstrap sdk missing, attempting to bootstrap with self" + updateSDK "$(jq -er .sdkVersion "$tmp"/release.json)" + else + exit 1 + fi $(nix-build -A $UPDATE_NIX_ATTR_PATH.fetch-deps --no-out-link) >&2 ) diff --git a/pkgs/development/compilers/dotnet/update.sh b/pkgs/development/compilers/dotnet/update.sh index ad51bcaf31da..2eb3d9cc234e 100755 --- a/pkgs/development/compilers/dotnet/update.sh +++ b/pkgs/development/compilers/dotnet/update.sh @@ -5,6 +5,8 @@ set -Eeuo pipefail shopt -s inherit_errexit +trap 'exit 1' ERR + rids=({linux-{,musl-}{arm,arm64,x64},osx-{arm64,x64},win-{arm64,x64,x86}}) release () { @@ -225,6 +227,11 @@ usage () { echo "Usage: $pname [[--sdk] [-o output] sem-version] ... Get updated dotnet src (platform - url & sha512) expressions for specified versions +Exit codes: + 0 Success + 1 Failure + 2 Release not found + Examples: $pname 6.0.14 7.0.201 - specific x.y.z versions $pname 6.0 7.0 - latest x.y versions @@ -256,11 +263,13 @@ update() { major_minor=$(sed 's/^\([0-9]*\.[0-9]*\).*$/\1/' <<< "$sem_version") content=$(curl -fsSL https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/"$major_minor"/releases.json) if [[ -n $sdk ]]; then + trap '' ERR major_minor_patch=$( jq -er --arg version "$sem_version" ' .releases[] | select(.sdks[].version == $version) | - ."release-version"' <<< "$content") + ."release-version"' <<< "$content" || if [[ $? == 4 ]]; then exit 2; else exit 1; fi) + trap 'exit 1' ERR else major_minor_patch=$([ "$patch_specified" == true ] && echo "$sem_version" || jq -er '."latest-release"' <<< "$content") fi