feat(daemon): stage installs on request
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 6s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 12s

This commit is contained in:
faumaray committed 2026-12-04 03:09:41 +03:00
1 parent 3f181dc241
commit 2c602fc3e7
8 files changed
+205 -3

No files matched your search

+16
View File
@@ -1508,6 +1508,8 @@ struct DaemonCmdOptions {
std::string graph_format_arg{"dot"};
std::optional<std::string> target_arg;
std::optional<std::string> pack_output_arg;
std::optional<std::string> prefix_arg;
std::string package_version_arg{"0.1.0"};
std::optional<std::string> file_filter_arg;
std::string limit_arg{"50"};
std::string timeout_ms_arg{"2000"};
@@ -1614,6 +1616,14 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
request_json = opts.pack_output_arg ? std::format(R"({{"op":"pack","output":{}}})",
Util::json_quote(*opts.pack_output_arg))
: R"({"op":"pack"})";
} else if (sub == "install") {
if (!opts.prefix_arg || opts.prefix_arg->empty()) {
std::cerr << "vbs daemon install: --prefix is required\n";
return 2;
}
request_json = std::format(R"({{"op":"install","prefix":{},"package_version":{}}})",
Util::json_quote(*opts.prefix_arg),
Util::json_quote(opts.package_version_arg));
} else if (sub == "editor_status") {
request_json = R"({"op":"editor_status"})";
} else if (sub == "workspace_members") {
@@ -2766,6 +2776,12 @@ int main(int argc, char **argv) {
configure_daemon_common(daemon_pack_cmd);
daemon_pack_cmd.option("--output", "-o", "Archive path relative to the build root",
daemon_opts.pack_output_arg);
auto &daemon_install_cmd =
daemon_cmd.subcommand("install", "Build and stage an install prefix via the daemon");
configure_daemon_common(daemon_install_cmd);
daemon_install_cmd.option("--prefix", "", "Install prefix (required)", daemon_opts.prefix_arg)
.option_default("--package-version", "", "Exported package version",
daemon_opts.package_version_arg, "0.1.0");
auto &daemon_target_cmd =
daemon_cmd.subcommand("target", "Target metadata served by the daemon");
auto &daemon_target_info_cmd = daemon_target_cmd.subcommand(