Skip to content

Commit 973191e

Browse files
authored
Fix api-v2 branch build (#2825)
## Problem The `api-v2` branch does not build in OBS. There are two problems: 1. Agama crashes if the l10n monitor cannot connect to the systemd locale service, which is not available when running the tests in OBS. 1. The `agama-services` is not part of the Rust package anymore. ## Solution The solution for the 2nd point is trivial. About the 1st one, we have decided that Agama should not crash, just report (in the logs) that it cannot observe system locale changes.
2 parents e6adf05 + 4a6dce9 commit 973191e

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

rust/agama-l10n/src/start.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ use agama_utils::{
3131
pub enum Error {
3232
#[error(transparent)]
3333
Service(#[from] service::Error),
34-
#[error(transparent)]
35-
Monitor(#[from] monitor::Error),
3634
}
3735

3836
/// Starts the localization service.
@@ -53,8 +51,17 @@ pub async fn start(
5351
let model = Model::from_system()?;
5452
let service = Service::new(model, issues, events);
5553
let handler = actor::spawn(service);
56-
let monitor = Monitor::new(handler.clone()).await?;
57-
monitor::spawn(monitor);
54+
55+
match Monitor::new(handler.clone()).await {
56+
Ok(monitor) => monitor::spawn(monitor),
57+
Err(error) => {
58+
tracing::error!(
59+
"Could not launch the l10n monitor, therefore changes from systemd will be ignored. \
60+
The original error was {error}"
61+
);
62+
}
63+
}
64+
5865
Ok(handler)
5966
}
6067

rust/agama-server/src/server/web.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use agama_utils::{
3131
},
3232
question,
3333
};
34-
use anyhow;
3534
use axum::{
3635
extract::State,
3736
response::{IntoResponse, Response},
@@ -72,17 +71,17 @@ type ServerResult<T> = Result<T, Error>;
7271
///
7372
/// * `events`: channel to send events to the websocket.
7473
/// * `dbus`: connection to Agama's D-Bus server. If it is not given, those features
75-
/// that require to connect to the Agama's D-Bus server won't work.
74+
/// that require to connect to the Agama's D-Bus server won't work.
7675
pub async fn server_service(
7776
events: event::Sender,
7877
dbus: Option<zbus::Connection>,
7978
) -> Result<Router, ServiceError> {
8079
let questions = question::start(events.clone())
8180
.await
82-
.map_err(|e| anyhow::Error::new(e))?;
81+
.map_err(anyhow::Error::msg)?;
8382
let manager = manager::start(questions.clone(), events, dbus)
8483
.await
85-
.map_err(|e| anyhow::Error::new(e))?;
84+
.map_err(anyhow::Error::msg)?;
8685

8786
let state = ServerState { manager, questions };
8887

rust/package/agama.spec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ echo $PATH
213213
%doc README.md
214214
%license LICENSE
215215
%{_bindir}/agama-web-server
216-
%{_datadir}/dbus-1/agama-services
217216
%{_pam_vendordir}/agama
218217
%{_unitdir}/agama-web-server.service
219218

0 commit comments

Comments
 (0)