From b357284a323b86b96828e38dcb2d86b67f172de5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 12 Sep 2004 19:08:57 +0000 Subject: * Fallback didn't work for subderivations of an unnormalised the main derivation, since NormalisationGoal would first run a NormalisationGoal on the subderivation (a no-op, since in a situation where we need fallback the successor is known), and then runs a RealisationGoal on the normal form, which then cannot do a fallback because it doesn't know the derivation expression for which it is a normal form. Tossed out the 2-phase normalisation/realisation in NormalisationGoal and SubstitutionGoal since it's no longer needed - a RealisationGoal will run a NormalisationGoal if necessary. --- src/libstore/normalise.cc | 51 +++++++---------------------------------------- 1 file changed, 7 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc index bb05b49719..62ffb981c9 100644 --- a/src/libstore/normalise.cc +++ b/src/libstore/normalise.cc @@ -357,7 +357,6 @@ private: /* The states. */ void init(); void haveStoreExpr(); - void inputNormalised(); void inputRealised(); void tryToBuild(); void buildDone(); @@ -474,33 +473,11 @@ void NormalisationGoal::haveStoreExpr() } assert(expr.type == StoreExpr::neDerivation); - /* Inputs must be normalised before we can build this goal. */ + /* Inputs must be realised before we can build this goal. */ for (PathSet::iterator i = expr.derivation.inputs.begin(); i != expr.derivation.inputs.end(); ++i) - addWaitee(worker.makeNormalisationGoal(*i)); + addWaitee(worker.makeRealisationGoal(*i)); - state = &NormalisationGoal::inputNormalised; -} - - -void NormalisationGoal::inputNormalised() -{ - trace("all inputs normalised"); - - if (nrFailed != 0) { - printMsg(lvlError, - format("cannot normalise derivation `%1%': " - "%2% closure element(s) could not be normalised") - % nePath % nrFailed); - amDone(false); - return; - } - - /* Inputs must also be realised before we can build this goal. */ - for (PathSet::iterator i = expr.derivation.inputs.begin(); - i != expr.derivation.inputs.end(); ++i) - addWaitee(worker.makeRealisationGoal(queryNormalForm(*i))); - state = &NormalisationGoal::inputRealised; } @@ -1474,26 +1451,9 @@ void SubstitutionGoal::tryNext() sub = subs.front(); subs.pop_front(); - /* Normalise the substitute store expression. */ - nrFailed = 0; - addWaitee(worker.makeNormalisationGoal(sub.storeExpr)); - - state = &SubstitutionGoal::exprNormalised; -} - - -void SubstitutionGoal::exprNormalised() -{ - trace("substitute store expression normalised"); - - if (nrFailed != 0) { - tryNext(); - return; - } - /* Realise the substitute store expression. */ - nfSub = queryNormalForm(sub.storeExpr); - addWaitee(worker.makeRealisationGoal(nfSub)); + nrFailed = 0; + addWaitee(worker.makeRealisationGoal(sub.storeExpr)); state = &SubstitutionGoal::exprRealised; } @@ -1508,6 +1468,9 @@ void SubstitutionGoal::exprRealised() return; } + /* !!! the storeExpr doesn't have to be a derivation, right? */ + nfSub = queryNormalForm(sub.storeExpr); + state = &SubstitutionGoal::tryToRun; worker.waitForBuildSlot(shared_from_this()); } -- cgit 1.4.1