diff options
Diffstat (limited to 'pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh')
-rwxr-xr-x | pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh b/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh index 34c42929857d1..def59954e4806 100755 --- a/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh +++ b/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh @@ -23,10 +23,17 @@ export DOTNET_CLI_TELEMETRY_OPTOUT=1 mapfile -t sources < <(dotnet nuget list source --format short | awk '/^E / { print $2 }') +declare -a remote_sources declare -A base_addresses for index in "${sources[@]}"; do - base_addresses[$index]=$( + if [[ -d "$index" ]]; then + continue + fi + + remote_sources+=($index) + + base_addresses[$index]=$( curl --compressed --netrc -fsL "$index" | \ jq -r '.resources[] | select(."@type" == "PackageBaseAddress/3.0.0")."@id"') done @@ -35,6 +42,7 @@ echo "{ fetchNuGet }: [" cd "$pkgs" for package in *; do + [[ -d "$package" ]] || continue cd "$package" for version in *; do id=$(xq -r .package.metadata.id "$version"/*.nuspec) @@ -44,7 +52,12 @@ for package in *; do fi used_source="$(jq -r '.source' "$version"/.nupkg.metadata)" - for source in "${sources[@]}"; do + + if [[ -d "$used_source" ]]; then + continue + fi + + for source in "${remote_sources[@]}"; do url="${base_addresses[$source]}$package/$version/$package.$version.nupkg" if [[ "$source" == "$used_source" ]]; then sha256="$(nix-hash --type sha256 --flat --base32 "$version/$package.$version".nupkg)" |