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/
Date: Fri, 04 Mar 2022 23:46:49
Message-Id: 1646437601.1c03fe1737bc8eb439e6ca49ce7733b7bae6e784.zmedico@gentoo
1 commit: 1c03fe1737bc8eb439e6ca49ce7733b7bae6e784
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 4 23:43:40 2022 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 4 23:46:41 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c03fe17
7
8 app-text/calibre: Bump to version 5.38.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.38.0.ebuild | 316 +++++++++++++++++++++++++++++++++
15 2 files changed, 317 insertions(+)
16
17 diff --git a/app-text/calibre/Manifest b/app-text/calibre/Manifest
18 index 0d29d2e7e16a..d6da779578b9 100644
19 --- a/app-text/calibre/Manifest
20 +++ b/app-text/calibre/Manifest
21 @@ -4,3 +4,4 @@ DIST calibre-5.33.2.tar.xz 37081104 BLAKE2B 7ef40e39d47b10378918dcdefbec5925d9a4
22 DIST calibre-5.35.0.tar.xz 37801424 BLAKE2B fcef3dfc3fa09d3a6324b3b9a860a3f0eb4cfe1311df84aea39beed9c0f42e620bfe3ec1a33c89e0e701b955fe44cf9b15f1e4b0f24529847c9b28d2eb7b2fa2 SHA512 b99a5c86a48d29bcc6f6188f9e4a20fe8ac1c4115147a964596e2bc3635d20c2556ae0be90c7deac95d4ef430b6ce6c7b712510358f71a22817c9360203b1f11
23 DIST calibre-5.36.0.tar.xz 38199520 BLAKE2B 2b1a8cb2df6a8b62796c709fdf15a7ab108c3dde4a25bbf33b3b3ef08101fc56927dc7dfbfdccf29b697d4d321c253d2a8b182d41b7fa1b993f095297f427720 SHA512 0a6fbd68870cbe0e992ef4275b8c0270801647e5afd8db8a6705dc551097ecdcf05d641ac652415e578e979d8009d1281dd123b8dc95ad118e00d9331d50f882
24 DIST calibre-5.37.0.tar.xz 38369808 BLAKE2B ac2e782b55c58f3b530d750e9cfbb003d694fec58d41dc1310c15aa2707f17a2061a550ed767359c42f634b4597b00cdceb43f098cc830ddff12e3610a70ba52 SHA512 cadff4f2ae8717fecf9d3e55098b42ebf5e1e3c69250bd151919c4fbdd1fdc1d0d8857f8da8475d84938b3e5e3b65d755de7c55e6086c42da7ad4f3811d4e9bb
25 +DIST calibre-5.38.0.tar.xz 38365980 BLAKE2B 1c6939e69abde52426d32ab56a91f9b31f687f1d20792c5b360bf5563d72384db395b29e63d8becc1e196f54522a8643588109891943eb1fa525a5395873bb3e SHA512 2744e9d0d3f6daa578360ffb8334adbc49b4dc41100fbe0820b73e4a5a1e24c70c1e75bf1f03b9590f2a64d6c0c7710b26884356567f51200d5c00fe23ed5772
26
27 diff --git a/app-text/calibre/calibre-5.38.0.ebuild b/app-text/calibre/calibre-5.38.0.ebuild
28 new file mode 100644
29 index 000000000000..a9f64cfe2e57
30 --- /dev/null
31 +++ b/app-text/calibre/calibre-5.38.0.ebuild
32 @@ -0,0 +1,316 @@
33 +# Copyright 1999-2022 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +PYTHON_COMPAT=( python3_{8..9} )
39 +PYTHON_REQ_USE="ipv6(+),sqlite,ssl"
40 +
41 +inherit toolchain-funcs python-single-r1 xdg-utils
42 +
43 +DESCRIPTION="Ebook management application"
44 +HOMEPAGE="https://calibre-ebook.com/"
45 +SRC_URI="https://download.calibre-ebook.com/${PV}/${P}.tar.xz"
46 +
47 +LICENSE="
48 + GPL-3+
49 + GPL-3
50 + GPL-2+
51 + GPL-2
52 + GPL-1+
53 + LGPL-3+
54 + LGPL-2.1+
55 + LGPL-2.1
56 + BSD
57 + MIT
58 + Old-MIT
59 + Apache-2.0
60 + public-domain
61 + || ( Artistic GPL-1+ )
62 + CC-BY-3.0
63 + OFL-1.1
64 + PSF-2
65 +"
66 +KEYWORDS="~amd64 ~arm ~x86"
67 +SLOT="0"
68 +IUSE="ios +udisks"
69 +
70 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
71 +
72 +COMMON_DEPEND="${PYTHON_DEPS}
73 + >=app-text/hunspell-1.7:=
74 + >=app-text/podofo-0.9.6_pre20171027:=
75 + >=app-text/poppler-0.26.5[qt5]
76 + dev-libs/glib:2=
77 + dev-libs/hyphen:=
78 + >=dev-libs/icu-57.1:=
79 + dev-libs/libinput:=
80 + >=dev-libs/dbus-glib-0.106
81 + dev-libs/snowball-stemmer:=
82 + >=sys-apps/dbus-1.10.8
83 + $(python_gen_cond_dep '
84 + app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]
85 + >=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
86 + dev-python/beautifulsoup4[${PYTHON_USEDEP}]
87 + dev-python/cchardet[${PYTHON_USEDEP}]
88 + >=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]
89 + >=dev-python/cssselect-0.7.1[${PYTHON_USEDEP}]
90 + >=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
91 + >=dev-python/dbus-python-1.2.4[${PYTHON_USEDEP}]
92 + dev-python/dnspython[${PYTHON_USEDEP}]
93 + >=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
94 + >=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
95 + >=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
96 + dev-python/jeepney[${PYTHON_USEDEP}]
97 + >=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
98 + >=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
99 + >=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
100 + >=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
101 + >=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
102 + >=dev-python/pillow-3.2.0[${PYTHON_USEDEP}]
103 + >=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
104 + >=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
105 + dev-python/pycryptodome[${PYTHON_USEDEP}]
106 + >=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
107 + >=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
108 + >=dev-python/PyQt5-5.15.5_pre2107091435[gui,svg,widgets,network,printsupport,${PYTHON_USEDEP}]
109 + >=dev-python/PyQt-builder-1.10.3[${PYTHON_USEDEP}]
110 + >=dev-python/PyQtWebEngine-5.15.5_pre2108100905[${PYTHON_USEDEP}]
111 + dev-python/regex[${PYTHON_USEDEP}]
112 + dev-python/zeroconf[${PYTHON_USEDEP}]
113 + ')
114 + dev-qt/qtcore:5=
115 + dev-qt/qtdbus:5=
116 + dev-qt/qtgui:5=[jpeg]
117 + >=dev-qt/qtwebengine-5.12
118 + dev-qt/qtwidgets:5=
119 + dev-util/desktop-file-utils
120 + dev-util/gtk-update-icon-cache
121 + media-fonts/liberation-fonts
122 + media-libs/fontconfig:=
123 + >=media-libs/freetype-2:=
124 + >=media-libs/libmtp-1.1.11:=
125 + >=media-libs/libwmf-0.2.8
126 + >=media-gfx/optipng-0.7.6
127 + >=sys-libs/zlib-1.2.11:=
128 + virtual/libusb:1=
129 + x11-libs/libxkbcommon:=
130 + x11-libs/libX11:=
131 + x11-libs/libXext:=
132 + x11-libs/libXrender:=
133 + x11-misc/shared-mime-info
134 + >=x11-misc/xdg-utils-1.0.2-r2
135 + ios? (
136 + >=app-pda/usbmuxd-1.0.8
137 + >=app-pda/libimobiledevice-1.2.0
138 + )
139 + udisks? ( virtual/libudev )"
140 +RDEPEND="${COMMON_DEPEND}
141 + udisks? ( sys-fs/udisks:2 )"
142 +DEPEND="${COMMON_DEPEND}"
143 +BDEPEND="$(python_gen_cond_dep '
144 + >=dev-python/setuptools-23.1.0[${PYTHON_USEDEP}]
145 + >=dev-python/sip-5[${PYTHON_USEDEP}]
146 + ')
147 + >=virtual/podofo-build-0.9.6_pre20171027
148 + virtual/pkgconfig"
149 +
150 +PATCHES=(
151 + # Don't prompt the user for updates - they've installed via
152 + # an ebuild.
153 + "${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch"
154 +
155 + # Skip calling a binary (JxrDecApp) from libjxr which is used for tests
156 + # We don't (yet?) package libjxr and it seems to be dead upstream
157 + # (last commit in 2017)
158 + "${FILESDIR}/${PN}-5.35.0-jxr-test.patch"
159 +
160 + # TODO:
161 + # test_qt tries to load a bunch of images using Qt and it currently fails
162 + # due to some presumably missing dependencies. This is important and
163 + # we need to look into it, but at time of writing, none of the tests
164 + # are even bring run, so I'd like to return to this later.
165 + # We don't want to skip test_qt entirely, so just skip this particular
166 + # assert for now.
167 + "${FILESDIR}/${PN}-5.31.0-qt-image-test.patch"
168 +)
169 +
170 +pkg_pretend() {
171 + if [[ ${MERGE_TYPE} != binary ]] && tc-is-gcc && [[ $(gcc-major-version) -lt 6 ]]; then
172 + eerror "Calibre cannot be built with this version of gcc."
173 + eerror "You need at least gcc-6.0"
174 + die "Your C compiler is too old for this package."
175 + fi
176 +}
177 +
178 +src_prepare() {
179 + default
180 +
181 + # Warning:
182 + #
183 + # While it might be rather tempting to add yet another sed here,
184 + # please don't. There have been several bugs in Gentoo's packaging
185 + # of calibre from seds-which-become-stale. Please consider
186 + # creating a patch instead, but in any case, run the test suite
187 + # and ensure it passes.
188 + #
189 + # If in doubt about a problem, checking Fedora or Arch Linux's packaging
190 + # is recommended, as Arch Linux's PKGBUILD is maintained by a Calibre
191 + # contributor. Or just ask them.
192 +
193 + # Fix outdated version constant.
194 + #sed -e "s#\\(^numeric_version =\\).*#\\1 (${PV//./, })#" \
195 + # -i src/calibre/constants.py || \
196 + # die "sed failed to patch constants.py"
197 +
198 + # Avoid sandbox violation in /usr/share/gnome/apps when linux.py
199 + # calls xdg-* (bug #258938).
200 + sed -e "s|'xdg-desktop-menu', 'install'|\\0, '--mode', 'user'|" \
201 + -e "s|check_call(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
202 + -e "s|\\(CurrentDir(tdir)\\), \\\\\$|\\1:|" \
203 + -e "s|, PreserveMIMEDefaults():|:|" \
204 + -e "s|'xdg-icon-resource', 'install'|\\0, '--mode', 'user'|" \
205 + -e "s|cmd\[2\]|cmd[4]|" \
206 + -e "s|cc(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
207 + -e "s|'xdg-mime', 'install'|\\0, '--mode', 'user'|" \
208 + -i src/calibre/linux.py || die "sed failed to patch linux.py"
209 +
210 + # Disable unnecessary privilege dropping for bug #287067.
211 + sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
212 + -i setup/install.py || die "sed failed to patch install.py"
213 + sed -e "/^ os.chdir(os.path.join(src_dir, 'build'))$/a\
214 +\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ self.check_call(['sed', \
215 +'-e', 's|^CFLAGS .*|\\\\\\\\0 ${CFLAGS}|', \
216 +'-e', 's|^CXXFLAGS .*|\\\\\\\\0 ${CXXFLAGS}|', \
217 +'-e', 's|^LFLAGS .*|\\\\\\\\0 ${LDFLAGS}|', \
218 +'-i', os.path.join(os.path.basename(src_dir), 'Makefile')])" \
219 + -e "s|open(self.j(bdir, '.qmake.conf'), 'wb').close()|open(self.j(bdir, '.qmake.conf'), 'wb').write(b'QMAKE_LFLAGS += ${LDFLAGS}')|" \
220 + -i setup/build.py || die "sed failed to patch build.py"
221 +}
222 +
223 +src_compile() {
224 + # TODO: get qmake called by setup.py to respect CC and CXX too
225 + tc-export CC CXX
226 +
227 + # bug 821871
228 + local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
229 + export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
230 +
231 + PATH="${T}/bin:${PATH}" ${EPYTHON} setup.py build || die
232 +}
233 +
234 +src_test() {
235 + # Skipped tests:
236 + # - 7z (unpackaged Python dependency: py7zr)
237 + # - test_unrar (unpackaged Python dependency: unrardll)
238 + #
239 + # Note that we currently have a hack to skip one part of test_qt!
240 + # See PATCHES for more.
241 + CALIBRE_PY3_PORT=1 ${PYTHON} setup.py test \
242 + --exclude-test-name 7z \
243 + --exclude-test-name test_mem_leaks \
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 +}