From 944d39424793ddc9e4f67dcdca24e7140c5b02d5 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Tue, 12 Aug 2025 11:05:28 +0200 Subject: [PATCH] node: Restrict use of systemd to Linux not Unix Building with Zigbuild for macOS caused build issues. Strengthen the condition for using systemd from the Unix family to Linux specifically. --- crates/radicle-node/Cargo.toml | 6 ++++-- crates/radicle-node/src/main.rs | 13 +++++++++---- crates/radicle-node/src/runtime.rs | 4 ++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/crates/radicle-node/Cargo.toml b/crates/radicle-node/Cargo.toml index 517163d6..1ac242c8 100644 --- a/crates/radicle-node/Cargo.toml +++ b/crates/radicle-node/Cargo.toml @@ -39,7 +39,6 @@ radicle-fetch = { workspace = true } radicle-git-ext = { workspace = true, features = ["serde"] } radicle-protocol = { workspace = true } radicle-signals = { workspace = true } -radicle-systemd = { workspace = true, optional = true } sqlite = { workspace = true, features = ["bundled"] } scrypt = { version = "0.11.0", default-features = false } serde = { workspace = true, features = ["derive"] } @@ -49,6 +48,9 @@ socket2 = "0.5.7" tempfile = { workspace = true } thiserror = { workspace = true } +[target.'cfg(target_os = "linux")'.dependencies] +radicle-systemd = { workspace = true, optional = true } + [dev-dependencies] qcheck = { workspace = true } qcheck-macros = { workspace = true } @@ -56,4 +58,4 @@ radicle = { workspace = true, features = ["test"] } radicle-protocol = { workspace = true, features = ["test"] } radicle-crypto = { workspace = true, features = ["test", "cyphernet"] } snapbox = { workspace = true } -test-log = "0.2.18" \ No newline at end of file +test-log = "0.2.18" diff --git a/crates/radicle-node/src/main.rs b/crates/radicle-node/src/main.rs index cb7e553c..e1a557ec 100644 --- a/crates/radicle-node/src/main.rs +++ b/crates/radicle-node/src/main.rs @@ -93,10 +93,15 @@ fn execute() -> anyhow::Result<()> { let level = options.log.unwrap_or(config.node.log); let logger = { - let journal = if cfg!(all(feature = "systemd", target_family = "unix")) { - radicle_systemd::journal::logger::<&str, &str, _>("radicle-node".to_string(), [])? - } else { - None + let journal = { + #[cfg(all(feature = "systemd", target_os = "linux"))] + { + radicle_systemd::journal::logger::<&str, &str, _>("radicle-node".to_string(), [])? + } + #[cfg(not(all(feature = "systemd", target_os = "linux")))] + { + None + } }; if let Some(logger) = journal { diff --git a/crates/radicle-node/src/runtime.rs b/crates/radicle-node/src/runtime.rs index f1d3cee0..b7d10e5f 100644 --- a/crates/radicle-node/src/runtime.rs +++ b/crates/radicle-node/src/runtime.rs @@ -344,7 +344,7 @@ impl Runtime { Ok(()) } - #[cfg(all(feature = "systemd", target_family = "unix"))] + #[cfg(all(feature = "systemd", target_os = "linux"))] fn receive_listener() -> Option { use std::os::fd::FromRawFd; match radicle_systemd::listen::fd("control") { @@ -371,7 +371,7 @@ impl Runtime { } fn bind(path: PathBuf) -> Result { - #[cfg(all(feature = "systemd", target_family = "unix"))] + #[cfg(all(feature = "systemd", target_os = "linux"))] { if let Some(listener) = Self::receive_listener() { log::info!(target: "node", "Received control socket.");