Fix tests on systems with a non-master git defaultBranch #1

Open
zebreus wants to merge 140 commits from fix-tests-without-master into main
4 changed files with 9 additions and 5 deletions
Showing only changes of commit d75df91f74 - Show all commits

View file

@ -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,

View file

@ -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, were done */ /* If the derivation already exists, were 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()

View file

@ -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;

View file

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