diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-02-27 05:46:59 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-02-27 05:46:59 +0000 |
commit | 7863036634ccb07e1933cd0b106fc27d5c073004 (patch) | |
tree | 36bf7f334b739269eb741813a68adde714f67293 /src/libstore/store-api.cc | |
parent | 90d76fa399de4e207ea14ec4c0dd65434f60c152 (diff) | |
parent | f0ad29acc1f2c9e82679c3af434a8bf185f36b94 (diff) |
Merge remote-tracking branch 'obsidian/path-info' into ca-drv-exotic
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 43 |
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; |