Require at least the same expat version as used during the build

The versioned requirement is no longer valid -
this happens again now with expat 2.7.2 introducing new symbols.

Make the versioned requirement future-proof - the generated version will always
match at least the one present in the buildroot during the Python build.
This commit is contained in:
Karolina Surma 2026-01-06 17:53:12 +01:00
commit 14cfcd8b1f

View file

@ -17,7 +17,7 @@ URL: https://www.python.org/
#global prerel ...
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 1%{?dist}
Release: 2%{?dist}
License: Python-2.0.1
@ -192,8 +192,7 @@ BuildRequires: bluez-libs-devel
BuildRequires: bzip2
BuildRequires: bzip2-devel
BuildRequires: desktop-file-utils
# See the runtime requirement in the -libs subpackage
BuildRequires: expat-devel >= 2.6
BuildRequires: expat-devel
BuildRequires: findutils
BuildRequires: gcc-c++
@ -497,12 +496,20 @@ Recommends: (%{pkgname}-tkinter%{?_isa} = %{version}-%{release} if tk%{?_isa})
Requires: tzdata
# The requirement on libexpat is generated, but we need to version it.
# When built with expat >= 2.6, but installed with older expat, we get:
# When built with a specific expat version, but installed with an older one,
# we sometimes get:
# ImportError: /usr/lib64/python3.X/lib-dynload/pyexpat.cpython-....so:
# undefined symbol: XML_SetReparseDeferralEnabled
# undefined symbol: XML_...
# The pyexpat module has build-time checks for expat version to only use the
# available symbols. However, there is no runtime protection, so when the module
# is later installed with an older expat, it may error due to undefined symbols.
# This breaks many things, including python -m venv.
# We avoid this problem by requiring at least the same version of expat that
# was used during the build time.
# Other subpackages (like -debug) also need this, but they all depend on -libs.
Requires: expat >= 2.6
%global expat_version %(LANG=C rpm -q --qf '%%{version}' expat.%{_target_cpu} | sed 's/.*not installed/0/')
Requires: expat >= %{expat_version}
# Since patch 251 changed from distutils to sysconfig, pip needed to be adapted
# The previous versions could cause serious bugs during `sudo pip install --upgrade ...`
@ -1642,6 +1649,9 @@ CheckPython optimized
# ======================================================
%changelog
* Tue Jan 06 2026 Karolina Surma <ksurma@redhat.com> - 3.10.19-2
- Require at least the same expat version as used during the build time
* Fri Oct 10 2025 Karolina Surma <ksurma@redhat.com> - 3.10.19-1
- Update to Python 3.10.19