Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/calibre/, app-text/calibre/files/
Date: Fri, 21 Jan 2022 04:11:45
Message-Id: 1642738016.b9abd1b1087ad02c6393ff070bc4fd5f6119b4c6.zmedico@gentoo
1 commit: b9abd1b1087ad02c6393ff070bc4fd5f6119b4c6
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 21 04:06:56 2022 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 21 04:06:56 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9abd1b1
7
8 app-text/calibre: Bump to version 5.35.0
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
12
13 app-text/calibre/Manifest | 1 +
14 app-text/calibre/calibre-5.35.0.ebuild | 315 +++++++++++++++++++++
15 .../calibre/files/calibre-5.35.0-jxr-test.patch | 24 ++
16 3 files changed, 340 insertions(+)
17
18 diff --git a/app-text/calibre/Manifest b/app-text/calibre/Manifest
19 index 74be0f200b5e..e7224900cc98 100644
20 --- a/app-text/calibre/Manifest
21 +++ b/app-text/calibre/Manifest
22 @@ -1,3 +1,4 @@
23 DIST calibre-5.16.0-SIP-v4.patch.xz 6768 BLAKE2B b939233266c7cab0fa71ccdeb748bbcffbf16248081ccf0ab313420fe3898954da71e0796b3d6c44e93c636113221f95fa6affc6be97bf41f4086a909b2849f9 SHA512 eb19e6bb328f60eb4af2c38d54c3d2a09989d41d71d27de10ab5ae443af902c3c12fc70042d4735dd785573cb63bb7d7a10ae5f7ed72afc1e1a9c6aacaf64aec
24 DIST calibre-5.16.1.tar.xz 36757204 BLAKE2B 71114eed723180142f5428a680d8c5ceabcd007acbc6a70a9298e45a9f21fc793f0ef86bf60b36c96bbd15e9e3f8d8638d179872fb6ff1f9b9f5e31a93e65ba1 SHA512 41cf29cc32c7af08215baf80609f8f099d44f2b82d34181451cbf3ed1648e07d64712dba9ff0ddec5bad3d342c7d8bde40bb822f6bd5fb93a4b29d25cf188aae
25 DIST calibre-5.33.2.tar.xz 37081104 BLAKE2B 7ef40e39d47b10378918dcdefbec5925d9a43f47c345ccb6fd8811b99a2c417923467724f3ba92152b0951e473af7dd20dcb779e1fc6ad7970ac527fc06fe09c SHA512 5886730000005f4e36373ef6d0b3da4e4f06941886f05d1703420720c16aa913dcfca9358c33e4fcec764f0e4bd24e0223ff35421b41f1cc3f818d6d53896d64
26 +DIST calibre-5.35.0.tar.xz 37801424 BLAKE2B fcef3dfc3fa09d3a6324b3b9a860a3f0eb4cfe1311df84aea39beed9c0f42e620bfe3ec1a33c89e0e701b955fe44cf9b15f1e4b0f24529847c9b28d2eb7b2fa2 SHA512 b99a5c86a48d29bcc6f6188f9e4a20fe8ac1c4115147a964596e2bc3635d20c2556ae0be90c7deac95d4ef430b6ce6c7b712510358f71a22817c9360203b1f11
27
28 diff --git a/app-text/calibre/calibre-5.35.0.ebuild b/app-text/calibre/calibre-5.35.0.ebuild
29 new file mode 100644
30 index 000000000000..59a9f2a0e0b8
31 --- /dev/null
32 +++ b/app-text/calibre/calibre-5.35.0.ebuild
33 @@ -0,0 +1,315 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +PYTHON_COMPAT=( python3_{8..9} )
40 +PYTHON_REQ_USE="ipv6(+),sqlite,ssl"
41 +
42 +inherit toolchain-funcs python-single-r1 xdg-utils
43 +
44 +DESCRIPTION="Ebook management application"
45 +HOMEPAGE="https://calibre-ebook.com/"
46 +SRC_URI="https://download.calibre-ebook.com/${PV}/${P}.tar.xz"
47 +
48 +LICENSE="
49 + GPL-3+
50 + GPL-3
51 + GPL-2+
52 + GPL-2
53 + GPL-1+
54 + LGPL-3+
55 + LGPL-2.1+
56 + LGPL-2.1
57 + BSD
58 + MIT
59 + Old-MIT
60 + Apache-2.0
61 + public-domain
62 + || ( Artistic GPL-1+ )
63 + CC-BY-3.0
64 + OFL-1.1
65 + PSF-2
66 +"
67 +KEYWORDS="~amd64 ~arm ~x86"
68 +SLOT="0"
69 +IUSE="ios +udisks"
70 +
71 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
72 +
73 +COMMON_DEPEND="${PYTHON_DEPS}
74 + >=app-text/hunspell-1.7:=
75 + >=app-text/podofo-0.9.6_pre20171027:=
76 + >=app-text/poppler-0.26.5[qt5]
77 + dev-libs/glib:2=
78 + dev-libs/hyphen:=
79 + >=dev-libs/icu-57.1:=
80 + dev-libs/libinput:=
81 + >=dev-libs/dbus-glib-0.106
82 + dev-libs/snowball-stemmer:=
83 + >=sys-apps/dbus-1.10.8
84 + $(python_gen_cond_dep '
85 + app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]
86 + >=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
87 + dev-python/beautifulsoup4[${PYTHON_USEDEP}]
88 + dev-python/cchardet[${PYTHON_USEDEP}]
89 + >=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]
90 + >=dev-python/cssselect-0.7.1[${PYTHON_USEDEP}]
91 + >=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
92 + >=dev-python/dbus-python-1.2.4[${PYTHON_USEDEP}]
93 + dev-python/dnspython[${PYTHON_USEDEP}]
94 + >=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
95 + >=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
96 + >=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
97 + dev-python/jeepney[${PYTHON_USEDEP}]
98 + >=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
99 + >=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
100 + >=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
101 + >=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
102 + >=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
103 + >=dev-python/pillow-3.2.0[${PYTHON_USEDEP}]
104 + >=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
105 + >=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
106 + dev-python/pycryptodome[${PYTHON_USEDEP}]
107 + >=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
108 + >=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
109 + >=dev-python/PyQt5-5.15.5_pre2107091435[gui,svg,widgets,network,printsupport,${PYTHON_USEDEP}]
110 + >=dev-python/PyQt-builder-1.10.3[${PYTHON_USEDEP}]
111 + >=dev-python/PyQtWebEngine-5.15.5_pre2108100905[${PYTHON_USEDEP}]
112 + dev-python/regex[${PYTHON_USEDEP}]
113 + dev-python/zeroconf[${PYTHON_USEDEP}]
114 + ')
115 + dev-qt/qtcore:5=
116 + dev-qt/qtdbus:5=
117 + dev-qt/qtgui:5=[jpeg]
118 + >=dev-qt/qtwebengine-5.12
119 + dev-qt/qtwidgets:5=
120 + dev-util/desktop-file-utils
121 + dev-util/gtk-update-icon-cache
122 + media-fonts/liberation-fonts
123 + media-libs/fontconfig:=
124 + >=media-libs/freetype-2:=
125 + >=media-libs/libmtp-1.1.11:=
126 + >=media-libs/libwmf-0.2.8
127 + >=media-gfx/optipng-0.7.6
128 + >=sys-libs/zlib-1.2.11:=
129 + virtual/libusb:1=
130 + x11-libs/libxkbcommon:=
131 + x11-libs/libX11:=
132 + x11-libs/libXext:=
133 + x11-libs/libXrender:=
134 + x11-misc/shared-mime-info
135 + >=x11-misc/xdg-utils-1.0.2-r2
136 + ios? (
137 + >=app-pda/usbmuxd-1.0.8
138 + >=app-pda/libimobiledevice-1.2.0
139 + )
140 + udisks? ( virtual/libudev )"
141 +RDEPEND="${COMMON_DEPEND}
142 + udisks? ( sys-fs/udisks:2 )"
143 +DEPEND="${COMMON_DEPEND}"
144 +BDEPEND="$(python_gen_cond_dep '
145 + >=dev-python/setuptools-23.1.0[${PYTHON_USEDEP}]
146 + >=dev-python/sip-5[${PYTHON_USEDEP}]
147 + ')
148 + >=virtual/podofo-build-0.9.6_pre20171027
149 + virtual/pkgconfig"
150 +
151 +PATCHES=(
152 + # Don't prompt the user for updates - they've installed via
153 + # an ebuild.
154 + "${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch"
155 +
156 + # Skip calling a binary (JxrDecApp) from libjxr which is used for tests
157 + # We don't (yet?) package libjxr and it seems to be dead upstream
158 + # (last commit in 2017)
159 + "${FILESDIR}/${PN}-5.35.0-jxr-test.patch"
160 +
161 + # TODO:
162 + # test_qt tries to load a bunch of images using Qt and it currently fails
163 + # due to some presumably missing dependencies. This is important and
164 + # we need to look into it, but at time of writing, none of the tests
165 + # are even bring run, so I'd like to return to this later.
166 + # We don't want to skip test_qt entirely, so just skip this particular
167 + # assert for now.
168 + "${FILESDIR}/${PN}-5.31.0-qt-image-test.patch"
169 +)
170 +
171 +pkg_pretend() {
172 + if [[ ${MERGE_TYPE} != binary ]] && tc-is-gcc && [[ $(gcc-major-version) -lt 6 ]]; then
173 + eerror "Calibre cannot be built with this version of gcc."
174 + eerror "You need at least gcc-6.0"
175 + die "Your C compiler is too old for this package."
176 + fi
177 +}
178 +
179 +src_prepare() {
180 + default
181 +
182 + # Warning:
183 + #
184 + # While it might be rather tempting to add yet another sed here,
185 + # please don't. There have been several bugs in Gentoo's packaging
186 + # of calibre from seds-which-become-stale. Please consider
187 + # creating a patch instead, but in any case, run the test suite
188 + # and ensure it passes.
189 + #
190 + # If in doubt about a problem, checking Fedora or Arch Linux's packaging
191 + # is recommended, as Arch Linux's PKGBUILD is maintained by a Calibre
192 + # contributor. Or just ask them.
193 +
194 + # Fix outdated version constant.
195 + #sed -e "s#\\(^numeric_version =\\).*#\\1 (${PV//./, })#" \
196 + # -i src/calibre/constants.py || \
197 + # die "sed failed to patch constants.py"
198 +
199 + # Avoid sandbox violation in /usr/share/gnome/apps when linux.py
200 + # calls xdg-* (bug #258938).
201 + sed -e "s|'xdg-desktop-menu', 'install'|\\0, '--mode', 'user'|" \
202 + -e "s|check_call(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
203 + -e "s|\\(CurrentDir(tdir)\\), \\\\\$|\\1:|" \
204 + -e "s|, PreserveMIMEDefaults():|:|" \
205 + -e "s|'xdg-icon-resource', 'install'|\\0, '--mode', 'user'|" \
206 + -e "s|cmd\[2\]|cmd[4]|" \
207 + -e "s|cc(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
208 + -e "s|'xdg-mime', 'install'|\\0, '--mode', 'user'|" \
209 + -i src/calibre/linux.py || die "sed failed to patch linux.py"
210 +
211 + # Disable unnecessary privilege dropping for bug #287067.
212 + sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
213 + -i setup/install.py || die "sed failed to patch install.py"
214 + sed -e "/^ os.chdir(os.path.join(src_dir, 'build'))$/a\
215 +\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ self.check_call(['sed', \
216 +'-e', 's|^CFLAGS .*|\\\\\\\\0 ${CFLAGS}|', \
217 +'-e', 's|^CXXFLAGS .*|\\\\\\\\0 ${CXXFLAGS}|', \
218 +'-e', 's|^LFLAGS .*|\\\\\\\\0 ${LDFLAGS}|', \
219 +'-i', os.path.join(os.path.basename(src_dir), 'Makefile')])" \
220 + -e "s|open(self.j(bdir, '.qmake.conf'), 'wb').close()|open(self.j(bdir, '.qmake.conf'), 'wb').write(b'QMAKE_LFLAGS += ${LDFLAGS}')|" \
221 + -i setup/build.py || die "sed failed to patch build.py"
222 +}
223 +
224 +src_compile() {
225 + # TODO: get qmake called by setup.py to respect CC and CXX too
226 + tc-export CC CXX
227 +
228 + # bug 821871
229 + local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
230 + export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
231 +
232 + PATH="${T}/bin:${PATH}" ${EPYTHON} setup.py build || die
233 +}
234 +
235 +src_test() {
236 + # Skipped tests:
237 + # - 7z (unpackaged Python dependency: py7zr)
238 + # - test_unrar (unpackaged Python dependency: unrardll)
239 + #
240 + # Note that we currently have a hack to skip one part of test_qt!
241 + # See PATCHES for more.
242 + CALIBRE_PY3_PORT=1 ${PYTHON} setup.py test \
243 + --exclude-test-name 7z \
244 + --exclude-test-name test_searching \
245 + --exclude-test-name test_unrar || die
246 +}
247 +
248 +src_install() {
249 + # calibre works with python 3, so remove the python 2 constraint
250 + export CALIBRE_PY3_PORT=1
251 +
252 + # Bypass kbuildsycoca and update-mime-database in order to
253 + # avoid sandbox violations if xdg-mime tries to call them.
254 + mkdir "${T}/bin" || die
255 + cat - > "${T}/bin/kbuildsycoca" <<-EOF
256 + #!${BASH}
257 + echo $0 : $@
258 + exit 0
259 + EOF
260 +
261 + cp "${T}"/bin/{kbuildsycoca,update-mime-database} || die
262 + chmod +x "${T}"/bin/{kbuildsycoca,update-mime-database} || die
263 +
264 + export QMAKE="${EPREFIX}/usr/$(get_libdir)/qt5/bin/qmake"
265 +
266 + # Unset DISPLAY in order to prevent xdg-mime from triggering a sandbox
267 + # violation with kbuildsycoca as in bug #287067, comment #13.
268 + export -n DISPLAY
269 +
270 + # Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
271 + # File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
272 + # return _parse_localename(localename)
273 + # File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
274 + # raise ValueError, 'unknown locale: %s' % localename
275 + #ValueError: unknown locale: 46
276 + export -n LANG LANGUAGE ${!LC_*}
277 + export LC_ALL=C.utf8 #709682
278 +
279 + # Bug #295672 - Avoid sandbox violation in ~/.config by forcing
280 + # variables to point to our fake temporary $HOME.
281 + export HOME="${T}/fake_homedir"
282 + export XDG_CONFIG_HOME="${HOME}/.config"
283 + export XDG_DATA_HOME="${HOME}/.local/share"
284 + export CALIBRE_CONFIG_DIRECTORY="${XDG_CONFIG_HOME}/calibre"
285 + mkdir -p "${XDG_DATA_HOME}" "${CALIBRE_CONFIG_DIRECTORY}" || die
286 +
287 + tc-export CC CXX
288 + # Bug #334243 - respect LDFLAGS when building extensions
289 + export OVERRIDE_CFLAGS="$CFLAGS" OVERRIDE_LDFLAGS="$LDFLAGS"
290 + local libdir=$(get_libdir)
291 + [[ -n $libdir ]] || die "get_libdir returned an empty string"
292 +
293 + addpredict /dev/dri #665310
294 +
295 + PATH=${T}/bin:${PATH} PYTHONPATH=${S}/src${PYTHONPATH:+:}${PYTHONPATH} \
296 + "${PYTHON}" setup.py install \
297 + --root="${D}" \
298 + --prefix="${EPREFIX}/usr" \
299 + --libdir="${EPREFIX}/usr/${libdir}" \
300 + --staging-root="${ED}/usr" \
301 + --staging-libdir="${ED}/usr/${libdir}" || die
302 +
303 + find "${ED}"/usr/share -type d -empty -delete
304 +
305 + cd "${ED}"/usr/share/calibre/fonts/liberation || die
306 + local x
307 + for x in * ; do
308 + [[ -f ${EPREFIX}/usr/share/fonts/liberation-fonts/${x} ]] || continue
309 + ln -sf "../../../fonts/liberation-fonts/${x}" "${x}" || die
310 + done
311 +
312 + einfo "Converting python shebangs"
313 + python_fix_shebang --force "${ED}"
314 +
315 + einfo "Compiling python modules"
316 + python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
317 +
318 + newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
319 + newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
320 +}
321 +
322 +pkg_preinst() {
323 + # Indentify stray directories from upstream's "Binary install"
324 + # method (see bug 622728).
325 + CALIBRE_LIB_DIR=/usr/$(get_libdir)/calibre
326 + CALIBRE_LIB_CONTENT=$(for x in "${ED}${CALIBRE_LIB_DIR}"/*; do
327 + printf -- "${x##*/} "; done) || die "Failed to list ${ED}${CALIBRE_LIB_DIR}"
328 +}
329 +
330 +pkg_postinst() {
331 + [[ -n ${CALIBRE_LIB_DIR} ]] || die "CALIBRE_LIB_DIR is unset"
332 + local x
333 + for x in "${EROOT}${CALIBRE_LIB_DIR}"/*; do
334 + if [[ " ${CALIBRE_LIB_CONTENT} " != *" ${x##*/} "* ]]; then
335 + elog "Purging '${x}'"
336 + rm -rf "${x}"
337 + fi
338 + done
339 + xdg_desktop_database_update
340 + xdg_mimeinfo_database_update
341 + xdg_icon_cache_update
342 +}
343 +
344 +pkg_postrm() {
345 + xdg_desktop_database_update
346 + xdg_mimeinfo_database_update
347 + xdg_icon_cache_update
348 +}
349
350 diff --git a/app-text/calibre/files/calibre-5.35.0-jxr-test.patch b/app-text/calibre/files/calibre-5.35.0-jxr-test.patch
351 new file mode 100644
352 index 000000000000..bec72c15cb8b
353 --- /dev/null
354 +++ b/app-text/calibre/files/calibre-5.35.0-jxr-test.patch
355 @@ -0,0 +1,24 @@
356 +Avoid calling libjxr's JxrDecApp as we currently don't package it.
357 +--- a/src/calibre/utils/img.py
358 ++++ b/src/calibre/utils/img.py
359 +@@ -118,8 +118,6 @@
360 + i = QImage()
361 + if not i.loadFromData(data):
362 + q = what(None, data)
363 +- if q == 'jxr':
364 +- return load_jxr_data(data)
365 + raise NotImage(f'Not a valid image (detected type: {q})')
366 + return i
367 +
368 +@@ -645,11 +643,6 @@
369 + despeckle_image(img)
370 + remove_borders_from_image(img)
371 + image_to_data(img, fmt='GIF')
372 +- raw = subprocess.Popen([get_exe_path('JxrDecApp'), '-h'],
373 +- creationflags=subprocess.DETACHED_PROCESS if iswindows else 0,
374 +- stdout=subprocess.PIPE).stdout.read()
375 +- if b'JPEG XR Decoder Utility' not in raw:
376 +- raise SystemExit('Failed to run JxrDecApp')
377 + # }}}
378 +
379 +