mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
Progress indicator: Unify "copying" and "substituting"
They're the same thing after all. Example: $ nix build --store local?root=/tmp/nix nixpkgs.firefox-unwrapped [0/1 built, 49/98 copied, 16.3/92.8 MiB DL, 55.8/309.2 MiB copied] downloading 'https://cache.nixos.org/nar/0pl9li1jigcj2dany47hpmn0r3r48wc4nz48v5mqhh426lgz3bz6.nar.xz'
This commit is contained in:
parent
c36467ad2e
commit
0e0dcf2c7e
4 changed files with 24 additions and 87 deletions
|
@ -621,16 +621,13 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const PathSet & storePa
|
|||
for (auto & path : storePaths)
|
||||
if (!valid.count(path)) missing.insert(path);
|
||||
|
||||
Activity act(actUnknown);
|
||||
Activity act(actCopyPaths, fmt("copying %d paths", missing.size()));
|
||||
|
||||
logger->event(evCopyStarted, act);
|
||||
|
||||
std::atomic<size_t> nrCopied{0};
|
||||
std::atomic<size_t> nrDone{storePaths.size() - missing.size()};
|
||||
std::atomic<size_t> nrDone{0};
|
||||
std::atomic<uint64_t> bytesExpected{0};
|
||||
|
||||
auto showProgress = [&]() {
|
||||
logger->event(evCopyProgress, act, storePaths.size(), nrCopied, nrDone);
|
||||
act.progress(nrDone, missing.size());
|
||||
};
|
||||
|
||||
ThreadPool pool;
|
||||
|
@ -659,11 +656,9 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const PathSet & storePa
|
|||
if (!dstStore->isValidPath(storePath)) {
|
||||
printInfo("copying '%s'...", storePath);
|
||||
copyStorePath(srcStore, dstStore, storePath, repair, checkSigs);
|
||||
nrCopied++;
|
||||
}
|
||||
|
||||
nrDone++;
|
||||
|
||||
showProgress();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue