forked from lix-project/lix
Make copyPaths
copy the whole realisations closure
Otherwise registering the realisations on the remote side might fail as it now expects a complete closure
This commit is contained in:
parent
8c30acc3e8
commit
63ebfc73c5
1 changed files with 26 additions and 6 deletions
|
@ -780,19 +780,39 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor
|
||||||
RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute)
|
RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute)
|
||||||
{
|
{
|
||||||
StorePathSet storePaths;
|
StorePathSet storePaths;
|
||||||
std::set<Realisation> realisations;
|
std::set<Realisation> toplevelRealisations;
|
||||||
for (auto & path : paths) {
|
for (auto & path : paths) {
|
||||||
storePaths.insert(path.path());
|
storePaths.insert(path.path());
|
||||||
if (auto realisation = std::get_if<Realisation>(&path.raw)) {
|
if (auto realisation = std::get_if<Realisation>(&path.raw)) {
|
||||||
settings.requireExperimentalFeature("ca-derivations");
|
settings.requireExperimentalFeature("ca-derivations");
|
||||||
realisations.insert(*realisation);
|
toplevelRealisations.insert(*realisation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto pathsMap = copyPaths(srcStore, dstStore, storePaths, repair, checkSigs, substitute);
|
auto pathsMap = copyPaths(srcStore, dstStore, storePaths, repair, checkSigs, substitute);
|
||||||
|
|
||||||
|
ThreadPool pool;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (auto & realisation : realisations) {
|
// Copy the realisation closure
|
||||||
dstStore->registerDrvOutput(realisation, checkSigs);
|
processGraph<Realisation>(
|
||||||
|
pool, Realisation::closure(*srcStore, toplevelRealisations),
|
||||||
|
[&](const Realisation& current) -> std::set<Realisation> {
|
||||||
|
std::set<Realisation> children;
|
||||||
|
for (const auto& drvOutput : current.drvOutputDeps) {
|
||||||
|
auto currentChild = srcStore->queryRealisation(drvOutput);
|
||||||
|
if (!currentChild)
|
||||||
|
throw Error(
|
||||||
|
"Incomplete realisation closure: '%s' is a "
|
||||||
|
"dependency "
|
||||||
|
"of '%s' but isn’t registered",
|
||||||
|
drvOutput.to_string(), current.id.to_string());
|
||||||
|
children.insert(*currentChild);
|
||||||
}
|
}
|
||||||
|
return children;
|
||||||
|
},
|
||||||
|
[&](const Realisation& current) -> void {
|
||||||
|
dstStore->registerDrvOutput(current, checkSigs);
|
||||||
|
});
|
||||||
} catch (MissingExperimentalFeature& e) {
|
} catch (MissingExperimentalFeature& e) {
|
||||||
// Don't fail if the remote doesn't support CA derivations is it might
|
// 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
|
// not be within our control to change that, and we might still want
|
||||||
|
|
Loading…
Reference in a new issue