From dd3c35fd102018c51d31e75345c4cf8ecab75848 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 7 Mar 2022 21:58:40 +0300 Subject: Determine config.install.root differently for various primary package types --- bbot/worker/worker.cxx | 97 ++++++++++++++++++++++++-------------------- tests/integration/testscript | 11 ++--- 2 files changed, 60 insertions(+), 48 deletions(-) diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index 18546e4..f2a3994 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -195,7 +195,7 @@ enum class step_id bpkg_update, bpkg_test, - // Note that separate test packages are configures as part of the + // Note that separate test packages are configured as part of the // bpkg_configure_build step above with options taken from // bpkg_{target,host}_configure_build, depending on tests package type. // @@ -1075,35 +1075,6 @@ build (size_t argc, const char* argv[]) return r; }; - // Search for config.install.root variable. If it is present and has a - // non-empty value, then test the package installation and uninstall. Note - // that passing [null] value would be meaningless, so we don't recognize - // it as a special one. - // - dir_path install_root; - { - size_t n (19); - auto space = [] (char c) {return c == ' ' || c == '\t';}; - - for (const char* s: - reverse_iterate (step_args (config_args, step_id::bpkg_create))) - { - if (strncmp (s, "config.install.root", n) == 0 && - (s[n] == '=' || space (s[n]))) - { - while (space (s[n])) ++n; // Skip spaces. - if (s[n] == '=') ++n; // Skip the equal sign. - while (space (s[n])) ++n; // Skip spaces. - - // Note that the config.install.root variable value may - // potentially be quoted. - // - install_root = dir_path (unquote (s + n)); - break; - } - } - } - // bpkg-rep-fetch trust options. // cstrings trust_ops; @@ -1290,6 +1261,56 @@ build (size_t argc, const char* argv[]) bool host_pkg (!module_pkg && requirement ("host")); bool target_pkg (!module_pkg && !host_pkg); + // Search for config.install.root variable. If it is present and has a + // non-empty value, then test the package installation and uninstall. Note + // that passing [null] value would be meaningless, so we don't recognize + // it as a special one. + // + // Note that the host package can only be installed for a self-hosted + // configuration, using bpkg configuration of the target type. + // + // Also note that the module package is always installed for a self-hosted + // configuration (and never otherwise), using config.install.root + // specified for ~build2 configuration. + // + // If present, indicates that the install, test installed, and uninstall + // operations need to be tested. + // + optional install_root; + + if (target_pkg || selfhost) + { + if (!module_pkg) + { + step_id s (step_id::bpkg_target_create); + step_id f1 (step_id::b_create); + step_id f2 (step_id::bpkg_create); + + size_t n (19); + auto space = [] (char c) {return c == ' ' || c == '\t';}; + + for (const char* a: + reverse_iterate (step_args (config_args, s, f1, f2))) + { + if (strncmp (a, "config.install.root", n) == 0 && + (a[n] == '=' || space (a[n]))) + { + while (space (a[n])) ++n; // Skip spaces. + if (a[n] == '=') ++n; // Skip the equal sign. + while (space (a[n])) ++n; // Skip spaces. + + // Note that the config.install.root variable value may potentially + // be quoted. + // + install_root = dir_path (unquote (a + n)); + break; + } + } + } + else + install_root = dir_path (); + } + // Split external test packages into the runtime and build-time lists. // // Note that runtime and build-time test packages are always configured in @@ -1379,7 +1400,7 @@ build (size_t argc, const char* argv[]) // Create the configuration for installing the main package of the host or // module type, unless it's not supposed to be installed. // - bool create_install (!target_pkg && !install_root.empty () && selfhost); + bool create_install (!target_pkg && install_root); // Root configuration through which we will be configuring the cluster // (note: does not necessarily match the main package type). @@ -2466,17 +2487,7 @@ build (size_t argc, const char* argv[]) // Install the package, optionally test the installation and uninstall // afterwards. // - // These operations are triggered by presence of config.install.root - // configuration variable having a non-empty value for - // bpkg.configure.create step. - // - if (install_root.empty ()) - break; - - // If this is not a self-hosted configuration, then skip installing host - // and module packages. - // - if (!target_pkg && !selfhost) + if (!install_root) break; // Now the overall plan is as follows: @@ -2577,7 +2588,7 @@ build (size_t argc, const char* argv[]) // beginning of the PATH environment variable value, so the installed // executables are found first. // - string paths ("PATH=" + (install_root / "bin").string ()); + string paths ("PATH=" + (*install_root / "bin").string ()); if (optional s = getenv ("PATH")) { diff --git a/tests/integration/testscript b/tests/integration/testscript index 94a718d..2a49dfd 100644 --- a/tests/integration/testscript +++ b/tests/integration/testscript @@ -49,12 +49,13 @@ wait = 1 # Seconds. controller = --fake-request ../task --dump-result pkg = libhello -ver = 1.0.0+8 +ver = 1.0.0+9 #rep_url = "https://git.build2.org/hello/libhello.git#1.0" #rep_type = git rep_url = https://stage.build2.org/1 rep_type = pkg rfp = yes +#host='host: true' #dependency_checksum = 'dependency-checksum: e6f10587696020674c260669f4e7000a0139df72467bff9770aea2f2b8b57ba0' #\ @@ -78,7 +79,7 @@ rfp = yes # #\ pkg = libbuild2-hello -ver = 0.1.0-a.0.20210928065245.4c3109c2b741 +ver = 0.1.0-a.0.20220111112708.b719144c077f rep_url = "https://github.com/build2/libbuild2-hello.git#master" rep_type = git #rep_url = https://stage.build2.org/1 @@ -92,7 +93,7 @@ host='host: true' # #\ pkg = libbuild2-kconfig -ver = 0.1.0-a.0.20210928065354.40a5c6beeb5c +ver = 0.2.0-a.0.20220120072650.3f6d1ccab040 rep_url = "https://github.com/build2/libbuild2-kconfig.git#master" rep_type = git #ver = 0.1.0-a.0.20200910053253.a71aa3f3938b @@ -116,7 +117,7 @@ rfp = yes #\ pkg = cli -ver = 1.2.0-b.8.20211123111254.927cc0443f6e +ver = 1.2.0-b.8.20220218142801.83de480a8bab rep_url = "https://git.codesynthesis.com/cli/cli.git#master" rep_type = git #rep_url = https://stage.build2.org/1 @@ -141,7 +142,7 @@ tests="tests: libxsd-tests == $ver" #\ pkg = xsd -ver = 4.2.0-b.2.20211026100043.e5d2958ee052 +ver = 4.2.0-b.3.20220224113525.516981000564 rep_url = "https://git.codesynthesis.com/xsd/xsd.git#master" rep_type = git #rep_url = https://queue.stage.build2.org/1 -- cgit v1.1