mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
DerivationBuilder no more callback soup for logging
`startBuilder` just returns the descriptor for the pipe now.
This commit is contained in:
parent
7f3314a68c
commit
14c206f05a
3 changed files with 11 additions and 17 deletions
|
|
@ -716,11 +716,6 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
|
||||
~DerivationBuildingGoalCallbacks() override = default;
|
||||
|
||||
void childStarted(Descriptor builderOut) override
|
||||
{
|
||||
goal.worker.childStarted(goal.shared_from_this(), {builderOut}, true, true);
|
||||
}
|
||||
|
||||
void childTerminated() override
|
||||
{
|
||||
goal.worker.childTerminated(&goal);
|
||||
|
|
@ -802,10 +797,11 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
|
||||
actLock.reset();
|
||||
|
||||
Descriptor builderOut;
|
||||
try {
|
||||
|
||||
/* Okay, we have to build. */
|
||||
builder->startBuilder();
|
||||
builderOut = builder->startBuilder();
|
||||
|
||||
} catch (BuildError & e) {
|
||||
builder.reset();
|
||||
|
|
@ -814,6 +810,8 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
co_return doneFailure(std::move(e)); // InputRejected
|
||||
}
|
||||
|
||||
worker.childStarted(shared_from_this(), {builderOut}, true, true);
|
||||
|
||||
started();
|
||||
co_await Suspend{};
|
||||
|
||||
|
|
|
|||
|
|
@ -114,13 +114,6 @@ struct DerivationBuilderCallbacks
|
|||
*/
|
||||
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
|
||||
*/
|
||||
|
|
@ -161,8 +154,10 @@ struct DerivationBuilder : RestrictionContext
|
|||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ public:
|
|||
|
||||
bool prepareBuild() override;
|
||||
|
||||
void startBuilder() override;
|
||||
Descriptor startBuilder() override;
|
||||
|
||||
SingleDrvOutputs unprepareBuild() override;
|
||||
|
||||
|
|
@ -679,7 +679,7 @@ static bool checkNotWorldWritable(std::filesystem::path path)
|
|||
return true;
|
||||
}
|
||||
|
||||
void DerivationBuilderImpl::startBuilder()
|
||||
Descriptor DerivationBuilderImpl::startBuilder()
|
||||
{
|
||||
/* Make sure that no other processes are executing under the
|
||||
sandbox uids. This must be done before any chownToBuilder()
|
||||
|
|
@ -841,9 +841,10 @@ void DerivationBuilderImpl::startBuilder()
|
|||
startChild();
|
||||
|
||||
pid.setSeparatePG(true);
|
||||
miscMethods->childStarted(builderOut.get());
|
||||
|
||||
processSandboxSetupMessages();
|
||||
|
||||
return builderOut.get();
|
||||
}
|
||||
|
||||
PathsInChroot DerivationBuilderImpl::getPathsInSandbox()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue