summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-08-05 09:47:20 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-08-05 09:47:20 +0000
commitd6b6b2d3a83aa2afe3cae361954d8aa640fd77da (patch)
tree36aa76713ba1bdc932101202cd9ce0861f572ba5
parentd2e963f7a39cebcc4c937f9060763386d72ce4db (diff)
downloadguix-d6b6b2d3a83aa2afe3cae361954d8aa640fd77da.tar.gz
* Delete obstructed paths prior to building.
-rw-r--r--src/normalise.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/normalise.cc b/src/normalise.cc
index 3f138a53ea..2fa6f7f401 100644
--- a/src/normalise.cc
+++ b/src/normalise.cc
@@ -152,11 +152,20 @@ FSId normaliseFState(FSId id, FSIdSet pending)
 
     if (!fastBuild) {
 
-        /* Check that none of the outputs exist. */
+        /* If any of the outputs already exist but are not registered,
+           delete them. */
         for (OutPaths::iterator i = outPaths.begin(); 
              i != outPaths.end(); i++)
-            if (pathExists(i->first))
-                throw Error(format("path `%1%' exists") % i->first);
+        {
+            string path = i->first;
+            FSId id;
+            if (queryPathId(path, id))
+                throw Error(format("obstructed build: path `%1%' exists") % path);
+            if (pathExists(path)) {
+                debug(format("removing unregistered path `%1%'") % path);
+                deletePath(path);
+            }
+        }
 
         /* Run the builder. */
         msg(lvlChatty, format("building..."));