diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2021-06-25 15:51:02 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2021-06-25 15:51:02 -0500 |
commit | c3a929349f6c1968285ffff735933772be2f77cb (patch) | |
tree | 0bfcfa57bf200461821a4239fe316a00f377a792 /src/nix-env/nix-env.cc | |
parent | d5fd0f4745d834f7ac7049a0eb7e212ce9c7ef47 (diff) | |
parent | bf68c693dc5157c2be1f3a9f407dd1ce3761df78 (diff) |
Merge remote-tracking branch 'origin/master' into cross-jobs
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r-- | src/nix-env/nix-env.cc | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 0f10a4cbb..e04954d45 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -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<DerivedPath> targets; for (auto & i : elems) { Path drvPath = i.queryDrvPath(); if (drvPath != "") - targets.push_back({state.store->parseStorePath(drvPath)}); + targets.push_back(DerivedPath::Built{state.store->parseStorePath(drvPath)}); else - targets.push_back({state.store->parseStorePath(i.queryOutPath())}); + targets.push_back(DerivedPath::Opaque{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<DerivedPath> paths { + (drv.queryDrvPath() != "") + ? (DerivedPath) (DerivedPath::Built { + globals.state->store->parseStorePath(drv.queryDrvPath()) + }) + : (DerivedPath) (DerivedPath::Opaque { + 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( |