libstore: add build result to Goal::Finished
it just makes sense to have it too, rather than just the pass/fail information we keep so far. once we turn goals into something more promise-shaped it'll also help detangle the current data flow mess Change-Id: I915cf04d177cad849ea7a5833215d795326f1946
This commit is contained in:
parent
a385c5935a
commit
d75df91f74
4 changed files with 9 additions and 5 deletions
|
@ -1550,6 +1550,7 @@ Goal::Finished DerivationGoal::done(
|
||||||
|
|
||||||
return Finished{
|
return Finished{
|
||||||
.exitCode = buildResult.success() ? ecSuccess : ecFailed,
|
.exitCode = buildResult.success() ? ecSuccess : ecFailed,
|
||||||
|
.result = buildResult,
|
||||||
.ex = ex ? std::make_shared<Error>(std::move(*ex)) : nullptr,
|
.ex = ex ? std::make_shared<Error>(std::move(*ex)) : nullptr,
|
||||||
.permanentFailure = buildResult.status == BuildResult::PermanentFailure,
|
.permanentFailure = buildResult.status == BuildResult::PermanentFailure,
|
||||||
.timedOut = buildResult.status == BuildResult::TimedOut,
|
.timedOut = buildResult.status == BuildResult::TimedOut,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "drv-output-substitution-goal.hh"
|
#include "drv-output-substitution-goal.hh"
|
||||||
|
#include "build-result.hh"
|
||||||
#include "finally.hh"
|
#include "finally.hh"
|
||||||
#include "worker.hh"
|
#include "worker.hh"
|
||||||
#include "substitution-goal.hh"
|
#include "substitution-goal.hh"
|
||||||
|
@ -27,7 +28,7 @@ Goal::WorkResult DrvOutputSubstitutionGoal::init(bool inBuildSlot)
|
||||||
|
|
||||||
/* If the derivation already exists, we’re done */
|
/* If the derivation already exists, we’re done */
|
||||||
if (worker.store.queryRealisation(id)) {
|
if (worker.store.queryRealisation(id)) {
|
||||||
return Finished{ecSuccess};
|
return Finished{ecSuccess, std::move(buildResult)};
|
||||||
}
|
}
|
||||||
|
|
||||||
subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
|
subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
|
||||||
|
@ -56,7 +57,7 @@ Goal::WorkResult DrvOutputSubstitutionGoal::tryNext(bool inBuildSlot)
|
||||||
/* Hack: don't indicate failure if there were no substituters.
|
/* Hack: don't indicate failure if there were no substituters.
|
||||||
In that case the calling derivation should just do a
|
In that case the calling derivation should just do a
|
||||||
build. */
|
build. */
|
||||||
return Finished{substituterFailed ? ecFailed : ecNoSubstituters};
|
return Finished{substituterFailed ? ecFailed : ecNoSubstituters, std::move(buildResult)};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub = subs.front();
|
sub = subs.front();
|
||||||
|
@ -133,7 +134,8 @@ Goal::WorkResult DrvOutputSubstitutionGoal::outPathValid(bool inBuildSlot)
|
||||||
if (nrFailed > 0) {
|
if (nrFailed > 0) {
|
||||||
debug("The output path of the derivation output '%s' could not be substituted", id.to_string());
|
debug("The output path of the derivation output '%s' could not be substituted", id.to_string());
|
||||||
return Finished{
|
return Finished{
|
||||||
nrNoSubstituters > 0 || nrIncompleteClosure > 0 ? ecIncompleteClosure : ecFailed
|
nrNoSubstituters > 0 || nrIncompleteClosure > 0 ? ecIncompleteClosure : ecFailed,
|
||||||
|
std::move(buildResult),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +146,7 @@ Goal::WorkResult DrvOutputSubstitutionGoal::outPathValid(bool inBuildSlot)
|
||||||
Goal::WorkResult DrvOutputSubstitutionGoal::finished()
|
Goal::WorkResult DrvOutputSubstitutionGoal::finished()
|
||||||
{
|
{
|
||||||
trace("finished");
|
trace("finished");
|
||||||
return Finished{ecSuccess};
|
return Finished{ecSuccess, std::move(buildResult)};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DrvOutputSubstitutionGoal::key()
|
std::string DrvOutputSubstitutionGoal::key()
|
||||||
|
|
|
@ -125,6 +125,7 @@ public:
|
||||||
};
|
};
|
||||||
struct [[nodiscard]] Finished {
|
struct [[nodiscard]] Finished {
|
||||||
ExitCode exitCode;
|
ExitCode exitCode;
|
||||||
|
BuildResult result;
|
||||||
std::shared_ptr<Error> ex;
|
std::shared_ptr<Error> ex;
|
||||||
bool permanentFailure = false;
|
bool permanentFailure = false;
|
||||||
bool timedOut = false;
|
bool timedOut = false;
|
||||||
|
|
|
@ -41,7 +41,7 @@ Goal::Finished PathSubstitutionGoal::done(
|
||||||
debug(*errorMsg);
|
debug(*errorMsg);
|
||||||
buildResult.errorMsg = *errorMsg;
|
buildResult.errorMsg = *errorMsg;
|
||||||
}
|
}
|
||||||
return Finished{result};
|
return Finished{result, std::move(buildResult)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue