Fix %python_provide when fed python3.10-foo to obsolete python-foo instead of python--foo

This has unlikely broken anything in practice,
no packages in Fedora use %python_provide with major.minor-version-prefixed names.
This commit is contained in:
Miro Hrončok 2021-06-15 16:15:45 +02:00
parent 370b825e45
commit 9dff7fbf6a
2 changed files with 7 additions and 3 deletions

View File

@ -74,6 +74,7 @@
local package = rpm.expand("%{?1}")
local vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
local provides = python.python_altprovides(package, vr)
local default_python3_pkgversion = rpm.expand("%{__default_python3_pkgversion}")
if (string.starts(package, "python3-")) then
for i, provide in ipairs(provides) do
print("\\nProvides: " .. provide)
@ -84,14 +85,14 @@
print(string.sub(package,9,string.len(package)))
print(" < " .. vr)
end
elseif (string.starts(package, "python" .. rpm.expand("%{__default_python3_pkgversion}") .. "-")) then
elseif (string.starts(package, "python" .. default_python3_pkgversion .. "-")) then
for i, provide in ipairs(provides) do
print("\\nProvides: " .. provide)
end
--Obsoleting the previous default python package (if it doesn't have isa)
if (string.sub(package, "-1") ~= ")") then
print("\\nObsoletes: python-")
print(string.sub(package,11,string.len(package)))
print(string.sub(package,8+string.len(default_python3_pkgversion),string.len(package)))
print(" < " .. vr)
end
elseif (string.starts(package, "python")) then

View File

@ -31,7 +31,7 @@ elseif posix.stat('macros.python-srpm') then
end
}
Version: %{__default_python3_version}
Release: 1%{?dist}
Release: 2%{?dist}
BuildArch: noarch
@ -109,6 +109,9 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
%changelog
* Tue Jun 15 2021 Miro Hrončok <mhroncok@redhat.com> - 3.10-2
- Fix %%python_provide when fed python3.10-foo to obsolete python-foo instead of python--foo
* Tue Jun 01 2021 Miro Hrončok <mhroncok@redhat.com> - 3.10-1
- Update main Python to Python 3.10
- https://fedoraproject.org/wiki/Changes/Python3.10