mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +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
|
@ -6,6 +6,7 @@
|
|||
#include "globals.hh"
|
||||
#include "names.hh"
|
||||
#include "profiles.hh"
|
||||
#include "path-with-outputs.hh"
|
||||
#include "shared.hh"
|
||||
#include "store-api.hh"
|
||||
#include "local-fs-store.hh"
|
||||
|
@ -418,13 +419,13 @@ static void queryInstSources(EvalState & state,
|
|||
|
||||
static void printMissing(EvalState & state, DrvInfos & elems)
|
||||
{
|
||||
std::vector<StorePathWithOutputs> targets;
|
||||
std::vector<BuildableReq> targets;
|
||||
for (auto & i : elems) {
|
||||
Path drvPath = i.queryDrvPath();
|
||||
if (drvPath != "")
|
||||
targets.push_back({state.store->parseStorePath(drvPath)});
|
||||
targets.push_back(BuildableReqFromDrv{state.store->parseStorePath(drvPath)});
|
||||
else
|
||||
targets.push_back({state.store->parseStorePath(i.queryOutPath())});
|
||||
targets.push_back(BuildableOpaque{state.store->parseStorePath(i.queryOutPath())});
|
||||
}
|
||||
|
||||
printMissing(state.store, targets);
|
||||
|
@ -693,17 +694,18 @@ static void opSet(Globals & globals, Strings opFlags, Strings opArgs)
|
|||
if (globals.forceName != "")
|
||||
drv.setName(globals.forceName);
|
||||
|
||||
if (drv.queryDrvPath() != "") {
|
||||
std::vector<StorePathWithOutputs> paths{{globals.state->store->parseStorePath(drv.queryDrvPath())}};
|
||||
printMissing(globals.state->store, paths);
|
||||
if (globals.dryRun) return;
|
||||
globals.state->store->buildPaths(paths, globals.state->repair ? bmRepair : bmNormal);
|
||||
} else {
|
||||
printMissing(globals.state->store,
|
||||
{{globals.state->store->parseStorePath(drv.queryOutPath())}});
|
||||
if (globals.dryRun) return;
|
||||
globals.state->store->ensurePath(globals.state->store->parseStorePath(drv.queryOutPath()));
|
||||
}
|
||||
std::vector<BuildableReq> paths {
|
||||
(drv.queryDrvPath() != "")
|
||||
? (BuildableReq) (BuildableReqFromDrv {
|
||||
globals.state->store->parseStorePath(drv.queryDrvPath())
|
||||
})
|
||||
: (BuildableReq) (BuildableOpaque {
|
||||
globals.state->store->parseStorePath(drv.queryOutPath())
|
||||
}),
|
||||
};
|
||||
printMissing(globals.state->store, paths);
|
||||
if (globals.dryRun) return;
|
||||
globals.state->store->buildPaths(paths, globals.state->repair ? bmRepair : bmNormal);
|
||||
|
||||
debug(format("switching to new user environment"));
|
||||
Path generation = createGeneration(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue