about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-09-12T19·08+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-09-12T19·08+0000
commitb357284a323b86b96828e38dcb2d86b67f172de5 (patch)
treed938e80ed7e6ed292935a9a5a8578f055b4d2455
parentdcc433de47d4bf4a27fe63bc8996e946164ae885 (diff)
* 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.

-rw-r--r--src/libstore/normalise.cc51
1 files changed, 7 insertions, 44 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc
index bb05b4971902..62ffb981c9d9 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());
 }