From 5d534dc30f607e619d1b884c74aefa5ff6a14820 Mon Sep 17 00:00:00 2001 From: John Rinehart Date: Tue, 5 Mar 2024 15:06:01 -0800 Subject: [PATCH 1/3] feat: show status bar with 'store copy-sigs' --- src/nix/sigs.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/nix/sigs.cc b/src/nix/sigs.cc index 39555c9ea..8d8688a75 100644 --- a/src/nix/sigs.cc +++ b/src/nix/sigs.cc @@ -41,14 +41,14 @@ struct CmdCopySigs : StorePathsCommand ThreadPool pool; - std::string doneLabel = "done"; std::atomic added{0}; - //logger->setExpected(doneLabel, storePaths.size()); + Activity act(*logger, lvlInfo, actCopyPaths, "copying signatures"); + act.setExpected(actCopyPaths, storePaths.size()); + + std::atomic_uint64_t counter; auto doPath = [&](const Path & storePathS) { - //Activity act(*logger, lvlInfo, "getting signatures for '%s'", storePath); - checkInterrupt(); auto storePath = store->parseStorePath(storePathS); @@ -72,15 +72,17 @@ struct CmdCopySigs : StorePathsCommand if (!info->sigs.count(sig)) newSigs.insert(sig); } catch (InvalidPath &) { + printError("path %s was invalid in substituter %s", storePath.to_string(), store2->getUri()); } } if (!newSigs.empty()) { + debug("adding %d signatures to store for %s", newSigs.size(), storePathS); store->addSignatures(storePath, newSigs); added += newSigs.size(); } - //logger->incProgress(doneLabel); + act.progress(counter++); }; for (auto & storePath : storePaths) From 9b40a46abeb69fc2d979c07cc7c712e488b2a519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophane=20Hufschmitt?= <7226587+thufschmitt@users.noreply.github.com> Date: Wed, 6 Mar 2024 06:56:03 +0100 Subject: [PATCH 2/3] Explicitly instantiate the progress-bar counter in copy-sigs --- src/nix/sigs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nix/sigs.cc b/src/nix/sigs.cc index 8d8688a75..6cdbfddca 100644 --- a/src/nix/sigs.cc +++ b/src/nix/sigs.cc @@ -46,7 +46,7 @@ struct CmdCopySigs : StorePathsCommand Activity act(*logger, lvlInfo, actCopyPaths, "copying signatures"); act.setExpected(actCopyPaths, storePaths.size()); - std::atomic_uint64_t counter; + std::atomic_uint64_t counter = 0; auto doPath = [&](const Path & storePathS) { checkInterrupt(); From e77d3b805eef59f64984b08f352316da40f2b5fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophane=20Hufschmitt?= <7226587+thufschmitt@users.noreply.github.com> Date: Wed, 6 Mar 2024 06:56:31 +0100 Subject: [PATCH 3/3] Don't print too loudly if a substituter is missing a path when copying signatures --- src/nix/sigs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nix/sigs.cc b/src/nix/sigs.cc index 6cdbfddca..1756a2c71 100644 --- a/src/nix/sigs.cc +++ b/src/nix/sigs.cc @@ -72,7 +72,7 @@ struct CmdCopySigs : StorePathsCommand if (!info->sigs.count(sig)) newSigs.insert(sig); } catch (InvalidPath &) { - printError("path %s was invalid in substituter %s", storePath.to_string(), store2->getUri()); + debug("path %s was invalid in substituter %s", storePath.to_string(), store2->getUri()); } }