diff options
author | eldritch horrors <pennae@lix.systems> | 2024-08-30 19:01:30 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-08-30 19:01:30 +0200 |
commit | d75df91f74b6819f674f0733143fdf32580af183 (patch) | |
tree | 0b30c89b598b1163ceb310b68ffce1807cbfe858 /src/libstore/build | |
parent | a385c5935aa7cfec4de47cfe5620bca2e0e0e55d (diff) |
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
Diffstat (limited to 'src/libstore/build')
-rw-r--r-- | src/libstore/build/derivation-goal.cc | 1 | ||||
-rw-r--r-- | src/libstore/build/drv-output-substitution-goal.cc | 10 | ||||
-rw-r--r-- | src/libstore/build/goal.hh | 1 | ||||
-rw-r--r-- | src/libstore/build/substitution-goal.cc | 2 |
4 files changed, 9 insertions, 5 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index 3011d5c6f..b59033bae 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -1550,6 +1550,7 @@ Goal::Finished DerivationGoal::done( return Finished{ .exitCode = buildResult.success() ? ecSuccess : ecFailed, + .result = buildResult, .ex = ex ? std::make_shared<Error>(std::move(*ex)) : nullptr, .permanentFailure = buildResult.status == BuildResult::PermanentFailure, .timedOut = buildResult.status == BuildResult::TimedOut, diff --git a/src/libstore/build/drv-output-substitution-goal.cc b/src/libstore/build/drv-output-substitution-goal.cc index 369b2dd90..d7a7d257c 100644 --- a/src/libstore/build/drv-output-substitution-goal.cc +++ b/src/libstore/build/drv-output-substitution-goal.cc @@ -1,4 +1,5 @@ #include "drv-output-substitution-goal.hh" +#include "build-result.hh" #include "finally.hh" #include "worker.hh" #include "substitution-goal.hh" @@ -27,7 +28,7 @@ Goal::WorkResult DrvOutputSubstitutionGoal::init(bool inBuildSlot) /* If the derivation already exists, we’re done */ if (worker.store.queryRealisation(id)) { - return Finished{ecSuccess}; + return Finished{ecSuccess, std::move(buildResult)}; } 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. In that case the calling derivation should just do a build. */ - return Finished{substituterFailed ? ecFailed : ecNoSubstituters}; + return Finished{substituterFailed ? ecFailed : ecNoSubstituters, std::move(buildResult)}; } sub = subs.front(); @@ -133,7 +134,8 @@ Goal::WorkResult DrvOutputSubstitutionGoal::outPathValid(bool inBuildSlot) if (nrFailed > 0) { debug("The output path of the derivation output '%s' could not be substituted", id.to_string()); 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() { trace("finished"); - return Finished{ecSuccess}; + return Finished{ecSuccess, std::move(buildResult)}; } std::string DrvOutputSubstitutionGoal::key() diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index 9d9ab53ca..502ba2a7d 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -125,6 +125,7 @@ public: }; struct [[nodiscard]] Finished { ExitCode exitCode; + BuildResult result; std::shared_ptr<Error> ex; bool permanentFailure = false; bool timedOut = false; diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc index a798cbde2..33715ea6b 100644 --- a/src/libstore/build/substitution-goal.cc +++ b/src/libstore/build/substitution-goal.cc @@ -41,7 +41,7 @@ Goal::Finished PathSubstitutionGoal::done( debug(*errorMsg); buildResult.errorMsg = *errorMsg; } - return Finished{result}; + return Finished{result, std::move(buildResult)}; } |