From 6097d6e202a315c18e47b24209b5277c95eb7622 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Sun, 8 Sep 2024 13:27:28 -0300 Subject: [PATCH] nuget-package-hook: use sub-shell to set nullglob --- .../compilers/dotnet/nuget-package-hook.sh | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/pkgs/development/compilers/dotnet/nuget-package-hook.sh b/pkgs/development/compilers/dotnet/nuget-package-hook.sh index 8f82f9bf4505..272481ba30a0 100644 --- a/pkgs/development/compilers/dotnet/nuget-package-hook.sh +++ b/pkgs/development/compilers/dotnet/nuget-package-hook.sh @@ -41,27 +41,29 @@ fi _createNugetSourceInOutput() { local package version id dir nupkg content local -a nuspec - shopt -s nullglob + ( + shopt -s nullglob - for package in "$prefix"/share/nuget/packages/*/*; do - version=$(basename "$package") - id=$(basename "$(dirname "$package")") - dir="$prefix/share/nuget/source/$id/$version" - nupkg=$dir/$id.$version.nupkg - nuspec=("$package"/*.nuspec) + for package in "$prefix"/share/nuget/packages/*/*; do + version=$(basename "$package") + id=$(basename "$(dirname "$package")") + dir="$prefix/share/nuget/source/$id/$version" + nupkg=$dir/$id.$version.nupkg + nuspec=("$package"/*.nuspec) - if [[ -n ${createInstallableNugetSource-} ]]; then - content=. - else - content=$(basename "${nuspec[0]}") - fi + if [[ -n ${createInstallableNugetSource-} ]]; then + content=. + else + content=$(basename "${nuspec[0]}") + fi - mkdir -p "$dir" - cp "${nuspec[0]}" "$dir/$id.nuspec" - (cd "$package" && @zip@/bin/zip -rq0 "$nupkg" "$content") - @stripNondeterminism@/bin/strip-nondeterminism --type zip "$nupkg" - touch "$nupkg".sha512 - done + mkdir -p "$dir" + cp "${nuspec[0]}" "$dir/$id.nuspec" + (cd "$package" && @zip@/bin/zip -rq0 "$nupkg" "$content") + @stripNondeterminism@/bin/strip-nondeterminism --type zip "$nupkg" + touch "$nupkg".sha512 + done + ) } createNugetSource() {