diff --git a/tests/Sanity/rust-rpmmacros/runtest.sh b/tests/Sanity/rust-rpmmacros/runtest.sh index bfca5d4..e5312c5 100755 --- a/tests/Sanity/rust-rpmmacros/runtest.sh +++ b/tests/Sanity/rust-rpmmacros/runtest.sh @@ -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 diff --git a/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec b/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec index 34d87a0..d97088c 100644 --- a/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec +++ b/tests/Sanity/rust-rpmmacros/rust-rpmtest.spec @@ -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