diff options
author | eldritch horrors <pennae@lix.systems> | 2024-10-05 00:38:35 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-10-05 20:17:20 +0000 |
commit | 7ff60b7445ccb599edcbf0078d181034f61a0859 (patch) | |
tree | 2b18077a07c073b2c76d7a49709115688ceeb534 /src | |
parent | fc6291e46dda940a69b627a3287b4633bb89f29f (diff) |
libstore: move Goal::exitCode to WorkResult
the field is simply duplicated between the two, and now that we can
return WorkResults from Worker::run we no longer need both of them.
Change-Id: I82fc47d050b39b7bb7d1656445630d271f6c9830
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/build/entry-points.cc | 6 | ||||
-rw-r--r-- | src/libstore/build/goal.cc | 19 | ||||
-rw-r--r-- | src/libstore/build/goal.hh | 5 |
3 files changed, 13 insertions, 17 deletions
diff --git a/src/libstore/build/entry-points.cc b/src/libstore/build/entry-points.cc index 73b0f01f3..3efd31682 100644 --- a/src/libstore/build/entry-points.cc +++ b/src/libstore/build/entry-points.cc @@ -32,7 +32,7 @@ void Store::buildPaths(const std::vector<DerivedPath> & reqs, BuildMode buildMod else ex = i->ex; } - if (i->exitCode != Goal::ecSuccess) { + if (result.exitCode != Goal::ecSuccess) { if (auto i2 = dynamic_cast<DerivationGoal *>(i.get())) failed.insert(printStorePath(i2->drvPath)); else if (auto i2 = dynamic_cast<PathSubstitutionGoal *>(i.get())) @@ -118,7 +118,7 @@ void Store::ensurePath(const StorePath & path) }); auto [goal, result] = *goals.begin(); - if (goal->exitCode != Goal::ecSuccess) { + if (result.exitCode != Goal::ecSuccess) { if (goal->ex) { goal->ex->withExitStatus(worker.failingExitStatus()); throw std::move(*goal->ex); @@ -140,7 +140,7 @@ void Store::repairPath(const StorePath & path) }); auto [goal, result] = *goals.begin(); - if (goal->exitCode != Goal::ecSuccess) { + if (result.exitCode != Goal::ecSuccess) { /* Since substituting the path didn't work, if we have a valid deriver, then rebuild the deriver. */ auto info = queryPathInfo(path); diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc index ef5e8ae96..c7dee08b7 100644 --- a/src/libstore/build/goal.cc +++ b/src/libstore/build/goal.cc @@ -25,8 +25,6 @@ try { BOOST_OUTCOME_CO_TRY(auto result, co_await workImpl()); trace("done"); - assert(!exitCode.has_value()); - exitCode = result.exitCode; ex = result.ex; notify->fulfill(result); @@ -42,14 +40,17 @@ Goal::waitForGoals(kj::Array<std::pair<GoalPtr, kj::Promise<Result<WorkResult>>> try { auto left = dependencies.size(); for (auto & [dep, p] : dependencies) { - p = p.then([this, dep, &left](auto _result) { + p = p.then([this, dep, &left](auto _result) -> Result<WorkResult> { + BOOST_OUTCOME_TRY(auto result, _result); + left--; trace(fmt("waitee '%s' done; %d left", dep->name, left)); - if (dep->exitCode != Goal::ecSuccess) ++nrFailed; - if (dep->exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters; - if (dep->exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure; - return _result; + if (result.exitCode != Goal::ecSuccess) ++nrFailed; + if (result.exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters; + if (result.exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure; + + return std::move(result); }).eagerlyEvaluate(nullptr); } @@ -57,11 +58,11 @@ try { while (auto item = co_await collectDeps.next()) { auto & [dep, _result] = *item; - BOOST_OUTCOME_CO_TRYV(_result); + BOOST_OUTCOME_CO_TRY(auto result, _result); waiteeDone(dep); - if (dep->exitCode == ecFailed && !settings.keepGoing) { + if (result.exitCode == ecFailed && !settings.keepGoing) { co_return result::success(); } } diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index fbcbbcffc..904b7564b 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -83,11 +83,6 @@ struct Goal std::string name; /** - * Whether the goal is finished. - */ - std::optional<ExitCode> exitCode; - - /** * Build result. */ BuildResult buildResult; |