aboutsummaryrefslogtreecommitdiff
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
parent29542865cee37ab22efe1bd142900b69f6c59f0d (diff)
Mention number of derivations to be build/fetched in output
Also correct grammar for the case of a single derivation.
-rw-r--r--doc/manual/advanced-topics/diff-hook.xml6
-rw-r--r--doc/manual/advanced-topics/post-build-hook.xml2
-rw-r--r--doc/manual/command-ref/nix-env.xml2
-rw-r--r--src/libmain/shared.cc20
4 files changed, 21 insertions, 9 deletions
diff --git a/doc/manual/advanced-topics/diff-hook.xml b/doc/manual/advanced-topics/diff-hook.xml
index fb4bf819f..f01ab71b3 100644
--- a/doc/manual/advanced-topics/diff-hook.xml
+++ b/doc/manual/advanced-topics/diff-hook.xml
@@ -70,7 +70,7 @@ path just built.</para>
<screen>
$ nix-build ./deterministic.nix -A stable
-these derivations will be built:
+this derivation will be built:
/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv
building '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
/nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable
@@ -85,7 +85,7 @@ checking outputs of '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
<screen>
$ nix-build ./deterministic.nix -A unstable
-these derivations will be built:
+this derivation will be built:
/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv
building '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv'...
/nix/store/krpqk0l9ib0ibi1d2w52z293zw455cap-unstable
@@ -193,7 +193,7 @@ repeat = 1
An example output of this configuration:
<screen>
$ nix-build ./test.nix -A unstable
-these derivations will be built:
+this derivation will be built:
/nix/store/ch6llwpr2h8c3jmnf3f2ghkhx59aa97f-unstable.drv
building '/nix/store/ch6llwpr2h8c3jmnf3f2ghkhx59aa97f-unstable.drv' (round 1/2)...
building '/nix/store/ch6llwpr2h8c3jmnf3f2ghkhx59aa97f-unstable.drv' (round 2/2)...
diff --git a/doc/manual/advanced-topics/post-build-hook.xml b/doc/manual/advanced-topics/post-build-hook.xml
index acfe9e3cc..6cc286ee1 100644
--- a/doc/manual/advanced-topics/post-build-hook.xml
+++ b/doc/manual/advanced-topics/post-build-hook.xml
@@ -122,7 +122,7 @@ post-build-hook = /etc/nix/upload-to-cache.sh
<screen>
$ nix-build -E '(import &lt;nixpkgs&gt; {}).writeText "example" (builtins.toString builtins.currentTime)'
-these derivations will be built:
+this derivation will be built:
/nix/store/s4pnfbkalzy5qz57qs6yybna8wylkig6-example.drv
building '/nix/store/s4pnfbkalzy5qz57qs6yybna8wylkig6-example.drv'...
running post-build-hook '/home/grahamc/projects/github.com/NixOS/nix/post-hook.sh'...
diff --git a/doc/manual/command-ref/nix-env.xml b/doc/manual/command-ref/nix-env.xml
index 2b95b6819..55f25d959 100644
--- a/doc/manual/command-ref/nix-env.xml
+++ b/doc/manual/command-ref/nix-env.xml
@@ -516,7 +516,7 @@ source:
$ nix-env -f '&lt;nixpkgs>' -iA hello --dry-run
(dry run; not doing anything)
installing ‘hello-2.10’
-these paths will be fetched (0.04 MiB download, 0.19 MiB unpacked):
+this path will be fetched (0.04 MiB download, 0.19 MiB unpacked):
/nix/store/wkhdf9jinag5750mqlax6z2zbwhqb76n-hello-2.10
<replaceable>...</replaceable></screen>
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)));
}