aboutsummaryrefslogtreecommitdiff
path: root/src/nix/log.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-08 18:20:39 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-11 13:32:16 +0000
commit678d1c2aa0f499466c723d3461277dc197515f57 (patch)
treed724d5782585463da2bd2f41f7e92588e5085754 /src/nix/log.cc
parent89effe9d4abde2ea8970736f79e0a6a499777692 (diff)
Factor out a `LogStore` interface
Continue progress on #5729. Just as I hoped, this uncovered an issue: the daemon protocol is missing a way to query build logs. This doesn't effect `unix://`, but does effect `ssh://`. A FIXME is left for this, so we come back to it later.
Diffstat (limited to 'src/nix/log.cc')
-rw-r--r--src/nix/log.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nix/log.cc b/src/nix/log.cc
index fd3c1d787..72d02ef11 100644
--- a/src/nix/log.cc
+++ b/src/nix/log.cc
@@ -2,6 +2,7 @@
#include "common-args.hh"
#include "shared.hh"
#include "store-api.hh"
+#include "log-store.hh"
#include "progress-bar.hh"
using namespace nix;
@@ -34,17 +35,24 @@ struct CmdLog : InstallableCommand
RunPager pager;
for (auto & sub : subs) {
+ auto * logSubP = dynamic_cast<LogStore *>(&*sub);
+ if (!logSubP) {
+ printInfo("Skipped '%s' which does not support retrieving build logs", sub->getUri());
+ continue;
+ }
+ auto & logSub = *logSubP;
+
auto log = std::visit(overloaded {
[&](const DerivedPath::Opaque & bo) {
- return sub->getBuildLog(bo.path);
+ return logSub.getBuildLog(bo.path);
},
[&](const DerivedPath::Built & bfd) {
- return sub->getBuildLog(bfd.drvPath);
+ return logSub.getBuildLog(bfd.drvPath);
},
}, b.raw());
if (!log) continue;
stopProgressBar();
- printInfo("got build log for '%s' from '%s'", installable->what(), sub->getUri());
+ printInfo("got build log for '%s' from '%s'", installable->what(), logSub.getUri());
std::cout << *log;
return;
}