From 134235ef7f6cd25e878eb4bf50a94749dda194f4 Mon Sep 17 00:00:00 2001 From: James Hodgkinson Date: Thu, 31 Mar 2022 14:12:53 +1000 Subject: [PATCH] Specifying MSRV in package now (#664) * specifying MSRV in package now --- DEVELOPER_README.md | 2 +- kanidm_client/Cargo.toml | 1 + kanidm_client/src/lib.rs | 12 +++++++++--- kanidm_proto/Cargo.toml | 1 + kanidm_tools/Cargo.toml | 1 + kanidm_unix_int/Cargo.toml | 1 + kanidm_unix_int/nss_kanidm/Cargo.toml | 1 + kanidm_unix_int/pam_kanidm/Cargo.toml | 1 + kanidm_unix_int/pam_tester/Cargo.toml | 1 + kanidmd/Cargo.toml | 1 + kanidmd/daemon/Cargo.toml | 1 + kanidmd/score/Cargo.toml | 1 + kanidmd_web_ui/Cargo.toml | 1 + orca/Cargo.toml | 1 + profiles/Cargo.toml | 1 + profiles/RUST_MSRV | 1 - profiles/build.rs | 4 ---- profiles/src/lib.rs | 11 ----------- 18 files changed, 23 insertions(+), 20 deletions(-) delete mode 100644 profiles/RUST_MSRV diff --git a/DEVELOPER_README.md b/DEVELOPER_README.md index d9b35d6e5..f4ecb0f03 100644 --- a/DEVELOPER_README.md +++ b/DEVELOPER_README.md @@ -16,7 +16,7 @@ The library documentation is [here](https://kanidm.github.io/kanidm/rustdoc/mast ### Minimum Supported Rust Version -The MSRV is specified [here](https://github.com/kanidm/kanidm/blob/master/profiles/RUST_MSRV). +The MSRV is specified in the package `Cargo.toml` files. ### Dependencies diff --git a/kanidm_client/Cargo.toml b/kanidm_client/Cargo.toml index be2d93ffd..99329025b 100644 --- a/kanidm_client/Cargo.toml +++ b/kanidm_client/Cargo.toml @@ -2,6 +2,7 @@ name = "kanidm_client" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Client Library" diff --git a/kanidm_client/src/lib.rs b/kanidm_client/src/lib.rs index 1ab3c87e8..ab803f3b3 100644 --- a/kanidm_client/src/lib.rs +++ b/kanidm_client/src/lib.rs @@ -128,9 +128,15 @@ impl KanidmClientBuilder { } // TODO #253: Handle these errors better, or at least provide diagnostics? - let mut f = File::open(ca_path).map_err(|e| {error!(?e);})?; - f.read_to_end(&mut buf).map_err(|e| {error!(?e);})?; - reqwest::Certificate::from_pem(&buf).map_err(|e| {error!(?e);}) + let mut f = File::open(ca_path).map_err(|e| { + error!(?e); + })?; + f.read_to_end(&mut buf).map_err(|e| { + error!(?e); + })?; + reqwest::Certificate::from_pem(&buf).map_err(|e| { + error!(?e); + }) } fn apply_config_options(self, kcc: KanidmClientConfig) -> Result { diff --git a/kanidm_proto/Cargo.toml b/kanidm_proto/Cargo.toml index 153070be5..7f0e7b797 100644 --- a/kanidm_proto/Cargo.toml +++ b/kanidm_proto/Cargo.toml @@ -2,6 +2,7 @@ name = "kanidm_proto" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Protocol Bindings for serde" diff --git a/kanidm_tools/Cargo.toml b/kanidm_tools/Cargo.toml index 3bba4688b..d555a04a2 100644 --- a/kanidm_tools/Cargo.toml +++ b/kanidm_tools/Cargo.toml @@ -2,6 +2,7 @@ name = "kanidm_tools" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" default-run = "kanidm" license = "MPL-2.0" diff --git a/kanidm_unix_int/Cargo.toml b/kanidm_unix_int/Cargo.toml index 0c8fe8015..ae221367b 100644 --- a/kanidm_unix_int/Cargo.toml +++ b/kanidm_unix_int/Cargo.toml @@ -2,6 +2,7 @@ name = "kanidm_unix_int" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Unix Integration Clients" diff --git a/kanidm_unix_int/nss_kanidm/Cargo.toml b/kanidm_unix_int/nss_kanidm/Cargo.toml index d6524af8e..06257a7e3 100644 --- a/kanidm_unix_int/nss_kanidm/Cargo.toml +++ b/kanidm_unix_int/nss_kanidm/Cargo.toml @@ -2,6 +2,7 @@ name = "nss_kanidm" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" [lib] diff --git a/kanidm_unix_int/pam_kanidm/Cargo.toml b/kanidm_unix_int/pam_kanidm/Cargo.toml index b90b6d163..ef7899eb1 100644 --- a/kanidm_unix_int/pam_kanidm/Cargo.toml +++ b/kanidm_unix_int/pam_kanidm/Cargo.toml @@ -2,6 +2,7 @@ name = "pam_kanidm" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" [lib] diff --git a/kanidm_unix_int/pam_tester/Cargo.toml b/kanidm_unix_int/pam_tester/Cargo.toml index a2fd1ddc0..45b9016d0 100644 --- a/kanidm_unix_int/pam_tester/Cargo.toml +++ b/kanidm_unix_int/pam_tester/Cargo.toml @@ -2,6 +2,7 @@ name = "pam_tester" version = "0.1.2" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/kanidmd/Cargo.toml b/kanidmd/Cargo.toml index 71292939d..8133c5f57 100644 --- a/kanidmd/Cargo.toml +++ b/kanidmd/Cargo.toml @@ -2,6 +2,7 @@ name = "kanidm" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Server Library and Binary" diff --git a/kanidmd/daemon/Cargo.toml b/kanidmd/daemon/Cargo.toml index e8edc28a8..4f3928bbc 100644 --- a/kanidmd/daemon/Cargo.toml +++ b/kanidmd/daemon/Cargo.toml @@ -2,6 +2,7 @@ name = "daemon" version = "0.1.0" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Server Daemon" diff --git a/kanidmd/score/Cargo.toml b/kanidmd/score/Cargo.toml index 07a47452b..967836b67 100644 --- a/kanidmd/score/Cargo.toml +++ b/kanidmd/score/Cargo.toml @@ -2,6 +2,7 @@ name = "score" version = "0.1.0" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Server Library and Binary" diff --git a/kanidmd_web_ui/Cargo.toml b/kanidmd_web_ui/Cargo.toml index eec6336e4..eddaaf8a6 100644 --- a/kanidmd_web_ui/Cargo.toml +++ b/kanidmd_web_ui/Cargo.toml @@ -2,6 +2,7 @@ name = "kanidmd_web_ui" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Server Web User Interface" diff --git a/orca/Cargo.toml b/orca/Cargo.toml index 072ee5097..20a1a1791 100644 --- a/orca/Cargo.toml +++ b/orca/Cargo.toml @@ -2,6 +2,7 @@ name = "orca" version = "1.1.0-alpha.7" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Orca - load testing for LDAP and Kanidm" diff --git a/profiles/Cargo.toml b/profiles/Cargo.toml index 1a52d4420..f714daed4 100644 --- a/profiles/Cargo.toml +++ b/profiles/Cargo.toml @@ -2,6 +2,7 @@ name = "profiles" version = "1.1.0" authors = ["William Brown "] +rust-version = "1.59" edition = "2021" license = "MPL-2.0" description = "Kanidm Build System Profiles" diff --git a/profiles/RUST_MSRV b/profiles/RUST_MSRV deleted file mode 100644 index bb120e876..000000000 --- a/profiles/RUST_MSRV +++ /dev/null @@ -1 +0,0 @@ -1.59.0 diff --git a/profiles/build.rs b/profiles/build.rs index 172c6b2be..6fc63d576 100644 --- a/profiles/build.rs +++ b/profiles/build.rs @@ -3,11 +3,8 @@ use std::fs; use std::path::PathBuf; fn main() { - println!("cargo:rerun-if-changed=RUST_MSRV"); println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE"); - let rust_minver = include_str!("RUST_MSRV"); - let profile = env::var("KANIDM_BUILD_PROFILE").unwrap_or_else(|_| "developer".to_string()); let profile_path: PathBuf = ["./", format!("{}.toml", profile).as_str()] @@ -23,5 +20,4 @@ fn main() { println!("cargo:rustc-env=KANIDM_BUILD_PROFILE={}", profile); println!("cargo:rustc-env=KANIDM_BUILD_PROFILE_TOML={}", contents); - println!("cargo:rustc-env=KANIDM_RUST_MSRV={}", rust_minver); } diff --git a/profiles/src/lib.rs b/profiles/src/lib.rs index 44fa0e5f4..6b692d060 100644 --- a/profiles/src/lib.rs +++ b/profiles/src/lib.rs @@ -1,4 +1,3 @@ -use rustc_version::{version, Version}; use serde::Deserialize; use std::env; @@ -29,19 +28,9 @@ struct ProfileConfig { } pub fn apply_profile() { - println!("cargo:rerun-if-env-changed=KANIDM_RUST_MSRV"); println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE"); println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE_TOML"); - // check to see if the rust version matches the rust minimum version we require for this build - let rust_minver = env!("KANIDM_RUST_MSRV"); - let required_rust_ver = Version::parse(&rust_minver.replace("\n", "")).unwrap(); - println!("Rust version: {}", version().unwrap()); - println!("Required version: {}", required_rust_ver); - if version().unwrap() < required_rust_ver { - panic!("This crate requires rustc >= {}, quitting.", rust_minver); - } - // transform any requested paths for our server. We do this by reading // our profile that we have been provided. let profile = env!("KANIDM_BUILD_PROFILE");