From ab8a3a6c226e047afeda08423ff5d8873631314d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 4 Apr 2023 14:46:54 +0300 Subject: Configure system dependencies from build package configuration globally in worker --- bbot/worker/worker.cxx | 80 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 18 deletions(-) (limited to 'bbot') diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index f1e5e8c..3367aaa 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -1109,20 +1109,23 @@ build (size_t argc, const char* argv[]) // If the package configuration is specified, then parse it into the // prefixed global options and configuration variables map, unprefixed // global options list, the main package-specific configuration variables - // list, and the dependency packages list, potentially with their own - // configuration variables (but not options). The prefixed arguments are - // added to the command lines at the corresponding steps after potential - // environment and target configuration arguments. Unprefixed arguments - // are added to the bpkg-pkg-build command line at the - // bpkg.configure.build step. Specifically, the unprefixed global options - // are specified after all the prefixed global options and the unprefixed - // variables are specified for the main package only, wherever it is - // configured. + // list, the main package-specific dependency packages list (only + // configured where the main package is configured), potentially with + // their own configuration variables (but not options), and the global + // system dependency packages list (configured in all configurations). The + // prefixed arguments are added to the command lines at the corresponding + // steps after potential environment and target configuration arguments. + // Unprefixed arguments are added to the bpkg-pkg-build command line at + // the bpkg.configure.build step. Specifically, the unprefixed global + // options are specified after all the prefixed global options and the + // unprefixed variables are specified for the main package only, wherever + // it is configured. // std::multimap pkg_args; strings pkg_config_opts; strings pkg_config_vars; - vector> pkg_config_deps; + vector> pkg_config_main_deps; // ?, sys: + vector> pkg_config_glob_deps; // ?sys: if (!tm.package_config.empty ()) { @@ -1251,7 +1254,35 @@ build (size_t argc, const char* argv[]) vars.push_back (move (da)); } - pkg_config_deps.push_back (make_pair (move (a), move (vars))); + // Add the system dependency packages (prefixed with `?sys:`) to + // a separate list, to specify them globally on the + // bpkg-pkg-build command line for configuring them in all the + // (being) created configurations. + // + // Note, though, that we will handle the build-to-hold system + // packages (prefixed with `sys:`) in the same way as non system + // dependencies, since such an auto-configuration is only + // supported by bpkg-pkg-build for system dependencies. In the + // future, we may support that on the bbot worker level by, for + // example, specifying all the configurations manually for the + // build-to-hold system packages and also specifying them as a + // system dependencies globally. We need to be careful to make + // sure that these dependencies are also auto-configured for the + // private configurations potentially created by bpkg-pkg-build. + // + // Also note that in the future we may allow dependency-specific + // --config-uuid options to only configure such dependencies in + // the specified configurations. We may also invent the special + // 00000000-0000-0000-0000-000000000005 configuration id to, for + // example, only configure them at the + // bpkg.test-separate-installed.configure.build step. + // + if (a.compare (0, 5, "?sys:") != 0) + pkg_config_main_deps.push_back (make_pair (move (a), + move (vars))); + else + pkg_config_glob_deps.push_back (make_pair (move (a), + move (vars))); } } else @@ -2276,8 +2307,9 @@ build (size_t argc, const char* argv[]) // -- // { |config..develop=false }+ // { config..develop=false }+ ... - // { }+ ... - // ... + // { }+ ... + // ... + // ... // step_id s (step_id::bpkg_target_configure_build); step_id f1 (step_id::b_configure); @@ -2335,7 +2367,7 @@ build (size_t argc, const char* argv[]) // Add the main package dependencies. // - for (const pair& d: pkg_config_deps) + for (const pair& d: pkg_config_main_deps) { if (!d.second.empty ()) { @@ -2376,8 +2408,9 @@ build (size_t argc, const char* argv[]) // // config..develop=false }+ ... // - // { }+ ... - // { }+ { ... } + // { }+ ... + // { }+ { ... } + // ... // // Main package configuration name. @@ -2615,7 +2648,7 @@ build (size_t argc, const char* argv[]) // specified and count the number of others. // size_t no_vars (0); - for (const pair& d: pkg_config_deps) + for (const pair& d: pkg_config_main_deps) { if (!d.second.empty ()) { @@ -2660,7 +2693,7 @@ build (size_t argc, const char* argv[]) if (no_vars != 1) pkgs.push_back ("{"); - for (const pair& d: pkg_config_deps) + for (const pair& d: pkg_config_main_deps) { if (d.second.empty ()) pkgs.push_back (d.first); @@ -2672,6 +2705,11 @@ build (size_t argc, const char* argv[]) } } + // Add the global system dependencies. + // + for (const pair& d: pkg_config_glob_deps) + pkgs.push_back (d.first); + // Finally, configure all the packages. // { @@ -3729,6 +3767,7 @@ build (size_t argc, const char* argv[]) // { }+ { ... } // ... // ?sys: + // ... // strings pkgs; @@ -3776,6 +3815,11 @@ build (size_t argc, const char* argv[]) pkgs.push_back ("?sys:" + pkg_rev); + // Add the global system dependencies. + // + for (const pair& d: pkg_config_glob_deps) + pkgs.push_back (d.first); + // Finally, configure all the test packages. // { -- cgit v1.1