This commit is contained in:
Eelco Dolstra 2020-07-29 00:24:55 +02:00
parent b8eea7e81a
commit c159f48a39

View file

@ -729,9 +729,9 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
{ {
auto valid = dstStore->queryValidPaths(storePaths, substitute); auto valid = dstStore->queryValidPaths(storePaths, substitute);
PathSet missing; StorePathSet missing;
for (auto & path : storePaths) for (auto & path : storePaths)
if (!valid.count(path)) missing.insert(srcStore->printStorePath(path)); if (!valid.count(path)) missing.insert(path);
if (missing.empty()) return; if (missing.empty()) return;
@ -748,29 +748,27 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
ThreadPool pool; ThreadPool pool;
processGraph<Path>(pool, processGraph<StorePath>(pool,
PathSet(missing.begin(), missing.end()), StorePathSet(missing.begin(), missing.end()),
[&](const Path & storePath) { [&](const StorePath & storePath) {
if (dstStore->isValidPath(dstStore->parseStorePath(storePath))) { if (dstStore->isValidPath(storePath)) {
nrDone++; nrDone++;
showProgress(); showProgress();
return PathSet(); return StorePathSet();
} }
auto info = srcStore->queryPathInfo(srcStore->parseStorePath(storePath)); auto info = srcStore->queryPathInfo(storePath);
bytesExpected += info->narSize; bytesExpected += info->narSize;
act.setExpected(actCopyPath, bytesExpected); act.setExpected(actCopyPath, bytesExpected);
return srcStore->printStorePathSet(info->references); return info->references;
}, },
[&](const Path & storePathS) { [&](const StorePath & storePath) {
checkInterrupt(); checkInterrupt();
auto storePath = dstStore->parseStorePath(storePathS);
if (!dstStore->isValidPath(storePath)) { if (!dstStore->isValidPath(storePath)) {
MaintainCount<decltype(nrRunning)> mc(nrRunning); MaintainCount<decltype(nrRunning)> mc(nrRunning);
showProgress(); showProgress();
@ -780,7 +778,7 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
nrFailed++; nrFailed++;
if (!settings.keepGoing) if (!settings.keepGoing)
throw e; throw e;
logger->log(lvlError, fmt("could not copy %s: %s", storePathS, e.what())); logger->log(lvlError, fmt("could not copy %s: %s", dstStore->printStorePath(storePath), e.what()));
showProgress(); showProgress();
return; return;
} }