summaryrefslogtreecommitdiffstats
path: root/vendor/os_info/src/linux
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/os_info/src/linux
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/os_info/src/linux')
-rw-r--r--vendor/os_info/src/linux/file_release.rs85
-rw-r--r--vendor/os_info/src/linux/lsb_release.rs36
-rw-r--r--vendor/os_info/src/linux/mod.rs10
-rw-r--r--vendor/os_info/src/linux/tests/Alpaquita/etc/os-release8
-rw-r--r--vendor/os_info/src/linux/tests/Arch/etc/os-release11
-rw-r--r--vendor/os_info/src/linux/tests/ArchARM/etc/os-release11
-rw-r--r--vendor/os_info/src/linux/tests/Artix/etc/os-release9
-rw-r--r--vendor/os_info/src/linux/tests/Debian_11/etc/os-release9
-rw-r--r--vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release9
-rw-r--r--vendor/os_info/src/linux/tests/openEuler/etc/os-release6
10 files changed, 190 insertions, 4 deletions
diff --git a/vendor/os_info/src/linux/file_release.rs b/vendor/os_info/src/linux/file_release.rs
index 119c85560..e9cb6c3f7 100644
--- a/vendor/os_info/src/linux/file_release.rs
+++ b/vendor/os_info/src/linux/file_release.rs
@@ -91,18 +91,20 @@ static DISTRIBUTIONS: [ReleaseInfo; 6] = [
// https://github.com/chef/os_release
//"almalinux" => Alma
+ "alpaquita" => Some(Type::Alpaquita),
"alpine" => Some(Type::Alpine),
"amzn" => Some(Type::Amazon),
//"antergos" => Antergos
//"aosc" => AOSC
"arch" => Some(Type::Arch),
- //"artix" => Artix
+ "archarm" => Some(Type::Arch),
+ "artix" => Some(Type::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),
@@ -115,6 +117,8 @@ static DISTRIBUTIONS: [ReleaseInfo; 6] = [
"mariner" => Some(Type::Mariner),
//"nexus" => Nexus
"nixos" => Some(Type::NixOS),
+ "opencloudos" => Some(Type::OpenCloudOS),
+ "openEuler" => Some(Type::openEuler),
"ol" => Some(Type::OracleLinux),
"opensuse" => Some(Type::openSUSE),
"opensuse-leap" => Some(Type::openSUSE),
@@ -196,6 +200,17 @@ mod tests {
use pretty_assertions::assert_eq;
#[test]
+ fn alpaquita_os_release() {
+ let root = "src/linux/tests/Alpaquita";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::Alpaquita);
+ assert_eq!(info.version, Version::Semantic(23, 0, 0));
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
fn alpine_3_12_os_release() {
let root = "src/linux/tests/Alpine_3_12";
@@ -240,6 +255,39 @@ mod tests {
}
#[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 artix_os_release() {
+ let root = "src/linux/tests/Artix";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::Artix);
+ 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";
@@ -284,6 +332,17 @@ mod tests {
}
#[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";
@@ -399,6 +458,28 @@ mod tests {
}
#[test]
+ fn opencloudos_os_release() {
+ let root = "src/linux/tests/OpenCloudOS";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::OpenCloudOS);
+ assert_eq!(info.version, Version::Semantic(8, 6, 0));
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
+ fn openeuler_os_release() {
+ let root = "src/linux/tests/openEuler";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::openEuler);
+ assert_eq!(info.version, Version::Semantic(22, 3, 0));
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
fn oracle_linux_os_release() {
let root = "src/linux/tests/OracleLinux";
diff --git a/vendor/os_info/src/linux/lsb_release.rs b/vendor/os_info/src/linux/lsb_release.rs
index 58a96ae2a..a494fce68 100644
--- a/vendor/os_info/src/linux/lsb_release.rs
+++ b/vendor/os_info/src/linux/lsb_release.rs
@@ -16,8 +16,10 @@ pub fn get() -> Option<Info> {
};
let os_type = match release.distribution.as_ref().map(String::as_ref) {
+ Some("Alpaquita") => Type::Alpaquita,
Some("Amazon") | Some("AmazonAMI") => Type::Amazon,
Some("Arch") => Type::Arch,
+ Some("Artix") => Type::Artix,
Some("CentOS") => Type::CentOS,
Some("Debian") => Type::Debian,
Some("EndeavourOS") => Type::EndeavourOS,
@@ -25,9 +27,12 @@ pub fn get() -> Option<Info> {
Some("Garuda") => Type::Garuda,
Some("Gentoo") => Type::Gentoo,
Some("Linuxmint") => Type::Mint,
+ Some("MaboxLinux") => Type::Mabox,
Some("ManjaroLinux") => Type::Manjaro,
Some("Mariner") => Type::Mariner,
Some("NixOS") => Type::NixOS,
+ Some("OpenCloudOS") => Type::OpenCloudOS,
+ Some("openEuler") => Type::openEuler,
Some("openSUSE") => Type::openSUSE,
Some("OracleServer") => Type::OracleLinux,
Some("Pop") => Type::Pop,
@@ -109,6 +114,14 @@ mod tests {
}
#[test]
+ fn alpaquita() {
+ let parse_results = parse(alpaquita_file());
+ assert_eq!(parse_results.distribution, Some("Alpaquita".to_string()));
+ assert_eq!(parse_results.version, Some("23".to_string()));
+ assert_eq!(parse_results.codename, None);
+ }
+
+ #[test]
fn arch() {
let parse_results = parse(arch_file());
assert_eq!(parse_results.distribution, Some("Arch".to_string()));
@@ -117,6 +130,14 @@ mod tests {
}
#[test]
+ fn artix() {
+ let parse_results = parse(artix_file());
+ assert_eq!(parse_results.distribution, Some("Artix".to_string()));
+ assert_eq!(parse_results.version, Some("rolling".to_string()));
+ assert_eq!(parse_results.codename, None);
+ }
+
+ #[test]
fn fedora() {
let parse_results = parse(fedora_file());
assert_eq!(parse_results.distribution, Some("Fedora".to_string()));
@@ -296,6 +317,13 @@ mod tests {
"
}
+ fn alpaquita_file() -> &'static str {
+ "\nDistributor ID: Alpaquita\n\
+ Description: BellSoft Alpaquita Linux Stream 23 (musl)\n\
+ Release: 23\n\
+ Codename: n/a"
+ }
+
fn arch_file() -> &'static str {
"\nLSB Version: 1.4\n\
Distributor ID: Arch\n\
@@ -304,6 +332,14 @@ mod tests {
Codename: n/a"
}
+ fn artix_file() -> &'static str {
+ "\nLSB Version: n/a\n\
+ Distributor ID: Artix\n\
+ Description: Artix Linux\n\
+ Release: rolling\n\
+ Codename: n/a"
+ }
+
fn fedora_file() -> &'static str {
"\nLSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch\n\
Distributor ID: Fedora\n\
diff --git a/vendor/os_info/src/linux/mod.rs b/vendor/os_info/src/linux/mod.rs
index 64d488342..ac5c8cc00 100644
--- a/vendor/os_info/src/linux/mod.rs
+++ b/vendor/os_info/src/linux/mod.rs
@@ -3,7 +3,7 @@ mod lsb_release;
use log::trace;
-use crate::{bitness, Info, Type};
+use crate::{architecture, bitness, Info, Type};
pub fn current_platform() -> Info {
trace!("linux::current_platform is called");
@@ -12,6 +12,7 @@ pub fn current_platform() -> Info {
.or_else(file_release::get)
.unwrap_or_else(|| Info::with_type(Type::Linux));
info.bitness = bitness::get();
+ info.architecture = architecture::get();
trace!("Returning {:?}", info);
info
@@ -25,9 +26,11 @@ mod tests {
fn os_type() {
let version = current_platform();
match version.os_type() {
- Type::Alpine
+ Type::Alpaquita
+ | Type::Alpine
| Type::Amazon
| Type::Arch
+ | Type::Artix
| Type::CentOS
| Type::Debian
| Type::EndeavourOS
@@ -35,9 +38,12 @@ mod tests {
| Type::Garuda
| Type::Gentoo
| Type::Linux
+ | Type::Mabox
| Type::Manjaro
| Type::Mariner
| Type::NixOS
+ | Type::OpenCloudOS
+ | Type::openEuler
| Type::openSUSE
| Type::OracleLinux
| Type::Pop
diff --git a/vendor/os_info/src/linux/tests/Alpaquita/etc/os-release b/vendor/os_info/src/linux/tests/Alpaquita/etc/os-release
new file mode 100644
index 000000000..4c47ccda3
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Alpaquita/etc/os-release
@@ -0,0 +1,8 @@
+NAME="BellSoft Alpaquita Linux Stream"
+ID=alpaquita
+ID_LIKE=alpine
+VERSION_ID=23
+PRETTY_NAME="BellSoft Alpaquita Linux Stream 23 (musl)"
+HOME_URL="https://bell-sw.com/"
+BUG_REPORT_URL="https://bell-sw.com/support/"
+LIBC_TYPE=musl
diff --git a/vendor/os_info/src/linux/tests/Arch/etc/os-release b/vendor/os_info/src/linux/tests/Arch/etc/os-release
new file mode 100644
index 000000000..8662a54df
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Arch/etc/os-release
@@ -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
diff --git a/vendor/os_info/src/linux/tests/ArchARM/etc/os-release b/vendor/os_info/src/linux/tests/ArchARM/etc/os-release
new file mode 100644
index 000000000..6218b0e2c
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/ArchARM/etc/os-release
@@ -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
diff --git a/vendor/os_info/src/linux/tests/Artix/etc/os-release b/vendor/os_info/src/linux/tests/Artix/etc/os-release
new file mode 100644
index 000000000..26279cec5
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Artix/etc/os-release
@@ -0,0 +1,9 @@
+NAME="Artix Linux"
+PRETTY_NAME="Artix Linux"
+ID=artix
+BUILD_ID=rolling
+ANSI_COLOR="38;2;23;147;209"
+HOME_URL="https://artixlinux.org/"
+DOCUMENTATION_URL="https://wiki.artixlinux.org/"
+SUPPORT_URL="https://forum.artixlinux.org/"
+BUG_REPORT_URL="https://gitea.artixlinux.org/artix"
diff --git a/vendor/os_info/src/linux/tests/Debian_11/etc/os-release b/vendor/os_info/src/linux/tests/Debian_11/etc/os-release
new file mode 100644
index 000000000..611cf746b
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Debian_11/etc/os-release
@@ -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/"
diff --git a/vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release b/vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release
new file mode 100644
index 000000000..4bc4580f6
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release
@@ -0,0 +1,9 @@
+NAME="OpenCloudOS"
+VERSION="8.6"
+ID="opencloudos"
+ID_LIKE="rhel fedora centos"
+VERSION_ID="8.6"
+PLATFORM_ID="platform:oc8"
+PRETTY_NAME="OpenCloudOS 8.6"
+ANSI_COLOR="0;31"
+CPE_NAME="cpe:/o:opencloudos:opencloudos:8" \ No newline at end of file
diff --git a/vendor/os_info/src/linux/tests/openEuler/etc/os-release b/vendor/os_info/src/linux/tests/openEuler/etc/os-release
new file mode 100644
index 000000000..bd72dd829
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/openEuler/etc/os-release
@@ -0,0 +1,6 @@
+NAME="openEuler"
+VERSION="22.03 LTS"
+ID="openEuler"
+VERSION_ID="22.03"
+PRETTY_NAME="openEuler 22.03 LTS"
+ANSI_COLOR="0;31" \ No newline at end of file