From 01d848149c22a69a62eada5fedc2406c54d95ba8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 5 Apr 2019 09:41:18 +0200 Subject: Support for --dry-run|-n mode, perform update part --- build2/in/rule.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'build2/in/rule.cxx') diff --git a/build2/in/rule.cxx b/build2/in/rule.cxx index 2f8094d..a6d4f2c 100644 --- a/build2/in/rule.cxx +++ b/build2/in/rule.cxx @@ -179,6 +179,9 @@ namespace build2 // For now we assume this is ok since this is probably not very common // and it makes the overall logic simpler. // + // Note also that because updating the depdb essentially requires + // performing the substitutions, this rule ignored the dry-run mode. + // size_t dd_skip (0); // Number of "good" variable lines. if (update) @@ -260,7 +263,7 @@ namespace build2 else if (verb) text << program_ << ' ' << ip; - // Read and process the file, one line at a time. + // Read and process the file, one line at a time, while updating depdb. // const char* what; const path* whom; @@ -278,9 +281,11 @@ namespace build2 if (t.is_a ()) prm |= permissions::xu | permissions::xg | permissions::xo; - // Remove the existing file to make sure permissions take effect. + // Remove the existing file to make sure permissions take effect. If + // this fails then presumable writing to it will fail as well and we + // will complain there. // - rmfile (tp, 3 /* verbosity */); + try_rmfile (tp, true /* ignore_error */); what = "open"; whom = &tp; ofdstream ofs (fdopen (tp, -- cgit v1.1