diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 0170ba6d88..1c7d83f307 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -2,8 +2,15 @@ export PROFILEDIR=debug -make fmt-travis && make build && make stratis-dumpmetadata && make build-min && make test && make clippy && make yamllint && make check-typos || exit 1 +make fmt-ci && + make build && + make stratis-dumpmetadata && + make build-min && + make test && + make clippy && + make yamllint && + make check-typos || exit 1 export PYTHONPATH=$PWD/tests/client-dbus/src -cd tests/client-dbus && make fmt-travis && make lint || exit 1 +cd tests/client-dbus && make fmt-ci && make lint || exit 1 diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 5ca3f76db4..65844d1eb5 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -51,7 +51,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Check out ci repo run: git clone https://github.com/stratis-storage/ci.git - name: Run comparisons of version specs with available Fedora packages diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 85769e7a5d..ab8ab056d6 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -34,33 +34,33 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - - task: make -f Makefile docs-travis - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + - task: make -f Makefile docs-ci + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: >- TANG_URL=localhost make -f Makefile test-clevis-loop-should-fail - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -95,7 +95,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f054d558f..c41db9a4b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,11 +33,11 @@ jobs: strategy: matrix: include: - - task: make -f Makefile fmt-travis - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + - task: make -f Makefile fmt-ci + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: rustfmt - task: make -f Makefile check-typos - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -61,6 +61,9 @@ jobs: with: components: ${{ matrix.components }} toolchain: ${{ matrix.toolchain }} + - uses: baptiste0928/cargo-install@v2 + with: + crate: typos-cli - name: Test ${{ matrix.task }} on ${{ matrix.toolchain }} toolchain run: ${{ matrix.task }} @@ -74,7 +77,7 @@ jobs: TANG_URL=tang RUST_LOG=stratisd=debug make -f Makefile test-clevis-loop - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo image: fedora:38 # CURRENT DEVELOPMENT ENVIRONMENT runs-on: ubuntu-22.04 @@ -152,7 +155,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.69.0 # LOWEST SUPPORTED RUST TOOLCHAIN + toolchain: 1.71.1 # LOWEST SUPPORTED RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd @@ -208,7 +211,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Run stratisd-min cli tests run: make test-stratisd-min - name: Run stratis-min cli tests @@ -229,43 +232,6 @@ jobs: - name: Run shell check run: make -f Makefile fmt-shell-ci - checks-with-ci-repo: - strategy: - matrix: - include: - - task: > - SET_LOWER_BOUNDS=./ci/dependency_management/set_lower_bounds - make -f Makefile_dependencies verify-dependency-bounds - runs-on: ubuntu-22.04 - container: - image: fedora:38 # CURRENT DEVELOPMENT ENVIRONMENT - steps: - - uses: actions/checkout@v3 - - name: Install dependencies for Fedora - run: > - dnf install -y - clang - curl - cryptsetup-devel - dbus-devel - device-mapper-devel - git - libblkid-devel - make - ncurses - openssl-devel - python-requests - python-semantic_version - systemd-devel - - uses: dtolnay/rust-toolchain@master - with: - components: cargo - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - - name: Check out ci repo - run: git clone https://github.com/stratis-storage/ci.git - - name: Run ${{ matrix.task }} - run: ${{ matrix.task }} - python-based-tests: runs-on: ubuntu-22.04 container: @@ -295,7 +261,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd @@ -339,7 +305,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.69.0 # LOWEST SUPPORTED RUST TOOLCHAIN + toolchain: 1.71.1 # LOWEST SUPPORTED RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 740db7abfb..439e0c6608 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -33,9 +33,9 @@ jobs: matrix: include: # MANDATORY CHECKS USING CURRENT DEVELOPMENT ENVIRONMENT - - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + - toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN # MANDATORY CHECKS USING LOWEST SUPPORTED ENVIRONMENT PROXY - - toolchain: 1.69.0 # LOWEST SUPPORTED RUST TOOLCHAIN + - toolchain: 1.71.1 # LOWEST SUPPORTED RUST TOOLCHAIN runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 @@ -134,7 +134,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml index d83f8cd18f..fb01b76107 100644 --- a/.github/workflows/support.yml +++ b/.github/workflows/support.yml @@ -43,7 +43,7 @@ jobs: task: PYTHONPATH=./src make -f Makefile lint working-directory: ./tests/client-dbus - dependencies: black python3-isort - task: make -f Makefile fmt-travis + task: make -f Makefile fmt-ci working-directory: ./tests/client-dbus - dependencies: yamllint task: make -f Makefile yamllint diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 2821de7630..ed51eb0651 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -34,28 +34,28 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - - task: make -f Makefile docs-travis - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + - task: make -f Makefile docs-ci + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -93,7 +93,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.72.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: diff --git a/CHANGES.txt b/CHANGES.txt index 817582835f..aaafb776e3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,44 @@ +stratisd 3.5.9 +============== +Recommended Rust toolchain version: 1.72.0 +Lowest supported Rust toolchain version: 1.71.1 + +- New commits: + * Remove trailing whitespace in CHANGES.txt + +- Cherry-picked commits: + * Update to nix 0.26.3 and fix compilation error + * Revert "Revert "Update lowest supported Rust to 1.71.1"" + * Remove SET_LOWER_BOUNDS check from CI + * Increase serde_derive dependency lower bound to 1.0.185 + * github actions: update recommended Rust to 1.72.0 + * jsonrpc: Fix useless-vec lint + * Fix clippy manual_try_fold lints + * Allow clippy redundant_closure_call + * Remove useless .into_inter() calls + * Fix useless-vec lint + * stratisd_proc_macros v0.2.1 + * Revert "Update lowest supported Rust to 1.71.1" + * Do not use fully qualified name for StratPool + * Update lowest supported Rust to 1.71.1 + * Cargo.toml: add vendor-filter metadata + * Remove PATH and install management for audit task + * Remove install and PATH setting for license target + * Remove outdated-related targets in Makefile + * Remove expand-related targets in Makefile + * Remove Makefile entries for cargo-bloat + * Do not do install and PATH adjustments in Makefile for typos + * Add cargo-auditable modification for cargo-build and rustc + * github actions: update recommended Rust to 1.71.1 + * Change -travis to -ci everywhere + * Decompose build-all into two sub-targets + * Fix bug in udev tests resulting from removing encrypted rollback + * Restrict min tests with feature flags + * Update lowest supported Rust to 1.71.0 + * Do not use default features for retry crate + * Do not require the futures feature for dbus dependency + + stratisd 3.5.8 ============== Recommended Rust toolchain version: 1.71.0 @@ -37,7 +78,7 @@ Recommended development platform for Python development: Fedora 38 * Require udev support in container stratis-min-cli checks in GitHub Actions * Update lowest supported Rust to 1.69.0 * Improve error message for unlock check - * Do not use undefined matrix field "toolchain" in GitHub Action + * Do not use undefined matrix field "toolchain" in GitHub Action * Fix a source code typo in a test method diff --git a/Cargo.lock b/Cargo.lock index 3cd26958ed..97a2113871 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.29", ] [[package]] @@ -357,8 +357,6 @@ version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" dependencies = [ - "futures-channel", - "futures-util", "libc", "libdbus-sys", "winapi", @@ -551,7 +549,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.29", ] [[package]] @@ -1238,13 +1236,13 @@ checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" [[package]] name = "serde_derive" -version = "1.0.175" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.29", ] [[package]] @@ -1311,7 +1309,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stratisd" -version = "3.5.8" +version = "3.5.9" dependencies = [ "assert_cmd", "assert_matches", @@ -1359,7 +1357,7 @@ dependencies = [ [[package]] name = "stratisd_proc_macros" -version = "0.2.0" +version = "0.2.1" dependencies = [ "proc-macro2", "quote", @@ -1385,9 +1383,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.27" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -1448,7 +1446,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.29", ] [[package]] @@ -1533,7 +1531,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.29", "wasm-bindgen-shared", ] @@ -1555,7 +1553,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index a5d379cff8..6063ed3939 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "stratisd" -version = "3.5.8" +version = "3.5.9" authors = ["Stratis Developers "] edition = "2021" -rust-version = "1.69.0" # LOWEST SUPPORTED RUST TOOLCHAIN +rust-version = "1.71.1" # LOWEST SUPPORTED RUST TOOLCHAIN build = "build.rs" description = "Stratis daemon" license = "MPL-2.0" @@ -91,7 +91,6 @@ optional = true [dependencies.dbus] version = "0.9.0" -features = ["futures"] optional = true [dependencies.dbus-tree] @@ -165,6 +164,7 @@ optional = true [dependencies.retry] version = "1.3.1" +default-features = false optional = true [dependencies.rpassword] @@ -176,7 +176,7 @@ version = "1.0.119" optional = true [dependencies.serde_derive] -version = "1.0.119" +version = "1.0.185" optional = true [dependencies.serde_json] @@ -218,7 +218,6 @@ optional = true [dev-dependencies] assert_cmd = "2.0.8" assert_matches = "1.5.0" -env_logger = "0.10.0" loopdev = "0.4.0" predicates = "3.0.0" proptest = "1.0.0" @@ -268,3 +267,11 @@ udev_scripts = ["data-encoding"] [patch.crates-io.loopdev] git = "https://github.com/mulkieran/loopdev" branch = "bump-bindgen-reduce-version" + +[package.metadata.vendor-filter] +platforms = ["*-unknown-linux-gnu"] +tier = "2" +all-features = true +exclude-crate-paths = [ { name = "num_cpus", exclude = "ci" }, + { name = "libm", exclude = "ci" }, + { name = "libdbus-sys", exclude = "vendor/dbus/tools/docker" } ] diff --git a/Makefile b/Makefile index 4cf7c03766..e649f08c13 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,11 @@ +ifeq ($(origin AUDITABLE), undefined) + BUILD = build + RUSTC = rustc +else + BUILD = auditable build + RUSTC = auditable rustc +endif + ifeq ($(origin TARGET), undefined) else TARGET_ARGS = --target=${TARGET} @@ -133,63 +141,32 @@ CLIPPY_PEDANTIC = -D clippy::await_holding_lock \ -D clippy::verbose_bit_mask \ -D clippy::wildcard_imports -${HOME}/.cargo/bin/cargo-outdated: - cargo install cargo-outdated - -${HOME}/.cargo/bin/cargo-license: - cargo install cargo-license - -${HOME}/.cargo/bin/cargo-bloat: - cargo install cargo-bloat - -${HOME}/.cargo/bin/cargo-audit: - cargo install cargo-audit - -${HOME}/.cargo/bin/cargo-expand: - cargo install cargo-expand - -${HOME}/.cargo/bin/typos: - cargo install typos-cli - -## Run cargo outdated -outdated: ${HOME}/.cargo/bin/cargo-outdated - PATH=${HOME}/.cargo/bin:${PATH} cargo outdated - ## Run cargo license -license: ${HOME}/.cargo/bin/cargo-license - PATH=${HOME}/.cargo/bin:${PATH} cargo license - -## Run cargo bloat -bloat: ${HOME}/.cargo/bin/cargo-bloat - PATH=${HOME}/.cargo/bin:${PATH} cargo bloat --release - PATH=${HOME}/.cargo/bin:${PATH} cargo bloat --release --crates +license: + cargo license ## Run cargo audit -audit: ${HOME}/.cargo/bin/cargo-audit - PATH=${HOME}/.cargo/bin:${PATH} cargo audit -D warnings - -## Run cargo expand -expand: ${HOME}/.cargo/bin/cargo-expand - PATH=${HOME}/.cargo/bin:${PATH} cargo expand --lib engine::strat_engine::pool +audit: + cargo audit -D warnings ## Check for spelling errors -check-typos: ${HOME}/.cargo/bin/typos - PATH=${HOME}/.cargo/bin:${PATH} typos +check-typos: + typos ## Run cargo fmt fmt: fmt-macros cargo fmt +## Run cargo fmt for CI jobs +fmt-ci: fmt-macros-ci + cargo fmt -- --check + ## Run cargo fmt for stratisd_proc_macros fmt-macros: cd stratisd_proc_macros && cargo fmt -## Run cargo fmt for CI jobs -fmt-travis: fmt-macros-travis - cargo fmt -- --check - ## Run cargo fmt on stratisd_proc_macros for CI jobs -fmt-macros-travis: +fmt-macros-ci: cd stratisd_proc_macros && cargo fmt -- --check ## Check shell formatting with shfmt @@ -204,7 +181,7 @@ fmt-shell-ci: build: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ - cargo build ${RELEASE_FLAG} \ + cargo ${BUILD} ${RELEASE_FLAG} \ --bin=stratisd \ ${TARGET_ARGS} @@ -218,7 +195,7 @@ build-tests: build-min: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ - cargo build ${RELEASE_FLAG} \ + cargo ${BUILD} ${RELEASE_FLAG} \ --bin=stratis-min --bin=stratisd-min --bin=stratis-utils \ ${SYSTEMD_FEATURES} ${TARGET_ARGS} @@ -226,7 +203,7 @@ build-min: build-stratis-str-cmp: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ - cargo rustc ${RELEASE_FLAG} \ + cargo ${RUSTC} ${RELEASE_FLAG} \ --bin=stratis-str-cmp \ ${UDEV_FEATURES} \ ${TARGET_ARGS} \ @@ -237,7 +214,7 @@ build-stratis-str-cmp: build-stratis-base32-decode: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ - cargo rustc ${RELEASE_FLAG} \ + cargo ${RUSTC} ${RELEASE_FLAG} \ --bin=stratis-base32-decode \ ${UDEV_FEATURES} \ ${TARGET_ARGS} \ @@ -253,21 +230,21 @@ build-udev-utils: build-stratis-str-cmp build-stratis-base32-decode stratis-dumpmetadata: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ - cargo build ${RELEASE_FLAG} \ + cargo ${BUILD} ${RELEASE_FLAG} \ --bin=stratis-dumpmetadata ${EXTRAS_FEATURES} ${TARGET_ARGS} ## Build stratis-min for early userspace stratis-min: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ - cargo build ${RELEASE_FLAG} \ + cargo ${BUILD} ${RELEASE_FLAG} \ --bin=stratis-min ${MIN_FEATURES} ${TARGET_ARGS} ## Build stratisd-min for early userspace stratisd-min: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ - cargo build ${RELEASE_FLAG} \ + cargo ${BUILD} ${RELEASE_FLAG} \ --bin=stratisd-min ${SYSTEMD_FEATURES} ${TARGET_ARGS} ## Install udev configuration @@ -336,9 +313,14 @@ install-daemons: ## Install all stratisd files install: install-udev-cfg install-man-cfg install-dbus-cfg install-dracut-cfg install-systemd-cfg install-binaries install-udev-binaries install-fstab-script install-daemons +## Build all Rust artifacts +build-all-rust: build build-min build-udev-utils stratis-dumpmetadata + +## Build all man pages +build-all-man: docs/stratisd.8 docs/stratis-dumpmetadata.8 -## Build all stratisd binaries and configuration -build-all: build build-min build-udev-utils docs/stratisd.8 stratis-dumpmetadata docs/stratis-dumpmetadata.8 +## Build all stratisd binaries and configuration necessary for install +build-all: build-all-rust build-all-man ## Remove installed configuration files clean-cfg: @@ -428,7 +410,7 @@ yamllint: yamllint --strict .github/workflows/*.yml ## Build docs-rust for CI -docs-travis: docs-rust +docs-ci: docs-rust ## Build rust documentation docs-rust: @@ -450,9 +432,10 @@ clippy: clippy-macros .PHONY: audit - bloat build build-all + build-all-man + build-all-rust build-min build-udev-utils build-stratis-base32-decode @@ -464,15 +447,14 @@ clippy: clippy-macros clean-primary clippy clippy-macros + docs-ci docs-rust - docs-travis - expand fmt + fmt-ci fmt-shell fmt-shell-ci - fmt-travis fmt-macros - fmt-macros-travis + fmt-macros-ci help install install-binaries @@ -485,7 +467,6 @@ clippy: clippy-macros install-udev-binaries install-udev-cfg license - outdated test test-valgrind test-loop diff --git a/src/dbus_api/api/shared.rs b/src/dbus_api/api/shared.rs index 523748d9fe..769751b7e0 100644 --- a/src/dbus_api/api/shared.rs +++ b/src/dbus_api/api/shared.rs @@ -138,7 +138,7 @@ where }) }) .fold(HashMap::new(), |mut props, prop| { - props.extend(prop.into_iter()); + props.extend(prop); props }); diff --git a/src/dbus_api/macros.rs b/src/dbus_api/macros.rs index aa41720464..e236973c31 100644 --- a/src/dbus_api/macros.rs +++ b/src/dbus_api/macros.rs @@ -180,6 +180,7 @@ macro_rules! handle_signal_change { let mut pairs = std::collections::HashMap::new(); $( if let $crate::dbus_api::types::SignalChange::Changed(t) = $prop_val { + #[allow(clippy::redundant_closure_call)] pairs.insert($prop, box_variant!($data_to_prop(t))); } )+ diff --git a/src/engine/sim_engine/filesystem.rs b/src/engine/sim_engine/filesystem.rs index 35aab44232..3f99507395 100644 --- a/src/engine/sim_engine/filesystem.rs +++ b/src/engine/sim_engine/filesystem.rs @@ -44,7 +44,7 @@ impl Filesystem for SimFilesystem { } fn path_to_mount_filesystem(&self, pool_name: &str, fs_name: &str) -> PathBuf { - vec!["/somepath", pool_name, fs_name].iter().collect() + ["/somepath", pool_name, fs_name].iter().collect() } fn used(&self) -> StratisResult { diff --git a/src/engine/sim_engine/pool.rs b/src/engine/sim_engine/pool.rs index 863a2d3d6e..dd0dd6274d 100644 --- a/src/engine/sim_engine/pool.rs +++ b/src/engine/sim_engine/pool.rs @@ -221,8 +221,8 @@ impl Pool for SimPool { let spec_map = validate_filesystem_size_specs(specs)?; - spec_map.iter().fold(Ok(()), |res, (name, size)| { - res.and_then(|()| validate_name(name)) + spec_map.iter().try_fold((), |_, (name, size)| { + validate_name(name) .and_then(|()| { if let Some((_, fs)) = self.filesystems.get_by_name(name) { if fs.size() == *size { diff --git a/src/engine/strat_engine/devlinks.rs b/src/engine/strat_engine/devlinks.rs index e444b5aebb..8afef7bf8f 100644 --- a/src/engine/strat_engine/devlinks.rs +++ b/src/engine/strat_engine/devlinks.rs @@ -11,7 +11,7 @@ pub const UEVENT_CHANGE_EVENT: &str = "change"; /// Given a pool name and a filesystem name, return the path it should be /// available as a device for mounting. pub fn filesystem_mount_path>(pool_name: T, fs_name: T) -> PathBuf { - vec![DEV_PATH, pool_name.as_ref(), fs_name.as_ref()] + [DEV_PATH, pool_name.as_ref(), fs_name.as_ref()] .iter() .collect() } diff --git a/src/engine/strat_engine/engine.rs b/src/engine/strat_engine/engine.rs index 24a9a31dbc..cffc889e14 100644 --- a/src/engine/strat_engine/engine.rs +++ b/src/engine/strat_engine/engine.rs @@ -277,7 +277,7 @@ impl<'a> Into for &'a StratEngine { json, <&LiminalDevices as Into>::into(&*self.liminal_devices.blocking_read()), ) { - j.extend(map.into_iter()); + j.extend(map); Value::Object(j) } else { unreachable!("json!() and LiminalDevices::into() always return JSON object"); @@ -354,7 +354,7 @@ impl Engine for StratEngine { ret_guards.push(guard); } } - diffs.extend(diffs_thread.into_iter()); + diffs.extend(diffs_thread); } Err(e) => { warn!("Failed to handle udev events: {}", e); diff --git a/src/engine/strat_engine/liminal/device_info.rs b/src/engine/strat_engine/liminal/device_info.rs index 1b65aa22e2..655bc390dc 100644 --- a/src/engine/strat_engine/liminal/device_info.rs +++ b/src/engine/strat_engine/liminal/device_info.rs @@ -651,12 +651,10 @@ impl DeviceSet { uuid: *uuid, }) }) - .fold(Some(Vec::new()), |vec, dev_info| { - vec.and_then(|mut v| { - dev_info.map(|d| { - v.push(d); - v - }) + .try_fold(Vec::new(), |mut vec, dev_info| { + dev_info.map(|d| { + vec.push(d); + vec }) }) .map(|d| LockedPoolInfo { diff --git a/src/engine/strat_engine/ns.rs b/src/engine/strat_engine/ns.rs index 3438b2a97a..8a2dfe9c3d 100644 --- a/src/engine/strat_engine/ns.rs +++ b/src/engine/strat_engine/ns.rs @@ -56,7 +56,7 @@ impl MemoryFilesystem { ))); } else { let stat_info = stat(NS_TMPFS_LOCATION)?; - let parent_path: PathBuf = vec![NS_TMPFS_LOCATION, ".."].iter().collect(); + let parent_path: PathBuf = [NS_TMPFS_LOCATION, ".."].iter().collect(); let parent_stat_info = stat(&parent_path)?; if stat_info.st_dev != parent_stat_info.st_dev { info!("Mount found at {}; unmounting", NS_TMPFS_LOCATION); diff --git a/src/engine/strat_engine/pool.rs b/src/engine/strat_engine/pool.rs index 3f2fa229f7..dd163bb0d0 100644 --- a/src/engine/strat_engine/pool.rs +++ b/src/engine/strat_engine/pool.rs @@ -755,8 +755,8 @@ impl Pool for StratPool { let increase = spec_map.values().copied().sum::(); self.check_overprov(increase)?; - spec_map.iter().fold(Ok(()), |res, (name, size)| { - res.and_then(|()| validate_name(name)) + spec_map.iter().try_fold((), |_, (name, size)| { + validate_name(name) .and_then(|()| { if let Some((_, fs)) = self.thin_pool.get_filesystem_by_name(name) { if fs.thindev_size() == *size { diff --git a/src/engine/strat_engine/thinpool/mdv.rs b/src/engine/strat_engine/thinpool/mdv.rs index ac0426a861..df27253f54 100644 --- a/src/engine/strat_engine/thinpool/mdv.rs +++ b/src/engine/strat_engine/thinpool/mdv.rs @@ -59,7 +59,7 @@ impl MetadataVol { /// Set up an existing Metadata Volume. pub fn setup(pool_uuid: PoolUuid, dev: LinearDev) -> StratisResult { let filename = format!(".mdv-{}", uuid_to_string!(pool_uuid)); - let mount_pt: PathBuf = vec![NS_TMPFS_LOCATION, &filename].iter().collect(); + let mount_pt: PathBuf = [NS_TMPFS_LOCATION, &filename].iter().collect(); let mdv = MetadataVol { dev, mount_pt }; diff --git a/src/jsonrpc/client/pool.rs b/src/jsonrpc/client/pool.rs index 1a1338f87f..29545a8b5a 100644 --- a/src/jsonrpc/client/pool.rs +++ b/src/jsonrpc/client/pool.rs @@ -100,7 +100,7 @@ fn properties_string(properties: Vec<(bool, bool)>) -> Vec { .map(|(has_cache, is_encrypted)| { let ca = if has_cache { " Ca" } else { "~Ca" }; let cr = if is_encrypted { " Cr" } else { "~Cr" }; - vec![ca, cr].join(",") + [ca, cr].join(",") }) .collect() } diff --git a/src/jsonrpc/server/server.rs b/src/jsonrpc/server/server.rs index 4094a92a07..bb1c1c34d2 100644 --- a/src/jsonrpc/server/server.rs +++ b/src/jsonrpc/server/server.rs @@ -309,12 +309,8 @@ fn try_recvmsg(fd: RawFd) -> StratisResult { let mut cmsg_space = cmsg_space!([RawFd; 1]); let mut vec = vec![0; 65536]; let (cmsgs, bytes) = { - let rmsg = recvmsg::( - fd, - &mut [IoSliceMut::new(vec.as_mut_slice())], - Some(&mut cmsg_space), - MsgFlags::empty(), - )?; + let mut iovecs = [IoSliceMut::new(vec.as_mut_slice())]; + let rmsg = recvmsg::(fd, &mut iovecs, Some(&mut cmsg_space), MsgFlags::empty())?; (rmsg.cmsgs().collect(), rmsg.bytes) }; diff --git a/stratisd_proc_macros/Cargo.toml b/stratisd_proc_macros/Cargo.toml index 6a41291a98..e8327a185b 100644 --- a/stratisd_proc_macros/Cargo.toml +++ b/stratisd_proc_macros/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "stratisd_proc_macros" -version = "0.2.0" +version = "0.2.1" authors = ["Stratis Developers "] edition = "2021" -rust-version = "1.69.0" # LOWEST SUPPORTED RUST TOOLCHAIN +rust-version = "1.71.1" # LOWEST SUPPORTED RUST TOOLCHAIN description = "Stratis daemon procedural macros" license = "MPL-2.0" repository = "https://github.com/stratis-storage/stratisd/" diff --git a/stratisd_proc_macros/src/lib.rs b/stratisd_proc_macros/src/lib.rs index 59d5278259..5f75d7e983 100644 --- a/stratisd_proc_macros/src/lib.rs +++ b/stratisd_proc_macros/src/lib.rs @@ -89,7 +89,7 @@ fn process_arguments(fn_arg: &FnArg) -> (Ident, PatType) { colon_token: Token![:](Span::call_site()), ty: Box::new( parse::(TokenStream::from(quote! { - #reference #mutability crate::engine::strat_engine::pool::StratPool + #reference #mutability StratPool })) .expect("Valid type"), ), diff --git a/tests/client-dbus/Makefile b/tests/client-dbus/Makefile index b1e48f3637..16fdbf7007 100644 --- a/tests/client-dbus/Makefile +++ b/tests/client-dbus/Makefile @@ -14,8 +14,8 @@ fmt: isort src tests black . -.PHONY: fmt-travis -fmt-travis: +.PHONY: fmt-ci +fmt-ci: isort --diff --check-only src tests black . --check diff --git a/tests/client-dbus/tests/udev/test_udev.py b/tests/client-dbus/tests/udev/test_udev.py index 00f26123f1..4db98a31dc 100644 --- a/tests/client-dbus/tests/udev/test_udev.py +++ b/tests/client-dbus/tests/udev/test_udev.py @@ -509,13 +509,8 @@ def test_duplicate_pool_name( get_object(TOP_OBJECT) ) - blockdevs = [] for pool_uuid in variant_pool_uuids: - ( - (changed, (_, blockdevs_tmp, _)), - exit_code, - _, - ) = Manager.Methods.StartPool( + Manager.Methods.StartPool( get_object(TOP_OBJECT), { "id": pool_uuid, @@ -523,12 +518,8 @@ def test_duplicate_pool_name( "id_type": "uuid", }, ) - if exit_code == StratisdErrors.OK and changed: - blockdevs = blockdevs_tmp - wait_for_udev_count( - len(blockdevs) + len(non_luks_tokens) + len(luks_tokens) - ) + wait_for_udev_count(len(non_luks_tokens) + len(luks_tokens)) # The number of pools should never exceed one, since all the pools # previously formed in the test have the same name. @@ -554,7 +545,7 @@ def test_duplicate_pool_name( ) for pool_uuid, props in variant_pool_uuids.items(): if "key_description" in props: - ((changed, _), exit_code, _) = Manager.Methods.StartPool( + Manager.Methods.StartPool( get_object(TOP_OBJECT), { "id": pool_uuid, diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 45973810d0..27b3e1b3bb 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1,6 +1,8 @@ // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#![cfg(all(feature = "engine", feature = "min"))] mod daemon; mod logger; pub use daemon::test_with_stratisd_min_sim; diff --git a/tests/stratis_min.rs b/tests/stratis_min.rs index 48b28e50d7..e073a75e47 100644 --- a/tests/stratis_min.rs +++ b/tests/stratis_min.rs @@ -1,6 +1,9 @@ // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#![cfg(all(feature = "engine", feature = "min"))] + use assert_cmd::Command; use common::test_with_stratisd_min_sim; use predicates::prelude::predicate;