From 5c3d58bb60c846f503d10af7fc5ba6e9f42fbae9 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 27 Nov 2020 15:03:46 -0500 Subject: refactor(tvix): Prefer absl::StrFormat/StrAppend This fmt call was particularly egregious Change-Id: I2a3b1006c285170ab3374d1c8d81fc53e82a7b05 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2174 Tested-by: BuildkiteCI Reviewed-by: kanepyork --- third_party/nix/src/libstore/build.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'third_party/nix/src') 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>(worker.runningBuilds); -- cgit 1.4.1