Skip to content

Commit

Permalink
Merge pull request #363 from 8bitZeta/master
Browse files Browse the repository at this point in the history
Fix: Add Types for Ultramarine Linux
  • Loading branch information
stanislav-tkach authored Mar 3, 2024
2 parents 6a43b42 + 58fab75 commit 5b5e49b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
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

0 comments on commit 5b5e49b

Please sign in to comment.