mirror of
https://github.com/NixOS/nix.git
synced 2024-11-24 15:52:30 +00:00
local-derivation-goal: Move builder preparation to non-builtin code path
This commit is contained in:
parent
74b93c1edb
commit
c8de35f74c
@ -2017,11 +2017,6 @@ void LocalDerivationGoal::runChild()
|
|||||||
throw SysError("setuid failed");
|
throw SysError("setuid failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the arguments. */
|
|
||||||
Strings args;
|
|
||||||
|
|
||||||
std::string builder = "invalid";
|
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
/* This has to appear before import statements. */
|
/* This has to appear before import statements. */
|
||||||
std::string sandboxProfile = "(version 1)\n";
|
std::string sandboxProfile = "(version 1)\n";
|
||||||
@ -2145,14 +2140,6 @@ void LocalDerivationGoal::runChild()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!drv->isBuiltin()) {
|
|
||||||
builder = drv->builder;
|
|
||||||
args.push_back(std::string(baseNameOf(drv->builder)));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto & i : drv->args)
|
|
||||||
args.push_back(rewriteStrings(i, inputRewrites));
|
|
||||||
|
|
||||||
/* Indicate that we managed to set up the build environment. */
|
/* Indicate that we managed to set up the build environment. */
|
||||||
writeFull(STDERR_FILENO, std::string("\2\n"));
|
writeFull(STDERR_FILENO, std::string("\2\n"));
|
||||||
|
|
||||||
@ -2183,6 +2170,14 @@ void LocalDerivationGoal::runChild()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now builder is not builtin
|
||||||
|
|
||||||
|
Strings args;
|
||||||
|
args.push_back(std::string(baseNameOf(drv->builder)));
|
||||||
|
|
||||||
|
for (auto & i : drv->args)
|
||||||
|
args.push_back(rewriteStrings(i, inputRewrites));
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
posix_spawnattr_t attrp;
|
posix_spawnattr_t attrp;
|
||||||
|
|
||||||
@ -2204,9 +2199,9 @@ void LocalDerivationGoal::runChild()
|
|||||||
posix_spawnattr_setbinpref_np(&attrp, 1, &cpu, NULL);
|
posix_spawnattr_setbinpref_np(&attrp, 1, &cpu, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
posix_spawn(NULL, builder.c_str(), NULL, &attrp, stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
posix_spawn(NULL, drv->builder.c_str(), NULL, &attrp, stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
||||||
#else
|
#else
|
||||||
execve(builder.c_str(), stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
execve(drv->builder.c_str(), stringsToCharPtrs(args).data(), stringsToCharPtrs(envStrs).data());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
throw SysError("executing '%1%'", drv->builder);
|
throw SysError("executing '%1%'", drv->builder);
|
||||||
|
Loading…
Reference in New Issue
Block a user