about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2016-12-06T16·43+0100
committerEelco Dolstra <edolstra@gmail.com>2016-12-06T16·43+0100
commit7a3e7d0e61a651cb929b88a23f930785cfef3774 (patch)
tree8137b3314bd3d2a47822f7bf60d1f7abb8caa1cf /src
parent6069b946ad3db5aa613f2691617fea8bd779c3ce (diff)
nix-store --serve: Suppress log output on stderr when repeating a build
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc3
-rw-r--r--src/libstore/globals.hh5
-rw-r--r--src/nix-store/nix-store.cc1
3 files changed, 8 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index ba51f85917f3..89d363a098b8 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3047,7 +3047,8 @@ void DerivationGoal::handleEOF(int fd)
 
 void DerivationGoal::flushLine()
 {
-    if (settings.verboseBuild)
+    if (settings.verboseBuild &&
+        (settings.printRepeatedBuilds || curRound == 1))
         printError(filterANSIEscapes(currentLogLine, true));
     else {
         logTail.push_back(currentLogLine);
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 3194193bc842..a423b4e5c0f4 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -149,6 +149,11 @@ struct Settings {
        before being killed (0 means no limit). */
     unsigned long maxLogSize;
 
+    /* When build-repeat > 0 and verboseBuild == true, whether to
+       print repeated builds (i.e. builds other than the first one) to
+       stderr. Hack to prevent Hydra logs from being polluted. */
+    bool printRepeatedBuilds = true;
+
     /* How often (in seconds) to poll for locks. */
     unsigned int pollInterval;
 
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 2e530ae52a3a..77ad517a7170 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -842,6 +842,7 @@ static void opServe(Strings opFlags, Strings opArgs)
             settings.maxLogSize = readInt(in);
         if (GET_PROTOCOL_MINOR(clientVersion) >= 3)
             settings.set("build-repeat", std::to_string(readInt(in)));
+        settings.printRepeatedBuilds = false;
     };
 
     while (true) {