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 ++++++++++++++++++++++++++++++++++++++----- doc/manual.cli | 7 +++ tests/integration/testscript | 29 +++++++++-- 3 files changed, 138 insertions(+), 18 deletions(-) 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 ()); } diff --git a/doc/manual.cli b/doc/manual.cli index 86b90ba..52cfc83 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -945,6 +945,13 @@ by always using the \c{bpkg.global.configure.build} prefix step id for global (as opposed to package-specific) \l{bpkg-pkg-build(1)} options. The \c{bpkg.global.configure.build} prefix id has no fallback ids. +Note finally that the worker adds the \c{config..develop=false} +configuration variables for the main and external test packages at the +\c{bpkg.configure.build} step to trigger their package skeleton creation and +loading. This makes sure that these packages can be used as dependencies of +dependents with configuration clauses. To keep the below listings concise, +these variables are not shown. + Worker script for \c{target} packages: \ diff --git a/tests/integration/testscript b/tests/integration/testscript index 2a49dfd..4b27b7f 100644 --- a/tests/integration/testscript +++ b/tests/integration/testscript @@ -60,7 +60,7 @@ rfp = yes #\ pkg = hello -ver = 1.0.0+6 +ver = 1.0.0+8 rep_url = "https://git.build2.org/hello/hello.git" rep_type = git rfp = yes @@ -68,7 +68,7 @@ rfp = yes #\ pkg = libstudxml -ver = 1.1.0-b.9.20210202082911.e729667b0f34 +ver = 1.1.0-b.10 rep_url = https://stage.build2.org/1 rep_type = pkg rfp = yes @@ -109,7 +109,7 @@ host='host: true' #\ pkg = curl -ver = 7.67.0+8 +ver = 7.76.0 rep_url = https://pkg.cppget.org/1/testing rep_type = pkg rfp = yes @@ -131,7 +131,7 @@ host='host: true' #\ pkg = libxsd -ver = 4.2.0-b.1.20211007072931.2239061347d1 +ver = 4.2.0-b.3.20220224113525.516981000564 rep_url = "https://git.codesynthesis.com/xsd/xsd.git#master" rep_type = git #rep_url = https://stage.build2.org/1 @@ -156,8 +156,18 @@ host='host: true' #\ #\ +pkg = odb +ver = 2.5.0-b.22.20220629083600.4a9af07ee566 +rep_url = "https://git.codesynthesis.com/odb/odb.git#master" +rep_type = git +rfp = yes +requires='requires: host' +host='host: true' +#\ + +#\ pkg = libcmark-gfm-extensions -ver = 0.29.0-a.1+7 +ver = 0.29.0-a.4 rep_url = https://stage.build2.org/1 rep_type = pkg rfp = yes @@ -172,6 +182,15 @@ rep_type = pkg rfp = yes #\ +#\ +pkg = fmt +ver = 8.1.1 +rep_url = "https://github.com/build2-packaging/fmt.git" +#rep_url = "git+file:/tmp/fmt#master" +rep_type = git +rfp = yes +#\ + # Note that we also need to make sure that the installed package libraries are # properly imported when configuring and running tests, and that the installed # executables are runnable. -- cgit v1.1