From c1de18f683ce58da054e1bbe9b85cdeb14668957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 12 Nov 2024 01:14:19 +0100 Subject: [PATCH] Accept arbitrary options from %pyproject_buildrequires in pyproject-srpm-macros This way, when we add new options to the actual macro in pyproject-rpm-macros, spec files that use them are parsable with the old pyproject-srpm-macros package. Last time, when we added the -g option in 1.16.0, it took at least a week for Fedora CI to be able to parse a spec file with it, as pyproject-srpm-macros 1.16.0+ needed to actually be installed on the CI systems. Next time this happens, the new option will be parsable with older versions of pyproject-rpm-macros Note that the (-) syntax is not supported yet on RPM 4.16 in RHEL 9. I'd use an expression to keep the literal set of flags for older RPM versions: %pyproject_buildrequires(%[v"0%{?rpmversion}" >= v"4.19" ? "-" : "rRxtNwpe:g:C:"]) But macro options are not processed as macros: https://github.com/rpm-software-management/rpm/issues/3440 As a result, this is not compatible with RHEL 9 and cannot be backported to it. Unless the (-) syntax is backported: https://issues.redhat.com/browse/RHEL-67161 https://gitlab.com/redhat/centos-stream/rpms/rpm/-/merge_requests/60 --- macros.aaa-pyproject-srpm | 4 ++-- macros.pyproject | 1 - pyproject-rpm-macros.spec | 14 ++++++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/macros.aaa-pyproject-srpm b/macros.aaa-pyproject-srpm index 1b06ac3..b394be5 100644 --- a/macros.aaa-pyproject-srpm +++ b/macros.aaa-pyproject-srpm @@ -3,8 +3,8 @@ # When this file is installed but macros.pyproject is not # this macro will cause the package with the real macro to be installed. # When macros.pyproject is installed, it overrides this macro. -# Note: This needs to maintain the same set of options as the real macro. -%pyproject_buildrequires(rRxtNwpe:g:C:) echo 'pyproject-rpm-macros' && exit 0 +# Note: This takes arbitrary options, to ease addition of new options to the real macro. +%pyproject_buildrequires(-) echo 'pyproject-rpm-macros' && exit 0 # Declarative buildsystem, requires RPM 4.20+ to work diff --git a/macros.pyproject b/macros.pyproject index 449afe6..af6b441 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -166,7 +166,6 @@ fi ]"\ ] -# Note: Keep the options in sync with this macro from macros.aaa-pyproject-srpm %pyproject_buildrequires(rRxtNwpe:g:C:) %{expand:\\\ %_set_pytest_addopts # The default flags expect the package note file to exist diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index de6ef3c..1886cf2 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.16.2 +Version: 1.16.3 Release: 1%{?dist} # Macro files @@ -137,15 +137,9 @@ install -pm 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/redha install -pm 644 pyproject_requirements_txt.py %{buildroot}%{_rpmconfigdir}/redhat/ install -pm 644 pyproject_wheel.py %{buildroot}%{_rpmconfigdir}/redhat/ -%check -# assert the two signatures of %%pyproject_buildrequires match exactly -signature1="$(grep '^%%pyproject_buildrequires' macros.pyproject | cut -d' ' -f1)" -signature2="$(grep '^%%pyproject_buildrequires' macros.aaa-pyproject-srpm | cut -d' ' -f1)" -test "$signature1" == "$signature2" -# but also assert we are not comparing empty strings -test "$signature1" != "" %if %{with tests} +%check export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856356 %pytest -vv --doctest-modules %{?with_pytest_xdist:-n auto} %{!?with_tox_tests:-k "not tox"} @@ -173,6 +167,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Tue Dec 03 2024 Miro Hrončok - 1.16.3-1 +- Accept arbitrary options from %%pyproject_buildrequires in pyproject-srpm-macros +- This will make future additions smoother + * Wed Nov 13 2024 Miro Hrončok - 1.16.2-1 - Fix one remaining test for setuptools 70+