mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Merge pull request #10413 from Ma27/path-info-all-binary-cache
path-info: print correct path when using `nix path-info --store file://... --all --json`
This commit is contained in:
commit
a268c0de71
2 changed files with 15 additions and 1 deletions
|
@ -43,10 +43,16 @@ static json pathInfoToJSON(
|
|||
|
||||
for (auto & storePath : storePaths) {
|
||||
json jsonObject;
|
||||
auto printedStorePath = store.printStorePath(storePath);
|
||||
|
||||
try {
|
||||
auto info = store.queryPathInfo(storePath);
|
||||
|
||||
// `storePath` has the representation `<hash>-x` rather than
|
||||
// `<hash>-<name>` in case of binary-cache stores & `--all` because we don't
|
||||
// know the name yet until we've read the NAR info.
|
||||
printedStorePath = store.printStorePath(info->path);
|
||||
|
||||
jsonObject = info->toJSON(store, true, HashFormat::SRI);
|
||||
|
||||
if (showClosureSize) {
|
||||
|
@ -74,7 +80,7 @@ static json pathInfoToJSON(
|
|||
jsonObject = nullptr;
|
||||
}
|
||||
|
||||
jsonAllObjects[store.printStorePath(storePath)] = std::move(jsonObject);
|
||||
jsonAllObjects[printedStorePath] = std::move(jsonObject);
|
||||
}
|
||||
return jsonAllObjects;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue