Move "created" field into Step::State

This commit is contained in:
Eelco Dolstra 2015-06-22 11:02:01 +02:00
parent 90a08db241
commit fed71d3fe9

View file

@ -145,6 +145,9 @@ struct Step
struct State struct State
{ {
/* Whether the step has finished initialisation. */
bool created = false;
/* The build steps on which this step depends. */ /* The build steps on which this step depends. */
std::set<Step::ptr> deps; std::set<Step::ptr> deps;
@ -161,7 +164,6 @@ struct Step
system_time after; system_time after;
}; };
std::atomic_bool created{false}; // debugging
std::atomic_bool finished{false}; // debugging std::atomic_bool finished{false}; // debugging
Sync<State> state; Sync<State> state;
@ -732,6 +734,8 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store, const Path & drvPat
auto step_(step->state.lock()); auto step_(step->state.lock());
assert(step_->created != isNew);
if (referringBuild) if (referringBuild)
step_->builds.push_back(referringBuild); step_->builds.push_back(referringBuild);
@ -741,10 +745,7 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store, const Path & drvPat
(*steps_)[drvPath] = step; (*steps_)[drvPath] = step;
} }
if (!isNew) { if (!isNew) return step;
assert(step->created);
return step;
}
printMsg(lvlDebug, format("considering derivation %1%") % drvPath); printMsg(lvlDebug, format("considering derivation %1%") % drvPath);
@ -788,8 +789,8 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store, const Path & drvPat
runnable. */ runnable. */
{ {
auto step_(step->state.lock()); auto step_(step->state.lock());
assert(!step->created); assert(!step_->created);
step->created = true; step_->created = true;
if (step_->deps.empty()) if (step_->deps.empty())
newRunnable.insert(step); newRunnable.insert(step);
} }
@ -838,7 +839,7 @@ void State::makeRunnable(Step::ptr step)
{ {
auto step_(step->state.lock()); auto step_(step->state.lock());
assert(step->created); assert(step_->created);
assert(!step->finished); assert(!step->finished);
assert(step_->deps.empty()); assert(step_->deps.empty());
} }
@ -1023,7 +1024,7 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
{ {
{ {
auto step_(step->state.lock()); auto step_(step->state.lock());
assert(step->created); assert(step_->created);
assert(!step->finished); assert(!step->finished);
} }
@ -1206,7 +1207,7 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
/* Note: if the step has not finished /* Note: if the step has not finished
initialisation yet, it will be made runnable in initialisation yet, it will be made runnable in
createStep(), if appropriate. */ createStep(), if appropriate. */
if (rdep_->deps.empty() && rdep->created) runnable = true; if (rdep_->deps.empty() && rdep_->created) runnable = true;
} }
if (runnable) makeRunnable(rdep); if (runnable) makeRunnable(rdep);