diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-02-11 12:05:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-02-11 12:05:19 +0200 |
commit | 5278e39d58007b730e452a14d8e13aa93118e9f4 (patch) | |
tree | 18e1e2fe0a3cac3adf6c74c4e8118e89c59a8ed2 /libbuild2/dist/operation.cxx | |
parent | 364159d8d024a783db44cb0a5b81e94f87f10ef4 (diff) |
Add match_only flag to context
Diffstat (limited to 'libbuild2/dist/operation.cxx')
-rw-r--r-- | libbuild2/dist/operation.cxx | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/libbuild2/dist/operation.cxx b/libbuild2/dist/operation.cxx index cc16e9b..52031a3 100644 --- a/libbuild2/dist/operation.cxx +++ b/libbuild2/dist/operation.cxx @@ -145,55 +145,58 @@ namespace build2 values params; path_name pn ("<dist>"); const location loc (pn); // Dummy location. - - const operations& ops (rs->root_extra->operations); - - for (operations::size_type id (default_id + 1); // Skip default_id. - id < ops.size (); - ++id) { - if (const operation_info* oif = ops[id]) - { - // Skip aliases (e.g., update-for-install). In fact, one can argue - // the default update should be sufficient since it is assumed to - // update all prerequisites and we no longer support ad hoc stuff - // like test.input. Though here we are using the dist meta-operation, - // not perform. - // - if (oif->id != id) - continue; + auto mog = make_guard ([&ctx] () {ctx.match_only = false;}); + ctx.match_only = true; - // Use standard (perform) match. - // - if (oif->pre != nullptr) + const operations& ops (rs->root_extra->operations); + for (operations::size_type id (default_id + 1); // Skip default_id. + id < ops.size (); + ++id) + { + if (const operation_info* oif = ops[id]) { - if (operation_id pid = oif->pre (params, dist_id, loc)) + // Skip aliases (e.g., update-for-install). In fact, one can argue + // the default update should be sufficient since it is assumed to + // update all prerequisites and we no longer support ad hoc stuff + // like test.input. Though here we are using the dist meta- + // operation, not perform. + // + if (oif->id != id) + continue; + + // Use standard (perform) match. + // + if (oif->pre != nullptr) { - const operation_info* poif (ops[pid]); - ctx.current_operation (*poif, oif, false /* diag_noise */); - action a (dist_id, poif->id, oif->id); - match (params, a, ts, - 1 /* diag (failures only) */, - false /* progress */); + if (operation_id pid = oif->pre (params, dist_id, loc)) + { + const operation_info* poif (ops[pid]); + ctx.current_operation (*poif, oif, false /* diag_noise */); + action a (dist_id, poif->id, oif->id); + match (params, a, ts, + 1 /* diag (failures only) */, + false /* progress */); + } } - } - ctx.current_operation (*oif, nullptr, false /* diag_noise */); - action a (dist_id, oif->id); - match (params, a, ts, - 1 /* diag (failures only) */, - false /* progress */); + ctx.current_operation (*oif, nullptr, false /* diag_noise */); + action a (dist_id, oif->id); + match (params, a, ts, + 1 /* diag (failures only) */, + false /* progress */); - if (oif->post != nullptr) - { - if (operation_id pid = oif->post (params, dist_id)) + if (oif->post != nullptr) { - const operation_info* poif (ops[pid]); - ctx.current_operation (*poif, oif, false /* diag_noise */); - action a (dist_id, poif->id, oif->id); - match (params, a, ts, - 1 /* diag (failures only) */, - false /* progress */); + if (operation_id pid = oif->post (params, dist_id)) + { + const operation_info* poif (ops[pid]); + ctx.current_operation (*poif, oif, false /* diag_noise */); + action a (dist_id, poif->id, oif->id); + match (params, a, ts, + 1 /* diag (failures only) */, + false /* progress */); + } } } } |