rust-rpmmacros: Improve test functionality

* Use arguments in cargo_build/install/test/license rpmmacros
* RHEL and CentOS 10 behaves like Fedora.
This commit is contained in:
Jesus Checa Hidalgo 2025-01-10 10:31:38 +01:00
commit 1716d90a4a

View file

@ -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]+"