diff options
Diffstat (limited to '')
-rw-r--r-- | third_party/nix/src/nix-build/nix-build.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/nix-daemon/nix-daemon-proto.cc | 7 | ||||
-rw-r--r-- | third_party/nix/src/nix-env/nix-env.cc | 4 | ||||
-rw-r--r-- | third_party/nix/src/nix-env/user-env.cc | 5 | ||||
-rw-r--r-- | third_party/nix/src/nix-store/nix-store.cc | 14 | ||||
-rw-r--r-- | third_party/nix/src/nix/installables.cc | 3 |
6 files changed, 24 insertions, 12 deletions
diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc index 1fb8a2f3ad..cc2d8bc2fb 100644 --- a/third_party/nix/src/nix-build/nix-build.cc +++ b/third_party/nix/src/nix-build/nix-build.cc @@ -359,7 +359,8 @@ static void _main(int argc, char** argv) { } if (!dryRun) { - util::OkOrThrow(store->buildPaths(paths, buildMode)); + auto discard_logs = DiscardLogsSink(); + util::OkOrThrow(store->buildPaths(discard_logs, paths, buildMode)); } }; diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc index cbc5452a71..6d18fc4096 100644 --- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc +++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc @@ -290,7 +290,7 @@ class WorkerServiceImpl final : public WorkerService::Service { Status BuildPaths( grpc::ServerContext*, const nix::proto::BuildPathsRequest* request, - grpc::ServerWriter<nix::proto::BuildEvent>* /* writer */) override { + grpc::ServerWriter<nix::proto::BuildEvent>* writer) override { return HandleExceptions( [&]() -> Status { PathSet drvs; @@ -303,11 +303,14 @@ class WorkerServiceImpl final : public WorkerService::Service { return Status(grpc::StatusCode::INTERNAL, "Invalid build mode"); } + BuildLogStreambuf log_buffer(writer); + std::ostream log_sink(&log_buffer); + // TODO(grfn): If mode is repair and not trusted, we need to return an // error here (but we can't yet because we don't know anything about // trusted users) return nix::util::proto::AbslToGRPCStatus( - store_->buildPaths(drvs, mode.value())); + store_->buildPaths(log_sink, drvs, mode.value())); }, __FUNCTION__); } diff --git a/third_party/nix/src/nix-env/nix-env.cc b/third_party/nix/src/nix-env/nix-env.cc index 7502a648d8..e42fc29c22 100644 --- a/third_party/nix/src/nix-env/nix-env.cc +++ b/third_party/nix/src/nix-env/nix-env.cc @@ -722,8 +722,10 @@ static void opSet(Globals& globals, Strings opFlags, Strings opArgs) { if (globals.dryRun) { return; } + auto discard_logs = DiscardLogsSink(); nix::util::OkOrThrow(globals.state->store->buildPaths( - paths, globals.state->repair != 0u ? bmRepair : bmNormal)); + discard_logs, paths, + globals.state->repair != 0u ? bmRepair : bmNormal)); } else { printMissing(globals.state->store, {drv.queryOutPath()}); if (globals.dryRun) { diff --git a/third_party/nix/src/nix-env/user-env.cc b/third_party/nix/src/nix-env/user-env.cc index dac0c52a81..e3124a60e3 100644 --- a/third_party/nix/src/nix-env/user-env.cc +++ b/third_party/nix/src/nix-env/user-env.cc @@ -38,8 +38,9 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile, } DLOG(INFO) << "building user environment dependencies"; + auto discard_logs = DiscardLogsSink(); util::OkOrThrow(state.store->buildPaths( - drvsToBuild, state.repair != 0u ? bmRepair : bmNormal)); + discard_logs, drvsToBuild, state.repair != 0u ? bmRepair : bmNormal)); /* Construct the whole top level derivation. */ PathSet references; @@ -139,7 +140,7 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile, /* Realise the resulting store expression. */ DLOG(INFO) << "building user environment"; util::OkOrThrow(state.store->buildPaths( - {topLevelDrv}, state.repair != 0u ? bmRepair : bmNormal)); + discard_logs, {topLevelDrv}, state.repair != 0u ? bmRepair : bmNormal)); /* Switch the current user environment to the output path. */ auto store2 = state.store.dynamic_pointer_cast<LocalFSStore>(); diff --git a/third_party/nix/src/nix-store/nix-store.cc b/third_party/nix/src/nix-store/nix-store.cc index a036fcec8b..101ab01ef9 100644 --- a/third_party/nix/src/nix-store/nix-store.cc +++ b/third_party/nix/src/nix-store/nix-store.cc @@ -69,7 +69,8 @@ static PathSet realisePath(Path path, bool build = true) { if (isDerivation(p.first)) { if (build) { - util::OkOrThrow(store->buildPaths({path})); + auto discard_logs = DiscardLogsSink(); + util::OkOrThrow(store->buildPaths(discard_logs, {path})); } Derivation drv = store->derivationFromPath(p.first); rootNr++; @@ -185,8 +186,9 @@ static void opRealise(Strings opFlags, Strings opArgs) { } /* Build all paths at the same time to exploit parallelism. */ - util::OkOrThrow( - store->buildPaths(PathSet(paths.begin(), paths.end()), buildMode)); + auto discard_logs = DiscardLogsSink(); + util::OkOrThrow(store->buildPaths( + discard_logs, PathSet(paths.begin(), paths.end()), buildMode)); if (!ignoreUnknown) { for (auto& i : paths) { @@ -1004,7 +1006,8 @@ static void opServe(Strings opFlags, Strings opArgs) { does one path at a time. */ if (!willSubstitute.empty()) { try { - util::OkOrThrow(store->buildPaths(willSubstitute)); + auto discard_logs = DiscardLogsSink(); + util::OkOrThrow(store->buildPaths(discard_logs, willSubstitute)); } catch (Error& e) { LOG(WARNING) << e.msg(); } @@ -1066,7 +1069,8 @@ static void opServe(Strings opFlags, Strings opArgs) { try { MonitorFdHup monitor(in.fd); - util::OkOrThrow(store->buildPaths(paths)); + auto discard_logs = DiscardLogsSink(); + util::OkOrThrow(store->buildPaths(discard_logs, paths)); out << 0; } catch (Error& e) { assert(e.status); diff --git a/third_party/nix/src/nix/installables.cc b/third_party/nix/src/nix/installables.cc index dd1202586a..b5980ce476 100644 --- a/third_party/nix/src/nix/installables.cc +++ b/third_party/nix/src/nix/installables.cc @@ -274,7 +274,8 @@ Buildables build( if (mode == DryRun) { printMissing(store, pathsToBuild); } else if (mode == Build) { - util::OkOrThrow(store->buildPaths(pathsToBuild)); + auto discard_logs = DiscardLogsSink(); + util::OkOrThrow(store->buildPaths(discard_logs, pathsToBuild)); } return buildables; |