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(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>(); @@ -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 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)}; }