diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-11-16 22:16:21 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-11-23 17:10:50 +0300 |
commit | f37129f4c6cc9e60f547fdfe0a28a984ddd8de73 (patch) | |
tree | fc11d149204a8f75a00298f609ad098d124f35e4 /bbot/worker/worker.cxx | |
parent | dc8b44e8d1354aa43f7aade825ad5a5f56bae1e8 (diff) |
Add support for package-config task manifest value
Diffstat (limited to 'bbot/worker/worker.cxx')
-rw-r--r-- | bbot/worker/worker.cxx | 490 |
1 files changed, 357 insertions, 133 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index 4b1a16d..0bf480f 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -17,7 +17,7 @@ #include <libbutl/b.hxx> #include <libbutl/pager.hxx> #include <libbutl/prompt.hxx> -#include <libbutl/utility.hxx> // to_utf8(), eof() +#include <libbutl/utility.hxx> // to_utf8(), eof(), alpha() #include <libbutl/timestamp.hxx> #include <libbutl/filesystem.hxx> #include <libbutl/string-parser.hxx> @@ -789,7 +789,7 @@ upload_manifest (tracer& trace, } } -static const string worker_checksum ("3"); // Logic version. +static const string worker_checksum ("4"); // Logic version. static int bbot:: build (size_t argc, const char* argv[]) @@ -936,9 +936,9 @@ build (size_t argc, const char* argv[]) // Parse configuration arguments. Report failures to the bbot controller. // - std::multimap<string, string> config_args; + std::multimap<string, string> tgt_args; - for (const string& c: tm.config) + for (const string& c: tm.target_config) { optional<pair<string, string>> v (parse_arg (c)); @@ -957,7 +957,7 @@ build (size_t argc, const char* argv[]) break; } - config_args.emplace (move (*v)); + tgt_args.emplace (move (*v)); } if (!rm.status) @@ -1113,6 +1113,105 @@ build (size_t argc, const char* argv[]) ver.effective_revision (), ver.iteration).string ()); + // Parse the build package configuration represented as a whitespace + // separated list of the following potentially quoted bpkg-pkg-build + // command arguments: + // + // <config-var>... ({ <config-var>... }+ ?[sys:]<pkg-name>[<version-spec>])... + // + // If the package configuration is specified, then parse it into the main + // package-specific configuration variables list and the dependency + // packages list, potentially with their own configuration variables. + // + strings pkg_config_vars; + vector<pair<string, strings>> pkg_config_deps; + + if (!tm.package_config.empty ()) + { + struct abort {}; + + auto fail = [&tm, &add_result, &fail_operation] (const string& d, + bool throw_abort = true) + { + fail_operation (add_result ("configure"), + "invalid package configuration: " + d + + "\n info: package configuration: '" + + tm.package_config + '\'', + result_status::abort); + + if (throw_abort) + throw abort (); + }; + + try + { + strings argsv (string_parser::parse_quoted (tm.package_config, + true /* unquote */)); + + cli::vector_scanner scanv (argsv); + cli::group_scanner args (scanv); + + while (args.more ()) + { + // Return true if the argument is a configuration variable. + // + auto var = [] (const string& a) + { + // Note: we need to be careful not to misinterpret + // '?libfoo == 1.0.0' as a variable. + // + return a.compare (0, 7, "config.") == 0 && + a.find ('=') != string::npos; + }; + + string a (args.next ()); + bool v (var (a)); + + // Fail if this is not a configuration variable nor a dependency. + // + if (v || a[0] == '?') + { + cli::scanner& ag (args.group ()); + + if (v) // Configuration variable. + { + if (ag.more ()) + fail ("unexpected options group for configuration variable '" + + a + '\''); + + pkg_config_vars.push_back (move (a)); + } + else // Dependency. + { + strings vars; + while (ag.more ()) + { + string da (ag.next ()); + if (!var (da)) + fail ("argument is not a configuration variable for " + "dependency " + a + ": '" + da + '\''); + + vars.push_back (move (da)); + } + + pkg_config_deps.push_back (make_pair (move (a), move (vars))); + } + } + else + fail ("not a configuration variable nor dependency: '" + a + '\''); + } + } + catch (const string_parser::invalid_string& e) + { + fail (e.what (), false /* throw_abort */); + break; + } + catch (const abort&) + { + break; + } + } + // Query the project's build system information with `b info`. // auto prj_info = [&trace] (const dir_path& d, @@ -1290,8 +1389,7 @@ build (size_t argc, const char* argv[]) size_t n (19); auto space = [] (char c) {return c == ' ' || c == '\t';}; - for (const char* a: - reverse_iterate (step_args (config_args, s, f1, f2))) + for (const char* a: reverse_iterate (step_args (tgt_args, s, f1, f2))) { if (strncmp (a, "config.install.root", n) == 0 && (a[n] == '=' || space (a[n]))) @@ -1461,7 +1559,7 @@ build (size_t argc, const char* argv[]) // // Create the target configuration. // - // bpkg create <env-modules> <env-config-args> <config-args> + // bpkg create <env-modules> <env-config-args> <tgt-config-args> // if (create_target) { @@ -1478,9 +1576,9 @@ build (size_t argc, const char* argv[]) "create", "-d", target_conf, !target_pkg ? cstrings ({"--uuid", target_uuid}) : cstrings (), - step_args (modules, s, f1, f2), - step_args (env_args, s, f1, f2), - step_args (config_args, s, f1, f2)); + step_args (modules, s, f1, f2), + step_args (env_args, s, f1, f2), + step_args (tgt_args, s, f1, f2)); if (!r.status) break; @@ -1501,7 +1599,7 @@ build (size_t argc, const char* argv[]) step_id f1 (step_id::b_create); step_id f2 (step_id::bpkg_create); - // bpkg create --type host <env-modules> <env-config-args> <config-args> + // bpkg create --type host <env-modules> <env-config-args> <tgt-config-args> // r.status |= run_bpkg ( b, @@ -1512,9 +1610,9 @@ build (size_t argc, const char* argv[]) "-d", host_conf, "--type", "host", "--uuid", host_uuid, - step_args (modules, s, f1, f2), - step_args (env_args, s, f1, f2), - step_args (config_args, s, f1, f2)); + step_args (modules, s, f1, f2), + step_args (env_args, s, f1, f2), + step_args (tgt_args, s, f1, f2)); if (!r.status) break; @@ -1522,7 +1620,7 @@ build (size_t argc, const char* argv[]) // Create the install configuration. // - // bpkg create <env-modules> <env-config-args> <config-args> + // bpkg create <env-modules> <env-config-args> <tgt-config-args> // if (create_install) { @@ -1538,9 +1636,9 @@ build (size_t argc, const char* argv[]) "create", "-d", install_conf, "--uuid", install_uuid, - step_args (modules, s, f1, f2), - step_args (env_args, s, f1, f2), - step_args (config_args, s, f1, f2)); + step_args (modules, s, f1, f2), + step_args (env_args, s, f1, f2), + step_args (tgt_args, s, f1, f2)); if (!r.status) break; @@ -1591,15 +1689,15 @@ build (size_t argc, const char* argv[]) // Create the module configuration. // { - // b create(<dir>) config.config.load=~build2 [<env-config-args> <config-args>] + // b create(<dir>) config.config.load=~build2 [<env-config-args> <tgt-config-args>] // // Note also that we suppress warnings about unused config.* values. // - // What if a module wants to use CLI? The current thinking is that we - // will be "whitelisting" base (i.e., those that can plausibly be used - // by multiple modules) libraries and tools for use by build system - // modules. So if and when we whitelist CLI, we will add it here, next - // to cc. + // What if a module wants to use CLI? The current thinking is that + // we will be "whitelisting" base (i.e., those that can plausibly be + // used by multiple modules) libraries and tools for use by build + // system modules. So if and when we whitelist CLI, we will add it + // here, next to cc. // string mods; cstrings eas; @@ -1617,8 +1715,8 @@ build (size_t argc, const char* argv[]) mods += m; } - eas = step_args (env_args, s); - cas = step_args (config_args, s); + eas = step_args (env_args, s); + cas = step_args (tgt_args, s); } else mods = "cc"; @@ -1669,7 +1767,7 @@ build (size_t argc, const char* argv[]) mods += m; } - // b create(<dir>) config.config.load=~build2 [<env-config-args> <config-args>] + // b create(<dir>) config.config.load=~build2 [<env-config-args> <tgt-config-args>] // r.status |= run_b ( b, @@ -1679,8 +1777,8 @@ build (size_t argc, const char* argv[]) "create(" + install_conf.representation () + ',' + mods + ')', "config.config.load=~build2", "config.config.persist+='config.*'@unused=drop", - step_args (env_args, s), - step_args (config_args, s)); + step_args (env_args, s), + step_args (tgt_args, s)); if (!r.status) break; @@ -1799,7 +1897,7 @@ build (size_t argc, const char* argv[]) // configuration for external build-time tests, if any, and the install // configuration, if present. // - // bpkg add <env-config-args> <config-args> <repository-url> + // bpkg add <env-config-args> <tgt-config-args> <repository-url> // { step_id b (step_id::bpkg_configure_add); @@ -1812,15 +1910,15 @@ build (size_t argc, const char* argv[]) "-v", "add", "-d", main_pkg_conf, - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), repo); if (!r.status) break; } - // bpkg fetch <env-config-args> <config-args> <trust-options> + // bpkg fetch <env-config-args> <tgt-config-args> <trust-options> // { step_id b (step_id::bpkg_configure_fetch); @@ -1833,8 +1931,8 @@ build (size_t argc, const char* argv[]) "-v", "fetch", "-d", main_pkg_conf, - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), trust_ops); if (!r.status) @@ -1843,7 +1941,7 @@ build (size_t argc, const char* argv[]) if (create_install) { - // bpkg add <env-config-args> <config-args> <repository-url> + // bpkg add <env-config-args> <tgt-config-args> <repository-url> // { step_id b (step_id::bpkg_configure_add); @@ -1856,15 +1954,15 @@ build (size_t argc, const char* argv[]) "-v", "add", "-d", install_conf, - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), repo); if (!r.status) break; } - // bpkg fetch <env-config-args> <config-args> <trust-options> + // bpkg fetch <env-config-args> <tgt-config-args> <trust-options> // { step_id b (step_id::bpkg_configure_fetch); @@ -1877,8 +1975,8 @@ build (size_t argc, const char* argv[]) "-v", "fetch", "-d", install_conf, - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), trust_ops); if (!r.status) @@ -1888,7 +1986,7 @@ build (size_t argc, const char* argv[]) if (has_buildtime_tests) { - // bpkg add <env-config-args> <config-args> <repository-url> + // bpkg add <env-config-args> <tgt-config-args> <repository-url> // { step_id b (step_id::bpkg_configure_add); @@ -1901,15 +1999,15 @@ build (size_t argc, const char* argv[]) "-v", "add", "-d", target_conf, - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), repo); if (!r.status) break; } - // bpkg fetch <env-config-args> <config-args> <trust-options> + // bpkg fetch <env-config-args> <tgt-config-args> <trust-options> // { step_id b (step_id::bpkg_configure_fetch); @@ -1922,8 +2020,8 @@ build (size_t argc, const char* argv[]) "-v", "fetch", "-d", target_conf, - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), trust_ops); if (!r.status) @@ -1935,28 +2033,48 @@ build (size_t argc, const char* argv[]) // // First, prepare the common and package arguments. // - // Add the config.<pkg>.develop=false variables for the main and - // external test packages to trigger their package skeleton creation and - // loading. This way we make sure that these packages can be used as - // dependencies of dependents with configuration clauses. + // If no variables are specified in the package configuration, then add + // the config.<pkg>.develop=false variable for the main package instead + // to trigger its package skeleton creation and loading. Also add this + // variable for the external test packages for the same purpose. This + // way we make sure that these packages can be used as dependencies of + // dependents with configuration clauses. + // + // Also add the dependency packages specified in the package + // configuration, if any, to configurations where the main package is + // being configured. + // + // Should we also add the dependency packages to configurations where + // the test packages are being configured? It feels like we shouldn't. + // Moreover, in the future we may decide to support specifying tests + // package configuration in the tests manifest value or some such. In + // this case a test package may have its own dependencies to be + // configured. What we could probably do now, is to never share a bpkg + // configuration between the main package and the tests packages if we + // configure any dependencies in it. Note that such dependencies may + // potentially be unsatisfactory for the test packages (unsatisfactory + // version, etc). This, however, seems rather far fetched so let's keep + // it simple for now. // strings common_args; strings pkg_args; if (target_pkg) // The simple common case (see above)? { - // The overall command looks like this: + // The overall command looks like this (but some parts may be omitted): // - // bpkg build --configure-only <env-config-args> <config-args> -- - // { config.<pkg-name>.develop=false }+ <pkg> - // { config.<runtime-test-name>.develop=false }+ <runtime-test>... + // bpkg build --configure-only <env-config-args> <tgt-config-args> -- + // { <pkg-config-vars>|config.<pkg-name>.develop=false }+ <pkg> + // { config.<runtime-test-name>.develop=false }+ <runtime-test>... + // { <dep-config-vars> }+ <dep>... + // <dep>... // step_id s (step_id::bpkg_target_configure_build); step_id f1 (step_id::b_configure); step_id f2 (step_id::bpkg_configure_build); - cstrings eas (step_args (env_args, s, f1, f2)); - cstrings cas (step_args (config_args, s, f1, f2)); + cstrings eas (step_args (env_args, s, f1, f2)); + cstrings cas (step_args (tgt_args, s, f1, f2)); common_args.push_back ("--checkout-root"); common_args.push_back (dist_root.string ()); @@ -1964,16 +2082,29 @@ build (size_t argc, const char* argv[]) common_args.insert (common_args.end (), eas.begin (), eas.end ()); common_args.insert (common_args.end (), cas.begin (), cas.end ()); + // Add the main package. + // + pkg_args.push_back ("{"); + // @@ config.<pkg>.develop=false // + // Only add the config.<pkg>.develop variable if there are no package + // configuration variables specified. + // + if (!pkg_config_vars.empty ()) + pkg_args.insert (pkg_args.end (), + pkg_config_vars.begin (), pkg_config_vars.end ()); #if 1 - pkg_args.push_back ("{"); - pkg_args.push_back ("config." + pkg_var + ".develop=false"); - pkg_args.push_back ("}+"); + else + pkg_args.push_back ("config." + pkg_var + ".develop=false"); #endif + pkg_args.push_back ("}+"); + pkg_args.push_back (pkg_rev); + // Add the runtime test packages. + // for (const auto& t: runtime_tests) { // @@ config.<pkg>.develop=false @@ -1991,17 +2122,37 @@ build (size_t argc, const char* argv[]) // pkg_args.push_back (t.string ()); } + + // Add the main package dependencies. + // + for (const pair<string, strings>& d: pkg_config_deps) + { + if (!d.second.empty ()) + { + pkg_args.push_back ("{"); + pkg_args.insert (pkg_args.end (), d.second.begin (), d.second.end ()); + pkg_args.push_back ("}+"); + } + + pkg_args.push_back (d.first); + } } else { // The overall command looks like this (but some parts may be omitted): // - // bpkg build --configure-only <env-config-args> <config-args> -- - // { <build-config> <env-config-args> <config-args> config.<pkg-name>.develop=false }+ <pkg> - // { <build-config> <env-config-args> <config-args> config.<runtime-test-name>.develop=false }+ <runtime-test>... - // { <install-config> <env-config-args> <config-args> }+ <pkg> - // { <target-config> <env-config-args> <config-args> config.<buildtime-test-name>.develop=false }+ <buildtime-test>... + // bpkg build --configure-only <env-config-args> <tgt-config-args> -- + // { <build-config> <env-config-args> <tgt-config-args> <pkg-config-vars>|config.<pkg-name>.develop=false }+ <pkg> + // { <build-config> <env-config-args> <tgt-config-args> config.<runtime-test-name>.develop=false }+ <runtime-test>... + // { <install-config> <env-config-args> <tgt-config-args> <pkg-config-vars> }+ <pkg> + // { <target-config> <env-config-args> <tgt-config-args> config.<buildtime-test-name>.develop=false }+ <buildtime-test>... + // { <build-config> <install-config> <dep-config-vars> }+ <dep>... + // { <build-config> <install-config> }+ { <dep>... } + // + + // Main package configuration name. // + const char* conf_uuid (host_pkg ? host_uuid : module_uuid); // Add the main package args. // @@ -2016,14 +2167,8 @@ build (size_t argc, const char* argv[]) step_id f1 (step_id::b_configure); step_id f2 (step_id::bpkg_configure_build); - cstrings eas (step_args (env_args, s, f1, f2)); - cstrings cas (step_args (config_args, s, f1, f2)); - - // Main package configuration name. - // - const char* conf_uuid (target_pkg ? target_uuid : - host_pkg ? host_uuid : - module_uuid); + cstrings eas (step_args (env_args, s, f1, f2)); + cstrings cas (step_args (tgt_args, s, f1, f2)); // Add the main package. // @@ -2041,8 +2186,15 @@ build (size_t argc, const char* argv[]) // @@ config.<pkg>.develop=false // + // Only add the config.<pkg>.develop variable if there are no + // package configuration variables specified. + // + if (!pkg_config_vars.empty ()) + pkg_args.insert (pkg_args.end (), + pkg_config_vars.begin (), pkg_config_vars.end ()); #if 1 - pkg_args.push_back ("config." + pkg_var + ".develop=false"); + else + pkg_args.push_back ("config." + pkg_var + ".develop=false"); #endif pkg_args.push_back ("}+"); @@ -2114,15 +2266,15 @@ build (size_t argc, const char* argv[]) } // Add the main package configured in the install configuration and - // the external build-time test packages + // the external build-time test packages. // { step_id s (step_id::bpkg_target_configure_build); step_id f1 (step_id::b_configure); step_id f2 (step_id::bpkg_configure_build); - cstrings eas (step_args (env_args, s, f1, f2)); - cstrings cas (step_args (config_args, s, f1, f2)); + cstrings eas (step_args (env_args, s, f1, f2)); + cstrings cas (step_args (tgt_args, s, f1, f2)); // Add the main package. // @@ -2146,6 +2298,9 @@ build (size_t argc, const char* argv[]) pkg_args.insert (pkg_args.end (), eas.begin (), eas.end ()); pkg_args.insert (pkg_args.end (), cas.begin (), cas.end ()); + pkg_args.insert (pkg_args.end (), + pkg_config_vars.begin (), pkg_config_vars.end ()); + pkg_args.push_back ("}+"); pkg_args.push_back (pkg_rev); @@ -2217,6 +2372,69 @@ build (size_t argc, const char* argv[]) } #endif } + + // Add the main package dependencies to those configurations where + // the main package is configured. + // + { + // Add dependencies which have some configuration variables + // specified and count the number of others. + // + size_t no_vars (0); + for (const pair<string, strings>& d: pkg_config_deps) + { + if (!d.second.empty ()) + { + pkg_args.push_back ("{"); + + pkg_args.push_back ("--config-uuid"); + pkg_args.push_back (conf_uuid); + + if (create_install) + { + pkg_args.push_back ("--config-uuid"); + pkg_args.push_back (install_uuid); + } + + pkg_args.insert (pkg_args.end (), d.second.begin (), d.second.end ()); + pkg_args.push_back ("}+"); + + pkg_args.push_back (d.first); + } + else + ++no_vars; + } + + // Add dependencies which have no configuration variables specified. + // + if (no_vars != 0) + { + pkg_args.push_back ("{"); + + pkg_args.push_back ("--config-uuid"); + pkg_args.push_back (conf_uuid); + + if (create_install) + { + pkg_args.push_back ("--config-uuid"); + pkg_args.push_back (install_uuid); + } + + pkg_args.push_back ("}+"); + + if (no_vars != 1) + pkg_args.push_back ("{"); + + for (const pair<string, strings>& d: pkg_config_deps) + { + if (d.second.empty ()) + pkg_args.push_back (d.first); + } + + if (no_vars != 1) + pkg_args.push_back ("}"); + } + } } // Finally, configure all the packages. @@ -2238,8 +2456,8 @@ build (size_t argc, const char* argv[]) tm.dependency_checksum ? *tm.dependency_checksum : "", "--yes", "-d", root_conf, - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), common_args, "--", pkg_args); @@ -2344,7 +2562,7 @@ build (size_t argc, const char* argv[]) change_wd (trace, &r.log, rwd / main_pkg_conf); - // bpkg update <env-config-args> <config-args> <package-name> + // bpkg update <env-config-args> <tgt-config-args> <package-name> // step_id b (step_id::bpkg_update); step_id s (step_id::bpkg_update); @@ -2355,8 +2573,8 @@ build (size_t argc, const char* argv[]) bkp_step, bkp_status, last_cmd, "-v", "update", - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), pkg); if (!r.status) @@ -2379,7 +2597,7 @@ build (size_t argc, const char* argv[]) // auto test = [&trace, &wre, &bkp_step, &bkp_status, &last_cmd, - &step_args, &config_args, &env_args, + &step_args, &tgt_args, &env_args, &bootstrap_import, &redist] (operation_result& r, @@ -2440,7 +2658,7 @@ build (size_t argc, const char* argv[]) // Update. // - // bpkg update <env-config-args> <config-args> <package-name> + // bpkg update <env-config-args> <tgt-config-args> <package-name> // { step_id b (installed @@ -2458,8 +2676,8 @@ build (size_t argc, const char* argv[]) bkp_step, bkp_status, last_cmd, "-v", "update", - step_args (env_args, s, f), - step_args (config_args, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f), import, pkg); @@ -2472,7 +2690,7 @@ build (size_t argc, const char* argv[]) // Note that we assume that the package supports the test operation // since this is its main purpose. // - // bpkg test <env-config-args> <config-args> <package-name> + // bpkg test <env-config-args> <tgt-config-args> <package-name> // { step_id b (installed @@ -2491,8 +2709,8 @@ build (size_t argc, const char* argv[]) "-v", "test", "--package-cwd", // See above for details. - step_args (env_args, s, f), - step_args (config_args, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f), import, pkg); @@ -2532,7 +2750,7 @@ build (size_t argc, const char* argv[]) // much sense, thus we don't pass the config.import.* variable on // the command line for modules that require bootstrap. // - // bpkg test <env-config-args> <config-args> <package-name> + // bpkg test <env-config-args> <tgt-config-args> <package-name> // step_id b (step_id::bpkg_test); step_id s (step_id::bpkg_test); @@ -2544,8 +2762,8 @@ build (size_t argc, const char* argv[]) "-v", "test", "--package-cwd", - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), pkg); if (!r.status) @@ -2614,7 +2832,7 @@ build (size_t argc, const char* argv[]) if (!target_pkg && create_target) rm_r (trace, &r.log, rwd / target_conf); - // bpkg install <env-config-args> <config-args> <package-name> + // bpkg install <env-config-args> <tgt-config-args> <package-name> // step_id b (step_id::bpkg_install); step_id s (step_id::bpkg_install); @@ -2625,8 +2843,8 @@ build (size_t argc, const char* argv[]) bkp_step, bkp_status, last_cmd, "-v", "install", - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), pkg); if (!r.status) @@ -2699,7 +2917,7 @@ build (size_t argc, const char* argv[]) { // Create the configuration. // - // b create(<dir>, <env-modules>) <env-config-args> <config-args> + // b create(<dir>, <env-modules>) <env-config-args> <tgt-config-args> // // Amalgamation directory that will contain configuration subdirectory // for package tests out of source tree build. @@ -2725,8 +2943,8 @@ build (size_t argc, const char* argv[]) bkp_step, bkp_status, last_cmd, "-V", "create('" + out_dir.representation () + '\'' + mods + ')', - step_args (env_args, s, f), - step_args (config_args, s, f)); + step_args (env_args, s, f), + step_args (tgt_args, s, f)); if (!r.status) break; @@ -2735,11 +2953,16 @@ build (size_t argc, const char* argv[]) // Configure testable subprojects sequentially and test/build in // parallel afterwards. // + // It feels right to configure internal tests also passing the main + // package configuration variables, since they may need to align with + // the main package setup (enable some testscripts, etc). + // strings test_specs; for (const dir_path& d: subprj_dirs) { // b configure(<subprj-src-dir>@<subprj-out-dir>) <env-config-args> - // <config-args> + // <tgt-config-args> + // <pkg-vars> // step_id b (step_id::b_test_installed_configure); step_id s (step_id::b_test_installed_configure); @@ -2760,8 +2983,9 @@ build (size_t argc, const char* argv[]) "configure('" + subprj_src_dir.representation () + "'@'" + subprj_out_dir.representation () + "')", - step_args (env_args, s, f), - step_args (config_args, s, f)); + step_args (env_args, s, f), + step_args (tgt_args, s, f), + pkg_config_vars); if (!r.status) break; @@ -2775,7 +2999,7 @@ build (size_t argc, const char* argv[]) // Build/test subprojects. // - // b test(<subprj-out-dir>)... <env-config-args> <config-args> + // b test(<subprj-out-dir>)... <env-config-args> <tgt-config-args> // { step_id b (step_id::b_test_installed_test); @@ -2788,8 +3012,8 @@ build (size_t argc, const char* argv[]) bkp_step, bkp_status, last_cmd, "-v", test_specs, - step_args (env_args, s), - step_args (config_args, s)); + step_args (env_args, s), + step_args (tgt_args, s)); if (!r.status) break; @@ -2842,7 +3066,7 @@ build (size_t argc, const char* argv[]) // Create the target configuration. // - // bpkg create <env-modules> <env-config-args> <config-args> + // bpkg create <env-modules> <env-config-args> <tgt-config-args> // if (create_target) { @@ -2874,9 +3098,9 @@ build (size_t argc, const char* argv[]) "-V", "create", "-d", target_conf, - step_args (modules, s, f), - step_args (env_args, s, f), - step_args (config_args, s, f)); + step_args (modules, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f)); if (!r.status) break; @@ -2886,7 +3110,7 @@ build (size_t argc, const char* argv[]) // if (create_host) { - // bpkg create --type host <env-modules> <env-config-args> <config-args> + // bpkg create --type host <env-modules> <env-config-args> <tgt-config-args> // step_id b (step_id::bpkg_test_separate_installed_create); @@ -2910,9 +3134,9 @@ build (size_t argc, const char* argv[]) "-d", host_conf, "--type", "host", "--name", "host", - step_args (modules, s, f), - step_args (env_args, s, f), - step_args (config_args, s, f)); + step_args (modules, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f)); if (!r.status) break; @@ -3022,7 +3246,7 @@ build (size_t argc, const char* argv[]) // if (has_runtime_tests) { - // bpkg add <env-config-args> <config-args> <repository-url> + // bpkg add <env-config-args> <tgt-config-args> <repository-url> // { step_id b (step_id::bpkg_test_separate_installed_configure_add); @@ -3036,15 +3260,15 @@ build (size_t argc, const char* argv[]) "-v", "add", "-d", runtime_tests_conf, - step_args (env_args, s, f), - step_args (config_args, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f), repo); if (!r.status) break; } - // bpkg fetch <env-config-args> <config-args> <trust-options> + // bpkg fetch <env-config-args> <tgt-config-args> <trust-options> // { step_id b (step_id::bpkg_test_separate_installed_configure_fetch); @@ -3058,8 +3282,8 @@ build (size_t argc, const char* argv[]) "-v", "fetch", "-d", runtime_tests_conf, - step_args (env_args, s, f), - step_args (config_args, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f), trust_ops); if (!r.status) @@ -3069,7 +3293,7 @@ build (size_t argc, const char* argv[]) if (has_buildtime_tests) { - // bpkg add <env-config-args> <config-args> <repository-url> + // bpkg add <env-config-args> <tgt-config-args> <repository-url> // { step_id b (step_id::bpkg_test_separate_installed_configure_add); @@ -3083,15 +3307,15 @@ build (size_t argc, const char* argv[]) "-v", "add", "-d", target_conf, - step_args (env_args, s, f), - step_args (config_args, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f), repo); if (!r.status) break; } - // bpkg fetch <env-config-args> <config-args> <trust-options> + // bpkg fetch <env-config-args> <tgt-config-args> <trust-options> // { step_id b (step_id::bpkg_test_separate_installed_configure_fetch); @@ -3105,8 +3329,8 @@ build (size_t argc, const char* argv[]) "-v", "fetch", "-d", target_conf, - step_args (env_args, s, f), - step_args (config_args, s, f), + step_args (env_args, s, f), + step_args (tgt_args, s, f), trust_ops); if (!r.status) @@ -3116,7 +3340,7 @@ build (size_t argc, const char* argv[]) // Configure all the packages using a single bpkg-pkg-build command. // - // bpkg build --configure-only <env-config-args> <config-args> + // bpkg build --configure-only <env-config-args> <tgt-config-args> // { <config> }+ { <runtime-test>... } // <buildtime-test>... // ?sys:<pkg> @@ -3194,10 +3418,10 @@ build (size_t argc, const char* argv[]) "--checkout-root", dist_installed_root, "--yes", "-d", root_conf, - step_args (env_args, g), - step_args (env_args, s, f), - step_args (config_args, g), - step_args (config_args, s, f), + step_args (env_args, g), + step_args (env_args, s, f), + step_args (tgt_args, g), + step_args (tgt_args, s, f), "--", pkg_args); @@ -3252,7 +3476,7 @@ build (size_t argc, const char* argv[]) change_wd (trace, &r.log, install_conf); - // bpkg uninstall <env-config-args> <config-args> <package-name> + // bpkg uninstall <env-config-args> <tgt-config-args> <package-name> // step_id b (step_id::bpkg_uninstall); step_id s (step_id::bpkg_uninstall); @@ -3263,8 +3487,8 @@ build (size_t argc, const char* argv[]) bkp_step, bkp_status, last_cmd, "-v", "uninstall", - step_args (env_args, s), - step_args (config_args, s), + step_args (env_args, s), + step_args (tgt_args, s), pkg); if (!r.status) |