From 6bae4bb194751be369cbc1b75a111f79094da3c3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 2 Aug 2024 07:32:13 +0000 Subject: [PATCH] Add python-lit, remove patch, change obsoletes version --- 0001-Add-back-support-for-Python-3.6.patch | 101 --------------------- files.spec.inc | 2 +- llvm.spec | 6 +- packages.spec.inc | 22 +++-- prep.spec.inc | 3 - 5 files changed, 18 insertions(+), 116 deletions(-) delete mode 100644 0001-Add-back-support-for-Python-3.6.patch diff --git a/0001-Add-back-support-for-Python-3.6.patch b/0001-Add-back-support-for-Python-3.6.patch deleted file mode 100644 index 36d118a..0000000 --- a/0001-Add-back-support-for-Python-3.6.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 74f3d3579ef636a20d7832b39bf1355c0f734848 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Fri, 19 Jul 2024 14:52:49 +0200 -Subject: [PATCH] Add back support for Python 3.6 - ---- - .../clang-tidy/tool/run-clang-tidy.py | 21 ++++++++++++++++--- - llvm/CMakeLists.txt | 2 +- - llvm/utils/update_test_body.py | 6 ++++-- - 3 files changed, 23 insertions(+), 6 deletions(-) - -diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -index 48401ba5ea42..c6552db36587 100755 ---- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -@@ -36,7 +36,6 @@ http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html - - import argparse - import asyncio --from dataclasses import dataclass - import glob - import json - import multiprocessing -@@ -223,7 +222,6 @@ async def run_with_semaphore( - return await f(*args, **kwargs) - - --@dataclass - class ClangTidyResult: - filename: str - invocation: List[str] -@@ -232,6 +230,22 @@ class ClangTidyResult: - stderr: str - elapsed: float - -+ def __init( -+ self, -+ filename: str, -+ invocation: List[str], -+ returncode: int, -+ stdout: str, -+ stderr: str, -+ elapsed: float, -+ ): -+ self.filename = filename -+ self.invocation = invocation -+ self.returncode = returncode -+ self.stdout = stdout -+ self.stderr = stderr -+ self.elapsed = elapsed -+ - - async def run_tidy( - args: argparse.Namespace, -@@ -623,4 +637,5 @@ async def main() -> None: - - - if __name__ == "__main__": -- asyncio.run(main()) -+ loop = asyncio.new_event_loop() -+ loop.run_until_complete(main()) -diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt -index 12618966c4ad..9c4df0082a9a 100644 ---- a/llvm/CMakeLists.txt -+++ b/llvm/CMakeLists.txt -@@ -932,7 +932,7 @@ set(LLVM_PROFDATA_FILE "" CACHE FILEPATH - - if(LLVM_INCLUDE_TESTS) - # All LLVM Python files should be compatible down to this minimum version. -- set(LLVM_MINIMUM_PYTHON_VERSION 3.8) -+ set(LLVM_MINIMUM_PYTHON_VERSION 3.6) - else() - # FIXME: it is unknown if this is the actual minimum bound - set(LLVM_MINIMUM_PYTHON_VERSION 3.0) -diff --git a/llvm/utils/update_test_body.py b/llvm/utils/update_test_body.py -index 661b0270d783..152d0c5f8476 100755 ---- a/llvm/utils/update_test_body.py -+++ b/llvm/utils/update_test_body.py -@@ -57,7 +57,8 @@ def process(args, path): - input="\n".join( - prolog[:-1] if prolog[-1].startswith(".endif") else prolog - ).encode(), -- capture_output=True, -+ stdout=subprocess.PIPE, -+ stderr=subprocess.PIPE, - check=True, - ) - except subprocess.CalledProcessError as ex: -@@ -71,7 +72,8 @@ def process(args, path): - - sub = subprocess.run( - ["sh", "-eu", "gen"], -- capture_output=True, -+ stdout=subprocess.PIPE, -+ stderr=subprocess.PIPE, - # Don't encode the directory information to the Clang output. - # Remove unneeded details (.ident) as well. - env=dict( --- -2.45.2 - diff --git a/files.spec.inc b/files.spec.inc index 6a94e6c..a8dc85c 100644 --- a/files.spec.inc +++ b/files.spec.inc @@ -1,6 +1,6 @@ #region LLVM lit files %if %{with python_lit} -%files -n python3-lit +%files -n python%{python3_pkgversion}-lit %license llvm/utils/lit/LICENSE.TXT %doc llvm/utils/lit/README.rst %{python3_sitelib}/lit/ diff --git a/llvm.spec b/llvm.spec index a95b269..a9031c7 100644 --- a/llvm.spec +++ b/llvm.spec @@ -73,8 +73,6 @@ Patch3002: 0001-Always-build-shared-libs-for-LLD.patch #region RHEL patches # All RHEL Patch9001: 0001-Remove-myst_parser-dependency-for-RHEL.patch -# RHEL 8 only -Patch9002: 0001-Add-back-support-for-Python-3.6.patch #endregion %if 0%{?rhel} == 8 @@ -91,9 +89,11 @@ BuildRequires: zlib-devel BuildRequires: libffi-devel BuildRequires: ncurses-devel # 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. +# python3.12-sphinx, and we are only using it as a binary anyway. BuildRequires: python3-sphinx %if 0%{?rhel} != 8 +# RHEL 8 does not have these packages for python3.12. However, they are only +# needed for LLDB tests. BuildRequires: python%{python3_pkgversion}-psutil BuildRequires: python%{python3_pkgversion}-pexpect %endif diff --git a/packages.spec.inc b/packages.spec.inc index 6706ac0..da89a20 100644 --- a/packages.spec.inc +++ b/packages.spec.inc @@ -1,13 +1,19 @@ #region LLVM lit package %if %{with python_lit} -%package -n python3-lit +%package -n python%{python3_pkgversion}-lit Summary: LLVM lit test runner for Python 3 BuildArch: noarch -Requires: python3-setuptools -Recommends: python3-psutil +Requires: python%{python3_pkgversion}-setuptools +%if 0%{?rhel} == 8 +# Became python3.12-clang in LLVM 20 +Obsoletes: python3-lit < 19.9 +%else +# This optional dependency is not available for python3.12 on RHEL 8. +Recommends: python%{python3_pkgversion}-psutil +%endif -%description -n python3-lit +%description -n python%{python3_pkgversion}-lit lit is a tool used by the LLVM project for executing its test suites. %endif #endregion @@ -206,8 +212,8 @@ Summary: Python3 bindings for clang Requires: %{pkg_name_clang}-devel%{?_isa} = %{version}-%{release} Requires: python%{python3_pkgversion} %if 0%{?rhel} == 8 -# Became python3.12-clang in LLVM 19 -Obsoletes: python3-clang < 18.9 +# Became python3.12-clang in LLVM 20 +Obsoletes: python3-clang < 19.9 %endif %description -n python%{python3_pkgversion}-clang %{summary}. @@ -339,8 +345,8 @@ Requires: python%{python3_pkgversion}-six Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} %if 0%{?rhel} == 8 -# Became python3.12-lldb in LLVM 19 -Obsoletes: python3-lldb < 18.9 +# Became python3.12-lldb in LLVM 20 +Obsoletes: python3-lldb < 19.9 %endif %description -n python%{python3_pkgversion}-lldb diff --git a/prep.spec.inc b/prep.spec.inc index 14bfe33..c28a911 100644 --- a/prep.spec.inc +++ b/prep.spec.inc @@ -16,9 +16,6 @@ %if %{defined rhel} %patch -p1 -P9001 -%if %rhel == 8 -%patch -p1 -P9002 -%endif %endif #region LLVM preparation