osu-lazer: Use nuget-to-nix in updater script

This commit is contained in:
Zhaofeng Li 2021-08-11 23:26:36 -07:00
parent 1ad800d919
commit 4d327d1e3f
2 changed files with 359 additions and 1801 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts dotnet-sdk_5
#!nix-shell -i bash -p curl jq common-updater-scripts nuget-to-nix dotnet-sdk_5
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
@ -25,21 +25,7 @@ pushd "$src"
mkdir ./nuget_tmp.packages
dotnet restore osu.Desktop --packages ./nuget_tmp.packages --runtime linux-x64
echo "{ fetchNuGet }: [" >"$deps_file"
while read pkg_spec; do
{ read pkg_name; read pkg_version; } < <(
# Build version part should be ignored: `3.0.0-beta2.20059.3+77df2220` -> `3.0.0-beta2.20059.3`
sed -nE 's/.*<id>([^<]*).*/\1/p; s/.*<version>([^<+]*).*/\1/p' "$pkg_spec")
pkg_sha256="$(nix-hash --type sha256 --flat --base32 "$(dirname "$pkg_spec")"/*.nupkg)"
cat >>"$deps_file" <<EOF
(fetchNuGet {
name = "$pkg_name";
version = "$pkg_version";
sha256 = "$pkg_sha256";
})
EOF
done < <(find ./nuget_tmp.packages -name '*.nuspec' | sort)
echo "]" >>"$deps_file"
nuget-to-nix ./nuget_tmp.packages > "$deps_file"
popd
rm -r "$src"