From 7b06ee81ab0e8a2199c4dce07ec67282c4f52f62 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 4 Apr 2023 08:05:21 +0200 Subject: Add support for installation filtering (GH issue #147) --- libbuild2/install/operation.hxx | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'libbuild2/install/operation.hxx') diff --git a/libbuild2/install/operation.hxx b/libbuild2/install/operation.hxx index 4983976..d71d8f3 100644 --- a/libbuild2/install/operation.hxx +++ b/libbuild2/install/operation.hxx @@ -4,15 +4,15 @@ #ifndef LIBBUILD2_INSTALL_OPERATION_HXX #define LIBBUILD2_INSTALL_OPERATION_HXX -#include -#include - #ifndef BUILD2_BOOTSTRAP # include #endif +#include +#include + #include -#include // auto_rmfile +#include // auto_rmfile, entry_type namespace build2 { @@ -22,10 +22,27 @@ namespace build2 extern const operation_info op_uninstall; extern const operation_info op_update_for_install; - // Set as context::current_inner_odata during the install inner operation. + using filters = vector>; + + // Set as context::current_inner_odata during the install/uninstall inner + // operations. // - struct install_context_data + struct context_data { + // Filters. + // + const install::filters* filters; + + // If entry type is a directory, then leaf must be empty. + // + static bool + filter (const scope& rs, + const dir_path& base, + const path& leaf, + entry_type); + + // Manifest. + // #ifndef BUILD2_BOOTSTRAP path manifest_file; // Absolute and normalized, empty if `-`. path_name manifest_name; // Original path/name. @@ -43,9 +60,6 @@ namespace build2 vector manifest_target_entries; #endif - explicit - install_context_data (const path* manifest); - // The following manifest_install_[dfl]() functions correspond to (and // are called from) file_rule::install_[dfl](). @@ -74,6 +88,11 @@ namespace build2 const path& link_target, const dir_path& dir, const path& link); + + // Constructor. + // + explicit + context_data (const install::filters*, const path* manifest); }; } } -- cgit v1.1