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

add os-release match for Arch and Debian ARM #331

Merged
merged 1 commit into from
Jan 23, 2023
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
36 changes: 35 additions & 1 deletion os_info/src/linux/file_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ static DISTRIBUTIONS: [ReleaseInfo; 6] = [
//"antergos" => Antergos
//"aosc" => AOSC
"arch" => Some(Type::Arch),
"archarm" => Some(Type::Arch),
//"artix" => Artix
"centos" => Some(Type::CentOS),
//"clear-linux-os" => ClearLinuxOS
//"clearos" => ClearOS
//"coreos"
//"cumulus-linux" => Cumulus
//"debian" => Debian
"debian" => Some(Type::Debian),
//"devuan" => Devuan
//"elementary" => Elementary
"fedora" => Some(Type::Fedora),
Expand Down Expand Up @@ -241,6 +242,28 @@ mod tests {
assert_eq!(info.codename, None);
}

#[test]
fn arch_os_release() {
let root = "src/linux/tests/Arch";

let info = retrieve(&DISTRIBUTIONS, root).unwrap();
assert_eq!(info.os_type(), Type::Arch);
assert_eq!(info.version, Version::Unknown);
assert_eq!(info.edition, None);
assert_eq!(info.codename, None);
}

#[test]
fn archarm_os_release() {
let root = "src/linux/tests/ArchARM";

let info = retrieve(&DISTRIBUTIONS, root).unwrap();
assert_eq!(info.os_type(), Type::Arch);
assert_eq!(info.version, Version::Unknown);
assert_eq!(info.edition, None);
assert_eq!(info.codename, None);
}

#[test]
fn centos_7_os_release() {
let root = "src/linux/tests/CentOS_7";
Expand Down Expand Up @@ -285,6 +308,17 @@ mod tests {
assert_eq!(info.codename, None);
}

#[test]
fn debian_11_os_release() {
let root = "src/linux/tests/Debian_11";

let info = retrieve(&DISTRIBUTIONS, root).unwrap();
assert_eq!(info.os_type(), Type::Debian);
assert_eq!(info.version, Version::Semantic(11, 0, 0));
assert_eq!(info.edition, None);
assert_eq!(info.codename, None);
}

#[test]
fn fedora_32_os_release() {
let root = "src/linux/tests/Fedora_32";
Expand Down
11 changes: 11 additions & 0 deletions os_info/src/linux/tests/Arch/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
11 changes: 11 additions & 0 deletions os_info/src/linux/tests/ArchARM/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NAME="Arch Linux ARM"
PRETTY_NAME="Arch Linux ARM"
ID=archarm
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinuxarm.org/"
DOCUMENTATION_URL="https://archlinuxarm.org/wiki"
SUPPORT_URL="https://archlinuxarm.org/forum"
BUG_REPORT_URL="https://github.com/archlinuxarm/PKGBUILDs/issues"
LOGO=archlinux-logo
9 changes: 9 additions & 0 deletions os_info/src/linux/tests/Debian_11/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"