about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-31T15·57+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-01T10·37+0200
commit7a108d904e9d3bb9ef94487c37b35a050c315a52 (patch)
treef995ea6d8b38e98c0922d771a00bc0e5bc2c4eef
parentfe38fce2d843625b7ff1b21ec8cd84cae6ff7c49 (diff)
Fix verbosity level for nix build --dry-run
-rw-r--r--src/libmain/shared.cc24
-rw-r--r--src/libmain/shared.hh4
-rw-r--r--src/nix/build.cc2
-rw-r--r--src/nix/installables.cc2
4 files changed, 16 insertions, 16 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index aa28ff2e53a4..6393d80bbf00 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -34,40 +34,40 @@ void printGCWarning()
 }
 
 
-void printMissing(ref<Store> store, const PathSet & paths)
+void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl)
 {
     unsigned long long downloadSize, narSize;
     PathSet willBuild, willSubstitute, unknown;
     store->queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
-    printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize);
+    printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize, lvl);
 }
 
 
 void printMissing(ref<Store> store, const PathSet & willBuild,
     const PathSet & willSubstitute, const PathSet & unknown,
-    unsigned long long downloadSize, unsigned long long narSize)
+    unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl)
 {
     if (!willBuild.empty()) {
-        printInfo(format("these derivations will be built:"));
+        printMsg(lvl, "these derivations will be built:");
         Paths sorted = store->topoSortPaths(willBuild);
         reverse(sorted.begin(), sorted.end());
         for (auto & i : sorted)
-            printInfo(format("  %1%") % i);
+            printMsg(lvl, fmt("  %s", i));
     }
 
     if (!willSubstitute.empty()) {
-        printInfo(format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
-            % (downloadSize / (1024.0 * 1024.0))
-            % (narSize / (1024.0 * 1024.0)));
+        printMsg(lvl, fmt("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):",
+                downloadSize / (1024.0 * 1024.0),
+                narSize / (1024.0 * 1024.0)));
         for (auto & i : willSubstitute)
-            printInfo(format("  %1%") % i);
+            printMsg(lvl, fmt("  %s", i));
     }
 
     if (!unknown.empty()) {
-        printInfo(format("don't know how to build these paths%1%:")
-            % (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
+        printMsg(lvl, fmt("don't know how to build these paths%s:",
+                (settings.readOnlyMode ? " (may be caused by read-only store access)" : "")));
         for (auto & i : unknown)
-            printInfo(format("  %1%") % i);
+            printMsg(lvl, fmt("  %s", i));
     }
 }
 
diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh
index becf258734e8..2a1e42dd9774 100644
--- a/src/libmain/shared.hh
+++ b/src/libmain/shared.hh
@@ -35,11 +35,11 @@ void printGCWarning();
 
 class Store;
 
-void printMissing(ref<Store> store, const PathSet & paths);
+void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl = lvlInfo);
 
 void printMissing(ref<Store> store, const PathSet & willBuild,
     const PathSet & willSubstitute, const PathSet & unknown,
-    unsigned long long downloadSize, unsigned long long narSize);
+    unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl = lvlInfo);
 
 string getArg(const string & opt,
     Strings::iterator & i, const Strings::iterator & end);
diff --git a/src/nix/build.cc b/src/nix/build.cc
index cc96ac48a977..4239dd3fff9d 100644
--- a/src/nix/build.cc
+++ b/src/nix/build.cc
@@ -25,7 +25,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
     {
         auto paths = toStorePaths(store, dryRun ? DryRun : Build);
 
-        printInfo("build result: %s", showPaths(paths));
+        printError("build result: %s", showPaths(paths));
     }
 };
 
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index bdd273d509c2..fdb6004fb31d 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -228,7 +228,7 @@ PathSet InstallablesCommand::toStorePaths(ref<Store> store, ToStorePathsMode mod
         }
 
     if (mode == DryRun)
-        printMissing(store, buildables);
+        printMissing(store, buildables, lvlError);
     else if (mode == Build)
         store->buildPaths(buildables);