summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@gentoo.org>2024-07-21 17:09:43 -0400
committerEli Schwartz <eschwartz@gentoo.org>2024-07-21 17:17:56 -0400
commit64fad029fd9e98ba427fe61628b12b79f448e8ac (patch)
tree08bb112a7043a86a94b211bb911ac34f767c7e3f /app-text/calibre
parentprofiles: x86: Drop kde-apps/*[kf6compat] from package.use.mask (diff)
downloadgentoo-64fad029fd9e98ba427fe61628b12b79f448e8ac.tar.gz
gentoo-64fad029fd9e98ba427fe61628b12b79f448e8ac.tar.bz2
gentoo-64fad029fd9e98ba427fe61628b12b79f448e8ac.zip
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@gentoo.org>
Diffstat (limited to 'app-text/calibre')
-rw-r--r--app-text/calibre/calibre-5.44.0-r3.ebuild4
-rw-r--r--app-text/calibre/files/calibre-5.44.0-icu75.patch28
-rw-r--r--app-text/calibre/files/e9cc00560a28f56a303cca97630ab58e519dd9c8.patch35
3 files changed, 67 insertions, 0 deletions
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 <kovid@kovidgoyal.net>
+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