1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

nuget-package-hook: unpack nuspec as lower-case

Some obscure build things, like in the msbuild package, assume that the
nuspec files are lower-case.
This commit is contained in:
David McFarland 2024-09-09 01:26:17 -03:00
parent ce92a4277e
commit a0c5f2662d

View file

@ -1,14 +1,30 @@
# shellcheck shell=bash disable=SC2154
unpackNupkg() {
local -r nupkg="$1" unpacked="$2"
local nuspec nuspec_l
mkdir -p "$unpacked"
@unzip@/bin/unzip -nqd "$unpacked" "$nupkg"
cd "$unpacked"
chmod -R +rw .
nuspec=(*.nuspec)
nuspec_l="${nuspec,,}"
if [[ $nuspec != "$nuspec_l" ]]; then
mv "$nuspec" "$nuspec".tmp
mv "$nuspec".tmp "$nuspec_l"
fi
echo {} > .nupkg.metadata
cd - >/dev/null
}
_unpackNugetPackagesInOutput() {
local -r unpacked="$prefix"/share/nuget/packages/.unpacked
local nuspec nuspec_l
(
shopt -s nullglob globstar
for nupkg in "$prefix"/share/nuget/source/**/*.nupkg; do
mkdir -p "$unpacked"
@unzip@/bin/unzip -qd "$unpacked" "$nupkg"
chmod -R +rw "$unpacked"
echo {} > "$unpacked"/.nupkg.metadata
unpackNupkg "$nupkg" "$unpacked"
@xmlstarlet@/bin/xmlstarlet \
sel -t \
-m /_:package/_:metadata \