From 60eb0db2ab65b8df15c6a746f40e37ca8df43021 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Sat, 7 Sep 2024 22:55:57 -0300 Subject: [PATCH] dotnet-sdk-setup-hook: add trailing slashes to NUGET_PACKAGES vars --- .../dotnet/add-nuget-deps/fetch-deps.sh | 2 +- .../compilers/dotnet/dotnet-sdk-setup-hook.sh | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/dotnet/add-nuget-deps/fetch-deps.sh b/pkgs/build-support/dotnet/add-nuget-deps/fetch-deps.sh index 92c9ff9d6444..7891b5434c13 100644 --- a/pkgs/build-support/dotnet/add-nuget-deps/fetch-deps.sh +++ b/pkgs/build-support/dotnet/add-nuget-deps/fetch-deps.sh @@ -15,6 +15,6 @@ genericBuild depsFile=$(realpath "${1:-@defaultDepsFile@}") tmpFile="$tmp"/deps.nix echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n" > "$tmpFile" -@nugetToNix@/bin/nuget-to-nix "$NUGET_PACKAGES" >> "$tmpFile" +@nugetToNix@/bin/nuget-to-nix "${NUGET_PACKAGES%/}" >> "$tmpFile" mv "$tmpFile" "$depsFile" echo "Succesfully wrote lockfile to $depsFile" diff --git a/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh b/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh index e9b150efad1f..2a600e073891 100644 --- a/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh +++ b/pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh @@ -27,10 +27,14 @@ _linkPackages() { createNugetDirs() { nugetTemp=$PWD/.nuget-temp - export NUGET_PACKAGES=$nugetTemp/packages - export NUGET_FALLBACK_PACKAGES=$nugetTemp/fallback + # trailing slash required here: + # Microsoft.Managed.Core.targets(236,5): error : SourceRoot paths are required to end with a slash or backslash: '/build/.nuget-temp/packages' + # also e.g. from avalonia: + # + export NUGET_PACKAGES=$nugetTemp/packages/ + export NUGET_FALLBACK_PACKAGES=$nugetTemp/fallback/ nugetSource=$nugetTemp/source - mkdir -p "$NUGET_PACKAGES" "$NUGET_FALLBACK_PACKAGES" "$nugetSource" + mkdir -p "${NUGET_PACKAGES%/}" "${NUGET_FALLBACK_PACKAGES%/}" "$nugetSource" dotnet new nugetconfig if [[ -z ${keepNugetConfig-} ]]; then @@ -45,7 +49,7 @@ configureNuget() { for x in "${!_nugetInputs[@]}"; do if [[ -d $x/share/nuget/packages ]]; then - _linkPackages "$x/share/nuget/packages" "$NUGET_FALLBACK_PACKAGES" + _linkPackages "$x/share/nuget/packages" "${NUGET_FALLBACK_PACKAGES%/}" fi if [[ -d $x/share/nuget/source ]]; then @@ -59,7 +63,7 @@ configureNuget() { || -f paket.dependencies ]]; then for x in "${!_nugetInputs[@]}"; do if [[ -d $x/share/nuget/packages ]]; then - @lndir@/bin/lndir -silent "$x/share/nuget/packages" "$NUGET_PACKAGES" + @lndir@/bin/lndir -silent "$x/share/nuget/packages" "${NUGET_PACKAGES%/}" fi done fi @@ -70,7 +74,7 @@ configureNuget() { for x in "${!_nugetInputs[@]}"; do if [[ -d $x/share/nuget/source ]]; then - @lndir@/bin/lndir -silent "$x/share/nuget/source" "$NUGET_PACKAGES" + @lndir@/bin/lndir -silent "$x/share/nuget/source" "${NUGET_PACKAGES%/}" fi done fi