Fixes: https://pagure.io/koji/issue/4419
Used this document to migration: https://fedoraproject.org/wiki/Changes/DeprecateSetuppyMacros#Migrating_to_%pyproject_macros
Tested build in Copr: https://copr.devel.redhat.com/coprs/jlibrova/koji-specfile-macros/build/125066/
not sure about this removal. It should still be needed on RHEL 8 (i.e. without pyproject_support)
%pyproject_install takes no arguments.
rebased onto ff90fb9bf146962c04e0720f1fa3dbf4aba42bd3
@churchyard Thanks Miro, both fixed.
%endif +%if 0%{?fedora} || 0%{?rhel} >= 9 +%define pyproject_support 1 +%else +%define pyproject_support 0 +%endif
You have added this /inside of/ the long section of py[23]_support logic with no spacing or comments. This makes it look like it is part of that logic. When code gets complicated, appropriate spacing and clarifying comments go a long way for readability and maintainability.
-%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
There are a couple places where you simply removed this macro, including in a section for py2 support. I would expect that the flow of the spec would remain unchanged unless we're inside of %if 0%{pyproject_support}..%endif
%if 0%{pyproject_support}..%endif
Note that the removal of %python_provide call is probably desired (yet it does not belong to the same commit indeed). Tha macro is deprecated.
Note that the removal of %python_provide call is probably desired (yet it does not belong to the same commit indeed). The macro is deprecated.
Sure, but the macro is still defined on rhel8, and I think we want the spec to execute as before in that case.
Yeah, keep it then, it's useless now but not harmful.
@mikem fixed
Sure, but the macro is still defined on rhel8...
For the record, it's also defined in Fedora.
This is what the macro does on EPEL 8 as well as plain RHEL 8:
<mock-chroot> sh-4.4# rpm --define 'name koji' --eval '%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}' (empty) <mock-chroot> sh-4.4# rpm --define 'name koji' --eval '%python_provide python%{python3_pkgversion}-%{name}' (still empty)
On RHEL 9:
<mock-chroot> sh-5.1# rpm --define 'name koji' --eval '%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}' Provides: python3.9-koji = %{version}-%{release} Provides: python-koji = %{version}-%{release} Obsoletes: python-koji < %{version}-%{release}
The same Provides are generated via https://gitlab.com/redhat/centos-stream/rpms/python-rpm-generators/-/blob/c9s/pythonname.attr?ref_type=heads
The python3 package does not seem to be built on RHEL < 8, so the removal for the python3 package is safe. Unless you really need to Obsolete python-koji -- and if you do, you better do it explicitly.
Ah, it didn't realize it was literally doing nothing on rhel8.
Oddly enough, it does something on rhel7.
# rpm --define 'name koji' --eval '%{?python_provide:%python_provide python2-%{name}}' Provides: python-koji(x86-64) = %{version}-%{release} Provides: python-koji = %{version}-%{release} Obsoletes: python-koji < %{version}-%{release}
(and our internal el7 builds show these)
At any rate, the current change set looks fine to me. We can reconsider dropping the older macro path later.
:thumbsup:
Metadata Update from @mikem: - Pull-request tagged with: testing-basic
Metadata Update from @mfilip: - Pull-request tagged with: testing-done
Commit 8518d4ff fixes this pull-request
Pull-Request has been merged by mikem
Fixes: https://pagure.io/koji/issue/4419
Used this document to migration: https://fedoraproject.org/wiki/Changes/DeprecateSetuppyMacros#Migrating_to_%pyproject_macros
Tested build in Copr: https://copr.devel.redhat.com/coprs/jlibrova/koji-specfile-macros/build/125066/