aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-04-07 12:12:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-04-07 12:30:13 +0300
commit9ad939e65513fb9d367ba039484febcd63423304 (patch)
tree37de25d685432cb61ad773784e3bfda8c72aeaea
parentb92c1c200deef9a4e2bbd686080ecc4c64c22d10 (diff)
Add support for bbot.install.ldconfig step in worker
-rw-r--r--bbot/worker/worker.cxx100
-rw-r--r--tests/integration/testscript1
2 files changed, 82 insertions, 19 deletions
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> (a)...);
}
+template <typename... A>
+static result_status
+run_ldconfig (step_id step,
+ tracer& t,
+ string& log, const regexes& warn_detect,
+ const optional<step_id>& bkp_step,
+ const optional<result_status>& 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> (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 <env-config-args> <tgt-config-args> <pkg-config-args>
- // <package-name>
+ // Install.
//
- step_id b (step_id::bpkg_install);
- step_id s (step_id::bpkg_install);
+ {
+ // bpkg install <env-config-args> <tgt-config-args> <pkg-config-args>
+ // <package-name>
+ //
+ 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 <env-config-args> <tgt-config-args> <pkg-config-args>
+ //
+ 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;
diff --git a/tests/integration/testscript b/tests/integration/testscript
index 4da46c1..9488691 100644
--- a/tests/integration/testscript
+++ b/tests/integration/testscript
@@ -61,6 +61,7 @@ rfp = yes
#host='host: true'
#dependency_checksum = 'dependency-checksum: e6f10587696020674c260669f4e7000a0139df72467bff9770aea2f2b8b57ba0'
+#package_config = 'package-config: +bbot.install.ldconfig:'
#package_config = 'package-config: -bpkg.install:'
#\