about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-05-15T13·38+0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-24T19·59+0200
commitb43e1e186e50bedc30d05d063dffbd751c1ff161 (patch)
treed8644d609a117d659ee58baa3580c8b0a5e8d396 /src/libstore
parentdc29e9fb47f9f98a851dc88b2bd3cae4b5c1fe6b (diff)
CachedDownloadResult: Include store path
Also, make fetchGit and fetchMercurial update allowedPaths properly.

(Maybe the evaluator, rather than the caller of the evaluator, should
apply toRealPath(), but that's a bigger change.)

(cherry picked from commit 5c34d665386f4053d666b0899ecca0639e500fbd)
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/download.cc2
-rw-r--r--src/libstore/download.hh3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index cb77cdc77df6..975cfd97d303 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -804,6 +804,7 @@ CachedDownloadResult Downloader::downloadCached(ref<Store> store, const string &
         expectedStorePath = store->makeFixedOutputPath(unpack, expectedHash, name);
         if (store->isValidPath(expectedStorePath)) {
             CachedDownloadResult result;
+            result.storePath = expectedStorePath;
             result.path = store->toRealPath(expectedStorePath);
             return result;
         }
@@ -912,6 +913,7 @@ CachedDownloadResult Downloader::downloadCached(ref<Store> store, const string &
             url, expectedHash.to_string(), gotHash.to_string());
     }
 
+    result.storePath = storePath;
     result.path = store->toRealPath(storePath);
     return result;
 }
diff --git a/src/libstore/download.hh b/src/libstore/download.hh
index 8acfe4e1a39c..aa8c34be2d61 100644
--- a/src/libstore/download.hh
+++ b/src/libstore/download.hh
@@ -43,6 +43,9 @@ struct DownloadResult
 
 struct CachedDownloadResult
 {
+    // Note: 'storePath' may be different from 'path' when using a
+    // chroot store.
+    Path storePath;
     Path path;
     std::optional<std::string> etag;
 };