|
6 | 6 | #include "nix/main/loggers.hh" |
7 | 7 | #include "nix/main/progress-bar.hh" |
8 | 8 | #include "nix/util/signals.hh" |
| 9 | +#include "nix/util/util.hh" |
9 | 10 |
|
10 | 11 | #include <algorithm> |
11 | 12 | #include <exception> |
@@ -64,18 +65,19 @@ void printMissing(ref<Store> store, const MissingPaths & missing, Verbosity lvl) |
64 | 65 | } |
65 | 66 |
|
66 | 67 | if (!missing.willSubstitute.empty()) { |
67 | | - const float downloadSizeMiB = missing.downloadSize / (1024.f * 1024.f); |
68 | | - const float narSizeMiB = missing.narSize / (1024.f * 1024.f); |
69 | 68 | if (missing.willSubstitute.size() == 1) { |
70 | 69 | printMsg( |
71 | | - lvl, "this path will be fetched (%.2f MiB download, %.2f MiB unpacked):", downloadSizeMiB, narSizeMiB); |
| 70 | + lvl, |
| 71 | + "this path will be fetched (%s download, %s unpacked):", |
| 72 | + renderSize(missing.downloadSize), |
| 73 | + renderSize(missing.narSize)); |
72 | 74 | } else { |
73 | 75 | printMsg( |
74 | 76 | lvl, |
75 | | - "these %d paths will be fetched (%.2f MiB download, %.2f MiB unpacked):", |
| 77 | + "these %d paths will be fetched (%s download, %s unpacked):", |
76 | 78 | missing.willSubstitute.size(), |
77 | | - downloadSizeMiB, |
78 | | - narSizeMiB); |
| 79 | + renderSize(missing.downloadSize), |
| 80 | + renderSize(missing.narSize)); |
79 | 81 | } |
80 | 82 | std::vector<const StorePath *> willSubstituteSorted = {}; |
81 | 83 | std::for_each(missing.willSubstitute.begin(), missing.willSubstitute.end(), [&](const StorePath & p) { |
@@ -406,7 +408,7 @@ RunPager::~RunPager() |
406 | 408 | PrintFreed::~PrintFreed() |
407 | 409 | { |
408 | 410 | if (show) |
409 | | - std::cout << fmt("%d store paths deleted, %s freed\n", results.paths.size(), showBytes(results.bytesFreed)); |
| 411 | + std::cout << fmt("%d store paths deleted, %s freed\n", results.paths.size(), renderSize(results.bytesFreed)); |
410 | 412 | } |
411 | 413 |
|
412 | 414 | } // namespace nix |
0 commit comments