aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Hermaszewski <git@monoid.al>2020-06-17 13:41:25 +0800
committerJoe Hermaszewski <git@monoid.al>2020-06-17 20:27:27 +0800
commitda8aac6ce8a73a7c9dc6d3cdfa27ab074f0bc976 (patch)
treeedcde1b4738ec69e144ad086213e4b8ce593801a /src
parent29542865cee37ab22efe1bd142900b69f6c59f0d (diff)
Mention number of derivations to be build/fetched in output
Also correct grammar for the case of a single derivation.
Diffstat (limited to 'src')
-rw-r--r--src/libmain/shared.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index dc6d5e413..1cb422967 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -48,7 +48,10 @@ void printMissing(ref<Store> store, const StorePathSet & willBuild,
unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl)
{
if (!willBuild.empty()) {
- printMsg(lvl, "these derivations will be built:");
+ if (willBuild.size() == 1)
+ printMsg(lvl, fmt("this derivation will be built:"));
+ else
+ printMsg(lvl, fmt("these %d derivations will be built:", willBuild.size()));
auto sorted = store->topoSortPaths(willBuild);
reverse(sorted.begin(), sorted.end());
for (auto & i : sorted)
@@ -56,9 +59,18 @@ void printMissing(ref<Store> store, const StorePathSet & willBuild,
}
if (!willSubstitute.empty()) {
- printMsg(lvl, fmt("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):",
- downloadSize / (1024.0 * 1024.0),
- narSize / (1024.0 * 1024.0)));
+ const float downloadSizeMiB = downloadSize / (1024.f * 1024.f);
+ const float narSizeMiB = narSize / (1024.f * 1024.f);
+ if (willSubstitute.size() == 1) {
+ printMsg(lvl, fmt("this path will be fetched (%.2f MiB download, %.2f MiB unpacked):",
+ downloadSizeMiB,
+ narSizeMiB));
+ } else {
+ printMsg(lvl, fmt("these %d paths will be fetched (%.2f MiB download, %.2f MiB unpacked):",
+ willSubstitute.size(),
+ downloadSizeMiB,
+ narSizeMiB));
+ }
for (auto & i : willSubstitute)
printMsg(lvl, fmt(" %s", store->printStorePath(i)));
}