I am trying to build a RPM package with two added python3 versions. I have built a Docker container that is using Rockylinux 8 that comes with python3.6. Now I added two more versions 3.9 and 3.11 using:
dnf download --source python3.11-requests
rpm -ivh python3.11-requests-2.28.1-1.el8.src.rpm
and:
dnf download --source python39-requests
rpm -ivh python-requests-2.25.0-2.module+el8.8.0+1554+fb04b4e8.src.rpm
This is the .spec file that I am using but if I try to build it, it builds it with only version 3.11 and ommit 3.9:
%global underscore() %(echo %1 | sed 's/-/_/g')
%global sum A simple python library for interacting with the Messaging APP
%global desc A simple python library for interacting with the Messaging APP
Name: my-fake-library
Summary: %{sum}
Version: 0.6.1
Release: 1%{?dist}
Group: Development/Libraries
License: ASL 2.0
URL: https://github.com/fake-git/my-fake-library.git
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
%description
%{desc}
%define __python3 /usr/bin/python3.9
%define python3_pkgversion 3.9
%package -n python%{python3_pkgversion}-%{name}
Obsoletes: fake-library
Provides: fake-library
Summary: %{sum}
BuildRequires: python3-devel python3-setuptools
Requires: python3-requests
AutoReq: no
%description -n python%{python3_pkgversion}-%{name}
%{desc}
%{?python_provide:%python3_provide python3-%{name}}
%define __python3 /usr/bin/python3.11
%define python3_pkgversion 3.11
%package -n python%{python3_pkgversion}-%{name}
Summary: %{sum}
BuildRequires: python3-devel python3-setuptools
Requires: python3-requests
AutoReq: no
%description -n python%{python3_pkgversion}-%{name}
%{desc}
%{?python_provide:%python3_provide python3-%{name}}
%prep
%setup -q
%build
%{py3_build}
%install
rm -rf %{buildroot}
%{py3_install "--record=INSTALLED_FILES_PY39" }
%{py3_install "--record=INSTALLED_FILES_PY311" }
%files -n python%{python3_pkgversion}-%{name} -f INSTALLED_FILES_PY39
%doc examples/ README.md
%defattr(-,root,root,-)
%{python3_sitelib}/*
%files -n python%{python3_pkgversion}-%{name} -f INSTALLED_FILES_PY311
%doc examples/ README.md
%defattr(-,root,root,-)
%{python3_sitelib}/*
What am I doing wrong? Thx!
I think I achieved what I wanted. With this adjusted code I got two python3 packages with versions that I need,
python3-3.11-fake-library-0.6.1-1.el8.noarch.rpmandpython3-3.9-fake-library-0.6.1-1.el8.noarch.rpm.