diff options
Diffstat (limited to 'pkgs/development/compilers/dotnet/update.nix')
-rw-r--r-- | pkgs/development/compilers/dotnet/update.nix | 100 |
1 files changed, 68 insertions, 32 deletions
diff --git a/pkgs/development/compilers/dotnet/update.nix b/pkgs/development/compilers/dotnet/update.nix index 58304188afa8..4fa837a4a274 100644 --- a/pkgs/development/compilers/dotnet/update.nix +++ b/pkgs/development/compilers/dotnet/update.nix @@ -1,18 +1,20 @@ -{ stdenvNoCC -, lib -, fetchurl -, writeScript -, nix -, runtimeShell -, curl -, cacert -, jq -, yq -, gnupg - -, releaseManifestFile -, releaseInfoFile -, allowPrerelease +{ + stdenvNoCC, + lib, + fetchurl, + writeScript, + nix, + runtimeShell, + curl, + cacert, + jq, + yq, + gnupg, + + releaseManifestFile, + releaseInfoFile, + bootstrapSdkFile, + allowPrerelease, }: let @@ -38,18 +40,36 @@ let drv = builtins.unsafeDiscardOutputDependency pkg.drvPath; -in writeScript "update-dotnet-vmr.sh" '' +in +writeScript "update-dotnet-vmr.sh" '' #! ${nix}/bin/nix-shell - #! nix-shell -i ${runtimeShell} --pure ${drv} + #! nix-shell -i ${runtimeShell} --pure ${drv} --keep UPDATE_NIX_ATTR_PATH set -euo pipefail - query=$(cat <<EOF - map( - select( - ${lib.optionalString (!allowPrerelease) ".prerelease == false and"} - .draft == false and - (.name | startswith(".NET ${channel}")))) | - first | ( + tag=''${1-} + + if [[ -n $tag ]]; then + query=$(cat <<EOF + map( + select( + (.tag_name == "$tag"))) | + first + EOF + ) + else + query=$(cat <<EOF + map( + select( + ${lib.optionalString (!allowPrerelease) ".prerelease == false and"} + .draft == false and + (.tag_name | startswith("v${channel}")))) | + first + EOF + ) + fi + + query="$query "$(cat <<EOF + | ( .tag_name, (.assets | .[] | @@ -63,7 +83,7 @@ in writeScript "update-dotnet-vmr.sh" '' ) ( - curl -fsL https://api.github.com/repos/dotnet/dotnet/releases | \ + curl -fsSL https://api.github.com/repos/dotnet/dotnet/releases | \ jq -r "$query" \ ) | ( read tagName @@ -73,12 +93,15 @@ in writeScript "update-dotnet-vmr.sh" '' tmp="$(mktemp -d)" trap 'rm -rf "$tmp"' EXIT + echo ${lib.escapeShellArg (toString ./update.sh)} \ + -o ${lib.escapeShellArg (toString bootstrapSdkFile)} --sdk foo + cd "$tmp" - curl -fsL "$releaseUrl" -o release.json + curl -fsSL "$releaseUrl" -o release.json release=$(jq -r .release release.json) - if [[ "$release" == "${release}" ]]; then + if [[ -z $tag && "$release" == "${release}" ]]; then >&2 echo "release is already $release" exit fi @@ -89,13 +112,16 @@ in writeScript "update-dotnet-vmr.sh" '' tarballHash=$(nix-hash --to-sri --type sha256 "''${prefetch[0]}") tarball=''${prefetch[1]} - curl -L "$sigUrl" -o release.sig + curl -fssL "$sigUrl" -o release.sig - export GNUPGHOME=$PWD/.gnupg - gpg --batch --import ${releaseKey} - gpg --batch --verify release.sig "$tarball" + ( + export GNUPGHOME=$PWD/.gnupg + trap 'gpgconf --kill all' EXIT + gpg --batch --import ${releaseKey} + gpg --batch --verify release.sig "$tarball" + ) - tar --strip-components=1 --no-wildcards-match-slash --wildcards -xzf "$tarball" \*/eng/Versions.props + tar --strip-components=1 --no-wildcards-match-slash --wildcards -xzf "$tarball" \*/eng/Versions.props \*/global.json artifactsVersion=$(xq -r '.Project.PropertyGroup | map(select(.PrivateSourceBuiltArtifactsVersion)) | .[] | .PrivateSourceBuiltArtifactsVersion' eng/Versions.props) @@ -110,6 +136,8 @@ in writeScript "update-dotnet-vmr.sh" '' artifactsHash=$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url "$artifactsUrl")") + sdkVersion=$(jq -r .tools.dotnet global.json) + jq --null-input \ --arg _0 "$tarballHash" \ --arg _1 "$artifactsUrl" \ @@ -121,5 +149,13 @@ in writeScript "update-dotnet-vmr.sh" '' }' > "${toString releaseInfoFile}" cp release.json "${toString releaseManifestFile}" + + cd - + + # needs to be run in nixpkgs + ${lib.escapeShellArg (toString ./update.sh)} \ + -o ${lib.escapeShellArg (toString bootstrapSdkFile)} --sdk "$sdkVersion" + + $(nix-build -A $UPDATE_NIX_ATTR_PATH.fetch-deps --no-out-link) ) '' |