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: Sat, 28 May 2022 17:02:02
Message-Id: 1653757295.abea19a622c8f65cd242abe0d0517d91f06ba807.zmedico@gentoo
1 commit: abea19a622c8f65cd242abe0d0517d91f06ba807
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 28 17:01:35 2022 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat May 28 17:01:35 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abea19a6
7
8 app-text/calibre: add 5.43.0
9
10 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
11
12 app-text/calibre/Manifest | 1 +
13 app-text/calibre/calibre-5.43.0.ebuild | 308 +++++++++++++++++++++++++++++++++
14 2 files changed, 309 insertions(+)
15
16 diff --git a/app-text/calibre/Manifest b/app-text/calibre/Manifest
17 index 91f1caca0695..c8dc66450062 100644
18 --- a/app-text/calibre/Manifest
19 +++ b/app-text/calibre/Manifest
20 @@ -1,3 +1,4 @@
21 DIST calibre-5.16.0-SIP-v4.patch.xz 6768 BLAKE2B b939233266c7cab0fa71ccdeb748bbcffbf16248081ccf0ab313420fe3898954da71e0796b3d6c44e93c636113221f95fa6affc6be97bf41f4086a909b2849f9 SHA512 eb19e6bb328f60eb4af2c38d54c3d2a09989d41d71d27de10ab5ae443af902c3c12fc70042d4735dd785573cb63bb7d7a10ae5f7ed72afc1e1a9c6aacaf64aec
22 DIST calibre-5.16.1.tar.xz 36757204 BLAKE2B 71114eed723180142f5428a680d8c5ceabcd007acbc6a70a9298e45a9f21fc793f0ef86bf60b36c96bbd15e9e3f8d8638d179872fb6ff1f9b9f5e31a93e65ba1 SHA512 41cf29cc32c7af08215baf80609f8f099d44f2b82d34181451cbf3ed1648e07d64712dba9ff0ddec5bad3d342c7d8bde40bb822f6bd5fb93a4b29d25cf188aae
23 DIST calibre-5.42.0.tar.xz 38523536 BLAKE2B 81d8477fbbaeedbf589c3c25b16925f6fe383c74d9ad17d0036f886304c9ce1f807fea6463ef0dc345a07de69438785faca6ef7337e5ff1e7d5684b4d0ed7cdd SHA512 dac197d0a6f36f8ebb56720214df355bfc2625ecf55992b824e3409e7273db12fabfd54d2f602f950761efc717e52f872f5f2c2078770abbc887ef30cc64bbe8
24 +DIST calibre-5.43.0.tar.xz 38641220 BLAKE2B dddf9e5f7303845f8d86826d38d08dfbf05f144c4fb80d215197f51dc6685f09d848148f00f9795c441f8cd8c541ed9d4988b0a5d2020ce98eb8f8bcd4853dac SHA512 1a5b95c621e47b660841d989445ab56244b9c805aa5d01efc4d95d8c37c5290e93523cedec92a6ca12d16e5f74b63743d6e682bf4084f400d080678ff540a190
25
26 diff --git a/app-text/calibre/calibre-5.43.0.ebuild b/app-text/calibre/calibre-5.43.0.ebuild
27 new file mode 100644
28 index 000000000000..f3484c057923
29 --- /dev/null
30 +++ b/app-text/calibre/calibre-5.43.0.ebuild
31 @@ -0,0 +1,308 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +PYTHON_COMPAT=( python3_{8..10} )
38 +PYTHON_REQ_USE="ipv6(+),sqlite,ssl"
39 +
40 +inherit toolchain-funcs python-single-r1 qmake-utils xdg-utils
41 +
42 +DESCRIPTION="Ebook management application"
43 +HOMEPAGE="https://calibre-ebook.com/"
44 +SRC_URI="https://download.calibre-ebook.com/${PV}/${P}.tar.xz"
45 +
46 +LICENSE="
47 + GPL-3+
48 + GPL-3
49 + GPL-2+
50 + GPL-2
51 + GPL-1+
52 + LGPL-3+
53 + LGPL-2.1+
54 + LGPL-2.1
55 + BSD
56 + MIT
57 + Old-MIT
58 + Apache-2.0
59 + public-domain
60 + || ( Artistic GPL-1+ )
61 + CC-BY-3.0
62 + OFL-1.1
63 + PSF-2
64 +"
65 +KEYWORDS="~amd64 ~arm ~x86"
66 +SLOT="0"
67 +IUSE="ios +udisks"
68 +
69 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
70 +
71 +COMMON_DEPEND="${PYTHON_DEPS}
72 + >=app-text/hunspell-1.7:=
73 + >=app-text/podofo-0.9.6_pre20171027:=
74 + >=app-text/poppler-0.26.5[qt5]
75 + dev-libs/glib:2=
76 + dev-libs/hyphen:=
77 + >=dev-libs/icu-57.1:=
78 + dev-libs/libinput:=
79 + >=dev-libs/dbus-glib-0.106
80 + dev-libs/openssl:=
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/qtwidgets:5=
118 + dev-util/desktop-file-utils
119 + dev-util/gtk-update-icon-cache
120 + media-fonts/liberation-fonts
121 + media-libs/fontconfig:=
122 + >=media-libs/freetype-2:=
123 + >=media-libs/libmtp-1.1.11:=
124 + >=media-libs/libwmf-0.2.8
125 + >=media-gfx/optipng-0.7.6
126 + >=sys-libs/zlib-1.2.11:=
127 + virtual/libusb:1=
128 + x11-libs/libxkbcommon:=
129 + x11-libs/libX11:=
130 + x11-libs/libXext:=
131 + x11-libs/libXrender:=
132 + x11-misc/shared-mime-info
133 + >=x11-misc/xdg-utils-1.0.2-r2
134 + ios? (
135 + >=app-pda/usbmuxd-1.0.8
136 + >=app-pda/libimobiledevice-1.2.0
137 + )
138 + udisks? ( virtual/libudev )"
139 +RDEPEND="${COMMON_DEPEND}
140 + udisks? ( sys-fs/udisks:2 )"
141 +DEPEND="${COMMON_DEPEND}"
142 +BDEPEND="$(python_gen_cond_dep '
143 + >=dev-python/setuptools-23.1.0[${PYTHON_USEDEP}]
144 + >=dev-python/sip-5[${PYTHON_USEDEP}]
145 + ')
146 + >=virtual/podofo-build-0.9.6_pre20171027
147 + virtual/pkgconfig"
148 +
149 +PATCHES=(
150 + # Don't prompt the user for updates - they've installed via
151 + # an ebuild.
152 + "${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch"
153 +
154 + # Skip calling a binary (JxrDecApp) from libjxr which is used for tests
155 + # We don't (yet?) package libjxr and it seems to be dead upstream
156 + # (last commit in 2017)
157 + "${FILESDIR}/${PN}-5.35.0-jxr-test.patch"
158 +
159 + # TODO:
160 + # test_qt tries to load a bunch of images using Qt and it currently fails
161 + # due to some presumably missing dependencies. This is important and
162 + # we need to look into it, but at time of writing, none of the tests
163 + # are even bring run, so I'd like to return to this later.
164 + # We don't want to skip test_qt entirely, so just skip this particular
165 + # assert for now.
166 + "${FILESDIR}/${PN}-5.31.0-qt-image-test.patch"
167 +)
168 +
169 +src_prepare() {
170 + default
171 +
172 + # Warning:
173 + #
174 + # While it might be rather tempting to add yet another sed here,
175 + # please don't. There have been several bugs in Gentoo's packaging
176 + # of calibre from seds-which-become-stale. Please consider
177 + # creating a patch instead, but in any case, run the test suite
178 + # and ensure it passes.
179 + #
180 + # If in doubt about a problem, checking Fedora or Arch Linux's packaging
181 + # is recommended, as Arch Linux's PKGBUILD is maintained by a Calibre
182 + # contributor. Or just ask them.
183 +
184 + # Fix outdated version constant.
185 + #sed -e "s#\\(^numeric_version =\\).*#\\1 (${PV//./, })#" \
186 + # -i src/calibre/constants.py || \
187 + # die "sed failed to patch constants.py"
188 +
189 + # Avoid sandbox violation in /usr/share/gnome/apps when linux.py
190 + # calls xdg-* (bug #258938).
191 + sed -e "s|'xdg-desktop-menu', 'install'|\\0, '--mode', 'user'|" \
192 + -e "s|check_call(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
193 + -e "s|\\(CurrentDir(tdir)\\), \\\\\$|\\1:|" \
194 + -e "s|, PreserveMIMEDefaults():|:|" \
195 + -e "s|'xdg-icon-resource', 'install'|\\0, '--mode', 'user'|" \
196 + -e "s|cmd\[2\]|cmd[4]|" \
197 + -e "s|cc(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
198 + -e "s|'xdg-mime', 'install'|\\0, '--mode', 'user'|" \
199 + -i src/calibre/linux.py || die "sed failed to patch linux.py"
200 +
201 + # Disable unnecessary privilege dropping for bug #287067.
202 + sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
203 + -i setup/install.py || die "sed failed to patch install.py"
204 + sed -e "/^ os.chdir(os.path.join(src_dir, 'build'))$/a\
205 +\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ self.check_call(['sed', \
206 +'-e', 's|^CFLAGS .*|\\\\\\\\0 ${CFLAGS}|', \
207 +'-e', 's|^CXXFLAGS .*|\\\\\\\\0 ${CXXFLAGS}|', \
208 +'-e', 's|^LFLAGS .*|\\\\\\\\0 ${LDFLAGS}|', \
209 +'-i', os.path.join(os.path.basename(src_dir), 'Makefile')])" \
210 + -e "s|open(self.j(bdir, '.qmake.conf'), 'wb').close()|open(self.j(bdir, '.qmake.conf'), 'wb').write(b'QMAKE_LFLAGS += ${LDFLAGS}')|" \
211 + -i setup/build.py || die "sed failed to patch build.py"
212 +}
213 +
214 +src_compile() {
215 + # TODO: get qmake called by setup.py to respect CC and CXX too
216 + tc-export CC CXX
217 +
218 + # bug 821871
219 + local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
220 + export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
221 +
222 + PATH="${T}/bin:$(qt5_get_bindir):${PATH}" ${EPYTHON} setup.py build || die
223 +}
224 +
225 +src_test() {
226 + # Skipped tests:
227 + # - 7z (unpackaged Python dependency: py7zr)
228 + # - test_unrar (unpackaged Python dependency: unrardll)
229 + #
230 + # Note that we currently have a hack to skip one part of test_qt!
231 + # See PATCHES for more.
232 + CALIBRE_PY3_PORT=1 ${PYTHON} setup.py test \
233 + --exclude-test-name 7z \
234 + --exclude-test-name test_mem_leaks \
235 + --exclude-test-name test_searching \
236 + --exclude-test-name test_unrar || die
237 +}
238 +
239 +src_install() {
240 + # calibre works with python 3, so remove the python 2 constraint
241 + export CALIBRE_PY3_PORT=1
242 +
243 + # Bypass kbuildsycoca and update-mime-database in order to
244 + # avoid sandbox violations if xdg-mime tries to call them.
245 + mkdir "${T}/bin" || die
246 + cat - > "${T}/bin/kbuildsycoca" <<-EOF
247 + #!${BASH}
248 + echo $0 : $@
249 + exit 0
250 + EOF
251 +
252 + cp "${T}"/bin/{kbuildsycoca,update-mime-database} || die
253 + chmod +x "${T}"/bin/{kbuildsycoca,update-mime-database} || die
254 +
255 + export QMAKE="$(qt5_get_bindir)/qmake"
256 +
257 + # Unset DISPLAY in order to prevent xdg-mime from triggering a sandbox
258 + # violation with kbuildsycoca as in bug #287067, comment #13.
259 + export -n DISPLAY
260 +
261 + # Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
262 + # File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
263 + # return _parse_localename(localename)
264 + # File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
265 + # raise ValueError, 'unknown locale: %s' % localename
266 + #ValueError: unknown locale: 46
267 + export -n LANG LANGUAGE ${!LC_*}
268 + export LC_ALL=C.utf8 #709682
269 +
270 + # Bug #295672 - Avoid sandbox violation in ~/.config by forcing
271 + # variables to point to our fake temporary $HOME.
272 + export HOME="${T}/fake_homedir"
273 + export XDG_CONFIG_HOME="${HOME}/.config"
274 + export XDG_DATA_HOME="${HOME}/.local/share"
275 + export CALIBRE_CONFIG_DIRECTORY="${XDG_CONFIG_HOME}/calibre"
276 + mkdir -p "${XDG_DATA_HOME}" "${CALIBRE_CONFIG_DIRECTORY}" || die
277 +
278 + tc-export CC CXX
279 + # Bug #334243 - respect LDFLAGS when building extensions
280 + export OVERRIDE_CFLAGS="$CFLAGS" OVERRIDE_LDFLAGS="$LDFLAGS"
281 + local libdir=$(get_libdir)
282 + [[ -n $libdir ]] || die "get_libdir returned an empty string"
283 +
284 + addpredict /dev/dri #665310
285 +
286 + PATH=${T}/bin:${PATH} PYTHONPATH=${S}/src${PYTHONPATH:+:}${PYTHONPATH} \
287 + "${PYTHON}" setup.py install \
288 + --root="${D}" \
289 + --prefix="${EPREFIX}/usr" \
290 + --libdir="${EPREFIX}/usr/${libdir}" \
291 + --staging-root="${ED}/usr" \
292 + --staging-libdir="${ED}/usr/${libdir}" || die
293 +
294 + find "${ED}"/usr/share -type d -empty -delete
295 +
296 + cd "${ED}"/usr/share/calibre/fonts/liberation || die
297 + local x
298 + for x in * ; do
299 + [[ -f ${EPREFIX}/usr/share/fonts/liberation-fonts/${x} ]] || continue
300 + ln -sf "../../../fonts/liberation-fonts/${x}" "${x}" || die
301 + done
302 +
303 + einfo "Converting python shebangs"
304 + python_fix_shebang --force "${ED}"
305 +
306 + einfo "Compiling python modules"
307 + python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
308 +
309 + newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
310 + newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
311 +}
312 +
313 +pkg_preinst() {
314 + # Indentify stray directories from upstream's "Binary install"
315 + # method (see bug 622728).
316 + CALIBRE_LIB_DIR=/usr/$(get_libdir)/calibre
317 + CALIBRE_LIB_CONTENT=$(for x in "${ED}${CALIBRE_LIB_DIR}"/*; do
318 + printf -- "${x##*/} "; done) || die "Failed to list ${ED}${CALIBRE_LIB_DIR}"
319 +}
320 +
321 +pkg_postinst() {
322 + [[ -n ${CALIBRE_LIB_DIR} ]] || die "CALIBRE_LIB_DIR is unset"
323 + local x
324 + for x in "${EROOT}${CALIBRE_LIB_DIR}"/*; do
325 + if [[ " ${CALIBRE_LIB_CONTENT} " != *" ${x##*/} "* ]]; then
326 + elog "Purging '${x}'"
327 + rm -rf "${x}"
328 + fi
329 + done
330 + xdg_desktop_database_update
331 + xdg_mimeinfo_database_update
332 + xdg_icon_cache_update
333 +}
334 +
335 +pkg_postrm() {
336 + xdg_desktop_database_update
337 + xdg_mimeinfo_database_update
338 + xdg_icon_cache_update
339 +}