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 ++++++++++++++++++++++++++++++++++---------- doc/manual.cli | 24 +++++++++---- tests/integration/testscript | 15 ++++++--- 3 files changed, 89 insertions(+), 30 deletions(-) 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. // { diff --git a/doc/manual.cli b/doc/manual.cli index b50ad77..8b64687 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -1031,8 +1031,9 @@ bpkg -v build --configure-only \\ [{ }+] / \\ [[ ]...] \\ [([{ }+] \\ - (?[sys:]|sys:) \\ - [])...] + (?|sys:) \\ + [])...] \\ + [?sys:[ ]...] # bpkg.update # @@ -1117,7 +1118,8 @@ bpkg -v update bpkg -v build --configure-only \\ \\ [ ]... \\ - ?sys:/ + ?sys:/ \\ + [?sys:[ ]...] # For each (runtime) tests, examples, or benchmarks package # referred to by the task manifest: @@ -1271,7 +1273,9 @@ bpkg -v build --configure-only \\ \\ ({ --config-uuid [--config-uuid ] \\ [] }+ \\ - (?[sys:]|sys:)[ ])... + (?|sys:)[ ])... \\ +\\ +[?sys:[ ]...] # bpkg.update # @@ -1416,7 +1420,9 @@ bpkg -v update -d { --config-name }+ \\ [ ]... \\ \\ - ?sys:/ + ?sys:/ \\ + \\ + [?sys:[ ]...] # For each tests, examples, or benchmarks package referred # to by the task manifest: @@ -1556,7 +1562,9 @@ bpkg -v build --configure-only \\ \\ ({ --config-uuid [--config-uuid ] \\ [] }+ \\ - (?[sys:]|sys:)[ ])... + (?|sys:)[ ])... \\ +\\ +[?sys:[ ]...] # bpkg.update # @@ -1640,7 +1648,9 @@ bpkg -v update -d { --config-name }+ \\ [ ]... \\ \\ - ?sys:/ + ?sys:/ \\ + \\ + [?sys:[ ]...] # For each (build-time) tests, examples, or benchmarks package # referred to by the task manifest: diff --git a/tests/integration/testscript b/tests/integration/testscript index 1e2ebb7..5c14d73 100644 --- a/tests/integration/testscript +++ b/tests/integration/testscript @@ -182,7 +182,7 @@ tests="tests: libxsd-tests == $ver" #\ pkg = xsd -ver = 4.2.0-b.4.20221031121010.4fdbd8298c4d +ver = 4.2.0-b.4.20230320140030.aafc60b2e901 rep_url = "https://git.codesynthesis.com/xsd/xsd.git#master" rep_type = git #rep_url = https://queue.stage.build2.org/1 @@ -194,12 +194,17 @@ examples: * xsd-examples == $ver" host='host: true' package_config = 'package-config: \ -?libxerces-c +{ config.libxerces_c.network=true } -?libcurl/7.76.0 -?sys:libz/* +?sys:libxerces-c --sys-install --sys-yes \' -#dependency_checksum = 'dependency-checksum: 40a0ad4546d836a3afc83a9e7da22f2b5d224af4e62996d88f7103eaee23e9e1' #\ +#package_config = 'package-config: +# \ +#?libxerces-c +{ config.libxerces_c.network=true } +#?libcurl/7.76.0 +#?sys:libz/* +# \' + +#dependency_checksum = 'dependency-checksum: 40a0ad4546d836a3afc83a9e7da22f2b5d224af4e62996d88f7103eaee23e9e1' #\ pkg = libxerces-c -- cgit v1.1