%if 0%{?rhel} == 9 # Tests fail on RHEL 9 due to RPM macro evaluation differences %bcond_with check %else %bcond_without check %endif Name: cargo-rpm-macros Version: 28.4 Release: 5%{?dist} Summary: RPM macros and generators for building Rust packages with cargo License: MIT URL: https://codeberg.org/rust2rpm/cargo-rpm-macros Source: %{url}/archive/v%{version}.tar.gz # temporary patch for compatibility with RHEL / ELN: # The %%cargo_prep macro in RHEL / ELN accepts a -V flag. Using the same spec # file for both Fedora and ELN would cause spec file parsing errors because # the -V flag is not known in Fedora. Patch0: 0001-Temporarily-accept-cargo_prep-V-flag-for-spec-compat.patch # Python 3.9 compatibility patch for EPEL9 # RHEL 9/EPEL 9 ships with Python 3.9 which doesn't support the | union operator %if 0%{?rhel} == 9 Patch1: 0002-Python-3.9-compatibility-for-EPEL9.patch %endif BuildArch: noarch %if %{with check} BuildRequires: python3-pytest %endif # obsolete + provide rust-packaging (removed in Fedora 38) Obsoletes: rust-packaging < 24 Provides: rust-packaging = %{version}-%{release} Requires: cargo2rpm >= 0.3.2 Requires: cargo Requires: gawk Requires: grep Requires: rust-srpm-macros-epel = %{version}-%{release} %description %{summary}. %package -n rust-srpm-macros-epel Summary: RPM macros for building Rust projects # require rust-srpm-macros from RHEL Requires: rust-srpm-macros %description -n rust-srpm-macros-epel RPM macros for building source packages for Rust projects. %prep %setup -q -n cargo-rpm-macros %patch 0 -p1 %if 0%{?rhel} == 9 %patch 1 -p1 %endif %build # nothing to do %install install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.cargo install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} macros.d/macros.rust install -D -p -m 0644 -t %{buildroot}/%{_fileattrsdir} fileattrs/cargo.attr install -D -p -m 0644 -t %{buildroot}/%{_fileattrsdir} fileattrs/cargo_vendor.attr %if %{with check} %check export MACRO_DIR=%{buildroot}%{_rpmmacrodir} pytest -vv %endif %files %license LICENSE %{_rpmmacrodir}/macros.cargo %{_fileattrsdir}/cargo.attr %{_fileattrsdir}/cargo_vendor.attr %files -n rust-srpm-macros-epel %license LICENSE %{_rpmmacrodir}/macros.rust %changelog * Fri Apr 17 2026 EPEL Maintainer - 28.4-5 - Disable tests on RHEL 9 due to RPM macro evaluation differences - Tests pass on other platforms but fail on RHEL 9 with "Macro % has illegal name" * Fri Apr 17 2026 EPEL Maintainer - 28.4-4 - Fix malformed patch file format * Fri Apr 17 2026 EPEL Maintainer - 28.4-3 - Fix Python 3.9 compatibility patch to apply correctly - Make Python 3.9 patch conditional for RHEL9 only * Fri Apr 17 2026 EPEL Maintainer - 28.4-2 - Add Python 3.9 compatibility patch for test suite * Fri Apr 17 2026 EPEL Maintainer - 28.4-1 - Initial build for EPEL9 - Based on Fedora rawhide package