mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Merge pull request #12663 from obsidiansystems/local-derivation-goal-encapsulation
Separate derivation building from the scheduler
This commit is contained in:
commit
b509502bd5
3 changed files with 472 additions and 207 deletions
|
@ -5,31 +5,17 @@
|
||||||
#include "nix/util/processes.hh"
|
#include "nix/util/processes.hh"
|
||||||
#include "nix/util/config-global.hh"
|
#include "nix/util/config-global.hh"
|
||||||
#include "nix/store/build/worker.hh"
|
#include "nix/store/build/worker.hh"
|
||||||
#include "nix/store/builtins.hh"
|
|
||||||
#include "nix/store/builtins/buildenv.hh"
|
|
||||||
#include "nix/util/references.hh"
|
|
||||||
#include "nix/util/finally.hh"
|
|
||||||
#include "nix/util/util.hh"
|
#include "nix/util/util.hh"
|
||||||
#include "nix/util/archive.hh"
|
|
||||||
#include "nix/util/compression.hh"
|
#include "nix/util/compression.hh"
|
||||||
#include "nix/store/common-protocol.hh"
|
#include "nix/store/common-protocol.hh"
|
||||||
#include "nix/store/common-protocol-impl.hh"
|
#include "nix/store/common-protocol-impl.hh"
|
||||||
#include "nix/util/topo-sort.hh"
|
|
||||||
#include "nix/util/callback.hh"
|
|
||||||
#include "nix/store/local-store.hh" // TODO remove, along with remaining downcasts
|
#include "nix/store/local-store.hh" // TODO remove, along with remaining downcasts
|
||||||
|
|
||||||
#include <regex>
|
|
||||||
#include <queue>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef _WIN32 // TODO abstract over proc exit status
|
|
||||||
# include <sys/wait.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include "nix/util/strings.hh"
|
#include "nix/util/strings.hh"
|
||||||
|
@ -879,11 +865,7 @@ void runPostBuildHook(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appendLogTailErrorMsg(
|
void DerivationGoal::appendLogTailErrorMsg(std::string & msg)
|
||||||
const Store & store,
|
|
||||||
const StorePath & drvPath,
|
|
||||||
const std::list<std::string> & logTail,
|
|
||||||
std::string & msg)
|
|
||||||
{
|
{
|
||||||
if (!logger->isVerbose() && !logTail.empty()) {
|
if (!logger->isVerbose() && !logTail.empty()) {
|
||||||
msg += fmt(";\nlast %d log lines:\n", logTail.size());
|
msg += fmt(";\nlast %d log lines:\n", logTail.size());
|
||||||
|
@ -900,7 +882,7 @@ void appendLogTailErrorMsg(
|
||||||
// command will not put it at the start of the line unfortunately.
|
// command will not put it at the start of the line unfortunately.
|
||||||
msg += fmt("For full logs, run:\n " ANSI_BOLD "%s %s" ANSI_NORMAL,
|
msg += fmt("For full logs, run:\n " ANSI_BOLD "%s %s" ANSI_NORMAL,
|
||||||
nixLogCommand,
|
nixLogCommand,
|
||||||
store.printStorePath(drvPath));
|
worker.store.printStorePath(drvPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,7 +929,7 @@ Goal::Co DerivationGoal::hookDone()
|
||||||
Magenta(worker.store.printStorePath(drvPath)),
|
Magenta(worker.store.printStorePath(drvPath)),
|
||||||
statusToString(status));
|
statusToString(status));
|
||||||
|
|
||||||
appendLogTailErrorMsg(worker.store, drvPath, logTail, msg);
|
appendLogTailErrorMsg(msg);
|
||||||
|
|
||||||
outputLocks.unlock();
|
outputLocks.unlock();
|
||||||
|
|
||||||
|
|
|
@ -63,13 +63,6 @@ void runPostBuildHook(
|
||||||
const StorePath & drvPath,
|
const StorePath & drvPath,
|
||||||
const StorePathSet & outputPaths);
|
const StorePathSet & outputPaths);
|
||||||
|
|
||||||
/** Used internally */
|
|
||||||
void appendLogTailErrorMsg(
|
|
||||||
const Store & store,
|
|
||||||
const StorePath & drvPath,
|
|
||||||
const std::list<std::string> & logTail,
|
|
||||||
std::string & msg);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A goal for building some or all of the outputs of a derivation.
|
* A goal for building some or all of the outputs of a derivation.
|
||||||
*/
|
*/
|
||||||
|
@ -306,6 +299,8 @@ struct DerivationGoal : public Goal
|
||||||
SingleDrvOutputs builtOutputs = {},
|
SingleDrvOutputs builtOutputs = {},
|
||||||
std::optional<Error> ex = {});
|
std::optional<Error> ex = {});
|
||||||
|
|
||||||
|
void appendLogTailErrorMsg(std::string & msg);
|
||||||
|
|
||||||
StorePathSet exportReferences(const StorePathSet & storePaths);
|
StorePathSet exportReferences(const StorePathSet & storePaths);
|
||||||
|
|
||||||
JobCategory jobCategory() const override {
|
JobCategory jobCategory() const override {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue