mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Use BuildableReq
for buildPaths
and ensurePath
This avoids an ambiguity where the `StorePathWithOutputs { drvPath, {} }` could mean "build `brvPath`" or "substitute `drvPath`" depending on context. It also brings the internals closer in line to the new CLI, by generalizing the `Buildable` type is used there and makes that distinction already. In doing so, relegate `StorePathWithOutputs` to being a type just for backwards compatibility (CLI and RPC).
This commit is contained in:
parent
32f4454b9f
commit
255d145ba7
31 changed files with 364 additions and 126 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "worker-protocol.hh"
|
||||
#include "graphml.hh"
|
||||
#include "legacy.hh"
|
||||
#include "path-with-outputs.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
@ -62,7 +63,7 @@ static PathSet realisePath(StorePathWithOutputs path, bool build = true)
|
|||
auto store2 = std::dynamic_pointer_cast<LocalFSStore>(store);
|
||||
|
||||
if (path.path.isDerivation()) {
|
||||
if (build) store->buildPaths({path});
|
||||
if (build) store->buildPaths({path.toBuildableReq()});
|
||||
auto outputPaths = store->queryDerivationOutputMap(path.path);
|
||||
Derivation drv = store->derivationFromPath(path.path);
|
||||
rootNr++;
|
||||
|
@ -132,7 +133,9 @@ static void opRealise(Strings opFlags, Strings opArgs)
|
|||
|
||||
uint64_t downloadSize, narSize;
|
||||
StorePathSet willBuild, willSubstitute, unknown;
|
||||
store->queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
|
||||
store->queryMissing(
|
||||
toBuildableReqs(paths),
|
||||
willBuild, willSubstitute, unknown, downloadSize, narSize);
|
||||
|
||||
if (ignoreUnknown) {
|
||||
std::vector<StorePathWithOutputs> paths2;
|
||||
|
@ -148,7 +151,7 @@ static void opRealise(Strings opFlags, Strings opArgs)
|
|||
if (dryRun) return;
|
||||
|
||||
/* Build all paths at the same time to exploit parallelism. */
|
||||
store->buildPaths(paths, buildMode);
|
||||
store->buildPaths(toBuildableReqs(paths), buildMode);
|
||||
|
||||
if (!ignoreUnknown)
|
||||
for (auto & i : paths) {
|
||||
|
@ -879,7 +882,7 @@ static void opServe(Strings opFlags, Strings opArgs)
|
|||
|
||||
try {
|
||||
MonitorFdHup monitor(in.fd);
|
||||
store->buildPaths(paths);
|
||||
store->buildPaths(toBuildableReqs(paths));
|
||||
out << 0;
|
||||
} catch (Error & e) {
|
||||
assert(e.status);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue