about summary refs log tree commit diff
path: root/third_party/nix/src/libstore
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-11-27T20·03-0500
committerglittershark <grfn@gws.fyi>2020-11-27T20·14+0000
commit5c3d58bb60c846f503d10af7fc5ba6e9f42fbae9 (patch)
tree77fb3fe7183c8d4fb2a63dc3b3a85308426d61bc /third_party/nix/src/libstore
parentbbfc47e96dcef901588e989a57a9d608eadafb26 (diff)
refactor(tvix): Prefer absl::StrFormat/StrAppend r/1943
This fmt call was particularly egregious

Change-Id: I2a3b1006c285170ab3374d1c8d81fc53e82a7b05
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2174
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'third_party/nix/src/libstore')
-rw-r--r--third_party/nix/src/libstore/build.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc
index b8a661f27821..15ed3b05146c 100644
--- a/third_party/nix/src/libstore/build.cc
+++ b/third_party/nix/src/libstore/build.cc
@@ -1463,15 +1463,22 @@ void DerivationGoal::tryToBuild() {
   bool buildLocally = buildMode != bmNormal || parsedDrv->willBuildLocally();
 
   auto started = [&]() {
-    auto msg = fmt(buildMode == bmRepair  ? "repairing outputs of '%s'"
-                   : buildMode == bmCheck ? "checking outputs of '%s'"
-                   : nrRounds > 1         ? "building '%s' (round %d/%d)"
-                                          : "building '%s'",
-                   drvPath, curRound, nrRounds);
+    std::string msg;
+    if (buildMode == bmRepair) {
+      msg = absl::StrFormat("repairing outputs of '%s'", drvPath);
+    } else if (buildMode == bmCheck) {
+      msg = absl::StrFormat("checking outputs of '%s'", drvPath);
+    } else if (nrRounds > 1) {
+      msg = absl::StrFormat("building '%s' (round %d/%d)", drvPath, curRound,
+                            nrRounds);
+    } else {
+      msg = absl::StrFormat("building '%s'", drvPath);
+    }
 
     if (hook) {
-      msg += fmt(" on '%s'", machineName);
+      absl::StrAppend(&msg, absl::StrFormat(" on '%s'", machineName));
     }
+
     log_sink() << msg << std::endl;
     mcRunningBuilds =
         std::make_unique<MaintainCount<uint64_t>>(worker.runningBuilds);