:modify python_provide macro from python2 to python3

This commit is contained in:
openeuler-basic 2020-02-11 21:55:47 +08:00
parent f0a67d0752
commit 378eda2b87
2 changed files with 21 additions and 18 deletions

View File

@ -2,7 +2,7 @@
Name: %{vendor}-rpm-config Name: %{vendor}-rpm-config
Version: 30 Version: 30
Release: 8 Release: 9
License: GPL+ License: GPL+
Summary: specific rpm configuration files Summary: specific rpm configuration files
URL: https://gitee.com/src-openeuler/openEuler-rpm-config URL: https://gitee.com/src-openeuler/openEuler-rpm-config
@ -104,6 +104,12 @@ mkdir -p %{buildroot}%{_fileattrsdir}
%{_rpmconfigdir}/macros.d/* %{_rpmconfigdir}/macros.d/*
%changelog %changelog
* Tue Feb 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-9
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:modify python_provide macro from python2 to python3
* Sun Jan 19 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-8 * Sun Jan 19 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-8
- Type:enhancement - Type:enhancement
- ID:NA - ID:NA

View File

@ -61,33 +61,30 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth
package = rpm.expand("%{?1}") package = rpm.expand("%{?1}")
vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}") vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
if (string.starts(package, "python2-")) then if (string.starts(package, "python2-")) then
if (rpm.expand("%{?buildarch}") ~= "noarch") then --No unversioned provides as python2 is not default
str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then
print(rpm.expand(str))
end
print("\\nProvides: python-") print("\\nProvides: python-")
print(string.sub(package,9,string.len(package))) l = 8 + string.len(rpm.expand("%{python3_pkgversion}"))
print(string.sub(package,l,string.len(package)))
print(" = ") print(" = ")
print(vr) print(vr)
--Obsoleting the previous default python package --Obsoleting the previous default python package (if it doesn't have isa)
print("\\nObsoletes: python-") if (string.sub(package, "-1") ~= ")") then
print(string.sub(package,9,string.len(package))) print("\\nObsoletes: python-")
print(" < ") print(string.sub(package,l,string.len(package)))
print(vr) print(" < ")
elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then print(vr)
--No unversioned provides as python3 is not default end
elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then
--No unversioned provides as python3_other is not default --No unversioned provides as python3_other is not default
elseif (string.starts(package, "pypy-")) then elseif (string.starts(package, "pypy-")) then
--No unversioned provides as pypy is not default --No unversioned provides as pypy is not default
elseif (string.starts(package, "pypy2-")) then
--No unversioned provides as pypy is not default
elseif (string.starts(package, "pypy3-")) then elseif (string.starts(package, "pypy3-")) then
--No unversioned provides as pypy is not default --No unversioned provides as pypy is not default
elseif (string.starts(package, "python-")) then elseif (string.starts(package, "python-")) then
--Providing the current default python --No unversioned provides needed for unversioned python
print("Provides: python2-")
print(string.sub(package,8,string.len(package)))
print(" = ")
print(vr)
else else
print("%python_provide: ERROR: ") print("%python_provide: ERROR: ")
print(package) print(package)