forked from lix-project/lix
libstore: make Worker status flags private
Change-Id: I16ec8994c6448d70b686a2e4c10f19d4e240750d
This commit is contained in:
parent
fc987b4123
commit
ba85e501ce
|
@ -1506,10 +1506,6 @@ Goal::Finished DerivationGoal::done(
|
||||||
buildResult.status = status;
|
buildResult.status = status;
|
||||||
if (ex)
|
if (ex)
|
||||||
buildResult.errorMsg = fmt("%s", Uncolored(ex->info().msg));
|
buildResult.errorMsg = fmt("%s", Uncolored(ex->info().msg));
|
||||||
if (buildResult.status == BuildResult::TimedOut)
|
|
||||||
worker.timedOut = true;
|
|
||||||
if (buildResult.status == BuildResult::PermanentFailure)
|
|
||||||
worker.permanentFailure = true;
|
|
||||||
|
|
||||||
mcExpectedBuilds.reset();
|
mcExpectedBuilds.reset();
|
||||||
mcRunningBuilds.reset();
|
mcRunningBuilds.reset();
|
||||||
|
@ -1535,6 +1531,10 @@ Goal::Finished DerivationGoal::done(
|
||||||
return Finished{
|
return Finished{
|
||||||
.result = buildResult.success() ? ecSuccess : ecFailed,
|
.result = buildResult.success() ? ecSuccess : ecFailed,
|
||||||
.ex = ex ? std::make_unique<Error>(std::move(*ex)) : nullptr,
|
.ex = ex ? std::make_unique<Error>(std::move(*ex)) : nullptr,
|
||||||
|
.permanentFailure = buildResult.status == BuildResult::PermanentFailure,
|
||||||
|
.timedOut = buildResult.status == BuildResult::TimedOut,
|
||||||
|
.hashMismatch = anyHashMismatchSeen,
|
||||||
|
.checkMismatch = anyCheckMismatchSeen,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,9 @@ struct DerivationGoal : public Goal
|
||||||
*/
|
*/
|
||||||
NeedRestartForMoreOutputs needRestart = NeedRestartForMoreOutputs::OutputsUnmodifedDontNeed;
|
NeedRestartForMoreOutputs needRestart = NeedRestartForMoreOutputs::OutputsUnmodifedDontNeed;
|
||||||
|
|
||||||
|
bool anyHashMismatchSeen = false;
|
||||||
|
bool anyCheckMismatchSeen = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See `retrySubstitution`; just for that field.
|
* See `retrySubstitution`; just for that field.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -115,6 +115,10 @@ public:
|
||||||
struct [[nodiscard]] Finished {
|
struct [[nodiscard]] Finished {
|
||||||
ExitCode result;
|
ExitCode result;
|
||||||
std::unique_ptr<Error> ex;
|
std::unique_ptr<Error> ex;
|
||||||
|
bool permanentFailure = false;
|
||||||
|
bool timedOut = false;
|
||||||
|
bool hashMismatch = false;
|
||||||
|
bool checkMismatch = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct [[nodiscard]] WorkResult : std::variant<
|
struct [[nodiscard]] WorkResult : std::variant<
|
||||||
|
|
|
@ -235,8 +235,9 @@ Goal::WorkResult LocalDerivationGoal::tryLocalBuild()
|
||||||
} catch (BuildError & e) {
|
} catch (BuildError & e) {
|
||||||
outputLocks.unlock();
|
outputLocks.unlock();
|
||||||
buildUser.reset();
|
buildUser.reset();
|
||||||
worker.permanentFailure = true;
|
auto report = done(BuildResult::InputRejected, {}, std::move(e));
|
||||||
return done(BuildResult::InputRejected, {}, std::move(e));
|
report.permanentFailure = true;
|
||||||
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This state will be reached when we get EOF on the child's
|
/* This state will be reached when we get EOF on the child's
|
||||||
|
@ -2195,7 +2196,7 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
|
||||||
if (wanted != got) {
|
if (wanted != got) {
|
||||||
/* Throw an error after registering the path as
|
/* Throw an error after registering the path as
|
||||||
valid. */
|
valid. */
|
||||||
worker.hashMismatch = true;
|
anyHashMismatchSeen = true;
|
||||||
// XXX: shameless layering violation hack that makes the hash mismatch error at least not utterly worthless
|
// XXX: shameless layering violation hack that makes the hash mismatch error at least not utterly worthless
|
||||||
auto guessedUrl = getOr(drv->env, "urls", getOr(drv->env, "url", "(unknown)"));
|
auto guessedUrl = getOr(drv->env, "urls", getOr(drv->env, "url", "(unknown)"));
|
||||||
delayedException = std::make_exception_ptr(
|
delayedException = std::make_exception_ptr(
|
||||||
|
@ -2282,7 +2283,7 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
|
||||||
if (!worker.store.isValidPath(newInfo.path)) continue;
|
if (!worker.store.isValidPath(newInfo.path)) continue;
|
||||||
ValidPathInfo oldInfo(*worker.store.queryPathInfo(newInfo.path));
|
ValidPathInfo oldInfo(*worker.store.queryPathInfo(newInfo.path));
|
||||||
if (newInfo.narHash != oldInfo.narHash) {
|
if (newInfo.narHash != oldInfo.narHash) {
|
||||||
worker.checkMismatch = true;
|
anyCheckMismatchSeen = true;
|
||||||
if (settings.runDiffHook || settings.keepFailed) {
|
if (settings.runDiffHook || settings.keepFailed) {
|
||||||
auto dst = worker.store.toRealPath(finalDestPath + checkSuffix);
|
auto dst = worker.store.toRealPath(finalDestPath + checkSuffix);
|
||||||
deletePath(dst);
|
deletePath(dst);
|
||||||
|
|
|
@ -21,10 +21,6 @@ Worker::Worker(Store & store, Store & evalStore)
|
||||||
nrLocalBuilds = 0;
|
nrLocalBuilds = 0;
|
||||||
nrSubstitutions = 0;
|
nrSubstitutions = 0;
|
||||||
lastWokenUp = steady_time_point::min();
|
lastWokenUp = steady_time_point::min();
|
||||||
permanentFailure = false;
|
|
||||||
timedOut = false;
|
|
||||||
hashMismatch = false;
|
|
||||||
checkMismatch = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,6 +141,11 @@ void Worker::goalFinished(GoalPtr goal, Goal::Finished & f)
|
||||||
assert(!goal->exitCode.has_value());
|
assert(!goal->exitCode.has_value());
|
||||||
goal->exitCode = f.result;
|
goal->exitCode = f.result;
|
||||||
|
|
||||||
|
permanentFailure |= f.permanentFailure;
|
||||||
|
timedOut |= f.timedOut;
|
||||||
|
hashMismatch |= f.hashMismatch;
|
||||||
|
checkMismatch |= f.checkMismatch;
|
||||||
|
|
||||||
if (f.ex) {
|
if (f.ex) {
|
||||||
if (!goal->waiters.empty())
|
if (!goal->waiters.empty())
|
||||||
logError(f.ex->info());
|
logError(f.ex->info());
|
||||||
|
|
|
@ -105,6 +105,27 @@ private:
|
||||||
*/
|
*/
|
||||||
std::map<StorePath, bool> pathContentsGoodCache;
|
std::map<StorePath, bool> pathContentsGoodCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if at least one derivation had a BuildError (i.e. permanent
|
||||||
|
* failure).
|
||||||
|
*/
|
||||||
|
bool permanentFailure = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if at least one derivation had a timeout.
|
||||||
|
*/
|
||||||
|
bool timedOut = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if at least one derivation fails with a hash mismatch.
|
||||||
|
*/
|
||||||
|
bool hashMismatch = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if at least one derivation is not deterministic in check mode.
|
||||||
|
*/
|
||||||
|
bool checkMismatch = false;
|
||||||
|
|
||||||
void goalFinished(GoalPtr goal, Goal::Finished & f);
|
void goalFinished(GoalPtr goal, Goal::Finished & f);
|
||||||
void handleWorkResult(GoalPtr goal, Goal::WorkResult how);
|
void handleWorkResult(GoalPtr goal, Goal::WorkResult how);
|
||||||
|
|
||||||
|
@ -133,27 +154,6 @@ public:
|
||||||
const Activity actDerivations;
|
const Activity actDerivations;
|
||||||
const Activity actSubstitutions;
|
const Activity actSubstitutions;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set if at least one derivation had a BuildError (i.e. permanent
|
|
||||||
* failure).
|
|
||||||
*/
|
|
||||||
bool permanentFailure;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set if at least one derivation had a timeout.
|
|
||||||
*/
|
|
||||||
bool timedOut;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set if at least one derivation fails with a hash mismatch.
|
|
||||||
*/
|
|
||||||
bool hashMismatch;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set if at least one derivation is not deterministic in check mode.
|
|
||||||
*/
|
|
||||||
bool checkMismatch;
|
|
||||||
|
|
||||||
Store & store;
|
Store & store;
|
||||||
Store & evalStore;
|
Store & evalStore;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue