1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

DerivationBuilder no more callback soup for logging

`startBuilder` just returns the descriptor for the pipe now.
This commit is contained in:
John Ericson 2025-09-03 17:33:48 -04:00
parent 7f3314a68c
commit 14c206f05a
3 changed files with 11 additions and 17 deletions

View file

@ -716,11 +716,6 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
~DerivationBuildingGoalCallbacks() override = default; ~DerivationBuildingGoalCallbacks() override = default;
void childStarted(Descriptor builderOut) override
{
goal.worker.childStarted(goal.shared_from_this(), {builderOut}, true, true);
}
void childTerminated() override void childTerminated() override
{ {
goal.worker.childTerminated(&goal); goal.worker.childTerminated(&goal);
@ -802,10 +797,11 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
actLock.reset(); actLock.reset();
Descriptor builderOut;
try { try {
/* Okay, we have to build. */ /* Okay, we have to build. */
builder->startBuilder(); builderOut = builder->startBuilder();
} catch (BuildError & e) { } catch (BuildError & e) {
builder.reset(); builder.reset();
@ -814,6 +810,8 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
co_return doneFailure(std::move(e)); // InputRejected co_return doneFailure(std::move(e)); // InputRejected
} }
worker.childStarted(shared_from_this(), {builderOut}, true, true);
started(); started();
co_await Suspend{}; co_await Suspend{};

View file

@ -114,13 +114,6 @@ struct DerivationBuilderCallbacks
*/ */
virtual void closeLogFile() = 0; virtual void closeLogFile() = 0;
/**
* Hook up `builderOut` to some mechanism to ingest the log
*
* @todo this should be reworked
*/
virtual void childStarted(Descriptor builderOut) = 0;
/** /**
* @todo this should be reworked * @todo this should be reworked
*/ */
@ -161,8 +154,10 @@ struct DerivationBuilder : RestrictionContext
/** /**
* Start building a derivation. * Start building a derivation.
*
* @return logging pipe
*/ */
virtual void startBuilder() = 0; virtual Descriptor startBuilder() = 0;
/** /**
* Tear down build environment after the builder exits (either on * Tear down build environment after the builder exits (either on

View file

@ -216,7 +216,7 @@ public:
bool prepareBuild() override; bool prepareBuild() override;
void startBuilder() override; Descriptor startBuilder() override;
SingleDrvOutputs unprepareBuild() override; SingleDrvOutputs unprepareBuild() override;
@ -679,7 +679,7 @@ static bool checkNotWorldWritable(std::filesystem::path path)
return true; return true;
} }
void DerivationBuilderImpl::startBuilder() Descriptor DerivationBuilderImpl::startBuilder()
{ {
/* Make sure that no other processes are executing under the /* Make sure that no other processes are executing under the
sandbox uids. This must be done before any chownToBuilder() sandbox uids. This must be done before any chownToBuilder()
@ -841,9 +841,10 @@ void DerivationBuilderImpl::startBuilder()
startChild(); startChild();
pid.setSeparatePG(true); pid.setSeparatePG(true);
miscMethods->childStarted(builderOut.get());
processSandboxSetupMessages(); processSandboxSetupMessages();
return builderOut.get();
} }
PathsInChroot DerivationBuilderImpl::getPathsInSandbox() PathsInChroot DerivationBuilderImpl::getPathsInSandbox()