dotnet/update.sh: check sdk version when updating

This commit is contained in:
David McFarland
2024-12-05 14:07:34 -04:00
parent 4c9ddcbc1a
commit 4ba028e885
+12 -9
View File
@@ -281,15 +281,18 @@ update() {
# If patch was not specified, check if the package is already the latest version
# If it is, exit early
if [ "$patch_specified" == false ] && [ -f "$output" ]; then
local current_version
current_version=$(nix-instantiate --eval -E "(import $output { \
buildAspNetCore = { ... }: {}; \
buildNetSdk = { ... }: {}; \
buildNetRuntime = { ... }: {}; \
fetchNupkg = { ... }: {}; \
}).release_${major_minor_underscore}" | jq -r)
if [[ "$current_version" == "$major_minor_patch" ]]; then
local -a versions
IFS= readarray -d '' versions < <(
nix-instantiate --eval --json -E "with (import $output {
buildAspNetCore = { ... }: {};
buildNetSdk = { version, ... }: { inherit version; };
buildNetRuntime = { version, ... }: { inherit version; };
fetchNupkg = { ... }: {};
}); (x: builtins.deepSeq x x) [
runtime_${major_minor_underscore}.version
sdk_${major_minor_underscore}.version
]" | jq --raw-output0 .[])
if [[ "${versions[0]}" == "$major_minor_patch" && "${versions[1]}" == "${sdk_versions[0]}" ]]; then
echo "Nothing to update."
return
fi