feat(platform,daemon): isolate executable lookup and report host backends
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 8s

This commit is contained in:
faumaray committed 2026-12-04 04:15:42 +03:00
1 parent 105519924a
commit 9f4477b8d4
10 files changed
+93 -7

No files matched your search

+21
View File
@@ -13,6 +13,7 @@
#include <Void/Build/Package/Resolver.hpp>
#include <Void/Build/Package/Toml.hpp>
#include <Void/Build/Platform/FileOps.hpp>
#include <Void/Build/Platform/Host.hpp>
#include <Void/Build/Platform/ProcessSupervisor.hpp>
#include <Void/Build/Provenance/TrustedKeys.hpp>
#include <Void/Build/Provider/Provider.hpp>
@@ -1868,6 +1869,26 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
object.emplace("version", JsonValue{std::string{Bootstrap::version}});
object.emplace("os", JsonValue{std::string{Bootstrap::os}});
object.emplace("architecture", JsonValue{std::string{Bootstrap::architecture}});
object.emplace("host_os",
JsonValue{std::string{Platform::host_os_name(Platform::host_os())}});
object.emplace("host_supported", JsonValue{Platform::host_supported()});
#if defined(VBS_HAS_VOID_SQLITE)
constexpr bool has_sqlite = true;
#else
constexpr bool has_sqlite = false;
#endif
#if defined(VBS_HAS_VOID_NET)
constexpr bool has_net = true;
#else
constexpr bool has_net = false;
#endif
JsonValue::Object backends;
backends.emplace("file_ops", JsonValue{Platform::host_supported()});
backends.emplace("process_supervisor", JsonValue{Platform::host_supported()});
backends.emplace("directory_watcher", JsonValue{Platform::host_supported()});
backends.emplace("sqlite", JsonValue{has_sqlite});
backends.emplace("net", JsonValue{has_net});
object.emplace("backends", JsonValue{std::move(backends)});
object.emplace("project_root", JsonValue{options.project_root.string()});
object.emplace("build_root", JsonValue{options.build_root.string()});
object.emplace(
+4 -6
View File
@@ -128,9 +128,8 @@ make_frontend_opts(const std::filesystem::path &project_root,
opts.sdk_source_dir = std::filesystem::path{Bootstrap::sdk_source_dir};
std::error_code ec;
std::vector<std::filesystem::path> sdk_candidates;
if (const auto self_exe = std::filesystem::read_symlink("/proc/self/exe", ec);
!ec && !self_exe.empty()) {
const auto self_root = self_exe.parent_path().parent_path();
if (const auto self_exe = Platform::current_executable_path(); self_exe) {
const auto self_root = self_exe->parent_path().parent_path();
sdk_candidates.push_back(self_root / "libVoidBuildSdk.a");
sdk_candidates.push_back(self_root / "libVoidBuild_Sdk.a");
sdk_candidates.push_back(self_root / "lib" / "libVoidBuildSdk.a");
@@ -2287,9 +2286,8 @@ int execute_ide_command(std::string_view sub, const IdeCmdOptions &opts) {
}
std::filesystem::path vbs_exe{"vbs"};
if (const auto self_exe = std::filesystem::read_symlink("/proc/self/exe", ec);
!ec && !self_exe.empty()) {
vbs_exe = self_exe;
if (const auto self_exe = Platform::current_executable_path(); self_exe) {
vbs_exe = *self_exe;
}
Editor::IdeConfigOptions ide_opts;
+13
View File
@@ -315,4 +315,17 @@ resolve_confined_path(const std::filesystem::path &root, const std::filesystem::
EACCES)};
}
Void::Result::Result<std::filesystem::path, Void::Result::Error> current_executable_path() {
std::error_code ec;
const auto path = std::filesystem::read_symlink("/proc/self/exe", ec);
if (ec || path.empty()) {
return std::unexpected{Void::System::make_system_error(
Void::System::SystemErrorCode::io_error,
std::format("current_executable_path: cannot resolve /proc/self/exe: {}",
ec ? ec.message() : "empty path"),
ec.value())};
}
return path;
}
} // namespace Void::Build::Platform