nuget-to-nix: skip local sources
This commit is contained in:
parent
482e352ba1
commit
ca181cefee
@ -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)"
|
||||
|
Loading…
Reference in New Issue
Block a user