diff --git a/macros.rust-toolset b/macros.rust-toolset index 6a2f7f5..135b3e2 100644 --- a/macros.rust-toolset +++ b/macros.rust-toolset @@ -126,32 +126,31 @@ EOF}\ %{nil} \ } -# NB: cargo_build/test/install do not use the -n/-a/-f argument parsing like -# Fedora's rust-packaging, because that change would break anyone that's -# already passing arguments directly to cargo after the macro. Instead, one can -# explicitly use --no-default-features, --all-features, or --features XYZ. - -# cargo_build: builds the crate with cargo -%cargo_build\ +# cargo_build: builds the crate with cargo with the specified feature flags +%cargo_build(naf:)\ %{shrink: \ %{__cargo} build \ %{__cargo_common_opts} \ --profile rpm \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ } -# cargo_test: runs the test suite with cargo +# cargo_test: runs the test suite with cargo with the specified feature flags # # To pass command-line arguments to the cargo test runners directly (for -# example, to skip certain tests during package builds), the -# "cargo test" argument parsing need to be bypassed, -# i.e. "%%cargo_test -- --skip foo" for skipping all tests with names that +# example, to skip certain tests during package builds), both the cargo_test +# macro argument parsing and "cargo test" argument parsing need to be bypassed, +# i.e. "%%cargo_test -- -- --skip foo" for skipping all tests with names that # match "foo". -%cargo_test\ +%cargo_test(naf:)\ %{shrink: \ %{__cargo} test \ %{__cargo_common_opts} \ --profile rpm \ --no-fail-fast \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ } # cargo_install: install files into the buildroot @@ -161,14 +160,19 @@ EOF}\ # "$CARGO_HOME/.crates.toml" file, which is used to keep track of which version # of a specific binary has been installed, but which conflicts between builds # of different Rust applications and is not needed when building RPM packages. -%cargo_install\ -%{shrink: \ - %{__cargo} install \ - %{__cargo_common_opts} \ - --profile rpm \ - --no-track \ - --path . \ -} +%cargo_install(t:naf:)\ +(\ +set -euo pipefail \ + %{shrink: \ + %{__cargo} install \ + %{__cargo_common_opts} \ + --profile rpm \ + --no-track \ + --path . \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ + } \ +) # cargo_license: print license information for all crate dependencies #