Hi Johannes, we already had some discussions about this. I don't have the time to go too much into the details again, just some remarks. Am 21.11.22 um 15:28 schrieb Johannes Kastl:
TL;DR There are working packages for ansible, ansible-core and ansible-lint (and all of their dependencies) for Leap 15.4 and SLES15SP4 with python3.10.
Congratulations!
Hi all,
as I had the request for ansible and ansible-lint packages for SLES15 SP4 I started the journey, and some 100 packages later I got it working.
https://build.opensuse.org/project/show/home:ojkastl_buildservice:ansible_fo...
https://build.opensuse.org/project/show/home:ojkastl_buildservice:ansible-li...
Which depend on and build against these projects:
https://build.opensuse.org/project/show/home:ojkastl_buildservice:cblas_for_...
https://build.opensuse.org/project/show/home:ojkastl_buildservice:pytest_dep...
https://build.opensuse.org/project/show/home:ojkastl_buildservice:pytest_for...
Due to my limited understanding of the python macros I used a simple prjconf to only build against the python3.10 version in the Python3 module of SLES15SP4.
%define pythons python310 %define primary_python python310
Substitute: python3-base python310-base
Macros: %pythons python310 %primary_python python310 :Macros
That did the trick for most of the packages, but I have two questions:
`%primary_python` affects the behavior and contents of the python310{,-base} packages. The definition for the primary interpreter is where /usr/bin/python3 points to. Thus, for having any effect, you have to rebuild pythin310{,-base} too. Once you have this, every python module in your stack which you rebuild yourself will have a `Provides: python3-foo` and override the python3-foo for Python 3.6. OTOH, this will require a lot of "Prefer:" lines, because the distro will now have multiple providers of python3-foo. Otherwise I do not see why `%primary_python` would need to be set at all. See: https://github.com/openSUSE/python-rpm-macros/blob/868757846f707ffcf351720b9...
1. Several packages failed as they correctly BuildRequire python310-setuptools, but not python310-base. I added a line to their spec file and all was well. Example:
https://build.opensuse.org/package/show/home:ojkastl_buildservice:pytest_dep...
Question: Is this something that should be fixed, i.e. should I open SRs for those packages? Or this due to an error I made somehow in the prjconf? Should the setuptools package BuildRequire the corresponding python3*-base package?
The requirement on python310-base comes automatically from the requirement on `python(abi) = 3.10` which is normally automatically added by /usr/lib/rpm/pythondistdeps.py. Leap's python310-setuptools does not have it but probably should. Wothout checking I do not know, whether it will be added when you build it yourself with above mentioned change of the primary interpreter link.
2. I had to refine the spec files for ansible, ansible-core, ansible-lint. As those are just building against the default python in Tumbleweed (i.e. they are not available as python310-ansible-...). I made them kind-of-singlespec, while defining only one python version in the "%pythons" macro. But I had to use the %primary_python macro to properly set the Requires, as singlespec and the macros did not help there. And just using "%pythons" would make this fail on Tumbleweed where there are multiple python versions.
And as the %pythons macro needs to be set inside the spec file to overwrite this on Tumbleweed, I had to define it again inside the package.
Example:
The %fdupes and the mkdir lines are wrong. %{python_sitelib} is not expanded in %prep,%build,%install, or %check. And it is only expanded in the header tags and %files when you use %python_subpackages. The way you are using it, it is only by happy coincidence pointing to the python310_sitelib.
And: Is there a macro that contains the executable name for the primary python? The ansible-lint packages contains calls to python3.10 for %build and %install, not sure if those could be replaced by some macro-foo.
Remember: "primary" is always where /usr/bin/python3 links to. Setting "%primary_python" without python310-base containing the file is wrong. - Ben