about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-03-24T10·50+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-03-24T10·52+0100
commitfd89f97be97d4f698efd208140062a3f701ef76e (patch)
tree40bde26dc89c301630721ecec2f934b2677a2536 /src/libstore
parent5ce50cd99e740d0d0f18c30327ae687be9356553 (diff)
Add the closure of store paths to the chroot
Thus, for example, to get /bin/sh in a chroot, you only need to
specify /bin/sh=${pkgs.bash}/bin/sh in build-chroot-dirs. The
dependencies of sh will be added automatically.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 88efb9a65d1a..1c510fa7d514 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1799,6 +1799,14 @@ void DerivationGoal::startBuilder()
         }
         dirsInChroot[tmpDir] = tmpDir;
 
+        /* Add the closure of store paths to the chroot. */
+        PathSet closure;
+        for (auto & i : dirsInChroot)
+            if (isInStore(i.second))
+                computeFSClosure(worker.store, toStorePath(i.second), closure);
+        for (auto & i : closure)
+            dirsInChroot[i] = i;
+
         string allowed = settings.get("allowed-impure-host-deps", string(DEFAULT_ALLOWED_IMPURE_PREFIXES));
         PathSet allowedPaths = tokenizeString<StringSet>(allowed);