forked from lix-project/lix
Display progress when running copyPaths (nix copy)
`nix copy` operations did not show progress. This is quite confusing. Add a `progressSink` which displays the progress during `copyPaths`, pretty much copied from `copyStorePath`. Fixes https://github.com/NixOS/nix/issues/8000
This commit is contained in:
parent
8730d3002f
commit
4bef2016a1
|
@ -1101,6 +1101,8 @@ std::map<StorePath, StorePath> copyPaths(
|
||||||
return storePathForDst;
|
return storePathForDst;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint64_t total = 0;
|
||||||
|
|
||||||
for (auto & missingPath : sortedMissing) {
|
for (auto & missingPath : sortedMissing) {
|
||||||
auto info = srcStore.queryPathInfo(missingPath);
|
auto info = srcStore.queryPathInfo(missingPath);
|
||||||
|
|
||||||
|
@ -1121,7 +1123,13 @@ std::map<StorePath, StorePath> copyPaths(
|
||||||
{storePathS, srcUri, dstUri});
|
{storePathS, srcUri, dstUri});
|
||||||
PushActivity pact(act.id);
|
PushActivity pact(act.id);
|
||||||
|
|
||||||
srcStore.narFromPath(missingPath, sink);
|
LambdaSink progressSink([&](std::string_view data) {
|
||||||
|
total += data.size();
|
||||||
|
act.progress(total, info->narSize);
|
||||||
|
});
|
||||||
|
TeeSink tee { sink, progressSink };
|
||||||
|
|
||||||
|
srcStore.narFromPath(missingPath, tee);
|
||||||
});
|
});
|
||||||
pathsToCopy.push_back(std::pair{infoForDst, std::move(source)});
|
pathsToCopy.push_back(std::pair{infoForDst, std::move(source)});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue