From 86954241bd4317c2af0c10607961a1303886cf58 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 30 Oct 2024 19:18:06 +0000 Subject: [PATCH] build: update nixpkgs, cargo and crates Signed-off-by: Tiago Castro --- .gitmodules | 2 +- .pre-commit-config.yaml | 2 +- apis/events/Cargo.toml | 41 +++++++++++++------------- apis/events/build.rs | 2 +- apis/events/src/event_traits.rs | 3 +- apis/io-engine/Cargo.toml | 26 +++++++--------- apis/io-engine/build.rs | 4 +-- apis/io-engine/src/v1.rs | 1 + composer/Cargo.toml | 21 +++++-------- composer/src/composer.rs | 6 ++-- devinfo/Cargo.toml | 15 +++++----- devinfo/src/mountinfo/mod.rs | 1 - event-publisher/Cargo.toml | 21 +++++++------ h2 | 2 +- nix/sources.json | 12 ++++---- nvmeadm/.cargo/{config => config.toml} | 0 nvmeadm/Cargo.toml | 18 +++++------ nvmeadm/src/nvmf_discovery.rs | 1 - nvmeadm/tests/discovery_test.rs | 3 +- prost-extend/Cargo.toml | 14 +++------ prost-extend/build.rs | 2 +- prost-extend/src/duration.rs | 2 +- prost-extend/src/timestamp.rs | 4 +-- scripts/rust/for_each.sh | 10 +++++++ shell.nix | 14 +++++++-- sysfs/Cargo.toml | 2 -- tracing-filter/Cargo.toml | 2 +- version-info/Cargo.toml | 9 ++---- 28 files changed, 114 insertions(+), 126 deletions(-) rename nvmeadm/.cargo/{config => config.toml} (100%) create mode 100755 scripts/rust/for_each.sh diff --git a/.gitmodules b/.gitmodules index 78c38c3..6120425 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "h2"] path = h2 url = https://github.com/openebs/h2.git - branch = v0.3-auth-fix + branch = v0.4.x diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37a5e46..2e3de99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: hooks: - id: nixpkgs-fmt - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v5.0.0 hooks: - id: trailing-whitespace - repo: local diff --git a/apis/events/Cargo.toml b/apis/events/Cargo.toml index 24571ad..623c828 100644 --- a/apis/events/Cargo.toml +++ b/apis/events/Cargo.toml @@ -5,27 +5,26 @@ edition = "2021" [build-dependencies] -tonic-build = "0.10.2" +tonic-build = "0.12.3" + +[features] +default = ["rls-ring"] +rls-aws-lc-rs = ["async-nats/aws-lc-rs"] +rls-ring = ["async-nats/ring"] [dependencies] -async-nats = "0.32.1" -bytes = "1.5.0" -serde = "1.0.188" -serde_json = "1.0.107" -tokio = "1.32.0" -tracing = "0.1.37" -uuid = { version = "1.4.1", features = ["v4"] } -async-trait = "0.1.73" -futures = "0.3.28" -snafu = "0.7.5" -tonic = "0.10.2" -prost = "0.12.1" -chrono = "0.4.31" -once_cell = "1.18.0" +async-nats = { version = "0.37.0", default-features = false } +bytes = "1.8.0" +serde = "1.0.214" +serde_json = "1.0.132" +tokio = "1.41.0" +tracing = "0.1.40" +uuid = { version = "1.11.0", features = ["v4"] } +async-trait = "0.1.83" +futures = "0.3.31" +snafu = "0.8.5" +tonic = "0.12.3" +prost = "0.13.3" +chrono = "0.4.38" +once_cell = "1.20.2" prost-extend = { path = "../../prost-extend" } - -[dev-dependencies.serde] -# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! -# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! -# https://github.com/serde-rs/serde/issues/2734 -version = ">=1.0.188,<1.0.198" \ No newline at end of file diff --git a/apis/events/build.rs b/apis/events/build.rs index 5230f67..bba8d4c 100644 --- a/apis/events/build.rs +++ b/apis/events/build.rs @@ -3,6 +3,6 @@ fn main() { .type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]") .extern_path(".google.protobuf.Timestamp", "::prost_extend::Timestamp") .extern_path(".google.protobuf.Duration", "::prost_extend::Duration") - .compile(&["protobuf/v1/event.proto"], &["protobuf/"]) + .compile_protos(&["protobuf/v1/event.proto"], &["protobuf/"]) .unwrap_or_else(|e| panic!("event v1 protobuf compilation failed: {e}")); } diff --git a/apis/events/src/event_traits.rs b/apis/events/src/event_traits.rs index ba05219..a52d34c 100644 --- a/apis/events/src/event_traits.rs +++ b/apis/events/src/event_traits.rs @@ -6,11 +6,10 @@ use crate::event::{ SwitchOverEventDetails, SwitchOverStatus, Version, }; use chrono::{DateTime, Utc}; -use once_cell::sync::OnceCell; use std::{str::FromStr, time::Duration}; /// Once cell static variable to store the component field of the event source. -static COMPONENT: OnceCell = OnceCell::new(); +static COMPONENT: std::sync::OnceLock = std::sync::OnceLock::new(); /// Initialize the event source component with the service name. pub fn initialize_source_component(comp: &str) { diff --git a/apis/io-engine/Cargo.toml b/apis/io-engine/Cargo.toml index a04120b..0b6e444 100644 --- a/apis/io-engine/Cargo.toml +++ b/apis/io-engine/Cargo.toml @@ -4,22 +4,16 @@ version = "1.0.0" edition = "2021" [build-dependencies] -tonic-build = "0.10.2" -prost-build = "0.12.1" +tonic-build = "0.12.3" +prost-build = "0.13.3" [dependencies] -tonic = "0.10.2" -bytes = "1.5.0" -prost = "0.12.1" -prost-derive = "0.12.1" +tonic = "0.12.3" +bytes = "1.8.0" +prost = "0.13.3" +prost-derive = "0.13.3" prost-extend = { path = "../../prost-extend" } -prost-types = "0.12.1" -serde = { version = "1.0.188", features = ["derive"] } -serde_derive = "1.0.188" -serde_json = "1.0.107" - -[dev-dependencies.serde] -# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! -# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! -# https://github.com/serde-rs/serde/issues/2734 -version = ">=1.0.188,<1.0.198" \ No newline at end of file +prost-types = "0.13.3" +serde = { version = "1.0.214", features = ["derive"] } +serde_derive = "1.0.214" +serde_json = "1.0.132" diff --git a/apis/io-engine/build.rs b/apis/io-engine/build.rs index 2c0d2c2..230bb77 100644 --- a/apis/io-engine/build.rs +++ b/apis/io-engine/build.rs @@ -10,7 +10,7 @@ fn main() { .build_server(true) .type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") .extern_path(".google.protobuf.Timestamp", "::prost_extend::Timestamp") - .compile(&["protobuf/mayastor.proto"], &["protobuf"]) + .compile_protos(&["protobuf/mayastor.proto"], &["protobuf"]) .unwrap_or_else(|e| panic!("io-engine protobuf compilation failed: {}", e)); tonic_build::configure() @@ -19,7 +19,7 @@ fn main() { .type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") .extern_path(".google.protobuf.Timestamp", "::prost_extend::Timestamp") .extern_path(".google.protobuf.Duration", "::prost_extend::Duration") - .compile( + .compile_protos( &[ "protobuf/v1/bdev.proto", "protobuf/v1/json.proto", diff --git a/apis/io-engine/src/v1.rs b/apis/io-engine/src/v1.rs index 6706cc1..59f0cfa 100644 --- a/apis/io-engine/src/v1.rs +++ b/apis/io-engine/src/v1.rs @@ -6,6 +6,7 @@ mod pb { // Include Rust sources generated by protobuf. #![allow(unknown_lints)] #![allow(clippy::derive_partial_eq_without_eq)] + #![allow(clippy::doc_lazy_continuation)] tonic::include_proto!("mayastor.v1"); } diff --git a/composer/Cargo.toml b/composer/Cargo.toml index 0c6140c..aa3d169 100644 --- a/composer/Cargo.toml +++ b/composer/Cargo.toml @@ -1,23 +1,16 @@ [package] name = "composer" version = "0.1.0" -authors = ["Tiago Castro "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tokio = { version = "1.32.0", features = [ "full" ] } -futures = "0.3.28" -tracing = "0.1.37" -once_cell = "1.18.0" +tokio = { version = "1.41.0", features = ["full"] } +futures = "0.3.31" +tracing = "0.1.40" +once_cell = "1.20.2" ipnetwork = "0.20.0" -bollard = "0.15.0" -strum = "0.25" -strum_macros = "0.25" - -[dev-dependencies.serde] -# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! -# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! -# https://github.com/serde-rs/serde/issues/2734 -version = ">=1.0.188,<1.0.198" \ No newline at end of file +bollard = "0.17.1" +strum = "0.26" +strum_macros = "0.26" diff --git a/composer/src/composer.rs b/composer/src/composer.rs index bb3e021..cae1f78 100644 --- a/composer/src/composer.rs +++ b/composer/src/composer.rs @@ -1782,13 +1782,11 @@ impl ComposeTest { tracing::trace!("Stopping {name:?}/{id}"); self.stop_id(&id) .await - .map_err(|error| { + .inspect_err(|_| { tracing::trace!("Failed to stop {name:?}/{id}"); - error }) - .map(|ok| { + .inspect(|_| { tracing::trace!("Stopped {name:?}/{id}"); - ok }) }) .collect::>(); diff --git a/devinfo/Cargo.toml b/devinfo/Cargo.toml index c90e252..1fe89f0 100644 --- a/devinfo/Cargo.toml +++ b/devinfo/Cargo.toml @@ -1,17 +1,16 @@ [package] name = "devinfo" version = "1.0.0" -authors = ["Jeffry Molanus "] edition = "2018" [dependencies] -nix = { version = "0.27.1", default-features = false, features = [ "feature" ] } -semver = "1.0.20" -snafu = "0.7.5" -url = "2.4.1" -uuid = { version = "1.4.1", features = ["v4"] } +nix = { version = "0.29.0", default-features = false, features = ["feature"] } +semver = "1.0.23" +snafu = "0.8.5" +url = "2.5.2" +uuid = { version = "1.11.0", features = ["v4"] } [build-dependencies] -bindgen = "0.68.1" +bindgen = "0.70.1" [target.'cfg(target_os="linux")'.dependencies] -udev = "0.8.0" +udev = "0.9.1" diff --git a/devinfo/src/mountinfo/mod.rs b/devinfo/src/mountinfo/mod.rs index f268895..fa4d760 100644 --- a/devinfo/src/mountinfo/mod.rs +++ b/devinfo/src/mountinfo/mod.rs @@ -100,7 +100,6 @@ impl FromStr for MountInfo { impl MountInfo { /// Attempt to parse a `/proc/mounts`-like line. - fn fetch_from_disk_by_path(path: &str) -> io::Result { PartitionID::from_disk_by_path(path) .map_err(|why| Error::new(ErrorKind::InvalidData, format!("{path}: {why}")))? diff --git a/event-publisher/Cargo.toml b/event-publisher/Cargo.toml index 232f752..9003b3d 100644 --- a/event-publisher/Cargo.toml +++ b/event-publisher/Cargo.toml @@ -3,15 +3,14 @@ name = "event-publisher" version = "0.1.0" edition = "2021" -[dependencies] -tracing-subscriber = { version = "0.3.17", features = [ "env-filter" ] } -tokio = { version = "1.32.0"} -tracing = "0.1.37" -serde_json = "1.0.107" -events-api = { path = "../apis/events" } +[features] +default = ["rls-ring"] +rls-aws-lc-rs = ["events-api/rls-aws-lc-rs"] +rls-ring = ["events-api/rls-ring"] -[dev-dependencies.serde] -# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! -# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! -# https://github.com/serde-rs/serde/issues/2734 -version = ">=1.0.188,<1.0.198" \ No newline at end of file +[dependencies] +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +tokio = { version = "1.41.0" } +tracing = "0.1.40" +serde_json = "1.0.132" +events-api = { path = "../apis/events", default-features = false } diff --git a/h2 b/h2 index b874ca5..fad108a 160000 --- a/h2 +++ b/h2 @@ -1 +1 @@ -Subproject commit b874ca5bac438cdd7058d918c98a45938404c301 +Subproject commit fad108a9a06986ee787297dd438f2985fb9c37f4 diff --git a/nix/sources.json b/nix/sources.json index 4ea869a..4f2df9d 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "35f9f5784eb50cabac4db09c8c11035dacf36411", - "sha256": "1gq4ajsmg2f5jdmbdhdavcnlg32bzynvvidvb4648pk4gdcnr49h", + "rev": "b06ca0fab3185980a7501d7db273bb9f864580d4", + "sha256": "08pvwij6855wyxq6giyjwj3mdbrl118zzvbr7xdynmb7w9r9lv0l", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/35f9f5784eb50cabac4db09c8c11035dacf36411.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/b06ca0fab3185980a7501d7db273bb9f864580d4.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "rust-overlay": { @@ -17,10 +17,10 @@ "homepage": "", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d064703dc0657a49a17671c74b1a15ea7433e753", - "sha256": "06g1c1ys8ihd3vsjswqrkl8nv9lypizzgivbvwz1aycm34i3ib4z", + "rev": "7509d76ce2b3d22b40bd25368b45c0a9f7f36c89", + "sha256": "12gh5a0clc11b219xrvh08f35v959wnnmm089ys1cmqfdxx9v77n", "type": "tarball", - "url": "https://github.com/oxalica/rust-overlay/archive/d064703dc0657a49a17671c74b1a15ea7433e753.tar.gz", + "url": "https://github.com/oxalica/rust-overlay/archive/7509d76ce2b3d22b40bd25368b45c0a9f7f36c89.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/nvmeadm/.cargo/config b/nvmeadm/.cargo/config.toml similarity index 100% rename from nvmeadm/.cargo/config rename to nvmeadm/.cargo/config.toml diff --git a/nvmeadm/Cargo.toml b/nvmeadm/Cargo.toml index f5b413f..f35c5e4 100644 --- a/nvmeadm/Cargo.toml +++ b/nvmeadm/Cargo.toml @@ -4,14 +4,14 @@ version = "1.0.0" edition = "2021" [dependencies] -derive_builder = "0.12.0" -enum-primitive-derive = "0.2.2" +derive_builder = "0.20.2" +enum-primitive-derive = "0.3.0" glob = "0.3.1" ioctl-gen = "0.1.1" -libc = "0.2.148" -nix = { version = "0.27.1", default-features = false, features = [ "ioctl" ] } -num-traits = "0.2.16" -once_cell = "1.18.0" -snafu = "0.7.5" -uuid = { version = "1.4.1", features = ["v4"] } -url = "2.4.1" +libc = "0.2.161" +nix = { version = "0.29.0", default-features = false, features = [ "ioctl" ] } +num-traits = "0.2.19" +once_cell = "1.20.2" +snafu = "0.8.5" +uuid = { version = "1.11.0", features = ["v4"] } +url = "2.5.2" diff --git a/nvmeadm/src/nvmf_discovery.rs b/nvmeadm/src/nvmf_discovery.rs index 5b9e80d..cb29046 100644 --- a/nvmeadm/src/nvmf_discovery.rs +++ b/nvmeadm/src/nvmf_discovery.rs @@ -671,7 +671,6 @@ impl ConnectArgs { /// ```rust /// let num_disconnects = nvmeadm::nvmf_discovery::disconnect("mynqn"); /// ``` - pub fn disconnect(nqn: &str) -> Result { let subsys: Result, NvmeError> = NvmeSubsystems::new()? .filter_map(Result::ok) diff --git a/nvmeadm/tests/discovery_test.rs b/nvmeadm/tests/discovery_test.rs index bf593cb..54846b4 100644 --- a/nvmeadm/tests/discovery_test.rs +++ b/nvmeadm/tests/discovery_test.rs @@ -187,9 +187,10 @@ fn disconnect_test() { fn test_against_real_target() { // Disconnect all pre-existing NVMe connections to make sure new controller // always gets id = 0. - let _nvme_disconnect = Command::new("nvme") + Command::new("nvme") .arg("disconnect-all") .spawn() + .and_then(|mut child| child.wait()) .expect("Failed to cleanup NVMe connections !"); // Start an SPDK-based nvmf target diff --git a/prost-extend/Cargo.toml b/prost-extend/Cargo.toml index 206c104..3144274 100644 --- a/prost-extend/Cargo.toml +++ b/prost-extend/Cargo.toml @@ -6,15 +6,9 @@ description = "A thinner prost-wkt fork with just the bits we need" [build-dependencies] -tonic-build = "0.10.2" +tonic-build = "0.12.3" [dependencies] -chrono = "0.4.26" -serde = { version = "1.0.183", features = [ "derive" ] } -prost = "0.12.1" - -[dev-dependencies.serde] -# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! -# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! -# https://github.com/serde-rs/serde/issues/2734 -version = ">=1.0.188,<1.0.198" \ No newline at end of file +chrono = "0.4.38" +serde = { version = "1.0.214", features = [ "derive" ] } +prost = "0.13.3" diff --git a/prost-extend/build.rs b/prost-extend/build.rs index df95bc6..d0caa6c 100644 --- a/prost-extend/build.rs +++ b/prost-extend/build.rs @@ -5,6 +5,6 @@ fn main() { "google.protobuf.Duration", "#[derive(serde::Serialize, serde::Deserialize)] #[serde(default)]", ) - .compile(&["protobuf/v1/pb_time.proto"], &["protobuf/"]) + .compile_protos(&["protobuf/v1/pb_time.proto"], &["protobuf/"]) .unwrap_or_else(|e| panic!("prost-extend v1 protobuf compilation failed: {e}")); } diff --git a/prost-extend/src/duration.rs b/prost-extend/src/duration.rs index c103eb7..34bd9b9 100644 --- a/prost-extend/src/duration.rs +++ b/prost-extend/src/duration.rs @@ -9,7 +9,7 @@ const NANOS_MAX: i32 = NANOS_PER_SECOND - 1; impl fmt::Display for Duration { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut d = self.clone(); + let mut d = *self; d.normalize(); if self.seconds < 0 && self.nanos < 0 { write!(f, "-")?; diff --git a/prost-extend/src/timestamp.rs b/prost-extend/src/timestamp.rs index 9b8b651..bb22637 100644 --- a/prost-extend/src/timestamp.rs +++ b/prost-extend/src/timestamp.rs @@ -79,7 +79,7 @@ impl TryFrom for DateTime { /// Converts proto timestamp to chrono's DateTime. impl Timestamp { fn date_time_utc(&self) -> DateTime { - DateTime::::try_from(self.clone()).expect("invalid or out-of-range datetime") + DateTime::::try_from(*self).expect("invalid or out-of-range datetime") } } @@ -114,7 +114,7 @@ impl<'de> Deserialize<'de> for Timestamp { { struct TimestampVisitor; - impl<'de> Visitor<'de> for TimestampVisitor { + impl Visitor<'_> for TimestampVisitor { type Value = Timestamp; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/scripts/rust/for_each.sh b/scripts/rust/for_each.sh new file mode 100755 index 0000000..ae98c10 --- /dev/null +++ b/scripts/rust/for_each.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +for d in `find -maxdepth 3 -name Cargo.toml -printf '%h\n' | grep -v "^./h2"`; do + pushd $d + $@ + popd +done + diff --git a/shell.nix b/shell.nix index 5a86389..1ed260c 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ profile ? "nightly", version ? "2024-02-06" }: +{ profile ? "nightly", version ? "2024-10-30" }: let sources = import ./nix/sources.nix; pkgs = import sources.nixpkgs { @@ -35,7 +35,15 @@ pkgs.mkShell { NODE_PATH = "${nodePackages."@commitlint/config-conventional"}/lib/node_modules"; shellHook = '' - pre-commit install - pre-commit install --hook commit-msg + if [ -z "$CI" ] && [ "$IN_NIX_SHELL" = "impure" ]; then + pre-commit install + pre-commit install --hook commit-msg + fi + + if [ -d ~/.cargo/bin ]; then + # Adding ~/.cargo/bin to the path let's us carry on using rustup but it lowers its + # priority: https://github.com/rust-lang/cargo/pull/11023 + export PATH=$PATH:~/.cargo/bin + fi ''; } diff --git a/sysfs/Cargo.toml b/sysfs/Cargo.toml index 1e3fba7..3d9a5bc 100644 --- a/sysfs/Cargo.toml +++ b/sysfs/Cargo.toml @@ -1,6 +1,4 @@ [package] name = "sysfs" version = "1.0.0" -authors = ["Jeffry Molanus "] edition = "2018" - diff --git a/tracing-filter/Cargo.toml b/tracing-filter/Cargo.toml index a73502c..83370a6 100644 --- a/tracing-filter/Cargo.toml +++ b/tracing-filter/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tracing-subscriber = { version = "0.3.17", features = [ "env-filter" ] } +tracing-subscriber = { version = "0.3.18", features = [ "env-filter" ] } diff --git a/version-info/Cargo.toml b/version-info/Cargo.toml index 9a51b02..1a6c71e 100644 --- a/version-info/Cargo.toml +++ b/version-info/Cargo.toml @@ -2,16 +2,13 @@ name = "version-info" version = "0.1.0" edition = "2018" -authors = [ - "Dmitry Savitskiy ", -] [dependencies] git-version-macro = { path = "../git-version-macro" } regex = "1" [features] -default = [ "deps" ] +default = ["deps"] deps = [] -deps-logs-head = [ "deps" ] -deps-index = [ "deps" ] +deps-logs-head = ["deps"] +deps-index = ["deps"]