From 23b8b7e096d3a2a784387a09f68115706b1e9552 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 16 Aug 2017 17:00:24 +0200 Subject: nix optimise-store: Add This replaces "nix-store --optimise". Main difference is that it has a progress indicator. --- src/libstore/optimise-store.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index b736307b3..5093305a1 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -249,14 +249,24 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa void LocalStore::optimiseStore(OptimiseStats & stats) { + Activity act(*logger, actOptimiseStore); + PathSet paths = queryAllValidPaths(); InodeHash inodeHash = loadInodeHash(); + act.progress(0, paths.size()); + + uint64_t done = 0; + for (auto & i : paths) { addTempRoot(i); if (!isValidPath(i)) continue; /* path was GC'ed, probably */ - //Activity act(*logger, lvlChatty, format("hashing files in '%1%'") % i); - optimisePath_(stats, realStoreDir + "/" + baseNameOf(i), inodeHash); + { + Activity act(*logger, actUnknown, fmt("optimising path '%s'", i)); + optimisePath_(stats, realStoreDir + "/" + baseNameOf(i), inodeHash); + } + done++; + act.progress(done, paths.size()); } } -- cgit v1.2.3