Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add Types for Ultramarine Linux #363

Merged
merged 7 commits into from
Mar 3, 2024
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
2 changes: 2 additions & 0 deletions cspell-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ xbian
xenenterprise
xenial
xenserver
ultramarine
kuma
4 changes: 2 additions & 2 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ targets = [
[advisories]
# The path where the advisory database is cloned/fetched into
db-path = "~/.cargo/advisory-db"
# The url of the advisory database to use
db-url = "https://github.com/rustsec/advisory-db"
# The url(s) of the advisory databases to use
db-urls = ["https://github.com/rustsec/advisory-db"]
# The lint level for security vulnerabilities
vulnerability = "deny"
# The lint level for unmaintained crates
Expand Down
1 change: 1 addition & 0 deletions os_info/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ mod tests {
Type::Solus,
Type::SUSE,
Type::Ubuntu,
Type::Ultramarine,
Type::Mint,
Type::Unknown,
Type::Windows,
Expand Down
14 changes: 12 additions & 2 deletions os_info/src/linux/lsb_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn get() -> Option<Info> {
Some("Solus") => Type::Solus,
Some("SUSE") => Type::SUSE,
Some("Ubuntu") => Type::Ubuntu,
Some("Ultramarine") => Type::Ultramarine,
Some("UltramarineLinux") => Type::Ultramarine,
_ => Type::Linux,
};

Expand Down Expand Up @@ -311,6 +311,17 @@ mod tests {
assert_eq!(parse_results.codename, None);
}

#[test]
fn ultramarine() {
let parse_results = parse(ultramarine_file());
assert_eq!(
parse_results.distribution,
Some("UltramarineLinux".to_string())
);
assert_eq!(parse_results.version, Some("39".to_string()));
assert_eq!(parse_results.codename, Some("kuma".to_string()));
}

#[test]
fn raspbian() {
let parse_results = parse(raspberry_os_file());
Expand Down Expand Up @@ -535,7 +546,6 @@ mod tests {
}

fn ultramarine_file() -> &'static str {

"LSB Version: n/a\n\
Distributor ID: UltramarineLinux\n\
Description: Ultramarine Linux 39 (Kuma)\n\
Expand Down
1 change: 1 addition & 0 deletions os_info/src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mod tests {
| Type::Solus
| Type::SUSE
| Type::Ubuntu
| Type::Ultramarine
| Type::Mint => (),
os_type => {
panic!("Unexpected OS type: {}", os_type);
Expand Down
4 changes: 4 additions & 0 deletions os_info/src/os_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ pub enum Type {
SUSE,
/// Ubuntu (<https://en.wikipedia.org/wiki/Ubuntu_(operating_system)>).
Ubuntu,
/// Ultramarine (<https://ultramarine-linux.org/>).
Ultramarine,
/// Unknown operating system.
Unknown,
/// Windows (<https://en.wikipedia.org/wiki/Microsoft_Windows>).
Expand Down Expand Up @@ -127,6 +129,7 @@ impl Display for Type {
Type::RedHatEnterprise => write!(f, "Red Hat Enterprise Linux"),
Type::RockyLinux => write!(f, "Rocky Linux"),
Type::SUSE => write!(f, "SUSE Linux Enterprise Server"),
Type::Ultramarine => write!(f, "Ultramarine Linux"),
_ => write!(f, "{self:?}"),
}
}
Expand Down Expand Up @@ -178,6 +181,7 @@ mod tests {
(Type::Solus, "Solus"),
(Type::SUSE, "SUSE Linux Enterprise Server"),
(Type::Ubuntu, "Ubuntu"),
(Type::Ultramarine, "Ultramarine Linux"),
(Type::Unknown, "Unknown"),
(Type::Windows, "Windows"),
];
Expand Down
Loading