From ef12ccd4a1ad02e9078f6ecd96a37706b85e5cc2 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 28 Jun 2022 17:55:03 +0300 Subject: Add config..develop=false variable to configuration of main and external test packages in worker --- bbot/worker/worker.cxx | 120 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 107 insertions(+), 13 deletions(-) (limited to 'bbot') diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index ce62ae9..234e804 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -789,7 +789,7 @@ upload_manifest (tracer& trace, } } -static const string worker_checksum ("2"); // Logic version. +static const string worker_checksum ("3"); // Logic version. static int bbot:: build (size_t argc, const char* argv[]) @@ -1099,6 +1099,7 @@ build (size_t argc, const char* argv[]) const version& ver (tm.version); const string repo (tm.repository.string ()); const dir_path pkg_dir (pkg + '-' + ver.string ()); + const string pkg_var (tm.name.variable ()); // Specify the revision explicitly for the bpkg-build command not to end // up with a race condition building the latest revision rather than the @@ -1427,7 +1428,7 @@ build (size_t argc, const char* argv[]) optional bootstrap_import; if (bootstrap) - bootstrap_import = "!config.import." + tm.name.variable () + "=" + + bootstrap_import = "!config.import." + pkg_var + "=" + (rwd / main_pkg_conf).string (); // Configure. @@ -1934,6 +1935,11 @@ build (size_t argc, const char* argv[]) // // First, prepare the common and package arguments. // + // Add the config..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. + // strings common_args; strings pkg_args; @@ -1942,7 +1948,8 @@ build (size_t argc, const char* argv[]) // The overall command looks like this: // // bpkg build --configure-only -- - // ... + // { config..develop=false }+ + // { config..develop=false }+ ... // step_id s (step_id::bpkg_target_configure_build); step_id f1 (step_id::b_configure); @@ -1957,22 +1964,43 @@ 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 ()); + // @@ config..develop=false + // +#if 1 + pkg_args.push_back ("{"); + pkg_args.push_back ("config." + pkg_var + ".develop=false"); + pkg_args.push_back ("}+"); +#endif + pkg_args.push_back (pkg_rev); - // Add test dependency package constraints (for example 'bar > 1.0.0'). - // - for (auto t: runtime_tests) + for (const auto& t: runtime_tests) + { + // @@ config..develop=false + // +#if 1 + pkg_args.push_back ("{"); + pkg_args.push_back ("config." + + t.name.variable () + + ".develop=false"); + pkg_args.push_back ("}+"); +#endif + + // Add test dependency package constraints (for example + // 'bar > 1.0.0'). + // pkg_args.push_back (t.string ()); + } } else { // The overall command looks like this (but some parts may be omitted): // // bpkg build --configure-only -- - // { }+ - // { }+ { ... } + // { config..develop=false }+ + // { config..develop=false }+ ... // { }+ - // { }+ { ... } + // { config..develop=false }+ ... // // Add the main package args. @@ -2011,6 +2039,12 @@ 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 ()); + // @@ config..develop=false + // +#if 1 + pkg_args.push_back ("config." + pkg_var + ".develop=false"); +#endif + pkg_args.push_back ("}+"); pkg_args.push_back (pkg_rev); @@ -2018,6 +2052,34 @@ build (size_t argc, const char* argv[]) // Add the runtime test packages. // + // @@ config..develop=false + // +#if 1 + for (const auto& t: runtime_tests) + { + pkg_args.push_back ("{"); + + pkg_args.push_back ("--config-uuid"); + pkg_args.push_back (conf_uuid); + + pkg_args.push_back ("--checkout-root"); + pkg_args.push_back (dist_root.string ()); + + if (bootstrap_import) + pkg_args.push_back (*bootstrap_import); + + pkg_args.insert (pkg_args.end (), eas.begin (), eas.end ()); + pkg_args.insert (pkg_args.end (), cas.begin (), cas.end ()); + + pkg_args.push_back ("config." + + t.name.variable () + + ".develop=false"); + + pkg_args.push_back ("}+"); + + pkg_args.push_back (t.string ()); + } +#else if (has_runtime_tests) { pkg_args.push_back ("{"); @@ -2042,12 +2104,13 @@ build (size_t argc, const char* argv[]) if (runtime_tests.size () != 1) pkg_args.push_back ("{"); - for (auto t: runtime_tests) + for (const auto& t: runtime_tests) pkg_args.push_back (t.string ()); if (runtime_tests.size () != 1) pkg_args.push_back ("}"); } +#endif } // Add the main package configured in the install configuration and @@ -2090,6 +2153,36 @@ build (size_t argc, const char* argv[]) // Add the build-time test packages. // + // @@ config..develop=false + // +#if 1 + for (const auto& t: buildtime_tests) + { + pkg_args.push_back ("{"); + + pkg_args.push_back ("--config-uuid"); + pkg_args.push_back (target_uuid); + + pkg_args.push_back ("--checkout-root"); + pkg_args.push_back (dist_root.string ()); + + if (bootstrap_import) + pkg_args.push_back (*bootstrap_import); + + pkg_args.insert (pkg_args.end (), eas.begin (), eas.end ()); + pkg_args.insert (pkg_args.end (), cas.begin (), cas.end ()); + + pkg_args.push_back ("config." + + t.name.variable () + + ".develop=false"); + + pkg_args.push_back ("}+"); + + // Strip the build-time mark. + // + pkg_args.push_back (t.dependency::string ()); + } +#else if (has_buildtime_tests) { pkg_args.push_back ("{"); @@ -2116,12 +2209,13 @@ build (size_t argc, const char* argv[]) // Strip the build-time mark. // - for (auto t: buildtime_tests) + for (const auto& t: buildtime_tests) pkg_args.push_back (t.dependency::string ()); if (buildtime_tests.size () != 1) pkg_args.push_back ("}"); } +#endif } } @@ -3056,7 +3150,7 @@ build (size_t argc, const char* argv[]) if (og && runtime_tests.size () != 1) pkg_args.push_back ("{"); - for (auto t: runtime_tests) + for (const auto& t: runtime_tests) pkg_args.push_back (t.string ()); if (og && runtime_tests.size () != 1) @@ -3067,7 +3161,7 @@ build (size_t argc, const char* argv[]) { // Strip the build-time mark. // - for (auto t: buildtime_tests) + for (const auto& t: buildtime_tests) pkg_args.push_back (t.dependency::string ()); } -- cgit v1.1