aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-14 22:12:36 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-16 20:56:03 +0200
commit0e0dcf2c7ec054f1b30629e275f53f56039b8257 (patch)
tree10dc034fe2ff6a5860f74eae3b22673e08d1191e /src/libstore/store-api.cc
parentc36467ad2e2e27d04e681144e0e10417c53c10c1 (diff)
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'
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 2b99a07e2..1e11e54eb 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -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();
});
}