diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-07-27 12:20:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-27 12:20:32 +0200 |
commit | c000cec27fcb16548606830410be265eb082f777 (patch) | |
tree | ad9ba8162ccf50992bbb0947b8c8c546c4530b62 /src/libcmd/command.cc | |
parent | f52fa47e16142d992127677739cc458fc26a0455 (diff) | |
parent | 29e4913f7947730c468c1d96f150648ec59f572d (diff) |
Merge pull request #5048 from tweag/flox-eval-store
--eval-store and faster closure copying
Diffstat (limited to 'src/libcmd/command.cc')
-rw-r--r-- | src/libcmd/command.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 6777b23be..2daf43aa7 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -54,6 +54,30 @@ void StoreCommand::run() run(getStore()); } +EvalCommand::EvalCommand() +{ +} + +EvalCommand::~EvalCommand() +{ + if (evalState) + evalState->printStats(); +} + +ref<Store> EvalCommand::getEvalStore() +{ + if (!evalStore) + evalStore = evalStoreUrl ? openStore(*evalStoreUrl) : getStore(); + return ref<Store>(evalStore); +} + +ref<EvalState> EvalCommand::getEvalState() +{ + if (!evalState) + evalState = std::make_shared<EvalState>(searchPath, getEvalStore(), getStore()); + return ref<EvalState>(evalState); +} + BuiltPathsCommand::BuiltPathsCommand(bool recursive) : recursive(recursive) { @@ -91,7 +115,7 @@ void BuiltPathsCommand::run(ref<Store> store) for (auto & p : store->queryAllValidPaths()) paths.push_back(BuiltPath::Opaque{p}); } else { - paths = toBuiltPaths(store, realiseMode, operateOn, installables); + paths = toBuiltPaths(getEvalStore(), store, realiseMode, operateOn, installables); if (recursive) { // XXX: This only computes the store path closure, ignoring // intermediate realisations |