diff --git a/python.lua b/python.lua index bd30a85..5264e59 100644 --- a/python.lua +++ b/python.lua @@ -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! diff --git a/tests/test_evals.py b/tests/test_evals.py index c65992d..017457e 100644 --- a/tests/test_evals.py +++ b/tests/test_evals.py @@ -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