diff --git a/macros.python-srpm b/macros.python-srpm index 0a0846f..ad6a0f6 100644 --- a/macros.python-srpm +++ b/macros.python-srpm @@ -210,9 +210,14 @@ -- In Fedora this is not needed as we don't ship ecosystem packages -- for alternative Python interpreters. if rhel ~= '' then - local obsoletes = python.python_altobsoletes(name, evr) - for i, obsolete in ipairs(obsoletes) do - print('Obsoletes: ' .. obsolete .. '\\n') + -- Create Obsoletes only if the name does not end in a parenthesis, + -- as Obsoletes can't include parentheses. + -- This most commonly happens when the name contains an isa. + if (string.sub(name, "-1") ~= ")") then + local obsoletes = python.python_altobsoletes(name, evr) + for i, obsolete in ipairs(obsoletes) do + print('Obsoletes: ' .. obsolete .. '\\n') + end end end } diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index cd4d6af..4d55010 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -49,7 +49,7 @@ elseif posix.stat('macros.python-srpm') then end } Version: %{__default_python3_version} -Release: 16%{?dist} +Release: 17%{?dist} BuildArch: noarch @@ -151,6 +151,9 @@ install -m 755 brp-* %{buildroot}%{_rpmconfigdir}/redhat/ %changelog +* Tue Feb 08 2022 Tomas Orsava - 3.10-17 +- %%py_provides: Do not generate Obsoletes for names containing parentheses + * Mon Jan 31 2022 Miro HronĨok - 3.10-16 - Explicitly opt-out from Python name-based provides and obsoletes generators diff --git a/tests/test_evals.py b/tests/test_evals.py index 2027a01..37eb030 100644 --- a/tests/test_evals.py +++ b/tests/test_evals.py @@ -195,6 +195,16 @@ def test_py_provides_python3(rhel): assert len(lines) == 3 +@pytest.mark.parametrize('rhel', [None, 9]) +def test_py_provides_python3_with_isa(rhel): + lines = rpm_eval('%py_provides python3-foo(x86_64)', version='6', release='1.fc66', rhel=rhel) + assert 'Provides: python3-foo(x86_64) = 6-1.fc66' in lines + assert 'Provides: python-foo(x86_64) = 6-1.fc66' in lines + assert f'Provides: python{X_Y}-foo(x86_64) = 6-1.fc66' in lines + assert f'Obsoletes: python{X_Y}-foo(x86_64) < 6-1.fc66' not in lines + assert len(lines) == 3 + + @pytest.mark.parametrize('rhel', [None, 13]) def test_py_provides_python3_epoched(rhel): lines = rpm_eval('%py_provides python3-foo', epoch='1', version='6', release='1.fc66', rhel=rhel)