From ef3ee1b07d8e92ebe2dbccbe4c4c7e3843ef62ba Mon Sep 17 00:00:00 2001 From: Stanislav Tkach Date: Sun, 31 Jul 2022 11:28:05 +0200 Subject: [PATCH 1/4] Release the 3.5.0 version --- CHANGELOG.md | 11 ++++++++++- README.md | 7 +++++-- cli/Cargo.toml | 2 +- os_info/Cargo.toml | 2 +- os_info/src/linux/lsb_release.rs | 2 +- os_info/src/linux/mod.rs | 3 ++- os_info/src/os_type.rs | 18 +++++++++--------- 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d3187f..eb40cf57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +## [3.5.0] (2022-08-01) + +- Red Hat Enterprise Linux detection has been improved. (#311) + +- Garuda Linux support has been added. (#314) + +- The operating system detection from the release files has been improved. (#317) + ## [3.4.0] (2022-05-22) - Gentoo Linux support has been added. (#307) @@ -261,7 +269,8 @@ All notable changes to this project will be documented in this file. The first release containing only minor infrastructural changes and based on [os_type](https://github.com/schultyy/os_type). -[Unreleased]: https://github.com/stanislav-tkach/os_info/compare/v3.4.0...HEAD +[Unreleased]: https://github.com/stanislav-tkach/os_info/compare/v3.5.0...HEAD +[3.5.0]: https://github.com/stanislav-tkach/os_info/compare/v3.4.0...v3.5.0 [3.4.0]: https://github.com/stanislav-tkach/os_info/compare/v3.3.0...v3.4.0 [3.3.0]: https://github.com/stanislav-tkach/os_info/compare/v3.2.0...v3.3.0 [3.2.0]: https://github.com/stanislav-tkach/os_info/compare/v3.1.0...v3.2.0 diff --git a/README.md b/README.md index 495477f3..a4704943 100644 --- a/README.md +++ b/README.md @@ -89,20 +89,23 @@ Right now, the following operating system types can be returned: - EndeavourOS - Fedora - FreeBSD +- Garuda Linux +- Gentoo Linux - HardenedBSD - Illumos - Linux -- Linux Mint - macOS (Mac OS X or OS X) - Manjaro +- Mariner - MidnightBSD +- Mint - NetBSD - NixOS - OpenBSD - openSUSE - Oracle Linux - Pop!_OS -- Raspberry OS +- Raspberry Pi OS - Red Hat Linux - Red Hat Enterprise Linux - Redox diff --git a/cli/Cargo.toml b/cli/Cargo.toml index baeb51d1..1375d620 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -17,7 +17,7 @@ name = "os_info" path = "src/main.rs" [dependencies] -os_info = { version = "3.4.0", default-features = false, path = "../os_info" } +os_info = { version = "3.5.0", default-features = false, path = "../os_info" } log = "0.4.5" env_logger = "0.9" clap = { version = "3", features = ["derive"] } diff --git a/os_info/Cargo.toml b/os_info/Cargo.toml index 5d9f31bc..eaaa785a 100644 --- a/os_info/Cargo.toml +++ b/os_info/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "os_info" -version = "3.4.0" +version = "3.5.0" authors = ["Jan Schulte ", "Stanislav Tkach "] description = "Detect the operating system type and version." documentation = "https://docs.rs/os_info" diff --git a/os_info/src/linux/lsb_release.rs b/os_info/src/linux/lsb_release.rs index 8f3ca91a..58a96ae2 100644 --- a/os_info/src/linux/lsb_release.rs +++ b/os_info/src/linux/lsb_release.rs @@ -22,6 +22,7 @@ pub fn get() -> Option { Some("Debian") => Type::Debian, Some("EndeavourOS") => Type::EndeavourOS, Some("Fedora") | Some("Fedora Linux") => Type::Fedora, + Some("Garuda") => Type::Garuda, Some("Gentoo") => Type::Gentoo, Some("Linuxmint") => Type::Mint, Some("ManjaroLinux") => Type::Manjaro, @@ -35,7 +36,6 @@ pub fn get() -> Option { Some("Solus") => Type::Solus, Some("SUSE") => Type::SUSE, Some("Ubuntu") => Type::Ubuntu, - Some("Garuda") => Type::Garuda, _ => Type::Linux, }; diff --git a/os_info/src/linux/mod.rs b/os_info/src/linux/mod.rs index f6fc4863..64d48834 100644 --- a/os_info/src/linux/mod.rs +++ b/os_info/src/linux/mod.rs @@ -32,6 +32,8 @@ mod tests { | Type::Debian | Type::EndeavourOS | Type::Fedora + | Type::Garuda + | Type::Gentoo | Type::Linux | Type::Manjaro | Type::Mariner @@ -45,7 +47,6 @@ mod tests { | Type::Solus | Type::SUSE | Type::Ubuntu - | Type::Garuda | Type::Mint => (), os_type => { panic!("Unexpected OS type: {}", os_type); diff --git a/os_info/src/os_type.rs b/os_info/src/os_type.rs index 9a9ddb91..8cab07b8 100644 --- a/os_info/src/os_type.rs +++ b/os_info/src/os_type.rs @@ -28,13 +28,15 @@ pub enum Type { Fedora, /// FreeBSD (). FreeBSD, + /// Garuda Linux () + Garuda, /// Gentoo Linux (). Gentoo, - /// Linux based operating system (). + /// HardenedBSD (https://hardenedbsd.org/). HardenedBSD, - /// HardenedBSD (https://hardenedbsd.org/) + /// Illumos (https://en.wikipedia.org/wiki/Illumos). Illumos, - /// Illumos (https://en.wikipedia.org/wiki/Illumos) + /// Linux based operating system (). Linux, /// Mac OS X/OS X/macOS (). Macos, @@ -42,9 +44,9 @@ pub enum Type { Manjaro, /// Mariner (). Mariner, - /// Mint (). + /// MidnightBSD (). MidnightBSD, - /// MidnightBSD(). + /// Mint (). Mint, /// NetBSD (). NetBSD, @@ -72,8 +74,6 @@ pub enum Type { SUSE, /// Ubuntu (). Ubuntu, - /// Garuda Linux () - Garuda, /// Unknown operating system. Unknown, /// Windows (). @@ -93,6 +93,7 @@ impl Display for Type { Type::Amazon => write!(f, "Amazon Linux AMI"), Type::Arch => write!(f, "Arch Linux"), Type::DragonFly => write!(f, "DragonFly BSD"), + Type::Garuda => write!(f, "Garuda Linux"), Type::Gentoo => write!(f, "Gentoo Linux"), Type::Illumos => write!(f, "illumos"), Type::Macos => write!(f, "Mac OS"), @@ -103,7 +104,6 @@ impl Display for Type { Type::Redhat => write!(f, "Red Hat Linux"), Type::RedHatEnterprise => write!(f, "Red Hat Enterprise Linux"), Type::SUSE => write!(f, "SUSE Linux Enterprise Server"), - Type::Garuda => write!(f, "Garuda Linux"), _ => write!(f, "{:?}", self), } } @@ -131,6 +131,7 @@ mod tests { (Type::Emscripten, "Emscripten"), (Type::EndeavourOS, "EndeavourOS"), (Type::Fedora, "Fedora"), + (Type::Garuda, "Garuda Linux"), (Type::Gentoo, "Gentoo Linux"), (Type::FreeBSD, "FreeBSD"), (Type::Linux, "Linux"), @@ -150,7 +151,6 @@ mod tests { (Type::Solus, "Solus"), (Type::SUSE, "SUSE Linux Enterprise Server"), (Type::Ubuntu, "Ubuntu"), - (Type::Garuda, "Garuda Linux"), (Type::Unknown, "Unknown"), (Type::Windows, "Windows"), ]; From b73bb8f49dd856f5d8acac373156afd0f29861b0 Mon Sep 17 00:00:00 2001 From: Stanislav Tkach Date: Sun, 31 Jul 2022 11:36:29 +0200 Subject: [PATCH 2/4] Remove ignored doc-tests --- os_info/src/linux/file_release.rs | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/os_info/src/linux/file_release.rs b/os_info/src/linux/file_release.rs index 0cebba1d..44c7fa65 100644 --- a/os_info/src/linux/file_release.rs +++ b/os_info/src/linux/file_release.rs @@ -57,8 +57,9 @@ fn retrieve(distributions: &[ReleaseInfo], root: &str) -> Option { /// Struct containing information on how to parse distribution info from a /// release file. /// -/// # Example -/// ```rust,ignore +/// # Examples +/// +/// ``` /// ReleaseInfo { /// path: "/etc/fedora-release", /// os_type: |_| Some(Type::Fedora), @@ -67,37 +68,17 @@ fn retrieve(distributions: &[ReleaseInfo], root: &str) -> Option { /// .find(&release) /// .map(Version::from_string) /// }, -/// }, +/// } /// ``` #[derive(Clone)] struct ReleaseInfo<'a> { /// Relative path to the release file this struct corresponds to from root. - /// - /// # Example - /// ```rust,ignore - /// path: "etc/os-release" - /// ``` path: &'a str, /// A closure that determines the os type from the release file contents. - /// - /// # Example - /// ```rust,ignore - /// //path: "/etc/mariner-release", - /// os_type: |_| Some(Type::Mariner), - /// ``` os_type: for<'b> fn(&'b str) -> Option, /// A closure that determines the os version from the release file contents. - /// - /// # Example - /// ```rust,ignore - /// version: |release| { - /// Matcher::KeyValue { key: "VERSION_ID" } - /// .find(&release) - /// .map(Version::from_string) - /// }, - /// ``` version: for<'b> fn(&'b str) -> Option, } From f915220dab6d06899ecab93978801a2481ff5b95 Mon Sep 17 00:00:00 2001 From: Stanislav Tkach Date: Mon, 1 Aug 2022 14:16:23 +0200 Subject: [PATCH 3/4] Remove the doc test --- os_info/src/linux/file_release.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/os_info/src/linux/file_release.rs b/os_info/src/linux/file_release.rs index 44c7fa65..119c8556 100644 --- a/os_info/src/linux/file_release.rs +++ b/os_info/src/linux/file_release.rs @@ -54,22 +54,7 @@ fn retrieve(distributions: &[ReleaseInfo], root: &str) -> Option { None } -/// Struct containing information on how to parse distribution info from a -/// release file. -/// -/// # Examples -/// -/// ``` -/// ReleaseInfo { -/// path: "/etc/fedora-release", -/// os_type: |_| Some(Type::Fedora), -/// version: |release| { -/// Matcher::PrefixedVersion { prefix: "release" } -/// .find(&release) -/// .map(Version::from_string) -/// }, -/// } -/// ``` +/// Struct containing information on how to parse distribution info from a release file. #[derive(Clone)] struct ReleaseInfo<'a> { /// Relative path to the release file this struct corresponds to from root. From 156063b672d7da766166e84e96b30ee0880c51ac Mon Sep 17 00:00:00 2001 From: Stanislav Tkach Date: Mon, 1 Aug 2022 14:17:43 +0200 Subject: [PATCH 4/4] Allow the unicode license --- deny.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/deny.toml b/deny.toml index 00d3157e..cac443f8 100644 --- a/deny.toml +++ b/deny.toml @@ -72,6 +72,7 @@ unlicensed = "deny" allow = [ "MIT", "Apache-2.0", + "Unicode-DFS-2016", ] # List of explictly disallowed licenses # See https://spdx.org/licenses/ for list of possible licenses