From 7528637fbe5386f3224549d7f8e7a09da1f85158 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 16 Jul 2024 14:14:11 +0000 Subject: [PATCH] Build against Python 3.12 on RHEL 8 The minimum Python version has been raised to 3.8 in LLVM 19. --- build.spec.inc | 4 ++++ files.spec.inc | 4 ++-- llvm.spec | 27 +++++++++++++++++---------- packages.spec.inc | 27 ++++++++++++++++++--------- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/build.spec.inc b/build.spec.inc index 9232954..3621702 100644 --- a/build.spec.inc +++ b/build.spec.inc @@ -187,7 +187,11 @@ popd %ifarch ppc64le -DLLDB_TEST_USER_ARGS=--skip-category=watchpoint \ %endif +%if 0%{?rhel} == 8 + -DLLDB_INCLUDE_TESTS:BOOL=OFF \ +%else -DLLDB_ENFORCE_STRICT_TEST_REQUIREMENTS:BOOL=ON \ +%endif %endif \ \ diff --git a/files.spec.inc b/files.spec.inc index c7c7157..6a94e6c 100644 --- a/files.spec.inc +++ b/files.spec.inc @@ -517,7 +517,7 @@ %endif %if %{without compat_build} -%files -n python3-clang +%files -n python%{python3_pkgversion}-clang %license clang/LICENSE.TXT %{python3_sitelib}/clang/ %endif @@ -653,7 +653,7 @@ %files -n %{pkg_name_lldb}-devel %{install_includedir}/lldb -%files -n python3-lldb +%files -n python%{python3_pkgversion}-lldb %{python3_sitearch}/lldb %endif #endregion diff --git a/llvm.spec b/llvm.spec index fdf2e01..a95b269 100644 --- a/llvm.spec +++ b/llvm.spec @@ -77,6 +77,11 @@ Patch9001: 0001-Remove-myst_parser-dependency-for-RHEL.patch Patch9002: 0001-Add-back-support-for-Python-3.6.patch #endregion +%if 0%{?rhel} == 8 +%global python3_pkgversion 3.12 +%global __python3 /usr/bin/python3.12 +%endif + BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: clang @@ -85,10 +90,15 @@ BuildRequires: ninja-build BuildRequires: zlib-devel BuildRequires: libffi-devel BuildRequires: ncurses-devel -BuildRequires: python3-psutil +# This intentionally does not use python3_pkgversion. RHEL 8 does not have +# python3.11-sphinx, and we are only using it as a binary anyway. BuildRequires: python3-sphinx +%if 0%{?rhel} != 8 +BuildRequires: python%{python3_pkgversion}-psutil +BuildRequires: python%{python3_pkgversion}-pexpect +%endif %if %{undefined rhel} -BuildRequires: python3-myst-parser +BuildRequires: python%{python3_pkgversion}-myst-parser %endif # Needed for %%multilib_fix_c_header BuildRequires: multilib-rpm-config @@ -102,14 +112,15 @@ BuildRequires: valgrind-devel # LLVM's LineEditor library will use libedit if it is available. BuildRequires: libedit-devel # We need python3-devel for %%py3_shebang_fix -BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +%if 0%{?rhel} == 8 +BuildRequires: python%{python3_pkgversion}-rpm-macros +%endif # For gpg source verification BuildRequires: gnupg2 -BuildRequires: python3-rpm-macros -BuildRequires: python3-lit BuildRequires: swig BuildRequires: libxml2-devel BuildRequires: doxygen @@ -120,7 +131,6 @@ BuildRequires: perl BuildRequires: perl-Data-Dumper BuildRequires: perl-Encode BuildRequires: libffi-devel -BuildRequires: python3 BuildRequires: perl-generators @@ -146,9 +156,6 @@ BuildRequires: perl(Sys::Hostname) BuildRequires: graphviz -# This is required because of "ModuleNotFoundError: No module named 'pexpect'" when running LLDB tests. -BuildRequires: python3-pexpect - # This is required because we need "ps" when running LLDB tests BuildRequires: procps-ng diff --git a/packages.spec.inc b/packages.spec.inc index 56da7c7..6706ac0 100644 --- a/packages.spec.inc +++ b/packages.spec.inc @@ -195,17 +195,21 @@ Development header files for clang tools. Summary: Integration of clang-format for git Requires: %{pkg_name_clang}-tools-extra = %{version}-%{release} Requires: git -Requires: python3 +Requires: python%{python3_pkgversion} %description -n git-clang-format%{pkg_suffix} clang-format integration for git. %if %{without compat_build} -%package -n python3-clang +%package -n python%{python3_pkgversion}-clang Summary: Python3 bindings for clang Requires: %{pkg_name_clang}-devel%{?_isa} = %{version}-%{release} -Requires: python3 -%description -n python3-clang +Requires: python%{python3_pkgversion} +%if 0%{?rhel} == 8 +# Became python3.12-clang in LLVM 19 +Obsoletes: python3-clang < 18.9 +%endif +%description -n python%{python3_pkgversion}-clang %{summary}. @@ -312,7 +316,7 @@ Summary: Next generation high-performance debugger License: Apache-2.0 WITH LLVM-exception OR NCSA URL: http://lldb.llvm.org/ -Requires: python3-lldb +Requires: python%{python3_pkgversion}-lldb %description -n %{pkg_name_lldb} LLDB is a next generation, high-performance debugger. It is built as a set @@ -327,14 +331,19 @@ Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} %description -n %{pkg_name_lldb}-devel The package contains header files for the LLDB debugger. -%package -n python3-lldb -%{?python_provide:%python_provide python3-lldb} +%package -n python%{python3_pkgversion}-lldb +%{?python_provide:%python_provide python%{python3_pkgversion}-lldb} Summary: Python module for LLDB -Requires: python3-six +Requires: python%{python3_pkgversion}-six Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} -%description -n python3-lldb +%if 0%{?rhel} == 8 +# Became python3.12-lldb in LLVM 19 +Obsoletes: python3-lldb < 18.9 +%endif + +%description -n python%{python3_pkgversion}-lldb The package contains the LLDB Python module. %endif #endregion