1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

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.
This commit is contained in:
John Ericson 2022-03-08 18:20:39 +00:00
parent 89effe9d4a
commit 678d1c2aa0
13 changed files with 92 additions and 22 deletions

View file

@ -4,6 +4,7 @@
#include "globals.hh"
#include "build-result.hh"
#include "gc-store.hh"
#include "log-store.hh"
#include "local-store.hh"
#include "monitor-fd.hh"
#include "serve-protocol.hh"
@ -474,13 +475,15 @@ static void opReadLog(Strings opFlags, Strings opArgs)
{
if (!opFlags.empty()) throw UsageError("unknown flag");
auto & logStore = LogStore::require(*store);
RunPager pager;
for (auto & i : opArgs) {
auto path = store->followLinksToStorePath(i);
auto log = store->getBuildLog(path);
auto path = logStore.followLinksToStorePath(i);
auto log = logStore.getBuildLog(path);
if (!log)
throw Error("build log of derivation '%s' is not available", store->printStorePath(path));
throw Error("build log of derivation '%s' is not available", logStore.printStorePath(path));
std::cout << *log;
}
}