mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 23:12:44 +01:00
Make Settings::sandboxPaths well-typed
Parsing logic is moved from `DerivationBuilder`, where is doesn't belong, to `Settings` itself, where it does.
This commit is contained in:
parent
52212635db
commit
a712445a7a
3 changed files with 73 additions and 20 deletions
|
|
@ -857,24 +857,10 @@ void DerivationBuilderImpl::startBuilder()
|
|||
|
||||
PathsInChroot DerivationBuilderImpl::getPathsInSandbox()
|
||||
{
|
||||
PathsInChroot pathsInChroot;
|
||||
|
||||
/* Allow a user-configurable set of directories from the
|
||||
host file system. */
|
||||
for (auto i : settings.sandboxPaths.get()) {
|
||||
if (i.empty())
|
||||
continue;
|
||||
bool optional = false;
|
||||
if (i[i.size() - 1] == '?') {
|
||||
optional = true;
|
||||
i.pop_back();
|
||||
}
|
||||
size_t p = i.find('=');
|
||||
if (p == std::string::npos)
|
||||
pathsInChroot[i] = {.source = i, .optional = optional};
|
||||
else
|
||||
pathsInChroot[i.substr(0, p)] = {.source = i.substr(p + 1), .optional = optional};
|
||||
}
|
||||
PathsInChroot pathsInChroot = settings.sandboxPaths.get();
|
||||
|
||||
if (hasPrefix(store.storeDir, tmpDirInSandbox())) {
|
||||
throw Error("`sandbox-build-dir` must not contain the storeDir");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue