commit: 64fad029fd9e98ba427fe61628b12b79f448e8ac Author: Eli Schwartz <eschwartz <AT> gentoo <DOT> org> AuthorDate: Sun Jul 21 21:09:43 2024 +0000 Commit: Eli Schwartz <eschwartz <AT> gentoo <DOT> org> CommitDate: Sun Jul 21 21:17:56 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64fad029
app-text/calibre: in 5.x, fix building against icu 75 And backport a test-only fix so that tests pass. Haven't actually tested icu 75 though since it requires rebuilding webengine... but a user did. Besides, it's the same change upstream made in newer versions. Closes: https://bugs.gentoo.org/936270 Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org> app-text/calibre/calibre-5.44.0-r3.ebuild | 4 +++ app-text/calibre/files/calibre-5.44.0-icu75.patch | 28 +++++++++++++++++ .../e9cc00560a28f56a303cca97630ab58e519dd9c8.patch | 35 ++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/app-text/calibre/calibre-5.44.0-r3.ebuild b/app-text/calibre/calibre-5.44.0-r3.ebuild index 34e4e197b419..ed6d79aa0779 100644 --- a/app-text/calibre/calibre-5.44.0-r3.ebuild +++ b/app-text/calibre/calibre-5.44.0-r3.ebuild @@ -130,6 +130,10 @@ PATCHES=( # Security backport for CVE-2023-46303 "${FILESDIR}"/0001-HTML-Input-Dont-add-resources-that-exist-outside-the.patch + # bug #936270 + "${FILESDIR}"/${P}-icu75.patch + # backport test-only fix for lxml 5 + "${FILESDIR}"/e9cc00560a28f56a303cca97630ab58e519dd9c8.patch ) src_prepare() { diff --git a/app-text/calibre/files/calibre-5.44.0-icu75.patch b/app-text/calibre/files/calibre-5.44.0-icu75.patch new file mode 100644 index 000000000000..3f79a9b4f79f --- /dev/null +++ b/app-text/calibre/files/calibre-5.44.0-icu75.patch @@ -0,0 +1,28 @@ +logical changes backported from: +https://github.com/kovidgoyal/calibre/commit/a3d3d8d33e314ccabb5099e78e4056a79b7c9aa2 +https://bugs.gentoo.org/936270 + +diff -rup a/setup/build.py b/setup/build.py +--- a/setup/build.py 2022-06-17 04:35:27.000000000 +0200 ++++ b/setup/build.py 2024-07-19 11:51:56.374389213 +0200 +@@ -65,6 +65,8 @@ class Extension: + self.cflags.insert(0, '-std=c++11') + elif kwargs.get('needs_c++14'): + self.cflags.insert(0, '-std=c++14') ++ elif kwargs.get('needs_c++17'): ++ self.cflags.insert(0, '-std=c++17') + else: + if kwargs.get('needs_c99'): + self.cflags.insert(0, '-std=c99') +diff -rup a/setup/extensions.json b/setup/extensions.json +--- a/setup/extensions.json 2022-06-17 04:35:27.000000000 +0200 ++++ b/setup/extensions.json 2024-07-19 11:52:11.253389395 +0200 +@@ -75,7 +75,7 @@ + "name": "sqlite_extension", + "headers": "calibre/utils/cpp_binding.h", + "sources": "calibre/db/sqlite_extension.cpp", +- "needs_c++14": true, ++ "needs_c++17": true, + "libraries": "icudata icui18n icuuc icuio stemmer", + "windows_libraries": "icudt icuin icuuc icuio libstemmer", + "lib_dirs": "!icu_lib_dirs", diff --git a/app-text/calibre/files/e9cc00560a28f56a303cca97630ab58e519dd9c8.patch b/app-text/calibre/files/e9cc00560a28f56a303cca97630ab58e519dd9c8.patch new file mode 100644 index 000000000000..deae34e201e3 --- /dev/null +++ b/app-text/calibre/files/e9cc00560a28f56a303cca97630ab58e519dd9c8.patch @@ -0,0 +1,35 @@ +From e9cc00560a28f56a303cca97630ab58e519dd9c8 Mon Sep 17 00:00:00 2001 +From: Kovid Goyal <[email protected]> +Date: Mon, 8 Jan 2024 09:12:35 +0530 +Subject: [PATCH] Fix #2048475 [Tests fail with lxml + 5.0](https://bugs.launchpad.net/calibre/+bug/2048475) + +--- + src/calibre/utils/xml_parse.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/calibre/utils/xml_parse.py b/src/calibre/utils/xml_parse.py +index a31c6ed83ed7..339538b90057 100644 +--- a/src/calibre/utils/xml_parse.py ++++ b/src/calibre/utils/xml_parse.py +@@ -36,6 +36,11 @@ def safe_xml_fromstring(string_or_bytes, recover=True): + return ans + + ++def unsafe_xml_fromstring(string_or_bytes): ++ parser = etree.XMLParser(resolve_entities=True) ++ return fs(string_or_bytes, parser=parser) ++ ++ + def find_tests(): + import unittest, tempfile, os + from calibre.constants import iswindows +@@ -61,7 +66,7 @@ def t(tid, val, expected, safe=True): + raw = templ.format(id=tid, val=val) + err = None + try: +- root = safe_xml_fromstring(raw) if safe else etree.fromstring(raw) ++ root = safe_xml_fromstring(raw) if safe else unsafe_xml_fromstring(raw) + except Exception as e: + err = str(e) + root = None
