Skip to content

Commit c6ba120

Browse files
committed
DerivationBuildingGoal::started make local (lambda) variable
1 parent 3b9c510 commit c6ba120

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

src/libstore/build/derivation-building-goal.cc

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -439,37 +439,36 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
439439
co_return tryToBuild();
440440
}
441441

442-
void DerivationBuildingGoal::started()
442+
Goal::Co DerivationBuildingGoal::tryToBuild()
443443
{
444-
auto msg =
445-
fmt(buildMode == bmRepair ? "repairing outputs of '%s'"
446-
: buildMode == bmCheck ? "checking outputs of '%s'"
447-
: "building '%s'",
448-
worker.store.printStorePath(drvPath));
449-
fmt("building '%s'", worker.store.printStorePath(drvPath));
444+
auto started = [&]() {
445+
auto msg =
446+
fmt(buildMode == bmRepair ? "repairing outputs of '%s'"
447+
: buildMode == bmCheck ? "checking outputs of '%s'"
448+
: "building '%s'",
449+
worker.store.printStorePath(drvPath));
450+
fmt("building '%s'", worker.store.printStorePath(drvPath));
450451
#ifndef _WIN32 // TODO enable build hook on Windows
451-
if (hook)
452-
msg += fmt(" on '%s'", machineName);
452+
if (hook)
453+
msg += fmt(" on '%s'", machineName);
453454
#endif
454-
act = std::make_unique<Activity>(
455-
*logger,
456-
lvlInfo,
457-
actBuild,
458-
msg,
459-
Logger::Fields{
460-
worker.store.printStorePath(drvPath),
455+
act = std::make_unique<Activity>(
456+
*logger,
457+
lvlInfo,
458+
actBuild,
459+
msg,
460+
Logger::Fields{
461+
worker.store.printStorePath(drvPath),
461462
#ifndef _WIN32 // TODO enable build hook on Windows
462-
hook ? machineName :
463+
hook ? machineName :
463464
#endif
464-
"",
465-
1,
466-
1});
467-
mcRunningBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.runningBuilds);
468-
worker.updateProgress();
469-
}
465+
"",
466+
1,
467+
1});
468+
mcRunningBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.runningBuilds);
469+
worker.updateProgress();
470+
};
470471

471-
Goal::Co DerivationBuildingGoal::tryToBuild()
472-
{
473472
/**
474473
* Activity that denotes waiting for a lock.
475474
*/

src/libstore/include/nix/store/build/derivation-building-goal.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ struct DerivationBuildingGoal : public Goal
158158
*/
159159
void killChild();
160160

161-
void started();
162-
163161
Done doneSuccess(BuildResult::Status status, SingleDrvOutputs builtOutputs);
164162

165163
Done doneFailure(BuildError ex);

0 commit comments

Comments
 (0)