Skip to content

Commit b509502

Browse files
authored
Merge pull request #12663 from obsidiansystems/local-derivation-goal-encapsulation
Separate derivation building from the scheduler
2 parents 89ba6df + d98c0db commit b509502

File tree

3 files changed

+472
-207
lines changed

3 files changed

+472
-207
lines changed

src/libstore/build/derivation-goal.cc

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,17 @@
55
#include "nix/util/processes.hh"
66
#include "nix/util/config-global.hh"
77
#include "nix/store/build/worker.hh"
8-
#include "nix/store/builtins.hh"
9-
#include "nix/store/builtins/buildenv.hh"
10-
#include "nix/util/references.hh"
11-
#include "nix/util/finally.hh"
128
#include "nix/util/util.hh"
13-
#include "nix/util/archive.hh"
149
#include "nix/util/compression.hh"
1510
#include "nix/store/common-protocol.hh"
1611
#include "nix/store/common-protocol-impl.hh"
17-
#include "nix/util/topo-sort.hh"
18-
#include "nix/util/callback.hh"
1912
#include "nix/store/local-store.hh" // TODO remove, along with remaining downcasts
2013

21-
#include <regex>
22-
#include <queue>
23-
2414
#include <fstream>
2515
#include <sys/types.h>
2616
#include <fcntl.h>
2717
#include <unistd.h>
2818

29-
#ifndef _WIN32 // TODO abstract over proc exit status
30-
# include <sys/wait.h>
31-
#endif
32-
3319
#include <nlohmann/json.hpp>
3420

3521
#include "nix/util/strings.hh"
@@ -879,11 +865,7 @@ void runPostBuildHook(
879865
}
880866

881867

882-
void appendLogTailErrorMsg(
883-
const Store & store,
884-
const StorePath & drvPath,
885-
const std::list<std::string> & logTail,
886-
std::string & msg)
868+
void DerivationGoal::appendLogTailErrorMsg(std::string & msg)
887869
{
888870
if (!logger->isVerbose() && !logTail.empty()) {
889871
msg += fmt(";\nlast %d log lines:\n", logTail.size());
@@ -900,7 +882,7 @@ void appendLogTailErrorMsg(
900882
// command will not put it at the start of the line unfortunately.
901883
msg += fmt("For full logs, run:\n " ANSI_BOLD "%s %s" ANSI_NORMAL,
902884
nixLogCommand,
903-
store.printStorePath(drvPath));
885+
worker.store.printStorePath(drvPath));
904886
}
905887
}
906888

@@ -947,7 +929,7 @@ Goal::Co DerivationGoal::hookDone()
947929
Magenta(worker.store.printStorePath(drvPath)),
948930
statusToString(status));
949931

950-
appendLogTailErrorMsg(worker.store, drvPath, logTail, msg);
932+
appendLogTailErrorMsg(msg);
951933

952934
outputLocks.unlock();
953935

src/libstore/include/nix/store/build/derivation-goal.hh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ void runPostBuildHook(
6363
const StorePath & drvPath,
6464
const StorePathSet & outputPaths);
6565

66-
/** Used internally */
67-
void appendLogTailErrorMsg(
68-
const Store & store,
69-
const StorePath & drvPath,
70-
const std::list<std::string> & logTail,
71-
std::string & msg);
72-
7366
/**
7467
* A goal for building some or all of the outputs of a derivation.
7568
*/
@@ -306,6 +299,8 @@ struct DerivationGoal : public Goal
306299
SingleDrvOutputs builtOutputs = {},
307300
std::optional<Error> ex = {});
308301

302+
void appendLogTailErrorMsg(std::string & msg);
303+
309304
StorePathSet exportReferences(const StorePathSet & storePaths);
310305

311306
JobCategory jobCategory() const override {

0 commit comments

Comments
 (0)