From de6b3ec15ae91e82d3595cbdeb5fdd9aaac387ba Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Fri, 19 Jan 2024 19:24:28 +0100 Subject: [PATCH] webruntime: fix build with python-3.12 * upgraded in oe-core with: https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150 * webruntime now fails to build with: | [56/26593] ACTION //chrome/browser/share/core/resources:make_share_targets_protobuf(//build/toolchain/linux:clang_webos_x64) | FAILED: gen/chrome/browser/share/core/resources/desktop_sharing_hub.pb | /OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/recipe-sysroot-native/usr/bin/python3-native/python3 ../../git/src/chrome/browser/share/core/resources/gen_share_targets_proto.py -w -i ../../git/src/chrome/browser/share/core/resources/share_targets.asciipb -d gen/chrome/browser/share/core/resources -o desktop_sharing_hub.pb -p pyproto -p pyproto/chrome/browser/share/proto | Traceback (most recent call last): | File "/OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/build/Release/../../git/src/chrome/browser/share/core/resources/gen_share_targets_proto.py", line 21, in | from binary_proto_generator import BinaryProtoGenerator | File "/OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/git/src/components/resources/protobufs/binary_proto_generator.py", line 12, in | import imp | ModuleNotFoundError: No module named 'imp' | [57/26593] ACTION //components/resources/ssl/ssl_error_assistant:make_ssl_error_assistant_protobuf(//build/toolchain/linux:clang_webos_x64) | FAILED: gen/components/resources/ssl/ssl_error_assistant/ssl_error_assistant.pb | /OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/recipe-sysroot-native/usr/bin/python3-native/python3 ../../git/src/components/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py -w -i ../../git/src/components/resources/ssl/ssl_error_assistant/ssl_error_assistant.asciipb -d gen/components/resources/ssl/ssl_error_assistant -o ssl_error_assistant.pb -p pyproto -p pyproto/components/security_interstitials/content/ | Traceback (most recent call last): | File "/OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/build/Release/../../git/src/components/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py", line 23, in | from binary_proto_generator import BinaryProtoGenerator | File "/OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/git/src/components/resources/protobufs/binary_proto_generator.py", line 12, in | import imp | ModuleNotFoundError: No module named 'imp' | [58/26593] ACTION //components/safe_browsing/content/resources:make_file_types_protobuf(//build/toolchain/linux:clang_webos_x64) | FAILED: gen/components/safe_browsing/content/resources/download_file_types.pb | /OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/recipe-sysroot-native/usr/bin/python3-native/python3 ../../git/src/components/safe_browsing/content/resources/gen_file_type_proto.py -w -t linux -i ../../git/src/components/safe_browsing/content/resources/download_file_types.asciipb -d gen/components/safe_browsing/content/resources -o download_file_types.pb -p pyproto -p pyproto/components/safe_browsing/content/common/proto | Traceback (most recent call last): | File "/OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/build/Release/../../git/src/components/safe_browsing/content/resources/gen_file_type_proto.py", line 25, in | from binary_proto_generator import BinaryProtoGenerator | File "/OE/build/luneos-scarthgap/tmp-glibc/work/corei7-64-webos-linux/webruntime-clang/108.0.5359.217-10/git/src/components/resources/protobufs/binary_proto_generator.py", line 12, in | import imp | ModuleNotFoundError: No module named 'imp' Signed-off-by: Martin Jansa --- ...oad_source-with-importlib-equivalent.patch | 52 +++++++++++++++++++ .../chromium/webruntime-repo_108.inc | 4 ++ 2 files changed, 56 insertions(+) create mode 100644 meta-luneos/recipes-webos/chromium/files/0001-Replace-imp.load_source-with-importlib-equivalent.patch diff --git a/meta-luneos/recipes-webos/chromium/files/0001-Replace-imp.load_source-with-importlib-equivalent.patch b/meta-luneos/recipes-webos/chromium/files/0001-Replace-imp.load_source-with-importlib-equivalent.patch new file mode 100644 index 0000000000..cb789a955b --- /dev/null +++ b/meta-luneos/recipes-webos/chromium/files/0001-Replace-imp.load_source-with-importlib-equivalent.patch @@ -0,0 +1,52 @@ +From 9e0c89a3b5638ba2b9b107fea34a01c774aa7805 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= +Date: Wed, 25 Oct 2023 06:20:54 +0000 +Subject: [PATCH] Replace imp.load_source with importlib equivalent. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The imp module has been deprecated for years and the function +load_source was even removed from the documentation long ago. + +It will be removed in Python 3.12, which will be part of Fedora +version 39, due in late October 2023. + +Bug: 1487454 +Change-Id: If06a2f139225b62c7bdc70c3eaef6e5acb8972d2 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4894238 +Reviewed-by: Mustafa Emre Acer +Commit-Queue: Jacobo Aragunde PĂ©rez +Cr-Commit-Position: refs/heads/main@{#1214660} +--- +Upstream-Status: Backport [9e0c89a3b5638ba2b9b107fea34a01c774aa7805] + + src/components/resources/protobufs/binary_proto_generator.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/components/resources/protobufs/binary_proto_generator.py b/src/components/resources/protobufs/binary_proto_generator.py +index 2a1802dccdc1e..8b9de65ed0b78 100755 +--- a/src/components/resources/protobufs/binary_proto_generator.py ++++ b/src/components/resources/protobufs/binary_proto_generator.py +@@ -9,7 +9,7 @@ + """ + from __future__ import print_function + import abc +-import imp ++from importlib import util as imp_util + import optparse + import os + import re +@@ -68,7 +68,11 @@ class GoogleProtobufModuleImporter: + raise ImportError(fullname) + + filepath = self._fullname_to_filepath(fullname) +- return imp.load_source(fullname, filepath) ++ spec = imp_util.spec_from_file_location(fullname, filepath) ++ loaded = imp_util.module_from_spec(spec) ++ spec.loader.exec_module(loaded) ++ ++ return loaded + + class BinaryProtoGenerator: + diff --git a/meta-luneos/recipes-webos/chromium/webruntime-repo_108.inc b/meta-luneos/recipes-webos/chromium/webruntime-repo_108.inc index 3db13e7224..7a6266fccd 100644 --- a/meta-luneos/recipes-webos/chromium/webruntime-repo_108.inc +++ b/meta-luneos/recipes-webos/chromium/webruntime-repo_108.inc @@ -9,6 +9,10 @@ CHROMIUM_LICENSE_CHKSUM = "file://src/LICENSE;md5=c408a301e3407c3803499ce9290515 # oss-pkg-info.yaml CHROMIUM_OSS_PKG_INFO_CHKSUM = "file://oss-pkg-info.yaml;md5=f6cf1c62d76fef64d3ca1b3556fc1d9a" +SRC_URI += " \ + file://0001-Replace-imp.load_source-with-importlib-equivalent.patch \ +" + # LuneOS specific patches SRC_URI += " \ file://0001-run_app_shell-fix-XDG_RUNTIME_DIR-for-LuneOS.patch \