nuget-package-hook: use sub-shell to set nullglob

This commit is contained in:
David McFarland 2024-09-08 13:27:28 -03:00
parent bfa7bef5ec
commit 6097d6e202

View File

@ -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() {