about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-03-07T15·53+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-03-07T15·53+0000
commit917e06bf6398ed77a23e5e1fc894321a7fc7f86e (patch)
tree79f01c25d15b57a0a407ad1a6577f49652f04585
parentdf0283ae86afd1a40a83b2abc3705146ab0a6cb8 (diff)
* Delete the output paths before invoking the build hook.
-rw-r--r--src/libstore/build.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index bee046655071..368d5751fff1 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1262,6 +1262,20 @@ bool DerivationGoal::prepareBuild()
             % drvPath);
     }
 
+    /* If any of the outputs already exist but are not registered,
+       delete them. */
+    for (DerivationOutputs::iterator i = drv.outputs.begin(); 
+         i != drv.outputs.end(); ++i)
+    {
+        Path path = i->second.path;
+        if (store->isValidPath(path))
+            throw BuildError(format("obstructed build: path `%1%' exists") % path);
+        if (pathExists(path)) {
+            debug(format("removing unregistered path `%1%'") % path);
+            deletePathWrapped(path);
+        }
+    }
+
     /* Gather information necessary for computing the closure and/or
        running the build hook. */
     
@@ -1318,20 +1332,6 @@ void DerivationGoal::startBuilder()
             format("a `%1%' is required to build `%3%', but I am a `%2%'")
             % drv.platform % thisSystem % drvPath);
 
-    /* If any of the outputs already exist but are not registered,
-       delete them. */
-    for (DerivationOutputs::iterator i = drv.outputs.begin(); 
-         i != drv.outputs.end(); ++i)
-    {
-        Path path = i->second.path;
-        if (store->isValidPath(path))
-            throw BuildError(format("obstructed build: path `%1%' exists") % path);
-        if (pathExists(path)) {
-            debug(format("removing unregistered path `%1%'") % path);
-            deletePathWrapped(path);
-        }
-    }
-
     /* Construct the environment passed to the builder. */
     typedef map<string, string> Environment;
     Environment env;