From 9ad939e65513fb9d367ba039484febcd63423304 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 7 Apr 2023 12:12:31 +0300 Subject: Add support for bbot.install.ldconfig step in worker --- bbot/worker/worker.cxx | 100 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 19 deletions(-) (limited to 'bbot') diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index b33fb9f..98c17d4 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -214,9 +214,11 @@ enum class step_id // bpkg_install, + bbot_install_ldconfig, // Note: disabled by default. + // Note that the bpkg_bindist_* steps are mutually exclusive and the latest // status change for them (via the leading +/- characters in the prefix) - // overrides all the previous ones. + // overrides all the previous ones. Disabled by default. // bpkg_bindist_debian, bpkg_bindist_fedora, @@ -299,6 +301,8 @@ static const strings step_id_str { "bpkg.install", + "bbot.install.ldconfig", + "bpkg.bindist.debian", "bpkg.bindist.fedora", "bpkg.bindist.archive", @@ -801,6 +805,27 @@ run_b (step_id step, verbosity, buildspec, forward (a)...); } +template +static result_status +run_ldconfig (step_id step, + tracer& t, + string& log, const regexes& warn_detect, + const optional& bkp_step, + const optional& bkp_status, + string& last_cmd, + A&&... a) +{ + return run_cmd (step, + t, + log, + nullptr /* out_str */, path () /* out_file*/, + warn_detect, + "sudo ldconfig", + bkp_step, bkp_status, last_cmd, + process_env ("sudo"), + "ldconfig", forward (a)...); +} + // Upload compressed manifest to the specified TFTP URL with curl. Issue // diagnostics and throw failed on invalid manifest or process management // errors and throw io_error for input/output errors or non-zero curl exit. @@ -1089,6 +1114,7 @@ build (size_t argc, const char* argv[]) prefix != "bpkg.test-separate.update" && prefix != "bpkg.test-separate.test" && prefix != "bpkg.install" && + prefix != "bbot.install.ldconfig" && prefix != "bpkg.bindist.debian" && prefix != "bpkg.bindist.fedora" && prefix != "bpkg.bindist.archive" && @@ -3340,33 +3366,69 @@ build (size_t argc, const char* argv[]) if (!target_pkg && create_target) rm_r (trace, &r.log, rwd / target_conf); - // bpkg install - // + // Install. // - step_id b (step_id::bpkg_install); - step_id s (step_id::bpkg_install); + { + // bpkg install + // + // + step_id b (step_id::bpkg_install); + step_id s (step_id::bpkg_install); - r.status |= run_bpkg ( - b, - trace, r.log, wre, - bkp_step, bkp_status, last_cmd, - "-v", - "install", - step_args (env_args, s), - step_args (tgt_args, s), - step_args (pkg_args, s), - pkg); + r.status |= run_bpkg ( + b, + trace, r.log, wre, + bkp_step, bkp_status, last_cmd, + "-v", + "install", + step_args (env_args, s), + step_args (tgt_args, s), + step_args (pkg_args, s), + pkg); - if (!r.status) + if (!r.status) + break; + } + + // Run ldconfig. + // + if (step_enabled (step_id::bbot_install_ldconfig)) + { + // sudo ldconfig + // + step_id b (step_id::bbot_install_ldconfig); + step_id s (step_id::bbot_install_ldconfig); + + r.status |= run_ldconfig ( + b, + trace, r.log, wre, + bkp_step, bkp_status, last_cmd, + step_args (env_args, s), + step_args (tgt_args, s), + step_args (pkg_args, s)); + + if (!r.status) + break; + } + // + // Fail if the breakpoint refers to the bbot.install.ldconfig step but + // this step is disabled. + // + else if (bkp_step && *bkp_step == step_id::bbot_install_ldconfig) + { + fail_unreached_breakpoint (r); break; + } rm.status |= r.status; } // - // Fail if the breakpoint refers to the bpkg.install step but the - // package is not supposed to be installed from source. + // Fail if the breakpoint refers to the bpkg.install related steps but + // the package is not supposed to be installed from source. // - else if (bkp_step && *bkp_step == step_id::bpkg_install) + else if (bkp_step && + *bkp_step >= step_id::bpkg_install && + *bkp_step <= step_id::bbot_install_ldconfig) { fail_unreached_breakpoint (add_result ("install")); break; -- cgit v1.1