1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-19 16:59:35 +01:00

queryMissing(): Return a struct

...instead of having a bunch of pass-by-reference arguments.
This commit is contained in:
Eelco Dolstra 2025-07-04 15:39:47 +02:00
parent d4f67fd46d
commit af05ce0f6d
11 changed files with 59 additions and 79 deletions

View file

@ -146,23 +146,19 @@ static void opRealise(Strings opFlags, Strings opArgs)
for (auto & i : opArgs)
paths.push_back(followLinksToStorePathWithOutputs(*store, i));
uint64_t downloadSize, narSize;
StorePathSet willBuild, willSubstitute, unknown;
store->queryMissing(
toDerivedPaths(paths),
willBuild, willSubstitute, unknown, downloadSize, narSize);
auto missing = store->queryMissing(toDerivedPaths(paths));
/* Filter out unknown paths from `paths`. */
if (ignoreUnknown) {
std::vector<StorePathWithOutputs> paths2;
for (auto & i : paths)
if (!unknown.count(i.path)) paths2.push_back(i);
if (!missing.unknown.count(i.path)) paths2.push_back(i);
paths = std::move(paths2);
unknown = StorePathSet();
missing.unknown = StorePathSet();
}
if (settings.printMissing)
printMissing(ref<Store>(store), willBuild, willSubstitute, unknown, downloadSize, narSize);
printMissing(ref<Store>(store), missing.willBuild, missing.willSubstitute, missing.unknown, missing.downloadSize, missing.narSize);
if (dryRun) return;