From fafc5727732c7df2c98b123292f483411e0050e3 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 31 Jan 2022 12:24:28 +0300 Subject: Add support for bootstrap-build and root-build values in package manifest --- bpkg/package.hxx | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) (limited to 'bpkg/package.hxx') diff --git a/bpkg/package.hxx b/bpkg/package.hxx index 0c70328..db6b2b3 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -27,7 +27,7 @@ // #define DB_SCHEMA_VERSION_BASE 7 -#pragma db model version(DB_SCHEMA_VERSION_BASE, 14, closed) +#pragma db model version(DB_SCHEMA_VERSION_BASE, 15, closed) namespace bpkg { @@ -596,16 +596,23 @@ namespace bpkg // specified or evaluates to true. Note that the package argument is used // for diagnostics only. // - // @@ DEP We will also need to pass some additional information here for - // the actual evaluation (bootstrap/root buildfiles, reflect clauses of - // already selected dependency alternatives, etc). + // @@ DEP We will also need to pass some additional information here for the + // actual evaluation (reflect clauses of already selected dependency + // alternatives, etc). // bool - evaluate_enabled (const dependency_alternative&, const package_name&); + evaluate_enabled (const dependency_alternative&, + const string& bootstrap_build, + const optional& root_build, + const package_name&); // tests // #pragma db value(test_dependency) definition + + // @@ TMP Drop when database migration to the schema version 11 is no longer + // supported. + // #pragma db member(test_dependency::buildtime) default(false) using optional_test_dependency_type = optional; @@ -679,6 +686,14 @@ namespace bpkg small_vector tests; + // Note that while the bootstrap buildfile is always present for stub + // packages, we don't save bootstrap/root buildfiles for stubs of any kind + // (can come from repository, be based on system selected package, etc), + // leaving *_build as nullopt. + // + optional bootstrap_build; + optional root_build; + // Present for non-transient objects only (and only for certain repository // types). // @@ -689,14 +704,24 @@ namespace bpkg mutable optional system_version_; public: - // Note: version constraints must be complete. + // Note: version constraints must be complete and the bootstrap build must + // be present, unless this is a stub. // available_package (package_manifest&& m) : id (move (m.name), m.version), version (move (m.version)), dependencies (convert (move (m.dependencies))), tests (move (m.tests)), - sha256sum (move (m.sha256sum)) {} + sha256sum (move (m.sha256sum)) + { + if (!stub ()) + { + assert (m.bootstrap_build.has_value ()); + + bootstrap_build = move (m.bootstrap_build); + root_build = move (m.root_build); + } + } // Create available stub package. // @@ -785,6 +810,20 @@ namespace bpkg // #pragma db member(tests) id_column("") value_column("test_") + // *_build + // + // @@ TMP Drop when database migration to the schema version 15 is no + // longer supported. + // + // Note that since no real packages use conditional dependencies yet, + // we can just set bootstrap_build to the empty string during migration + // to the database schema version 15. Also we never rely on + // bootstrap_build to be nullopt for the stub packages, so let's not + // complicate things and set bootstrap_build to the empty string for + // them either. + // + #pragma db member(bootstrap_build) default("") + private: friend class odb::access; available_package () = default; -- cgit v1.1