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.cc43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index f470cfd99..5a6fd33d1 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -800,6 +800,36 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
}
+std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStore, const RealisedPath::Set & paths,
+ RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute)
+{
+ StorePathSet storePaths;
+ std::set<Realisation> realisations;
+ for (auto & path : paths) {
+ storePaths.insert(path.path());
+ if (auto realisation = std::get_if<Realisation>(&path.raw)) {
+ settings.requireExperimentalFeature("ca-derivations");
+ realisations.insert(*realisation);
+ }
+ }
+ auto pathsMap = copyPaths(srcStore, dstStore, storePaths, repair, checkSigs, substitute);
+ try {
+ for (auto & realisation : realisations) {
+ dstStore->registerDrvOutput(realisation);
+ }
+ } catch (MissingExperimentalFeature & e) {
+ // Don't fail if the remote doesn't support CA derivations is it might
+ // not be within our control to change that, and we might still want
+ // to at least copy the output paths.
+ if (e.missingFeature == "ca-derivations")
+ ignoreException();
+ else
+ throw;
+ }
+
+ return pathsMap;
+}
+
std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & storePaths,
RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute)
{
@@ -813,7 +843,6 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor
for (auto & path : storePaths)
pathsMap.insert_or_assign(path, path);
- if (missing.empty()) return pathsMap;
Activity act(*logger, lvlInfo, actCopyPaths, fmt("copying %d paths", missing.size()));
@@ -890,21 +919,9 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor
nrDone++;
showProgress();
});
-
return pathsMap;
}
-
-void copyClosure(ref<Store> srcStore, ref<Store> dstStore,
- const StorePathSet & storePaths, RepairFlag repair, CheckSigsFlag checkSigs,
- SubstituteFlag substitute)
-{
- StorePathSet closure;
- srcStore->computeFSClosure(storePaths, closure);
- copyPaths(srcStore, dstStore, closure, repair, checkSigs, substitute);
-}
-
-
std::optional<ValidPathInfo> decodeValidPathInfo(const Store & store, std::istream & str, std::optional<HashResult> hashGiven)
{
std::string path;