forked from lix-project/lix
Fix tests on systems with a non-master git defaultBranch #1
|
@ -125,7 +125,7 @@ Goal::WorkResult DerivationGoal::timedOut(Error && ex)
|
|||
}
|
||||
|
||||
|
||||
kj::Promise<Result<Goal::WorkResult>> DerivationGoal::work() noexcept
|
||||
kj::Promise<Result<Goal::WorkResult>> DerivationGoal::workImpl() noexcept
|
||||
{
|
||||
return useDerivation ? getDerivation() : haveDerivation();
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ struct DerivationGoal : public Goal
|
|||
|
||||
WorkResult timedOut(Error && ex);
|
||||
|
||||
kj::Promise<Result<WorkResult>> work() noexcept override;
|
||||
kj::Promise<Result<WorkResult>> workImpl() noexcept override;
|
||||
|
||||
/**
|
||||
* Add wanted outputs to an already existing derivation goal.
|
||||
|
|
|
@ -24,7 +24,7 @@ DrvOutputSubstitutionGoal::DrvOutputSubstitutionGoal(
|
|||
}
|
||||
|
||||
|
||||
kj::Promise<Result<Goal::WorkResult>> DrvOutputSubstitutionGoal::work() noexcept
|
||||
kj::Promise<Result<Goal::WorkResult>> DrvOutputSubstitutionGoal::workImpl() noexcept
|
||||
try {
|
||||
trace("init");
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
kj::Promise<Result<WorkResult>> outPathValid() noexcept;
|
||||
kj::Promise<Result<WorkResult>> finished() noexcept;
|
||||
|
||||
kj::Promise<Result<WorkResult>> work() noexcept override;
|
||||
kj::Promise<Result<WorkResult>> workImpl() noexcept override;
|
||||
|
||||
JobCategory jobCategory() const override {
|
||||
return JobCategory::Substitution;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "goal.hh"
|
||||
#include "async-collect.hh"
|
||||
#include "worker.hh"
|
||||
#include <boost/outcome/try.hpp>
|
||||
#include <kj/time.h>
|
||||
|
||||
namespace nix {
|
||||
|
@ -19,6 +20,23 @@ kj::Promise<void> Goal::waitForAWhile()
|
|||
return worker.aio.provider->getTimer().afterDelay(settings.pollInterval.get() * kj::SECONDS);
|
||||
}
|
||||
|
||||
kj::Promise<Result<Goal::WorkResult>> Goal::work() noexcept
|
||||
try {
|
||||
BOOST_OUTCOME_CO_TRY(auto result, co_await workImpl());
|
||||
|
||||
trace("done");
|
||||
assert(!exitCode.has_value());
|
||||
exitCode = result.exitCode;
|
||||
ex = result.ex;
|
||||
|
||||
notify->fulfill();
|
||||
cleanup();
|
||||
|
||||
co_return std::move(result);
|
||||
} catch (...) {
|
||||
co_return result::failure(std::current_exception());
|
||||
}
|
||||
|
||||
kj::Promise<Result<void>>
|
||||
Goal::waitForGoals(kj::Array<std::pair<GoalPtr, kj::Promise<void>>> dependencies) noexcept
|
||||
try {
|
||||
|
|
|
@ -92,7 +92,7 @@ struct Goal
|
|||
*/
|
||||
BuildResult buildResult;
|
||||
|
||||
// for use by Worker only. will go away once work() is a promise.
|
||||
// for use by Worker and Goal only. will go away once work() is a promise.
|
||||
kj::Own<kj::PromiseFulfiller<void>> notify;
|
||||
|
||||
protected:
|
||||
|
@ -121,6 +121,8 @@ protected:
|
|||
return waitForGoals(kj::arrOf<std::pair<GoalPtr, kj::Promise<void>>>(std::move(goals)...));
|
||||
}
|
||||
|
||||
virtual kj::Promise<Result<WorkResult>> workImpl() noexcept = 0;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -138,7 +140,7 @@ public:
|
|||
trace("goal destroyed");
|
||||
}
|
||||
|
||||
virtual kj::Promise<Result<WorkResult>> work() noexcept = 0;
|
||||
kj::Promise<Result<WorkResult>> work() noexcept;
|
||||
|
||||
virtual void waiteeDone(GoalPtr waitee) { }
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ Goal::WorkResult PathSubstitutionGoal::done(
|
|||
}
|
||||
|
||||
|
||||
kj::Promise<Result<Goal::WorkResult>> PathSubstitutionGoal::work() noexcept
|
||||
kj::Promise<Result<Goal::WorkResult>> PathSubstitutionGoal::workImpl() noexcept
|
||||
try {
|
||||
trace("init");
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
);
|
||||
~PathSubstitutionGoal();
|
||||
|
||||
kj::Promise<Result<WorkResult>> work() noexcept override;
|
||||
kj::Promise<Result<WorkResult>> workImpl() noexcept override;
|
||||
|
||||
/**
|
||||
* The states.
|
||||
|
|
|
@ -195,19 +195,12 @@ static void removeGoal(std::shared_ptr<G> goal, auto & goalMap)
|
|||
|
||||
void Worker::goalFinished(GoalPtr goal, Goal::WorkResult & f)
|
||||
{
|
||||
goal->trace("done");
|
||||
assert(!goal->exitCode.has_value());
|
||||
goal->exitCode = f.exitCode;
|
||||
goal->ex = f.ex;
|
||||
|
||||
permanentFailure |= f.permanentFailure;
|
||||
timedOut |= f.timedOut;
|
||||
hashMismatch |= f.hashMismatch;
|
||||
checkMismatch |= f.checkMismatch;
|
||||
|
||||
removeGoal(goal);
|
||||
goal->notify->fulfill();
|
||||
goal->cleanup();
|
||||
}
|
||||
|
||||
void Worker::removeGoal(GoalPtr goal)
|
||||
|
|
Loading…
Reference in a new issue