aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 2cd39ab11..9d10ae76f 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -893,7 +893,24 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor
MaintainCount<decltype(nrRunning)> mc(nrRunning);
showProgress();
try {
- copyStorePath(srcStore, dstStore, storePath, repair, checkSigs);
+ if (dstStore->isTrusting || info->ca) {
+ copyStorePath(srcStore, dstStore, storePath, repair, checkSigs);
+ } else if (info->deriver && dstStore->storeDir == srcStore->storeDir) {
+ auto drvPath = *info->deriver;
+ auto outputMap = srcStore->queryDerivationOutputMap(drvPath);
+ auto p = std::find_if(outputMap.begin(), outputMap.end(), [&](auto & i) {
+ return i.second == storePath;
+ });
+ // drv file is always CA
+ srcStore->ensurePath(drvPath);
+ copyStorePath(srcStore, dstStore, drvPath, repair, checkSigs);
+ dstStore->buildPaths({{
+ drvPath,
+ p != outputMap.end() ? StringSet { p->first } : StringSet {},
+ }});
+ } else {
+ dstStore->ensurePath(storePath);
+ }
} catch (Error &e) {
nrFailed++;
if (!settings.keepGoing)