aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-configure.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-04-11 14:47:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-04-15 09:56:08 +0200
commit306ad185e8d8f50923316bdd1b68ef9a3b1e50e6 (patch)
treefc4c0ec62ee03af028889b7d5f12a94e5383df4b /bpkg/pkg-configure.hxx
parent8326e7f3b9f8a0dd4bf84cb96cc77652d03eed4c (diff)
Split package configuration into two passes in pkg-build
Diffstat (limited to 'bpkg/pkg-configure.hxx')
-rw-r--r--bpkg/pkg-configure.hxx75
1 files changed, 65 insertions, 10 deletions
diff --git a/bpkg/pkg-configure.hxx b/bpkg/pkg-configure.hxx
index 16ed96f..a7409b9 100644
--- a/bpkg/pkg-configure.hxx
+++ b/bpkg/pkg-configure.hxx
@@ -21,6 +21,14 @@ namespace bpkg
int
pkg_configure (const pkg_configure_options&, cli::scanner& args);
+ // Configure a system package and commit the transaction.
+ //
+ shared_ptr<selected_package>
+ pkg_configure_system (const package_name&,
+ const version&,
+ database&,
+ transaction&);
+
// The custom search function. If specified, it is called by pkg_configure()
// to obtain the database to search for the prerequisite in, instead of
// searching for it in the linked databases, recursively. If the function
@@ -31,7 +39,14 @@ namespace bpkg
const package_name&,
bool buildtime);
- // Configure the package, update its state, and commit the transaction.
+ // Given dependencies of a package, return its prerequisite packages,
+ // configuration variables that resulted from selection of these
+ // prerequisites (import, reflection, etc), and sources of the configuration
+ // variables resulted from evaluating the reflect clauses. See
+ // pkg_configure() for the semantics of the dependency list. Fail if for
+ // some of the dependency alternative lists there is no satisfactory
+ // alternative (all its dependencies are configured, satisfy the respective
+ // constraints, etc).
//
// The package dependency constraints are expected to be complete.
//
@@ -50,6 +65,54 @@ namespace bpkg
// dependency decisions" mode). Failed that, select an alternative as if no
// prerequisites are specified (the "make dependency decisions" mode).
//
+ struct configure_prerequisites_result
+ {
+ package_prerequisites prerequisites;
+ strings config_variables; // Note: name and value.
+
+ // Only contains sources of configuration variables collected using the
+ // package skeleton, excluding those user-specified variables which are
+ // not the project variables for the specified package (module
+ // configuration variables, etc). Thus, it is not parallel to the
+ // config_variables member.
+ //
+ vector<config_variable> config_sources; // Note: name and source.
+ };
+
+ // Return the "would be" state for packages that would be configured
+ // by this stage.
+ //
+ using find_package_state_function =
+ optional<pair<package_state, package_substate>> (
+ const shared_ptr<selected_package>&);
+
+ // Note: loads selected packages.
+ //
+ configure_prerequisites_result
+ pkg_configure_prerequisites (const common_options&,
+ database&,
+ transaction&,
+ const dependencies&,
+ const vector<size_t>* alternatives,
+ package_skeleton&&,
+ const vector<package_name>* prev_prerequisites,
+ bool simulate,
+ const function<find_database_function>&,
+ const function<find_package_state_function>&);
+
+ // Configure the package, update its state, and commit the transaction.
+ //
+ void
+ pkg_configure (const common_options&,
+ database&,
+ transaction&,
+ const shared_ptr<selected_package>&,
+ configure_prerequisites_result&&,
+ bool disfigured,
+ bool simulate);
+
+ // Note: loads selected packages.
+ //
void
pkg_configure (const common_options&,
database&,
@@ -58,18 +121,10 @@ namespace bpkg
const dependencies&,
const vector<size_t>* alternatives,
package_skeleton&&,
- const vector<package_name>* prerequisites,
+ const vector<package_name>* prev_prerequisites,
bool disfigured,
bool simulate,
const function<find_database_function>& = {});
-
- // Configure a system package and commit the transaction.
- //
- shared_ptr<selected_package>
- pkg_configure_system (const package_name&,
- const version&,
- database&,
- transaction&);
}
#endif // BPKG_PKG_CONFIGURE_HXX