From fd03f499cd945f0cb22b3f0366c844966ea490ce Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Tue, 20 Aug 2024 10:53:15 +0200 Subject: [PATCH] Use Python 3 and bundled re2 Re2 was used bundled anyway and just copying header files from system doesn't actually change anything, except that it breaks when there is an API change. --- python3.12-imp.patch | 26 ++++++++ python3.12-six.patch | 58 +++++++++++++++++ python3.13-pipes.patch | 21 +++++++ qt5-qtwebengine.spec | 62 +++---------------- ...engine-everywhere-5.15.5-use-python2.patch | 13 ---- sources | 3 - sources.keep | 3 - 7 files changed, 113 insertions(+), 73 deletions(-) create mode 100644 python3.12-imp.patch create mode 100644 python3.12-six.patch create mode 100644 python3.13-pipes.patch delete mode 100644 qtwebengine-everywhere-5.15.5-use-python2.patch diff --git a/python3.12-imp.patch b/python3.12-imp.patch new file mode 100644 index 0000000..b06f957 --- /dev/null +++ b/python3.12-imp.patch @@ -0,0 +1,26 @@ +Description: stop using imp module which was removed in Python 3.12 +Origin: upstream, commits + https://chromium.googlesource.com/chromium/src/+/9e0c89a3b5638ba2 + https://chromium.googlesource.com/chromium/src/+/f5f6e361d037c316 +Last-Update: 2024-03-17 + +--- a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py ++++ b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py +@@ -3,7 +3,6 @@ + # found in the LICENSE file. + + import errno +-import imp + import os.path + import sys + +--- a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py ++++ b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py +@@ -2,7 +2,6 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-import imp + import os.path + import sys + diff --git a/python3.12-six.patch b/python3.12-six.patch new file mode 100644 index 0000000..bfc0438 --- /dev/null +++ b/python3.12-six.patch @@ -0,0 +1,58 @@ +Patch-Source: https://sources.debian.org/data/main/q/qtwebengine-opensource-src/5.15.16+dfsg-3/debian/patches/python3.12-six.patch +-- +Description: implement find_spec() for _SixMetaPathImporter +Origin: upstream, https://github.com/benjaminp/six/commit/25916292d96f5f09 +Last-Update: 2024-03-17 + +--- a/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py ++++ b/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py +@@ -71,6 +71,11 @@ else: + MAXSIZE = int((1 << 63) - 1) + del X + ++if PY34: ++ from importlib.util import spec_from_loader ++else: ++ spec_from_loader = None ++ + + def _add_doc(func, doc): + """Add documentation to a function.""" +@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object): + return self + return None + ++ def find_spec(self, fullname, path, target=None): ++ if fullname in self.known_modules: ++ return spec_from_loader(fullname, self) ++ return None ++ + def __get_module(self, fullname): + try: + return self.known_modules[fullname] +--- a/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py ++++ b/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py +@@ -71,6 +71,11 @@ else: + MAXSIZE = int((1 << 63) - 1) + del X + ++if PY34: ++ from importlib.util import spec_from_loader ++else: ++ spec_from_loader = None ++ + + def _add_doc(func, doc): + """Add documentation to a function.""" +@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object): + return self + return None + ++ def find_spec(self, fullname, path, target=None): ++ if fullname in self.known_modules: ++ return spec_from_loader(fullname, self) ++ return None ++ + def __get_module(self, fullname): + try: + return self.known_modules[fullname] diff --git a/python3.13-pipes.patch b/python3.13-pipes.patch new file mode 100644 index 0000000..b04f6a4 --- /dev/null +++ b/python3.13-pipes.patch @@ -0,0 +1,21 @@ +diff --git a/src/3rdparty/chromium/build/android/gyp/util/build_utils.py b/src/3rdparty/chromium/build/android/gyp/util/build_utils.py +index 022980517..e3f82704a 100644 +--- a/src/3rdparty/chromium/build/android/gyp/util/build_utils.py ++++ b/src/3rdparty/chromium/build/android/gyp/util/build_utils.py +@@ -12,7 +12,6 @@ import fnmatch + import json + import logging + import os +-import pipes + import re + import shutil + import stat +@@ -198,7 +197,7 @@ class CalledProcessError(Exception): + # A user should be able to simply copy and paste the command that failed + # into their shell. + copyable_command = '( cd {}; {} )'.format(os.path.abspath(self.cwd), +- ' '.join(map(pipes.quote, self.args))) ++ printed_cmd) + return 'Command failed: {}\n{}'.format(copyable_command, self.output) + + diff --git a/qt5-qtwebengine.spec b/qt5-qtwebengine.spec index d8c3f73..e9fec33 100644 --- a/qt5-qtwebengine.spec +++ b/qt5-qtwebengine.spec @@ -11,11 +11,6 @@ # For screen sharing on Wayland, currently Fedora only thing - no epel #global pipewire 1 %endif -%if 0%{?rhel} && 0%{?rhel} == 9 -%global use_system_re2 0 -%else -%global use_system_re2 1 -%endif %if 0%{?fedora} > 32 # need libicu >= 65, only currently available on f33+ @@ -76,13 +71,6 @@ Source10: macros.qt5-qtwebengine # pulseaudio headers Source20: pulseaudio-12.2-headers.tar.gz -## Python2 Sources -## src.rpm is Fedora spec with tests and tkinter turned off -## binary rpms have been built on epel9 -Source100: python2.7-2.7.18-19.el9.1.src.rpm -Source101: python2.7-2.7.18-19.el9.1.aarch64.rpm -Source102: python2.7-2.7.18-19.el9.1.x86_64.rpm - # fix extractCFlag to also look in QMAKE_CFLAGS_RELEASE, needed to detect the # ARM flags with our %%qmake_qt5 macro, including for the next patch Patch2: qtwebengine-opensource-src-5.12.4-fix-extractcflag.patch @@ -99,8 +87,6 @@ Patch7: chromium-hunspell-nullptr.patch Patch8: qtwebengine-everywhere-5.15.8-libpipewire-0.3.patch # Fix/workaround FTBFS on aarch64 with newer glibc Patch24: qtwebengine-everywhere-src-5.11.3-aarch64-new-stat.patch -# Use Python2 -Patch26: qtwebengine-everywhere-5.15.5-use-python2.patch Patch32: qtwebengine-skia-missing-includes.patch Patch34: qtwebengine-fix-build.patch Patch35: qt5-qtwebengine-c99.patch @@ -113,6 +99,9 @@ Patch61: qt5-qtwebengine-ffmpeg7.patch # Fix build Patch70: qtwebengine-5.15.13_p20240322-ninja1.12.patch Patch71: fix_build_pdf_extension_util.patch +Patch72: python3.12-imp.patch +Patch73: python3.12-six.patch +Patch74: python3.13-pipes.patch # riscv64 support patch from https://github.com/felixonmars/archriscv-packages/tree/master/qt5-webengine Patch100: v8.patch @@ -153,9 +142,6 @@ BuildRequires: libicu-devel >= 65 %endif BuildRequires: libjpeg-devel BuildRequires: nodejs -%if 0%{?use_system_re2} -BuildRequires: re2-devel -%endif %if 0%{?pipewire} BuildRequires: pkgconfig(libpipewire-0.3) %endif @@ -203,19 +189,8 @@ BuildRequires: pkgconfig(xkbfile) ## requires libxml2 built with icu support #BuildRequires: pkgconfig(libxslt) pkgconfig(libxml-2.0) BuildRequires: perl-interpreter -# fesco exception to allow python2 use: https://pagure.io/fesco/issue/2208 -# per https://fedoraproject.org/wiki/Changes/RetirePython2#FESCo_exceptions -# Only the interpreter is needed -%if 0%{?fedora} > 29 || 0%{?rhel} > 8 -%if 0%{?rhel} && 0%{?rhel} == 9 BuildRequires: %{__python3} -%else -BuildRequires: %{__python2} -%endif -%else -BuildRequires: python2 -BuildRequires: python2-rpm-macros -%endif +BuildRequires: python3-html5lib %if 0%{?use_system_libvpx} BuildRequires: pkgconfig(vpx) >= 1.8.0 %endif @@ -389,19 +364,6 @@ mv pulse src/3rdparty/chromium/ pushd src/3rdparty/chromium popd -%if 0%{?rhel} && 0%{?rhel} == 9 -# Install python2 from rpms -mkdir python2 -pushd python2 -%ifarch aarch64 -rpm2cpio %{SOURCE101} | cpio -idm -%endif -%ifarch x86_64 -rpm2cpio %{SOURCE102} | cpio -idm -%endif -popd -%endif - %patch -P2 -p1 -b .fix-extractcflag %if !0%{?arm_neon} %patch -P3 -p1 -b .no-neon @@ -416,7 +378,6 @@ popd ## upstream patches %patch -P24 -p1 -b .aarch64-new-stat -%patch -P26 -p1 -b .use-python2 %patch -P32 -p1 -b .skia-missing-includes %patch -P34 -p1 -b .fix-build @@ -426,6 +387,9 @@ popd %patch -P61 -p1 %patch -P70 -p1 %patch -P71 -p1 +%patch -P72 -p1 +%patch -P73 -p1 +%patch -P74 -p1 %ifarch riscv64 %patch -P100 -p1 -b .riscv64-v8 @@ -437,12 +401,6 @@ popd sed -i -e '/toolprefix = /d' -e 's/\${toolprefix}//g' \ src/3rdparty/chromium/build/toolchain/linux/BUILD.gn -%if 0%{?use_system_re2} -# http://bugzilla.redhat.com/1337585 -# can't just delete, but we'll overwrite with system headers to be on the safe side -cp -bv /usr/include/re2/*.h src/3rdparty/chromium/third_party/re2/src/re2/ -%endif - # copy the Chromium license so it is installed with the appropriate name cp -p src/3rdparty/chromium/LICENSE LICENSE.Chromium @@ -458,10 +416,6 @@ test -f "./include/QtWebEngineCore/qtwebenginecoreglobal.h" %build -# python2 path -export PATH=$(pwd)/python2/usr/bin:$PATH -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/python2/usr/lib64 - export STRIP=strip export NINJAFLAGS="%{__ninja_common_opts}" export NINJA_PATH=%{__ninja} @@ -474,7 +428,7 @@ export NINJA_PATH=%{__ninja} CONFIG+="link_pulseaudio use_gold_linker" \ %endif QMAKE_EXTRA_ARGS+="-system-webengine-ffmpeg -system-webengine-webp -system-webengine-opus" \ - QMAKE_EXTRA_ARGS+="-webengine-kerberos" \ + QMAKE_EXTRA_ARGS+="-webengine-kerberos -webengine-python-version python3" \ %{?use_system_libicu:QMAKE_EXTRA_ARGS+="-system-webengine-icu"} \ %{?pipewire:QMAKE_EXTRA_ARGS+="-webengine-webrtc-pipewire"} \ . diff --git a/qtwebengine-everywhere-5.15.5-use-python2.patch b/qtwebengine-everywhere-5.15.5-use-python2.patch deleted file mode 100644 index 91a17ae..0000000 --- a/qtwebengine-everywhere-5.15.5-use-python2.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/webengine/module.pro b/src/webengine/module.pro -index 49a1086b2..afc89d49e 100644 ---- a/src/webengine/module.pro -+++ b/src/webengine/module.pro -@@ -76,7 +76,7 @@ qtConfig(webengine-testsupport) { - python = $$pythonPathForShell() - chromium_attributions.commands = \ - cd $$shell_quote($$shell_path($$PWD/../3rdparty)) && \ -- $$python chromium/tools/licenses.py \ -+ python2 chromium/tools/licenses.py \ - --file-template ../../tools/about_credits.tmpl \ - --entry-template ../../tools/about_credits_entry.tmpl credits \ - $$shell_quote($$shell_path($$OUT_PWD/chromium_attributions.qdoc)) diff --git a/sources b/sources index 8fff628..dd94a45 100644 --- a/sources +++ b/sources @@ -1,5 +1,2 @@ SHA512 (qtwebengine-everywhere-src-5.15.17-clean.tar.xz) = d8fa20e0d1eea0c3c15a98145995eaa37ca21edcb7de3bf5ec548a0347c0aa2409a183ba2f8d9fdfc3686802e5e1f5bb083c0d51fe5ad3a435ab3c72b4c32af9 SHA512 (pulseaudio-12.2-headers.tar.gz) = a5a9bcbb16030b3bc83cc0cc8f5e7f90e0723d3e83258a5c77eacb32eaa267118a73fa7814fbcc99a24e4907916a2b371ebb6dedc4f45541c3acf6c834fd35be -SHA512 (python2.7-2.7.18-19.el9.1.src.rpm) = e6d738b2880b833ea80aec709f7bcf20dac2e8c59d45f1627f61245b3aa9be845888152232e9f08145723514eb29aeada3d5d99641aabe9ec9af2a5c15f32777 -SHA512 (python2.7-2.7.18-19.el9.1.aarch64.rpm) = 66c8487a3323bb854ff79242287ae5d290315609b4f79fb985626e52d96286d6dfd2da9a8257e23be036b72adabbbec08d53db339935d5d6e8b6018417bbc769 -SHA512 (python2.7-2.7.18-19.el9.1.x86_64.rpm) = 55f03b17f649a2da9edae67c1ca7c84738a023fc3ab2e7d6060db8a2b8ddf20099147533f3d50ce3dfafec5ca988f75ff229e67d331bcb669c879802ab6555a9 diff --git a/sources.keep b/sources.keep index a90d5b7..adf9556 100644 --- a/sources.keep +++ b/sources.keep @@ -1,4 +1 @@ SHA512 (pulseaudio-12.2-headers.tar.gz) = a5a9bcbb16030b3bc83cc0cc8f5e7f90e0723d3e83258a5c77eacb32eaa267118a73fa7814fbcc99a24e4907916a2b371ebb6dedc4f45541c3acf6c834fd35be -SHA512 (python2.7-2.7.18-19.el9.1.src.rpm) = e6d738b2880b833ea80aec709f7bcf20dac2e8c59d45f1627f61245b3aa9be845888152232e9f08145723514eb29aeada3d5d99641aabe9ec9af2a5c15f32777 -SHA512 (python2.7-2.7.18-19.el9.1.aarch64.rpm) = 66c8487a3323bb854ff79242287ae5d290315609b4f79fb985626e52d96286d6dfd2da9a8257e23be036b72adabbbec08d53db339935d5d6e8b6018417bbc769 -SHA512 (python2.7-2.7.18-19.el9.1.x86_64.rpm) = 55f03b17f649a2da9edae67c1ca7c84738a023fc3ab2e7d6060db8a2b8ddf20099147533f3d50ce3dfafec5ca988f75ff229e67d331bcb669c879802ab6555a9