diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-04-05 09:41:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-04-08 12:51:00 +0200 |
commit | 01d848149c22a69a62eada5fedc2406c54d95ba8 (patch) | |
tree | 66a3b59619f32f7f7244200f810f4d4cc9115ca5 /build2/in | |
parent | 3392226a2248b5cd93a899afb986917ce9e7ad74 (diff) |
Support for --dry-run|-n mode, perform update part
Diffstat (limited to 'build2/in')
-rw-r--r-- | build2/in/rule.cxx | 11 | ||||
-rw-r--r-- | build2/in/rule.hxx | 3 |
2 files changed, 11 insertions, 3 deletions
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<exe> ()) 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, diff --git a/build2/in/rule.hxx b/build2/in/rule.hxx index 001fc66..b3430c5 100644 --- a/build2/in/rule.hxx +++ b/build2/in/rule.hxx @@ -19,6 +19,9 @@ namespace build2 // Note that a derived rule can use the target data pad to cache data // (e.g., in match()) to be used in substitute/lookup() calls. // + // Note also that currently this rule ignores the dry-run mode (see + // perform_update() for the rationale). + // class rule: public build2::rule { public: |