diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-06-28 17:55:03 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-06-29 12:43:00 +0300 |
commit | ef12ccd4a1ad02e9078f6ecd96a37706b85e5cc2 (patch) | |
tree | 8bf5412c01a3ce0d8be892b8ff068cb215c594c5 | |
parent | 6f020aaefacd43706f80829ee77ba2ee26dcbf4b (diff) |
Add config.<pkg>.develop=false variable to configuration of main and external test packages in worker
-rw-r--r-- | bbot/worker/worker.cxx | 120 | ||||
-rw-r--r-- | doc/manual.cli | 7 | ||||
-rw-r--r-- | 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<string> 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.<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. + // 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 <env-config-args> <config-args> -- - // <pkg> <runtime-test>... + // { config.<pkg-name>.develop=false }+ <pkg> + // { config.<runtime-test-name>.develop=false }+ <runtime-test>... // 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.<pkg>.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.<pkg>.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 <env-config-args> <config-args> -- - // { <build-config> <env-config-args> <config-args> }+ <pkg> - // { <build-config> <env-config-args> <config-args> }+ { <runtime-test>... } + // { <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> }+ { <buildtime-test>... } + // { <target-config> <env-config-args> <config-args> config.<buildtime-test-name>.develop=false }+ <buildtime-test>... // // 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.<pkg>.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.<pkg>.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.<pkg>.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.<name>.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. |