dotnet-sdk: update.sh - allow early exit.

If updating to the latest version, and the local expression already is
the latest version, exit without regenerating everything.
This commit is contained in:
mdarocha 2022-09-21 06:50:00 +02:00
parent b93a1f4538
commit a9fc578fe7

View File

@ -297,17 +297,32 @@ Examples:
major_minor=$(sed 's/^\([0-9]*\.[0-9]*\).*$/\1/' <<< "$sem_version")
content=$(curl -sL https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/"$major_minor"/releases.json)
major_minor_patch=$([ "$patch_specified" == true ] && echo "$sem_version" || jq -r '."latest-release"' <<< "$content")
major_minor_underscore=${major_minor/./_}
release_content=$(release "$content" "$major_minor_patch")
aspnetcore_version=$(jq -r '."aspnetcore-runtime".version' <<< "$release_content")
runtime_version=$(jq -r '.runtime.version' <<< "$release_content")
sdk_version=$(jq -r '.sdk.version' <<< "$release_content")
# If patch was not specified, check if the package is already the latest version
# If it is, exit early
if [ "$patch_specified" == false ] && [ -f "./versions/${sem_version}.nix" ]; then
current_version=$(nix-instantiate --eval -E "(import ./versions/${sem_version}.nix { \
buildAspNetCore = { ... }: {}; \
buildNetRuntime = { ... }: {}; \
buildNetSdk = { version, ... }: version; \
icu = null; }).sdk_${major_minor_underscore}" | jq -r)
if [[ "$current_version" == "$sdk_version" ]]; then
echo "Nothing to update."
exit
fi
fi
aspnetcore_files="$(release_files "$release_content" "aspnetcore-runtime")"
runtime_files="$(release_files "$release_content" "runtime")"
sdk_files="$(release_files "$release_content" "sdk")"
major_minor_underscore=${major_minor/./_}
channel_version=$(jq -r '."channel-version"' <<< "$content")
support_phase=$(jq -r '."support-phase"' <<< "$content")
echo "{ buildAspNetCore, buildNetRuntime, buildNetSdk, icu }: