Commit 42a751ad authored by David McFarland's avatar David McFarland
Browse files

nuget-to-json: fix missing tool packages

After dotnet 9.0.1->9.0.2, when a package is restored with 'tool
install', .nupkg.metadata no longer contains the field:

    "source": null

It still contains "contentHash", so we return a dummy source name in
that case.

Fixes: 383ceb66
parent 383ceb66
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ done
            fi

            # packages in the nix store should have an empty metadata file
            used_source="$(jq -r 'if has("source") then .source else "" end' "$version"/.nupkg.metadata)"
            # packages installed with 'dotnet tool' may be missing 'source'
            used_source="$(jq -r 'if has("source") then .source elif has("contentHash") then "__unknown" else "" end' "$version"/.nupkg.metadata)"
            found=false

            if [[ -z "$used_source" || -d "$used_source" ]]; then