Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,979 changes: 1,267 additions & 712 deletions rust/Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions rust/agama-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ edition = "2021"

[dependencies]
clap = { version = "4.5.19", features = ["derive", "wrap_help"] }
curl = { version = "0.4.47", features = ["protocol-ftp"] }
agama-lib = { path="../agama-lib" }
agama-lib = { path = "../agama-lib" }
serde_json = "1.0.128"
indicatif= "0.17.8"
thiserror = "1.0.64"
indicatif = "0.17.8"
thiserror = "2.0.12"
console = "0.15.8"
anyhow = "1.0.89"
tempfile = "3.13.0"
nix = { version = "0.27.1", features = ["user"] }
tokio = { version = "1.40.0", features = ["macros", "rt-multi-thread"] }
async-trait = "0.1.83"
reqwest = { version = "0.12.8", features = ["json"] }
url = "2.5.2"
inquire = { version = "0.7.5", default-features = false, features = ["crossterm", "one-liners"] }
inquire = { version = "0.7.5", default-features = false, features = [
"crossterm",
"one-liners",
] }
chrono = "0.4.38"
regex = "1.11.1"
home = "0.5.11"
serde = { version = "1.0.219", features = ["derive"] }
fluent-uri = "0.3.2"

[[bin]]
Expand Down
8 changes: 5 additions & 3 deletions rust/agama-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ edition = "2021"
[dependencies]
anyhow = "1.0"
async-trait = "0.1.83"
cidr = { version = "0.2.3", features = ["serde"] }
cidr = { version = "0.3.1", features = ["serde"] }
futures-util = "0.3.30"
jsonschema = { version = "0.16.1", default-features = false, features = ["resolve-file"] }
jsonschema = { version = "0.30.0", default-features = false, features = [
"resolve-file",
] }
log = "0.4"
reqwest = { version = "0.12.8", features = ["json", "cookies"] }
serde = { version = "1.0.210", features = ["derive"] }
serde_json = { version = "1.0.128", features = ["raw_value"] }
serde_repr = "0.1.19"
tempfile = "3.13.0"
thiserror = "1.0.64"
thiserror = "2.0.12"
tokio = { version = "1.40.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.16"
url = { version = "2.5.2", features = ["serde"] }
Expand Down
24 changes: 13 additions & 11 deletions rust/agama-lib/src/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

use crate::error::ProfileError;
use anyhow::Context;
use jsonschema::JSONSchema;
use log::info;
use serde_json;
use std::{fs, io::Write, path::Path, process::Command};
Expand Down Expand Up @@ -109,7 +108,7 @@ impl std::fmt::Display for ValidationOutcome {
/// assert!(matches!(ValidationOutcome::Valid, result));
/// ```
pub struct ProfileValidator {
schema: JSONSchema,
validator: jsonschema::Validator,
}

impl ProfileValidator {
Expand Down Expand Up @@ -137,8 +136,8 @@ impl ProfileValidator {
.as_object_mut()
.and_then(|s| s.insert("$id".to_string(), serde_json::json!(id)));

let schema = JSONSchema::compile(&schema).expect("A valid schema");
Ok(Self { schema })
let validator = jsonschema::validator_for(&schema).expect("A valid schema");
Ok(Self { validator })
}

pub fn validate_file(&self, profile_path: &Path) -> Result<ValidationOutcome, ProfileError> {
Expand All @@ -148,14 +147,17 @@ impl ProfileValidator {

pub fn validate_str(&self, profile: &str) -> Result<ValidationOutcome, ProfileError> {
let contents = serde_json::from_str(profile)?;
let result = self.schema.validate(&contents);
if let Err(errors) = result {
let messages: Vec<String> = errors
.map(|e| format!("{}. {}", e, e.instance_path))
.collect();
return Ok(ValidationOutcome::NotValid(messages));
let messages: Vec<String> = self
.validator
.iter_errors(&contents)
.map(|e| format!("{}. {}", e, e.instance_path))
.collect();

if messages.is_empty() {
Ok(ValidationOutcome::Valid)
} else {
Ok(ValidationOutcome::NotValid(messages))
}
Ok(ValidationOutcome::Valid)
}
}

Expand Down
6 changes: 3 additions & 3 deletions rust/agama-locale-data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ edition = "2021"
[dependencies]
anyhow = "1.0"
serde = { version = "1.0.210", features = ["derive"] }
quick-xml = { version = "0.28.2", features = ["serialize"] }
quick-xml = { version = "0.37.5", features = ["serialize"] }
flate2 = "1.0.34"
chrono-tz = "0.8.6"
chrono-tz = "0.10.3"
regex = "1"
thiserror = "1.0.64"
thiserror = "2.0.12"
utoipa = "5.2.0"
1 change: 0 additions & 1 deletion rust/agama-locale-data/src/keyboard/xkeyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub struct XKeyboard {
pub id: String,
/// like "Ukrainian (phonetic)"
pub description: String,
pub ascii: bool,
pub comment: Option<String>,
pub languages: RankedLanguages,
pub territories: RankedTerritories,
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-locale-data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ mod tests {
#[test]
fn test_get_timezones() {
let result = get_timezones();
assert_eq!(result.len(), 430);
assert_eq!(result.len(), 431);
let first = result.first().expect("no keyboards");
assert_eq!(first, "Africa/Abidjan");
// test that we filter out deprecates Asmera ( there is already recent Asmara)
Expand Down
7 changes: 5 additions & 2 deletions rust/agama-locale-data/src/timezone_part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ impl TimezoneIdParts {
/// let timezones = vec!["Europe/Prague".to_string(), "Europe/Berlin".to_string()];
/// let result = vec!["Evropa/Praha".to_string(), "Evropa/Berlín".to_string()];
/// assert_eq!(parts.localize_timezones("cs", &timezones), result);
///
/// let timezones = vec!["America/Unknown".to_string()];
/// assert_eq!(parts.localize_timezones("cs", &timezones), vec!["Amerika/Unknown"]);
/// ```
pub fn localize_timezones(&self, language: &str, timezones: &[String]) -> Vec<String> {
let mapping = self.construct_mapping(language);
Expand Down Expand Up @@ -85,8 +88,8 @@ impl TimezoneIdParts {
.map(|tzp| {
mapping
.get(&tzp.to_string())
.unwrap_or_else(|| panic!("Unknown timezone part {tzp}"))
.to_owned()
.map(|t| t.to_owned())
.unwrap_or(tzp.to_string())
})
.collect::<Vec<String>>()
.join("/")
Expand Down
14 changes: 7 additions & 7 deletions rust/agama-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ agama-lib = { path = "../agama-lib" }
log = "0.4"
zbus = { version = "5", default-features = false, features = ["tokio"] }
uuid = { version = "1.10.0", features = ["v4"] }
thiserror = "1.0.64"
thiserror = "2.0.12"
serde = { version = "1.0.210", features = ["derive"] }
cidr = { version = "0.2.3", features = ["serde"] }
cidr = { version = "0.3.1", features = ["serde"] }
tokio = { version = "1.40.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.16"
gettext-rs = { version = "0.7.1", features = ["gettext-system"] }
Expand All @@ -24,7 +24,7 @@ macaddr = { version = "1.0", features = ["serde_std"] }
async-trait = "0.1.83"
axum = { version = "0.7.7", features = ["ws"] }
serde_json = "1.0.128"
tower-http = { version = "0.5.2", features = [
tower-http = { version = "0.6.2", features = [
"compression-br",
"fs",
"trace",
Expand All @@ -34,10 +34,10 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tracing-journald = "0.3.0"
tracing = "0.1.40"
clap = { version = "4.5.19", features = ["derive", "wrap_help"] }
tower = { version = "0.4.13", features = ["util"] }
tower = { version = "0.5.2", features = ["util"] }
utoipa = { version = "5.2.0", features = ["axum_extras", "uuid"] }
config = "0.14.0"
rand = "0.8.5"
config = "0.15.11"
rand = "0.9.1"
axum-extra = { version = "0.9.4", features = ["cookie", "typed-header"] }
pam = "0.8.0"
serde_with = "3.10.0"
Expand All @@ -52,7 +52,7 @@ futures-util = { version = "0.3.30", default-features = false, features = [
] }
libsystemd = "0.7.0"
subprocess = "0.2.9"
gethostname = "0.4.3"
gethostname = "1.0.0"
tokio-util = "0.7.12"
tempfile = "3.13.0"
url = "2.5.2"
Expand Down
5 changes: 2 additions & 3 deletions rust/agama-server/src/web/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! take precedence.

use config::{Config, ConfigError, File};
use rand::distributions::{Alphanumeric, DistString};
use rand::distr::{Alphanumeric, SampleString};
use serde::Deserialize;

/// Web service configuration.
Expand All @@ -44,8 +44,7 @@ pub struct ServiceConfig {
impl ServiceConfig {
pub fn load() -> Result<Self, ConfigError> {
const JWT_SECRET_SIZE: usize = 30;
let jwt_secret: String =
Alphanumeric.sample_string(&mut rand::thread_rng(), JWT_SECRET_SIZE);
let jwt_secret: String = Alphanumeric.sample_string(&mut rand::rng(), JWT_SECRET_SIZE);

let config = Config::builder()
.set_default("jwt_secret", jwt_secret)?
Expand Down
5 changes: 5 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri May 2 07:42:21 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Update dependencies (gh#agama-project/agama#2317).
Comment thread
dgdavid marked this conversation as resolved.

-------------------------------------------------------------------
Wed Apr 30 08:18:10 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
Loading