mirror of
https://github.com/NixOS/nix
synced 2025-07-03 02:01:48 +02:00
Make regular copyPaths
only copy again
The is new function parameter so just the build hook can opt into the remote-side building.
This commit is contained in:
parent
5738b08233
commit
141cb9a706
3 changed files with 57 additions and 23 deletions
|
@ -819,8 +819,40 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
|
|||
}
|
||||
|
||||
|
||||
void copyStorePathAdapter(ref<Store> srcStore, ref<Store> dstStore,
|
||||
const ValidPathInfo & info, RepairFlag repair, CheckSigsFlag checkSigs)
|
||||
{
|
||||
copyStorePath(srcStore, dstStore, info.path, repair, checkSigs);
|
||||
}
|
||||
|
||||
void copyOrBuildStorePath(ref<Store> srcStore, ref<Store> dstStore,
|
||||
const ValidPathInfo & info, RepairFlag repair, CheckSigsFlag checkSigs)
|
||||
{
|
||||
auto storePath = info.path;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & storePaths,
|
||||
RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute)
|
||||
RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute,
|
||||
std::function<void(ref<Store>, ref<Store>, const ValidPathInfo &, RepairFlag, CheckSigsFlag)> copyStorePathImpl)
|
||||
{
|
||||
auto valid = dstStore->queryValidPaths(storePaths, substitute);
|
||||
|
||||
|
@ -893,24 +925,7 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor
|
|||
MaintainCount<decltype(nrRunning)> mc(nrRunning);
|
||||
showProgress();
|
||||
try {
|
||||
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);
|
||||
}
|
||||
copyStorePathImpl(srcStore, dstStore, *info, repair, checkSigs);
|
||||
} catch (Error &e) {
|
||||
nrFailed++;
|
||||
if (!settings.keepGoing)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue