Update rpmmacros test

Starting with rhel 9.8 we are using the same rpmmacros format as Fedora
and RHEL 10, while RHEL older than 9.8 and 8 are using the "legacy"
format which pass-through the arguments to the cargo macros.
This commit is contained in:
Jesus Checa Hidalgo 2025-09-16 12:53:23 +02:00
commit bc84e88208
2 changed files with 14 additions and 6 deletions

View file

@ -36,7 +36,13 @@ rlJournalStart
rlPhaseEnd
rlPhaseStartTest
rlRun "rpmbuild --define '_topdir $tmp' -ba $tmp/SPECS/$SPECFILE"
# Rpmmacros depending on RHEL version
# https://issues.redhat.com/browse/RHEL-104777
LEGACY_MACROS=""
if rlIsRHEL 8 || rlIsRHEL "<9.8"; then
LEGACY_MACROS="--with legacy_rpmmacros"
fi
rlRun "rpmbuild --define '_topdir $tmp' -ba ${LEGACY_MACROS} $tmp/SPECS/$SPECFILE"
rlPhaseEnd
rlPhaseStartCleanup

View file

@ -1,5 +1,8 @@
%global crate rpmtest
# Build condition for legacy RPM macros (disabled by default)
%bcond_with legacy_rpmmacros
Name: rust-rpmtest
Version: 0.1.0
Release: 1
@ -38,9 +41,8 @@ Summary: %{summary}
%endif
%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
# Use legacy cargo macros when requested
%if %{with legacy_rpmmacros}
%cargo_build --all-features
%else
%cargo_build -a
@ -51,14 +53,14 @@ Summary: %{summary}
%{?cargo_license_summary:%cargo_license_summary -a}
%install
%if 0%{?rhel} && 0%{?rhel} < 10
%if %{with legacy_rpmmacros}
%cargo_install --all-features
%else
%cargo_install -a
%endif
%check
%%if 0%{?rhel} && 0%{?rhel} < 10
%if %{with legacy_rpmmacros}
%cargo_test --all-features
%else
%cargo_test -a