Commit a4328dfc authored by David McFarland's avatar David McFarland
Browse files

dotnet/update.nix: use relative paths in update script

This stops incorrect paths from being used when run in a temporary
worktree by maintainers/scripts/update.nix.
parent 5283ce22
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -40,6 +40,13 @@ let

  drv = builtins.unsafeDiscardOutputDependency pkg.drvPath;

  toOutputPath =
    path:
    let
      root = ../../../..;
    in
    lib.path.removePrefix root path;

in
writeScript "update-dotnet-vmr.sh" ''
  #! ${nix}/bin/nix-shell
@@ -135,6 +142,11 @@ writeScript "update-dotnet-vmr.sh" ''

      sdkVersion=$(jq -r .tools.dotnet global.json)

      # below needs to be run in nixpkgs because toOutputPath uses relative paths
      cd -

      cp "$tmp"/release.json "${toOutputPath releaseManifestFile}"

      jq --null-input \
          --arg _0 "$tarballHash" \
          --arg _1 "$artifactsUrl" \
@@ -143,15 +155,10 @@ writeScript "update-dotnet-vmr.sh" ''
              "tarballHash": $_0,
              "artifactsUrl": $_1,
              "artifactsHash": $_2,
          }' > "${toString releaseInfoFile}"

      cp release.json "${toString releaseManifestFile}"

      cd -
          }' > "${toOutputPath releaseInfoFile}"

      # needs to be run in nixpkgs
      ${lib.escapeShellArg (toString ./update.sh)} \
          -o ${lib.escapeShellArg (toString bootstrapSdkFile)} --sdk "$sdkVersion"
      ${lib.escapeShellArg (toOutputPath ./update.sh)} \
          -o ${lib.escapeShellArg (toOutputPath bootstrapSdkFile)} --sdk "$sdkVersion"

      $(nix-build -A $UPDATE_NIX_ATTR_PATH.fetch-deps --no-out-link)
  )