From 1716d90a4a5a96e6948c50e3038f5df4354e183c Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 10 Jan 2025 10:31:38 +0100 Subject: [PATCH] rust-rpmmacros: Improve test functionality * Use arguments in cargo_build/install/test/license rpmmacros * RHEL and CentOS 10 behaves like Fedora. --- tests/Sanity/rust-rpmmacros/rust-rpmtest.spec | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec b/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec index abe8c12..34d87a0 100644 --- a/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec +++ b/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec @@ -38,14 +38,29 @@ Summary: %{summary} %endif %build -%cargo_build +# cargo_build/install/test don't use -n/-a/-f in rhel/centos < 10 to avoid breaking +# existing packages using arguments. +%if 0%{?rhel} && 0%{?rhel} < 10 +%cargo_build --all-features +%else +%cargo_build -a +%endif + # cargo_license(_summary) macros is not available in rust 1.73 and older. -%{?cargo_license} -%{?cargo_license_summary} +%{?cargo_license:%cargo_license -a} +%{?cargo_license_summary:%cargo_license_summary -a} %install -%cargo_install +%if 0%{?rhel} && 0%{?rhel} < 10 +%cargo_install --all-features +%else +%cargo_install -a +%endif %check -%cargo_test +%%if 0%{?rhel} && 0%{?rhel} < 10 +%cargo_test --all-features +%else +%cargo_test -a +%endif %{buildroot}/%{_bindir}/rpmtest | grep -E "The answer is [0-9]+"