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

Releas the 3.5.0 version #321

Merged
merged 4 commits into from
Aug 1, 2022
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
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion os_info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "os_info"
version = "3.4.0"
version = "3.5.0"
authors = ["Jan Schulte <hello@unexpected-co.de>", "Stanislav Tkach <stanislav.tkach@gmail.com>"]
description = "Detect the operating system type and version."
documentation = "https://docs.rs/os_info"
Expand Down
36 changes: 1 addition & 35 deletions os_info/src/linux/file_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,16 @@ fn retrieve(distributions: &[ReleaseInfo], root: &str) -> Option<Info> {
None
}

/// Struct containing information on how to parse distribution info from a
/// release file.
///
/// # Example
/// ```rust,ignore
/// 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.
///
/// # 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<Type>,

/// 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<Version>,
}

Expand Down
2 changes: 1 addition & 1 deletion os_info/src/linux/lsb_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub fn get() -> Option<Info> {
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,
Expand All @@ -35,7 +36,6 @@ pub fn get() -> Option<Info> {
Some("Solus") => Type::Solus,
Some("SUSE") => Type::SUSE,
Some("Ubuntu") => Type::Ubuntu,
Some("Garuda") => Type::Garuda,
_ => Type::Linux,
};

Expand Down
3 changes: 2 additions & 1 deletion os_info/src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ mod tests {
| Type::Debian
| Type::EndeavourOS
| Type::Fedora
| Type::Garuda
| Type::Gentoo
| Type::Linux
| Type::Manjaro
| Type::Mariner
Expand All @@ -45,7 +47,6 @@ mod tests {
| Type::Solus
| Type::SUSE
| Type::Ubuntu
| Type::Garuda
| Type::Mint => (),
os_type => {
panic!("Unexpected OS type: {}", os_type);
Expand Down
18 changes: 9 additions & 9 deletions os_info/src/os_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ pub enum Type {
Fedora,
/// FreeBSD (<https://en.wikipedia.org/wiki/FreeBSD>).
FreeBSD,
/// Garuda Linux (<https://en.wikipedia.org/wiki/Garuda_Linux>)
Garuda,
/// Gentoo Linux (<https://en.wikipedia.org/wiki/Gentoo_Linux>).
Gentoo,
/// Linux based operating system (<https://en.wikipedia.org/wiki/Linux>).
/// 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 (<https://en.wikipedia.org/wiki/Linux>).
Linux,
/// Mac OS X/OS X/macOS (<https://en.wikipedia.org/wiki/MacOS>).
Macos,
/// Manjaro (<https://en.wikipedia.org/wiki/Manjaro>).
Manjaro,
/// Mariner (<https://en.wikipedia.org/wiki/CBL-Mariner>).
Mariner,
/// Mint (<https://en.wikipedia.org/wiki/Linux_Mint>).
/// MidnightBSD (<https://en.wikipedia.org/wiki/MidnightBSD>).
MidnightBSD,
/// MidnightBSD(<https://en.wikipedia.org/wiki/MidnightBSD>).
/// Mint (<https://en.wikipedia.org/wiki/Linux_Mint>).
Mint,
/// NetBSD (<https://en.wikipedia.org/wiki/NetBSD>).
NetBSD,
Expand Down Expand Up @@ -72,8 +74,6 @@ pub enum Type {
SUSE,
/// Ubuntu (<https://en.wikipedia.org/wiki/Ubuntu_(operating_system)>).
Ubuntu,
/// Garuda Linux (<https://en.wikipedia.org/wiki/Garuda_Linux>)
Garuda,
/// Unknown operating system.
Unknown,
/// Windows (<https://en.wikipedia.org/wiki/Microsoft_Windows>).
Expand All @@ -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"),
Expand All @@ -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),
}
}
Expand Down Expand Up @@ -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"),
Expand All @@ -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"),
];
Expand Down