Add option ‘build-extra-chroot-dirs’

This is useful for extending (rather than overriding) the default set
of chroot paths.
This commit is contained in:
Eelco Dolstra 2014-08-04 18:00:00 +02:00 committed by Ludovic Courtès
parent 75f746f018
commit f530ee6f35
3 changed files with 7 additions and 9 deletions

View File

@ -1804,12 +1804,15 @@ void DerivationGoal::startBuilder()
/* Bind-mount a user-configurable set of directories from the /* Bind-mount a user-configurable set of directories from the
host file system. */ host file system. */
foreach (StringSet::iterator, i, settings.dirsInChroot) { PathSet dirs = tokenizeString<StringSet>(settings.get(string("build-chroot-dirs"), DEFAULT_CHROOT_DIRS));
size_t p = i->find('='); PathSet dirs2 = tokenizeString<StringSet>(settings.get(string("build-extra-chroot-dirs"), ""));
dirs.insert(dirs2.begin(), dirs2.end());
for (auto & i : dirs) {
size_t p = i.find('=');
if (p == string::npos) if (p == string::npos)
dirsInChroot[*i] = *i; dirsInChroot[i] = i;
else else
dirsInChroot[string(*i, 0, p)] = string(*i, p + 1); dirsInChroot[string(i, 0, p)] = string(i, p + 1);
} }
dirsInChroot[tmpDir] = tmpDir; dirsInChroot[tmpDir] = tmpDir;

View File

@ -131,7 +131,6 @@ void Settings::update()
get(useSubstitutes, "build-use-substitutes"); get(useSubstitutes, "build-use-substitutes");
get(buildUsersGroup, "build-users-group"); get(buildUsersGroup, "build-users-group");
get(useChroot, "build-use-chroot"); get(useChroot, "build-use-chroot");
get(dirsInChroot, "build-chroot-dirs");
get(impersonateLinux26, "build-impersonate-linux-26"); get(impersonateLinux26, "build-impersonate-linux-26");
get(keepLog, "build-keep-log"); get(keepLog, "build-keep-log");
get(compressLog, "build-compress-log"); get(compressLog, "build-compress-log");

View File

@ -142,10 +142,6 @@ struct Settings {
/* Whether to build in chroot. */ /* Whether to build in chroot. */
bool useChroot; bool useChroot;
/* The directories from the host filesystem to be included in the
chroot. */
StringSet dirsInChroot;
/* Set of ssh connection strings for the ssh substituter */ /* Set of ssh connection strings for the ssh substituter */
Strings sshSubstituterHosts; Strings sshSubstituterHosts;