forked from lix-project/lix
simplify build.cc using modern C++ features
This commit is contained in:
parent
4876bb012e
commit
bd09a4c967
|
@ -1921,7 +1921,9 @@ void DerivationGoal::startBuilder()
|
||||||
for (auto & i : closure)
|
for (auto & i : closure)
|
||||||
dirsInChroot[i] = i;
|
dirsInChroot[i] = i;
|
||||||
|
|
||||||
if(!SANDBOX_ENABLED) {
|
#if SANDBOX_ENABLED
|
||||||
|
additionalSandboxProfile = get(drv->env, "__sandboxProfile");
|
||||||
|
#else
|
||||||
string allowed = settings.get("allowed-impure-host-deps", string(DEFAULT_ALLOWED_IMPURE_PREFIXES));
|
string allowed = settings.get("allowed-impure-host-deps", string(DEFAULT_ALLOWED_IMPURE_PREFIXES));
|
||||||
PathSet allowedPaths = tokenizeString<StringSet>(allowed);
|
PathSet allowedPaths = tokenizeString<StringSet>(allowed);
|
||||||
|
|
||||||
|
@ -1947,9 +1949,7 @@ void DerivationGoal::startBuilder()
|
||||||
|
|
||||||
dirsInChroot[i] = i;
|
dirsInChroot[i] = i;
|
||||||
}
|
}
|
||||||
} else {
|
#endif
|
||||||
additionalSandboxProfile = get(drv->env, "__sandboxProfile");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CHROOT_ENABLED
|
#if CHROOT_ENABLED
|
||||||
/* Create a temporary directory in which we set up the chroot
|
/* Create a temporary directory in which we set up the chroot
|
||||||
|
@ -2527,17 +2527,15 @@ void DerivationGoal::runChild()
|
||||||
debug("Generated sandbox profile:");
|
debug("Generated sandbox profile:");
|
||||||
debug(sandboxProfile);
|
debug(sandboxProfile);
|
||||||
|
|
||||||
char *tmpProfile = strdup((format("%1%/nix-sandboxXXXXXX.sb") % globalTmpDir).str().c_str());
|
Path tmpProfile = createTempDir() + "/profile.sb";
|
||||||
int profileFd = mkstemps(tmpProfile, 3);
|
writeFile(tmpProfile, sandboxProfile);
|
||||||
closeOnExec(profileFd);
|
|
||||||
writeFull(profileFd, sandboxProfile);
|
|
||||||
|
|
||||||
builder = "/usr/bin/sandbox-exec";
|
builder = "/usr/bin/sandbox-exec";
|
||||||
args.push_back("sandbox-exec");
|
args.push_back("sandbox-exec");
|
||||||
args.push_back("-f");
|
args.push_back("-f");
|
||||||
args.push_back(tmpProfile);
|
args.push_back(tmpProfile);
|
||||||
args.push_back("-D");
|
args.push_back("-D");
|
||||||
args.push_back((format("_GLOBAL_TMP_DIR=%1%") % globalTmpDir).str());
|
args.push_back("_GLOBAL_TMP_DIR=" + globalTmpDir);
|
||||||
args.push_back(drv->builder);
|
args.push_back(drv->builder);
|
||||||
} else {
|
} else {
|
||||||
builder = drv->builder.c_str();
|
builder = drv->builder.c_str();
|
||||||
|
|
Loading…
Reference in a new issue