mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 21:16:02 +01:00
Merge remote-tracking branch 'detsys/external-builder-under-build-user' into refactor-derivation-builder
This commit is contained in:
commit
e290b52613
1 changed files with 14 additions and 4 deletions
|
|
@ -29,9 +29,7 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
|
|||
|
||||
bool prepareBuild() override
|
||||
{
|
||||
// External builds don't use build users, so this always
|
||||
// succeeds.
|
||||
return true;
|
||||
return DerivationBuilderImpl::prepareBuild();
|
||||
}
|
||||
|
||||
Path tmpDirInSandbox() override
|
||||
|
|
@ -49,7 +47,12 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
|
|||
|
||||
void prepareUser() override
|
||||
{
|
||||
// Nothing to do here since we don't have a build user.
|
||||
DerivationBuilderImpl::prepareUser();
|
||||
}
|
||||
|
||||
void setUser() override
|
||||
{
|
||||
DerivationBuilderImpl::setUser();
|
||||
}
|
||||
|
||||
void checkSystem() override
|
||||
|
|
@ -103,6 +106,13 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
|
|||
|
||||
args.insert(args.end(), jsonFile);
|
||||
|
||||
if (chdir(tmpDir.c_str()) == -1)
|
||||
throw SysError("changing into '%1%'", tmpDir);
|
||||
|
||||
chownToBuilder(topTmpDir);
|
||||
|
||||
setUser();
|
||||
|
||||
debug("executing external builder: %s", concatStringsSep(" ", args));
|
||||
execv(externalBuilder.program.c_str(), stringsToCharPtrs(args).data());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue