aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-11-01 11:50:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-11-01 11:50:08 +0200
commitd0d4486702b045852dca36008746afeb8754ae85 (patch)
treeb4f3930c8a64b4650a183c59257a43adc854da46 /libbuild2/algorithm.cxx
parent736c9f08b68b2735d85fe7eefdf2118de8b8c34e (diff)
Tighten/optimize cleaning of fsdir{} during match
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r--libbuild2/algorithm.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index 4ec4db5..1f2d88b 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -3137,7 +3137,14 @@ namespace build2
// Let's keep this as close to update_during_match() semantically as
// possible until we see a clear reason to deviate.
- assert (a == perform_clean_id);
+ // We have a problem with fsdir{}: if the directory is not empty because
+ // there are other targets that depend on it and we execute it here and
+ // now, it will not remove the directory (because it's not yet empty) but
+ // will cause the target to be in the executed state, which means that
+ // when other targets try to execute it, it will be a noop and the
+ // directory will be left behind.
+
+ assert (a == perform_clean_id && !t.is_a<fsdir> ());
target_state os (t.matched_state (a));
@@ -3194,6 +3201,8 @@ namespace build2
{
const target& pt (*p.target);
+ assert (!pt.is_a<fsdir> ()); // See above.
+
target_state os (pt.matched_state (a));
if (os != target_state::unchanged)