about summary refs log tree commit diff
path: root/pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-03-06 00:02:47 +0000
committerGitHub <noreply@github.com>2024-03-06 00:02:47 +0000
commitb5be23cc08d85d645c6b79a1568d4679af89ea1f (patch)
tree3cb82819e7e830e7ba66145ddebcdb4a48bc205b /pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh
parent9c0a3e4166876e9a6794fd734cbb1dc3734fada4 (diff)
parent8660ec23c78ad726f0a7dd3acdad92fd598d9712 (diff)
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh')
-rwxr-xr-xpkgs/build-support/dotnet/nuget-to-nix/nuget-to-nix.sh17
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)"