Hardcode that python3-* packages will obsolete python39-* packages

We hardcode the xy prefix we want to obsolete to "39", because:
1. Python 3.9 will remain the main Python versin in RHEL 9
2. python39 in RHEL 8 is still using the dotless naming (as opposed to
   python3.9)

Resolves: rhbz#1990421
This commit is contained in:
Tomas Orsava 2022-01-19 18:24:39 +01:00
parent 04145e4cdd
commit 30da77e6af
2 changed files with 15 additions and 6 deletions

View File

@ -6,11 +6,20 @@
-- python3-foo -> python-foo, python3.X-foo
-- python3.X-foo -> python-foo, python3-foo
-- If only_3_to_3_X is true there is only 1 rule:
-- python3-foo -> python3.X-foo
-- python3-foo -> python3X-foo
-- There is no python-foo -> rule, python-foo packages are version agnostic.
-- Returns a table/array with strings. Empty when no rule matched.
local function python_altnames(name, only_3_to_3_X)
local xy = rpm.expand('%{__default_python3_pkgversion}')
local xy
if only_3_to_3_X then
-- Here we hardcode the xy prefix we want to obsolete to "39", because:
-- 1. Python 3.9 will remain the main Python version in RHEL 9
-- 2. python39 in RHEL 8 is still using the dotless naming (as opposed to
-- python3.9)
xy = "39"
else
xy = rpm.expand('%{__default_python3_pkgversion}')
end
local altnames = {}
local replaced
-- NB: dash needs to be escaped!

View File

@ -189,7 +189,7 @@ def test_py_provides_python3(rhel):
assert 'Provides: python-foo = 6-1.fc66' in lines
assert f'Provides: python{X_Y}-foo = 6-1.fc66' in lines
if rhel:
assert f'Obsoletes: python{X_Y}-foo < 6-1.fc66' in lines
assert f'Obsoletes: python{XY}-foo < 6-1.fc66' in lines
assert len(lines) == 4
else:
assert len(lines) == 3
@ -202,7 +202,7 @@ def test_py_provides_python3_epoched(rhel):
assert 'Provides: python-foo = 1:6-1.fc66' in lines
assert f'Provides: python{X_Y}-foo = 1:6-1.fc66' in lines
if rhel:
assert f'Obsoletes: python{X_Y}-foo < 1:6-1.fc66' in lines
assert f'Obsoletes: python{XY}-foo < 1:6-1.fc66' in lines
assert len(lines) == 4
else:
assert len(lines) == 3
@ -234,7 +234,7 @@ def test_py_provides_doubleuse(rhel):
assert 'Provides: python-foo = 6-1.fc66' in lines
assert f'Provides: python{X_Y}-foo = 6-1.fc66' in lines
if rhel:
assert f'Obsoletes: python{X_Y}-foo < 6-1.fc66' in lines
assert f'Obsoletes: python{XY}-foo < 6-1.fc66' in lines
assert len(lines) == 8
assert len(set(lines)) == 4
else:
@ -250,7 +250,7 @@ def test_py_provides_with_evr(rhel):
assert 'Provides: python-foo = 123' in lines
assert f'Provides: python{X_Y}-foo = 123' in lines
if rhel:
assert f'Obsoletes: python{X_Y}-foo < 123' in lines
assert f'Obsoletes: python{XY}-foo < 123' in lines
assert len(lines) == 4
else:
assert len(lines) == 3