diff options
Diffstat (limited to 'src/nix/log.cc')
-rw-r--r-- | src/nix/log.cc | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/nix/log.cc b/src/nix/log.cc index d8a3830e91c8..ed610261d1ca 100644 --- a/src/nix/log.cc +++ b/src/nix/log.cc @@ -1,12 +1,11 @@ #include "command.hh" #include "common-args.hh" -#include "installables.hh" #include "shared.hh" #include "store-api.hh" using namespace nix; -struct CmdLog : StoreCommand, MixInstallables +struct CmdLog : InstallablesCommand { CmdLog() { @@ -24,32 +23,23 @@ struct CmdLog : StoreCommand, MixInstallables void run(ref<Store> store) override { - auto elems = evalInstallables(store); - - PathSet paths; - - for (auto & elem : elems) { - if (elem.isDrv) - paths.insert(elem.drvPath); - else - paths.insert(elem.outPaths.begin(), elem.outPaths.end()); - } - auto subs = getDefaultSubstituters(); subs.push_front(store); - for (auto & path : paths) { - bool found = false; - for (auto & sub : subs) { - auto log = sub->getBuildLog(path); - if (!log) continue; - std::cout << *log; - found = true; - break; + for (auto & inst : installables) { + for (auto & path : inst->toBuildable()) { + bool found = false; + for (auto & sub : subs) { + auto log = sub->getBuildLog(path); + if (!log) continue; + std::cout << *log; + found = true; + break; + } + if (!found) + throw Error("build log of path ‘%s’ is not available", path); } - if (!found) - throw Error("build log of path ‘%s’ is not available", path); } } }; |