1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

Make appendLogTailErrorMsg as class method after all

The other parameters it took were somewhat implementation-specific.
This commit is contained in:
John Ericson 2025-03-16 16:48:41 -04:00
parent 89ba6dff66
commit e83ef7a477
3 changed files with 6 additions and 15 deletions

View file

@ -879,11 +879,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 +896,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 +943,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();

View file

@ -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 {

View file

@ -623,7 +623,7 @@ Goal::Co LocalDerivationGoal::tryLocalBuild()
Magenta(worker.store.printStorePath(drvPath)), Magenta(worker.store.printStorePath(drvPath)),
statusToString(status)); statusToString(status));
appendLogTailErrorMsg(worker.store, drvPath, logTail, msg); appendLogTailErrorMsg(msg);
if (diskFull) if (diskFull)
msg += "\nnote: build failure may have been caused by lack of free disk space"; msg += "\nnote: build failure may have been caused by lack of free disk space";