Cleanup and python 3.13

This commit is contained in:
Mario Fetka
2025-05-05 10:23:40 +02:00
parent 7c1ee4ca45
commit b56141d74d
121 changed files with 9006 additions and 479 deletions

33
app-text/calibre/Manifest Normal file
View File

@@ -0,0 +1,33 @@
AUX 0001-HTML-Input-Dont-add-resources-that-exist-outside-the.patch 2420 BLAKE2B eafb4c38c87bdb708905b0c17b9d3466dad76c1f286f702b6c063c9af866ab8dc656af019eb10a70fa841cfda4e47e1eac9276abdd63d23cf2ffe69f377ad110 SHA512 083e7112f6bdabd0f1894a8afacc87a166ffdad7fa9c88683f05991249b2aa18de04c4e5d842991b0b49a6d0d76248093a7f6ed29a3d0c1a6725e8ab512982e7
AUX 0001-PIL-11.0-changes-its-webp-features-output.patch 1223 BLAKE2B 959dc14e452dd1d19a67976fef43e7fc12ec7739d91710848e9f0cfd24966d553c74521a48a44f3b67d36256ef2041b20b8ee2201a855870270512a5937c36ba SHA512 365f55f94d3657a39a5495604f383e3ecda2ed9c4ab8e783b5117b59f2707f933722939049f4450e7629a3f91ce0c607d968427e6b05b9a00e275980b5b2c2ca
AUX calibre-5.35.0-jxr-test.patch 827 BLAKE2B 0a94ac5b12ee2ec732d3ff68979c2060b0b218eee27409b3c351a9cc0b6bccce2260b8b387b442ae10f31483b20bd6d672f7d5424f7d9a8297a1bd14af2f7793 SHA512 259a3b4882bf0fbb01cb22974e219a621a2b337d6f638234a806148b11142fdbf9ac36ae38e71fcb7e18bd61362b34cf3c221ba1df317ec6ea8668591ad2d3ff
AUX calibre-5.44.0-Fix-compatibility-with-zeroconf-0.73.patch 1065 BLAKE2B 7a74b7d7788340f96b326619f5e2bd916ff21644f0554b2507fcea439eec8217b8b002a2da3b99021fa576a6d3a6fd15d82222f005b8a4fbf37ab5016f33bdb9 SHA512 13f6fc949cc8c5c66013c772cd40429a679fa067d7828cc02e416ecbd556eafb56bebc80bc85a8b442feb3e6b94518450252e701e6426f5a2cde9d102312cf87
AUX calibre-5.44.0-icu75.patch 1294 BLAKE2B 1f05f84e5653a7c3d9162fc1dc7d91fc73b3346323e05d3c379227deece394e0754a6c2d72223ef2453abf5b062ba3ad3b4705b110bd333e643fa0a35d0a0ad4 SHA512 3eecadbd27cb178f630b80b789d3e3a437d95e883b429473414fd08d9a412a9c32201b7b859d28446523426caff292580c244a86a1b7bb117fa2b7281fd15b5f
AUX calibre-5.44.0-xss-backport.patch 1272 BLAKE2B 65be0f6b97b387b37faa86f79d84e150f0a2801a8f2bde95497ebf4f292f95a56bf9c49613d727446dfa9afdef6a4f108a28e1c02cb4343bbc717834ae544896 SHA512 d8ae8fbe64c40169efd4a2f090c194d5a032b2d7072b6f7763932597b227fb12f88712290fd902cf639d40fff48a8806226037d6bb89e8bb4d1a7a79d4bdc21f
AUX calibre-7.0.0-jxr-test.patch 935 BLAKE2B bc38ea2f2d10ec4859ee03ab5d18048df4cf0af5ce4076efc013013bc975966390d618c43ce621675e3b8ee8f929bfaebaa72cf6bb7d8dea544bca77d9772b60 SHA512 db8da42fdcf5b5d5dfad35c128e394cf8f51e57dda6cd1a482803429738515fc1a8b338c711679a11acb93678f35f10883e1bf282e1443ccaafe2eb470fbbfee
AUX calibre-7.17.0-qt-texttospeech.patch 1857 BLAKE2B c043883ffc42314d00754907ccbadbc6f1d4916f4d53b0cfe0a86403d251db26f07b26a169671683fd26816868e4f7538705c57024f1314d863edb39937bcee5 SHA512 246c1e8dc4f423b8d87d8e96b13d695c1efe1bd24c69b06fa82b8d655aad89d206ae1bc5998b9f2d160bcd1b87f4d0af41806ed17de711b445811a159d165a37
AUX calibre-server-3.conf 541 BLAKE2B 06593633721e6adf2cf2077dffa83953eea46ccdcdc857ad468a9b74788326e9424f6ab9058be344dbbac8e49d343f5a1e53ddb486f2018b77319a7f8f713cf4 SHA512 12ef793a5b6ffd4413f780a13cad63927a95f15d17d85d4229eb5005ead68e51779abb822f9898ab5ae8c2094affeec1f9e85c34f109499739e6726b7641542a
AUX calibre-server-3.init 1796 BLAKE2B f87d785d6f6fc10fa648d40944ec8538027854bb872d9a3be6b5b35b0abf3cda1e4e93874a9422914da5eb4287f193459733956e3f1e25e61bec0c214c552c99 SHA512 88110ded1b9c6cf8d3bfc3d5889654f77578f9d299e88daea9023767b930082e00fbddbb92a6e43c46d900248f3684232d93396ec1d0e784c7ec14b44783f98a
AUX e9cc00560a28f56a303cca97630ab58e519dd9c8.patch 1335 BLAKE2B eb71cb5510d2259bbc7a4fe7b54652bb543aa3d26816654da7e22a6effb0c81770a91eccccecff5fe711d0495ff5b1ab378231e3cb10dd18f3faeb301acab1ba SHA512 211ea8c0fab1de5bd076eb965eda51ee1330a69e54251fc6a16e5aa0d6ef7721aea14a57a27eb75a99c8e37418aa15bd311e6f4d03f1f05d80cd87d2f00fb995
DIST calibre-5.44.0.tar.xz 41015696 BLAKE2B c7053e728da20fccfa981ed4f56e24a4d5b382b7687c92ecb039b078fd4828de0529380093e4ab33f77d78aa54a59758c1620cf8f918937a9a64f13decdf77ee SHA512 3d79e76d820cd1a41605dfd4c1d992599a6e4a759e57a8383d42d86982177e4539313f59e647758ab1896ce5874cb2a93c7678bf962e332c44171651aabf0230
DIST calibre-5.44.0.tar.xz.sig 566 BLAKE2B 413b95855d79bdb5b17ca5d760f834006797b4d3e413604f27d351a3392e16d647e772dc063306bf973e1156c34f68cb38152a66164bca849ebed5484e7f6065 SHA512 59957bf35a73f218241bf76cc86994d5af87cea11d3b0800e83f157bf0b2cfcaf4b6c1314562e74a1141d0c167fdb1619cb9a90e93b67f55dd55ceed77045059
DIST calibre-7.16.0.tar.xz 44833684 BLAKE2B 2b609a0d014d43998f693a69c10f6d8b0165bf97f8c9d388cf4e1e398e7254b300d53b26e5ec24af651e03bb625bb088331dc77aa2ed6edea13de2beb0e75339 SHA512 5ea11badd972422299ce143e2aa33f58f7abcfd2837acba47d2a7aa6f0997a711245273205ed043c783e5e82bbaaf7cab44e5c03c00e274a03a4ba29be53a708
DIST calibre-7.16.0.tar.xz.sig 566 BLAKE2B 1d09e8dd49ad53c88632dc23573fa9cd5403d45a308598ac4ed7d4f2dd5a84cc3ae6812ac652ff4a98fc5d67589ad1584411f7746b6b98468bf03a35a0585de6 SHA512 91f3897d95d234a8d673006273974d32cb6c5aa4953d247700d6d89d511c9b1450dc8e222eabf5d1e4d82de206e425ee440defaff38d1ca83efdbf4bcada7c7c
DIST calibre-7.17.0.tar.xz 45053400 BLAKE2B 93149c4fab7a25e1239c4b8c72b766e5ffc71eb27d1206225bc8436f26d2c76f9323e0f0f63d8444291f02a5a7e94d4500715398a71df4ab2a5b16e325e7be73 SHA512 916337dc425916110528828bac0fbdc24db9496362c1e8dad67eafdfda42b90174fb6a4352400cd34af0f11268aabed82b166b3e4875f59e317359079e10bf3b
DIST calibre-7.17.0.tar.xz.sig 566 BLAKE2B c041904919ef300f51ba7363daf7d2bc70fc8bb819ffef157e53c28f91b9716be56b1e95465180ecd67069241a5810b70ac08027f4837426a5426792fab05e49 SHA512 af88bcbf394ac6ec68c40d661545a17e956b31dd7797d1cc8490e090437206902a64c7a642cf1e34184e379c79066843959e1459eb1836bddbd615febbc85c07
DIST calibre-7.19.0.tar.xz 45057708 BLAKE2B 888ddf4292b8c8931c811eb78d6e9b003139545947f2b7bf63fcd96d96caa050a0f93a30ed0313ccf9b4ebfb25c2df1be7f2806d5117a870d1ac34ad29669e39 SHA512 b1225d6d403a8c4dca321c108d270aa79cf65a450f7db90a4e4df5525e8c1c6eb06b4a2492de7b691f6a1a85ce09361dc3796311c46fa082d6e82829827022a7
DIST calibre-7.19.0.tar.xz.sig 566 BLAKE2B 35a9f8987f0dfad0a14843f3db61f8b3442692dafdf9d253ed13c2071b7e8d9d4cec8012dad4b59b30013fdda790967cf42594a29c6a9a2a668bccda72ac2e72 SHA512 836a0138ed46b179fefe78bc678f6f8146fe5d8a1eb9111f02bcc804d96253281c918cc4ad7a3a860a3177babac9c6fd4b2e417361e59b7245d19bfa50f3f739
DIST calibre-7.20.0.tar.xz 44795188 BLAKE2B 2ccb7fcd5acdf9f627d79f5656709a7eddee7545dd2c8a95bbb7d2dc61fb26dcf8c34c3c2d6b1514fdbb6b4d7c3fd3e98be72c778026c7b2bb4a42651c5e664b SHA512 3b6e2d4ed8d0755096b466f4bdcc8b6ca4810398caa2322c1efc30280680ff8b10dc5fb8cb763bed8fee82746e7c51c6f31f56e5d9689d5f43c671442004c532
DIST calibre-7.20.0.tar.xz.sig 566 BLAKE2B 4d89a7781eb1500969ca75ddf01890bbfea6ecfde4e7173f062be6546e898f68a16e0ff7a3d76e5e17dc0abca617d381de24e18e72f4f05b5965b051f28e6cab SHA512 62dc9964c3a30477e22f832148fdaa57860559e2aaddccff107b37c399854ac3ca84097cd7072c2ee4e57403c7ed17286469f31f6efc3d790f63f438d9c78c79
DIST calibre-7.21.0.tar.xz 44802864 BLAKE2B f86ce0f310ac5b38f3aa54ca6436ad9c22c465e5608089c0178fcc5ed87d988ffae50d6b760ae4281ce68315998a5e1c426f243b58bfae86a78e5479d824070d SHA512 0c2ee610833df83219c0c33b09e1374a8262f1630ccd48e3c4725c92922a3ac5d102ad83fc213457fb9de3efa4f5a2c98ff6dff039828e1661085a1054d7f631
DIST calibre-7.21.0.tar.xz.sig 566 BLAKE2B 6410767553809878644ccae960b756b3b0571309bf4cbb61b9282586442243d41d1b2da578f97fbf7fbac573c7e9f84bc293e6b38e921850bce44bc7c87d74c8 SHA512 444492b958a01105cb60e8653f8b0e3c5c27a42876527b642f176a375459d3a5664b601aa8fa64c3d39ae486200cd456cd8691a055f7f7530225df106b1bd074
DIST calibre-7.22.0.tar.xz 42428392 BLAKE2B e9b7e0dc6e92340ff76d99f44f8265a572d05afadb6b5b06312a6dfbc6b0540d49647686a3fbb367da67a31d680ec8982a46d7baeb2c8371b4eeea1f0eb6c1f8 SHA512 583a1e2bcdd05c350e57cb205fc95eb076210ea5c9156f95a08c63e27f418ecb735c0a68212514edaa05af61e780cf8377a1e1b76a89729ee13b4d5ed34359c7
DIST calibre-7.22.0.tar.xz.sig 566 BLAKE2B d818c347043efcd8b01f68efdfdae43bf0315d45a7d8c52e8920972b8fa718b9551edb388a0531eb1781c8a959b31a16bb6f1dec517d3415b0a596d50c4d368e SHA512 9e72f286f01bf3ca76d702f0a8415635d5a352e06765f14a50fae828bea3f5c710200eb857075972e1bcfd176c05983421d899a13ef5aa9c3aa7e996bce80e5e
EBUILD calibre-5.44.0-r5.ebuild 8984 BLAKE2B b5f9a34dadb013f347366ccbe2cc36168b85caf4a466188665d949d6116406664ba533290395046148d24104140aaa94b6caf5027444293c9fe17de43a27b4ca SHA512 43381007298d2f41cad354cd608e6f3b04192bb055836d9175d8c9204832f26d54297b0da0ddea4e6139ae058fb49ff761932978992928885b8197f193749804
EBUILD calibre-7.16.0.ebuild 7987 BLAKE2B 61535b4bea3c99a8ac5cbe3b6738c91c3bdd0d30780a904102fc1b21799b835e922c034045bbfcf234f3a99890c0fa0203274ccefbdf570254dc946c65ea503b SHA512 090609b21ec694a22a89f27a516e10d5772bc5377c87e0fe2ff0b751c01d2a0cf9c4fa0512541a77e49483cbf7722a83e264b3bb0b45f3ee6f8d73e2b8f7054e
EBUILD calibre-7.17.0.ebuild 8155 BLAKE2B e8045cf5f3e6557b0027ba84ce2c4e2558a1dd67f6007eee794ac2571c5277ed45b6c45b183d0144fe58c297af405637cb95c54ebdcfaaa96e6a9c117e7c3533 SHA512 07ba8a2a98a960111dec197e415b8ffcd9697a6d7e2278c7b417d6e89864713d7f0b1e7a015b23958f08db8fb5965e1c7502fc79508872c24b979d4b053eae38
EBUILD calibre-7.19.0.ebuild 8374 BLAKE2B 80659908ab33bf598b3f3706c0c6b57cf477af6953e14f038544920862839864dc3dccc53f029e1fd45a62cc4d9f40719f1306ed44a474c6c8912977616639a6 SHA512 9a469b83c5c36b42e8d3e589a9a56cc7cf7be74bbf2e30f7d0987386de80882c8e8a538d7d873bf175f3bf5eacaf9fef09c93ddffa5e46b5d08aaebcf7d50566
EBUILD calibre-7.20.0.ebuild 8400 BLAKE2B a36548f91272362a57c6286342855044cb39f7712ddfa9e55a3c72627ababc4eacdca6008741e63df056eb2ca7e5df0f59c22830ab988fcc3a8b683eb232ef79 SHA512 28a5034d892e24d61ffb0e40e0d996ce0a4dbb0faded49240d42803d920917457471efd86dd5706f64ab1075d917432daa9c482da0c3d302dcb78c41487d52a5
EBUILD calibre-7.21.0.ebuild 8305 BLAKE2B cf08c0f9a5d1046632aa77f7d6e0ce2cb24551e716fe6f4c7614f508c8331841a574337b2678b0b79396f15d02df629247c7da16a90c0e925fb56d3567394230 SHA512 ec7852d1b70a18df376d10ea2d93b1147a3da58f3c635ecd6ac23c90c9f53f79b6da7a71d533334e62fc8b6f5aae6babfbbf8aaa3cc4fdb947516f999f7eda3c
EBUILD calibre-7.22.0.ebuild 8337 BLAKE2B 93f2ebb81f4b2a0c15921b72b33bd13bdbef9f474b3def869a1f90862acab431edc37d25ab37a64c41763f2bf9503ab575c06fe980826950be6f23a04bc0cbe7 SHA512 27a8ed9283914061c446a519c8e88e29c4dde9c91e45f9f9385b74b6f635f1579d6345e28a8606fc238d65549d18176ab8f780b970731b2765f3901010732492
MISC metadata.xml 662 BLAKE2B 102f4f537d2127c42311951cd5ca73e41a0ab948d85a037ed24c876382ffe628070d96b7310a337ac8efac61b32fd225b840b20fbe3f51e4cbf48ce073e95e7c SHA512 9929c8d731dfa112cf4b2ca67ddb269360a4f2cd84d9c0c0df6adfa2efe04669e1a45d9d7011f1dffe9e7ebf185e348478c2a1afa2bf2351e69b4f7e7c14da32

View File

@@ -0,0 +1,265 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="sqlite,ssl"
inherit edo toolchain-funcs python-single-r1 qmake-utils verify-sig xdg
DESCRIPTION="Ebook management application"
HOMEPAGE="https://calibre-ebook.com/"
SRC_URI="
https://download.calibre-ebook.com/${PV}/${P}.tar.xz
verify-sig? ( https://calibre-ebook.com/signatures/${P}.tar.xz.sig )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kovidgoyal.gpg
LICENSE="
GPL-3+
GPL-3
GPL-2+
GPL-2
GPL-1+
LGPL-3+
LGPL-2.1+
LGPL-2.1
BSD
MIT
Old-MIT
Apache-2.0
public-domain
|| ( Artistic GPL-1+ )
CC-BY-3.0
OFL-1.1
PSF-2
"
SLOT="0"
KEYWORDS="amd64"
IUSE="ios speech +system-mathjax test +udisks unrar"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Qt slotted dependencies are used because the libheadless.so plugin links to
# QT_*_PRIVATE_ABI. It only uses core/gui/dbus.
COMMON_DEPEND="${PYTHON_DEPS}
>=app-text/hunspell-1.7:=
>=app-text/podofo-0.9.6_pre20171027:=
<app-text/podofo-0.10:=
app-text/poppler[utils]
dev-libs/hyphen:=
>=dev-libs/icu-57.1:=
dev-libs/openssl:=
dev-libs/snowball-stemmer:=
$(python_gen_cond_dep '
>=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
dev-python/faust-cchardet[${PYTHON_USEDEP}]
>=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
dev-python/dnspython[${PYTHON_USEDEP}]
>=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
>=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
>=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
dev-python/jeepney[${PYTHON_USEDEP}]
>=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
dev-python/lxml-html-clean[${PYTHON_USEDEP}]
>=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
>=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
>=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
>=dev-python/pillow-3.2.0[jpeg,truetype,webp,zlib,${PYTHON_USEDEP}]
>=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
>=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
>=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
>=dev-python/pyqt5-5.15.5_pre2107091435[gui,widgets,network,printsupport,svg,${PYTHON_USEDEP}]
>=dev-python/pyqtwebengine-5.15.5_pre2108100905[${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/zeroconf[${PYTHON_USEDEP}]
')
dev-qt/qtimageformats:5
dev-qt/qtcore:5=
dev-qt/qtdbus:5=
dev-qt/qtgui:5=[jpeg,png]
dev-qt/qtwidgets:5
dev-util/desktop-file-utils
dev-util/gtk-update-icon-cache
media-fonts/liberation-fonts
media-libs/fontconfig:=
>=media-libs/freetype-2:=
>=media-libs/libmtp-1.1.11:=
>=media-gfx/optipng-0.7.6
virtual/libusb:1=
x11-misc/shared-mime-info
>=x11-misc/xdg-utils-1.0.2-r2
ios? (
>=app-pda/usbmuxd-1.0.8
>=app-pda/libimobiledevice-1.2.0
)
speech? ( $(python_gen_cond_dep 'app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]') )
system-mathjax? ( >=dev-libs/mathjax-3:= )
udisks? ( virtual/libudev )
unrar? ( dev-python/unrardll )
"
RDEPEND="${COMMON_DEPEND}
udisks? ( sys-fs/udisks:2 )"
DEPEND="${COMMON_DEPEND}
test? ( $(python_gen_cond_dep '>=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]') )
"
BDEPEND="$(python_gen_cond_dep '
>=dev-python/pyqt-builder-1.10.3[${PYTHON_USEDEP}]
>=dev-python/sip-5[${PYTHON_USEDEP}]
')
>=virtual/podofo-build-0.9.6_pre20171027
<virtual/podofo-build-0.10
virtual/pkgconfig
system-mathjax? ( dev-lang/rapydscript-ng )
verify-sig? ( sec-keys/openpgp-keys-kovidgoyal )
"
PATCHES=(
# Skip calling a binary (JxrDecApp) from libjxr which is used for tests
# We don't (yet?) package libjxr and it seems to be dead upstream
# (last commit in 2017)
"${FILESDIR}/${PN}-5.35.0-jxr-test.patch"
# fix compatibility with recent versions of zeroconf
"${FILESDIR}"/${PN}-5.44.0-Fix-compatibility-with-zeroconf-0.73.patch
# 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
# Security backport for CVE-2024-7008
"${FILESDIR}"/${P}-xss-backport.patch
)
src_prepare() {
default
# Warning:
#
# While it might be rather tempting to add yet another sed here,
# please don't. There have been several bugs in Gentoo's packaging
# of calibre from seds-which-become-stale. Please consider
# creating a patch instead, but in any case, run the test suite
# and ensure it passes.
#
# If in doubt about a problem, checking Fedora's packaging is recommended.
# Disable unnecessary privilege dropping for bug #287067.
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
-i setup/install.py || die "sed failed to patch install.py"
sed -e "/^ os.chdir(os.path.join(src_dir, 'build'))$/a\
\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ self.check_call(['sed', \
'-e', 's|^CFLAGS .*|\\\\\\\\0 ${CFLAGS}|', \
'-e', 's|^CXXFLAGS .*|\\\\\\\\0 ${CXXFLAGS}|', \
'-e', 's|^LFLAGS .*|\\\\\\\\0 ${LDFLAGS}|', \
'-i', os.path.join(os.path.basename(src_dir), 'Makefile')])" \
-e "s|open(self.j(bdir, '.qmake.conf'), 'wb').close()|open(self.j(bdir, '.qmake.conf'), 'wb').write(b'QMAKE_LFLAGS += ${LDFLAGS}')|" \
-i setup/build.py || die "sed failed to patch build.py"
# This is only ever used at build time. It contains a small embedded copy
# of the rapydscript-ng compiler usable inside of qtwebengine, if you don't
# have rapydscript-ng (a nodejs package) itself installed. Its only purpose
# is to build some resources that come bundled in dist tarballs already...
# and which we may also need to regenerate e.g. to use system-mathjax.
#
# However, running qtwebengine violates the portage sandbox (among other
# things, it tries to create directories in /usr! amazing) so this is a
# wash anyway. The only real solution here is to package rapydscript-ng.
#
# We do not need it at build time, and *no one* needs it at install time.
# Delete the cruft.
rm -r resources/rapydscript/ || die
}
src_compile() {
# TODO: get qmake called by setup.py to respect CC and CXX too
tc-export CC CXX
# bug 821871
local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
export QMAKE="$(qt5_get_bindir)/qmake"
edo ${EPYTHON} setup.py build
edo ${EPYTHON} setup.py gui
# A few different resources are bundled in the distfile by default, because
# not all systems necessarily have them. We un-vendor them, using the
# upstream integrated approach if possible. See setup/revendor.py and
# consider migrating other resources to this if they do not use it, in
# *preference* over manual rm'ing.
edo ${EPYTHON} setup.py liberation_fonts \
--path-to-liberation_fonts "${EPREFIX}"/usr/share/fonts/liberation-fonts \
--system-liberation_fonts
if use system-mathjax; then
edo ${EPYTHON} setup.py mathjax --path-to-mathjax "${EPREFIX}"/usr/share/mathjax --system-mathjax
edo ${EPYTHON} setup.py rapydscript
fi
}
src_test() {
# Skipped tests:
local _test_excludes=(
# unpackaged Python dependency: py7zr
7z
# tests if a completely unused module is bundled
pycryptodome
$(usev !speech speech_dispatcher)
$(usev !unrar test_unrar)
# undocumented reasons
test_mem_leaks
test_searching
)
edo ${PYTHON} setup.py test "${_test_excludes[@]/#/--exclude-test-name=}"
}
src_install() {
# Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
# File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
# return _parse_localename(localename)
# File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
# raise ValueError, 'unknown locale: %s' % localename
#ValueError: unknown locale: 46
export -n LANG LANGUAGE ${!LC_*}
export LC_ALL=C.utf8 # bug #709682
# Bug #295672 - Avoid sandbox violation in ~/.config by forcing
# variables to point to our fake temporary $HOME.
export HOME="${T}/fake_homedir"
export CALIBRE_CONFIG_DIRECTORY="${HOME}/.config/calibre"
mkdir -p "${CALIBRE_CONFIG_DIRECTORY}" || die
addpredict /dev/dri #665310
# If this directory doesn't exist, zsh completion won't install
dodir /usr/share/zsh/site-functions
edo "${PYTHON}" setup.py install \
--staging-root="${ED}/usr" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
--staging-libdir="${ED}/usr/$(get_libdir)" \
--system-plugins-location="${EPREFIX}/usr/share/calibre/system-plugins"
cp -r man-pages/ "${ED}"/usr/share/man || die
find "${ED}"/usr/share -type d -empty -delete || die
python_fix_shebang "${ED}/usr/bin"
python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
}

View File

@@ -0,0 +1,243 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="sqlite,ssl"
inherit edo toolchain-funcs python-single-r1 qmake-utils verify-sig xdg
DESCRIPTION="Ebook management application"
HOMEPAGE="https://calibre-ebook.com/"
SRC_URI="
https://download.calibre-ebook.com/${PV}/${P}.tar.xz
verify-sig? ( https://calibre-ebook.com/signatures/${P}.tar.xz.sig )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kovidgoyal.gpg
LICENSE="
GPL-3+
GPL-3
GPL-2+
GPL-2
GPL-1+
LGPL-3+
LGPL-2.1+
LGPL-2.1
BSD
MIT
Old-MIT
Apache-2.0
public-domain
|| ( Artistic GPL-1+ )
CC-BY-3.0
OFL-1.1
PSF-2
"
SLOT="0"
KEYWORDS="amd64 ~arm64"
IUSE="+font-subsetting ios speech +system-mathjax test +udisks unrar"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Qt slotted dependencies are used because the libheadless.so plugin links to
# QT_*_PRIVATE_ABI. It only uses core/gui/dbus.
COMMON_DEPEND="${PYTHON_DEPS}
app-i18n/uchardet
>=app-text/hunspell-1.7:=
>=app-text/podofo-0.10.0:=
app-text/poppler[utils]
dev-libs/hyphen:=
>=dev-libs/icu-57.1:=
dev-libs/openssl:=
dev-libs/snowball-stemmer:=
$(python_gen_cond_dep '
>=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
>=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
dev-python/dnspython[${PYTHON_USEDEP}]
>=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
>=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
>=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
dev-python/jeepney[${PYTHON_USEDEP}]
>=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
dev-python/lxml-html-clean[${PYTHON_USEDEP}]
>=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
>=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
>=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
>=dev-python/pillow-3.2.0[jpeg,truetype,webp,zlib,${PYTHON_USEDEP}]
>=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
>=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
>=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
dev-python/pyqt6[gui,network,opengl,printsupport,quick,svg,widgets,${PYTHON_USEDEP}]
dev-python/pyqt6-webengine[widgets,${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/xxhash[${PYTHON_USEDEP}]
>=dev-python/zeroconf-0.75.0[${PYTHON_USEDEP}]
')
dev-qt/qtbase:6=[gui,widgets]
dev-qt/qtimageformats:6
dev-util/desktop-file-utils
dev-util/gtk-update-icon-cache
media-fonts/liberation-fonts
media-libs/fontconfig:=
>=media-libs/freetype-2:=
>=media-libs/libmtp-1.1.11:=
>=media-gfx/optipng-0.7.6
virtual/libusb:1=
x11-misc/shared-mime-info
>=x11-misc/xdg-utils-1.0.2-r2
font-subsetting? ( $(python_gen_cond_dep 'dev-python/fonttools[${PYTHON_USEDEP}]') )
ios? (
>=app-pda/usbmuxd-1.0.8
>=app-pda/libimobiledevice-1.2.0
)
speech? ( $(python_gen_cond_dep 'app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]') )
system-mathjax? ( >=dev-libs/mathjax-3:= )
udisks? ( virtual/libudev )
unrar? ( dev-python/unrardll )
"
RDEPEND="${COMMON_DEPEND}
udisks? ( sys-fs/udisks:2 )"
DEPEND="${COMMON_DEPEND}
test? ( $(python_gen_cond_dep '>=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]') )
"
BDEPEND="$(python_gen_cond_dep '
>=dev-python/pyqt-builder-1.10.3[${PYTHON_USEDEP}]
>=dev-python/sip-5[${PYTHON_USEDEP}]
')
virtual/pkgconfig
system-mathjax? ( dev-lang/rapydscript-ng )
verify-sig? ( sec-keys/openpgp-keys-kovidgoyal )
"
PATCHES=(
# Skip calling a binary (JxrDecApp) from libjxr which is used for tests
# We don't (yet?) package libjxr and it seems to be dead upstream
# (last commit in 2017)
"${FILESDIR}/${PN}-7.0.0-jxr-test.patch"
)
src_prepare() {
default
# Warning:
#
# While it might be rather tempting to add yet another sed here,
# please don't. There have been several bugs in Gentoo's packaging
# of calibre from seds-which-become-stale. Please consider
# creating a patch instead, but in any case, run the test suite
# and ensure it passes.
#
# If in doubt about a problem, checking Fedora's packaging is recommended.
# Disable unnecessary privilege dropping for bug #287067.
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
-i setup/install.py || die "sed failed to patch install.py"
# This is only ever used at build time. It contains a small embedded copy
# of the rapydscript-ng compiler usable inside of qtwebengine, if you don't
# have rapydscript-ng (a nodejs package) itself installed. Its only purpose
# is to build some resources that come bundled in dist tarballs already...
# and which we may also need to regenerate e.g. to use system-mathjax.
#
# However, running qtwebengine violates the portage sandbox (among other
# things, it tries to create directories in /usr! amazing) so this is a
# wash anyway. The only real solution here is to package rapydscript-ng.
#
# We do not need it at build time, and *no one* needs it at install time.
# Delete the cruft.
rm -r resources/rapydscript/ || die
}
src_compile() {
# TODO: get qmake called by setup.py to respect CC and CXX too
tc-export CC CXX
# bug 821871
local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
export QMAKE="$(qt6_get_bindir)/qmake"
edo ${EPYTHON} setup.py build
edo ${EPYTHON} setup.py gui
# A few different resources are bundled in the distfile by default, because
# not all systems necessarily have them. We un-vendor them, using the
# upstream integrated approach if possible. See setup/revendor.py and
# consider migrating other resources to this if they do not use it, in
# *preference* over manual rm'ing.
edo ${EPYTHON} setup.py liberation_fonts \
--path-to-liberation_fonts "${EPREFIX}"/usr/share/fonts/liberation-fonts \
--system-liberation_fonts
if use system-mathjax; then
edo ${EPYTHON} setup.py mathjax --path-to-mathjax "${EPREFIX}"/usr/share/mathjax --system-mathjax
edo ${EPYTHON} setup.py rapydscript
fi
}
src_test() {
# Skipped tests:
local _test_excludes=(
# unpackaged Python dependency: py7zr
7z
# unpackaged Python dependency: pyzstd
test_zstd
# tests if a completely unused module is bundled
pycryptodome
$(usev !speech speech_dispatcher)
$(usev !unrar test_unrar)
# undocumented reasons
test_mem_leaks
test_searching
)
edo ${PYTHON} setup.py test "${_test_excludes[@]/#/--exclude-test-name=}"
}
src_install() {
# Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
# File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
# return _parse_localename(localename)
# File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
# raise ValueError, 'unknown locale: %s' % localename
#ValueError: unknown locale: 46
export -n LANG LANGUAGE ${!LC_*}
export LC_ALL=C.utf8 # bug #709682
# Bug #295672 - Avoid sandbox violation in ~/.config by forcing
# variables to point to our fake temporary $HOME.
export HOME="${T}/fake_homedir"
export CALIBRE_CONFIG_DIRECTORY="${HOME}/.config/calibre"
mkdir -p "${CALIBRE_CONFIG_DIRECTORY}" || die
addpredict /dev/dri #665310
# If this directory doesn't exist, zsh completion won't install
dodir /usr/share/zsh/site-functions
edo "${PYTHON}" setup.py install \
--staging-root="${ED}/usr" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
--staging-libdir="${ED}/usr/$(get_libdir)" \
--system-plugins-location="${EPREFIX}/usr/share/calibre/system-plugins"
cp -r man-pages/ "${ED}"/usr/share/man || die
find "${ED}"/usr/share -type d -empty -delete || die
python_fix_shebang "${ED}/usr/bin"
python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
}

View File

@@ -0,0 +1,246 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="sqlite,ssl"
inherit edo toolchain-funcs python-single-r1 qmake-utils verify-sig xdg
DESCRIPTION="Ebook management application"
HOMEPAGE="https://calibre-ebook.com/"
SRC_URI="
https://download.calibre-ebook.com/${PV}/${P}.tar.xz
verify-sig? ( https://calibre-ebook.com/signatures/${P}.tar.xz.sig )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kovidgoyal.gpg
LICENSE="
GPL-3+
GPL-3
GPL-2+
GPL-2
GPL-1+
LGPL-3+
LGPL-2.1+
LGPL-2.1
BSD
MIT
Old-MIT
Apache-2.0
public-domain
|| ( Artistic GPL-1+ )
CC-BY-3.0
OFL-1.1
PSF-2
"
SLOT="0"
KEYWORDS="amd64 ~arm64"
IUSE="+font-subsetting ios speech +system-mathjax test +udisks unrar"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Qt slotted dependencies are used because the libheadless.so plugin links to
# QT_*_PRIVATE_ABI. It only uses core/gui/dbus.
COMMON_DEPEND="${PYTHON_DEPS}
app-i18n/uchardet
>=app-text/hunspell-1.7:=
>=app-text/podofo-0.10.0:=
app-text/poppler[utils]
dev-libs/hyphen:=
>=dev-libs/icu-57.1:=
dev-libs/openssl:=
dev-libs/snowball-stemmer:=
$(python_gen_cond_dep '
>=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
>=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
dev-python/dnspython[${PYTHON_USEDEP}]
>=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
>=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
>=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
dev-python/jeepney[${PYTHON_USEDEP}]
>=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
dev-python/lxml-html-clean[${PYTHON_USEDEP}]
>=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
>=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
>=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
>=dev-python/pillow-3.2.0[jpeg,truetype,webp,zlib,${PYTHON_USEDEP}]
>=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
>=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
>=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
dev-python/pyqt6[gui,network,opengl,printsupport,quick,svg,widgets,${PYTHON_USEDEP}]
dev-python/pyqt6-webengine[widgets,${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/xxhash[${PYTHON_USEDEP}]
>=dev-python/zeroconf-0.75.0[${PYTHON_USEDEP}]
')
dev-qt/qtbase:6=[gui,widgets]
dev-qt/qtimageformats:6
dev-util/desktop-file-utils
dev-util/gtk-update-icon-cache
media-fonts/liberation-fonts
media-libs/fontconfig:=
>=media-libs/freetype-2:=
>=media-libs/libmtp-1.1.11:=
>=media-gfx/optipng-0.7.6
virtual/libusb:1=
x11-misc/shared-mime-info
>=x11-misc/xdg-utils-1.0.2-r2
font-subsetting? ( $(python_gen_cond_dep 'dev-python/fonttools[${PYTHON_USEDEP}]') )
ios? (
>=app-pda/usbmuxd-1.0.8
>=app-pda/libimobiledevice-1.2.0
)
speech? ( $(python_gen_cond_dep 'app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]') )
system-mathjax? ( >=dev-libs/mathjax-3:= )
udisks? ( virtual/libudev )
unrar? ( dev-python/unrardll )
"
RDEPEND="${COMMON_DEPEND}
udisks? ( sys-fs/udisks:2 )"
DEPEND="${COMMON_DEPEND}
test? ( $(python_gen_cond_dep '>=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]') )
"
BDEPEND="$(python_gen_cond_dep '
>=dev-python/pyqt-builder-1.10.3[${PYTHON_USEDEP}]
>=dev-python/sip-5[${PYTHON_USEDEP}]
')
virtual/pkgconfig
system-mathjax? ( dev-lang/rapydscript-ng )
verify-sig? ( sec-keys/openpgp-keys-kovidgoyal )
"
PATCHES=(
# Skip calling a binary (JxrDecApp) from libjxr which is used for tests
# We don't (yet?) package libjxr and it seems to be dead upstream
# (last commit in 2017)
"${FILESDIR}/${PN}-7.0.0-jxr-test.patch"
# Don't test availability of PyQt6 tts module, which is not yet used.
# Recheck this with future version bumps...
"${FILESDIR}"/calibre-7.17.0-qt-texttospeech.patch
)
src_prepare() {
default
# Warning:
#
# While it might be rather tempting to add yet another sed here,
# please don't. There have been several bugs in Gentoo's packaging
# of calibre from seds-which-become-stale. Please consider
# creating a patch instead, but in any case, run the test suite
# and ensure it passes.
#
# If in doubt about a problem, checking Fedora's packaging is recommended.
# Disable unnecessary privilege dropping for bug #287067.
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
-i setup/install.py || die "sed failed to patch install.py"
# This is only ever used at build time. It contains a small embedded copy
# of the rapydscript-ng compiler usable inside of qtwebengine, if you don't
# have rapydscript-ng (a nodejs package) itself installed. Its only purpose
# is to build some resources that come bundled in dist tarballs already...
# and which we may also need to regenerate e.g. to use system-mathjax.
#
# However, running qtwebengine violates the portage sandbox (among other
# things, it tries to create directories in /usr! amazing) so this is a
# wash anyway. The only real solution here is to package rapydscript-ng.
#
# We do not need it at build time, and *no one* needs it at install time.
# Delete the cruft.
rm -r resources/rapydscript/ || die
}
src_compile() {
# TODO: get qmake called by setup.py to respect CC and CXX too
tc-export CC CXX
# bug 821871
local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
export QMAKE="$(qt6_get_bindir)/qmake"
edo ${EPYTHON} setup.py build
edo ${EPYTHON} setup.py gui
# A few different resources are bundled in the distfile by default, because
# not all systems necessarily have them. We un-vendor them, using the
# upstream integrated approach if possible. See setup/revendor.py and
# consider migrating other resources to this if they do not use it, in
# *preference* over manual rm'ing.
edo ${EPYTHON} setup.py liberation_fonts \
--path-to-liberation_fonts "${EPREFIX}"/usr/share/fonts/liberation-fonts \
--system-liberation_fonts
if use system-mathjax; then
edo ${EPYTHON} setup.py mathjax --path-to-mathjax "${EPREFIX}"/usr/share/mathjax --system-mathjax
edo ${EPYTHON} setup.py rapydscript
fi
}
src_test() {
# Skipped tests:
local _test_excludes=(
# unpackaged Python dependency: py7zr
7z
# unpackaged Python dependency: pyzstd
test_zstd
# tests if a completely unused module is bundled
pycryptodome
$(usev !speech speech_dispatcher)
$(usev !unrar test_unrar)
# undocumented reasons
test_mem_leaks
test_searching
)
edo ${PYTHON} setup.py test "${_test_excludes[@]/#/--exclude-test-name=}"
}
src_install() {
# Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
# File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
# return _parse_localename(localename)
# File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
# raise ValueError, 'unknown locale: %s' % localename
#ValueError: unknown locale: 46
export -n LANG LANGUAGE ${!LC_*}
export LC_ALL=C.utf8 # bug #709682
# Bug #295672 - Avoid sandbox violation in ~/.config by forcing
# variables to point to our fake temporary $HOME.
export HOME="${T}/fake_homedir"
export CALIBRE_CONFIG_DIRECTORY="${HOME}/.config/calibre"
mkdir -p "${CALIBRE_CONFIG_DIRECTORY}" || die
addpredict /dev/dri #665310
# If this directory doesn't exist, zsh completion won't install
dodir /usr/share/zsh/site-functions
edo "${PYTHON}" setup.py install \
--staging-root="${ED}/usr" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
--staging-libdir="${ED}/usr/$(get_libdir)" \
--system-plugins-location="${EPREFIX}/usr/share/calibre/system-plugins"
cp -r man-pages/ "${ED}"/usr/share/man || die
find "${ED}"/usr/share -type d -empty -delete || die
python_fix_shebang "${ED}/usr/bin"
python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
}

View File

@@ -0,0 +1,254 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="sqlite,ssl"
inherit edo toolchain-funcs python-single-r1 qmake-utils verify-sig xdg
DESCRIPTION="Ebook management application"
HOMEPAGE="https://calibre-ebook.com/"
SRC_URI="
https://download.calibre-ebook.com/${PV}/${P}.tar.xz
verify-sig? ( https://calibre-ebook.com/signatures/${P}.tar.xz.sig )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kovidgoyal.gpg
LICENSE="
GPL-3+
GPL-3
GPL-2+
GPL-2
GPL-1+
LGPL-3+
LGPL-2.1+
LGPL-2.1
BSD
MIT
Old-MIT
Apache-2.0
public-domain
|| ( Artistic GPL-1+ )
CC-BY-3.0
OFL-1.1
PSF-2
"
SLOT="0"
KEYWORDS="amd64 ~arm64"
IUSE="+font-subsetting ios speech +system-mathjax test +udisks unrar"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Qt slotted dependencies are used because the libheadless.so plugin links to
# QT_*_PRIVATE_ABI. It only uses core/gui/dbus.
COMMON_DEPEND="${PYTHON_DEPS}
app-i18n/uchardet
>=app-text/hunspell-1.7:=
>=app-text/podofo-0.10.0:=
app-text/poppler[utils]
dev-libs/hyphen:=
>=dev-libs/icu-57.1:=
dev-libs/openssl:=
dev-libs/snowball-stemmer:=
$(python_gen_cond_dep '
>=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
>=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
dev-python/dnspython[${PYTHON_USEDEP}]
>=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
>=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
>=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
dev-python/jeepney[${PYTHON_USEDEP}]
>=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
dev-python/lxml-html-clean[${PYTHON_USEDEP}]
>=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
>=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
>=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
>=dev-python/pillow-3.2.0[jpeg,truetype,webp,zlib,${PYTHON_USEDEP}]
>=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
>=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
>=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
dev-python/pyqt6[gui,network,opengl,printsupport,quick,svg,widgets,${PYTHON_USEDEP}]
dev-python/pyqt6-webengine[widgets,${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/xxhash[${PYTHON_USEDEP}]
>=dev-python/zeroconf-0.75.0[${PYTHON_USEDEP}]
')
dev-qt/qtbase:6=[gui,widgets]
dev-qt/qtimageformats:6
dev-util/desktop-file-utils
dev-util/gtk-update-icon-cache
media-fonts/liberation-fonts
media-libs/fontconfig:=
>=media-libs/freetype-2:=
>=media-libs/libmtp-1.1.11:=
>=media-gfx/optipng-0.7.6
virtual/libusb:1=
x11-misc/shared-mime-info
>=x11-misc/xdg-utils-1.0.2-r2
font-subsetting? ( $(python_gen_cond_dep 'dev-python/fonttools[${PYTHON_USEDEP}]') )
ios? (
>=app-pda/usbmuxd-1.0.8
>=app-pda/libimobiledevice-1.2.0
)
speech? (
$(python_gen_cond_dep 'app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]')
dev-python/pyqt6[multimedia,speech]
)
system-mathjax? ( >=dev-libs/mathjax-3:= )
udisks? ( virtual/libudev )
unrar? ( dev-python/unrardll )
"
RDEPEND="${COMMON_DEPEND}
udisks? ( sys-fs/udisks:2 )"
DEPEND="${COMMON_DEPEND}
test? ( $(python_gen_cond_dep '>=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]') )
"
BDEPEND="$(python_gen_cond_dep '
>=dev-python/pyqt-builder-1.10.3[${PYTHON_USEDEP}]
>=dev-python/sip-5[${PYTHON_USEDEP}]
')
virtual/pkgconfig
system-mathjax? ( dev-lang/rapydscript-ng )
verify-sig? ( sec-keys/openpgp-keys-kovidgoyal )
"
PATCHES=(
# Skip calling a binary (JxrDecApp) from libjxr which is used for tests
# We don't (yet?) package libjxr and it seems to be dead upstream
# (last commit in 2017)
"${FILESDIR}/${PN}-7.0.0-jxr-test.patch"
# fix tests with pillow 11
"${FILESDIR}"/0001-PIL-11.0-changes-its-webp-features-output.patch
)
src_prepare() {
default
# Warning:
#
# While it might be rather tempting to add yet another sed here,
# please don't. There have been several bugs in Gentoo's packaging
# of calibre from seds-which-become-stale. Please consider
# creating a patch instead, but in any case, run the test suite
# and ensure it passes.
#
# If in doubt about a problem, checking Fedora's packaging is recommended.
# Disable unnecessary privilege dropping for bug #287067.
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
-i setup/install.py || die "sed failed to patch install.py"
# This is only ever used at build time. It contains a small embedded copy
# of the rapydscript-ng compiler usable inside of qtwebengine, if you don't
# have rapydscript-ng (a nodejs package) itself installed. Its only purpose
# is to build some resources that come bundled in dist tarballs already...
# and which we may also need to regenerate e.g. to use system-mathjax.
#
# However, running qtwebengine violates the portage sandbox (among other
# things, it tries to create directories in /usr! amazing) so this is a
# wash anyway. The only real solution here is to package rapydscript-ng.
#
# We do not need it at build time, and *no one* needs it at install time.
# Delete the cruft.
rm -r resources/rapydscript/ || die
}
src_compile() {
# TODO: get qmake called by setup.py to respect CC and CXX too
tc-export CC CXX
# bug 821871
local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
export QMAKE="$(qt6_get_bindir)/qmake"
edo ${EPYTHON} setup.py build
edo ${EPYTHON} setup.py gui
# A few different resources are bundled in the distfile by default, because
# not all systems necessarily have them. We un-vendor them, using the
# upstream integrated approach if possible. See setup/revendor.py and
# consider migrating other resources to this if they do not use it, in
# *preference* over manual rm'ing.
edo ${EPYTHON} setup.py liberation_fonts \
--path-to-liberation_fonts "${EPREFIX}"/usr/share/fonts/liberation-fonts \
--system-liberation_fonts
if use system-mathjax; then
edo ${EPYTHON} setup.py mathjax --path-to-mathjax "${EPREFIX}"/usr/share/mathjax --system-mathjax
edo ${EPYTHON} setup.py rapydscript
fi
}
src_test() {
# Skipped tests:
local _test_excludes=(
# unpackaged Python dependency: py7zr
7z
# unpackaged Python dependency: pyzstd
test_zstd
# unpackaged TTS backend (optional at runtime): https://github.com/rhasspy/piper
piper
# tests if a completely unused module is bundled
pycryptodome
$(usev !speech speech_dispatcher)
$(usev !unrar test_unrar)
# undocumented reasons
test_mem_leaks
test_searching
)
# Some of these tests weren't practical to split out into distinct tests, so
# have a different control mechanism
use speech || export SKIP_SPEECH_TESTS=1
edo ${PYTHON} setup.py test "${_test_excludes[@]/#/--exclude-test-name=}"
}
src_install() {
# Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
# File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
# return _parse_localename(localename)
# File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
# raise ValueError, 'unknown locale: %s' % localename
#ValueError: unknown locale: 46
export -n LANG LANGUAGE ${!LC_*}
export LC_ALL=C.utf8 # bug #709682
# Bug #295672 - Avoid sandbox violation in ~/.config by forcing
# variables to point to our fake temporary $HOME.
export HOME="${T}/fake_homedir"
export CALIBRE_CONFIG_DIRECTORY="${HOME}/.config/calibre"
mkdir -p "${CALIBRE_CONFIG_DIRECTORY}" || die
addpredict /dev/dri #665310
# If this directory doesn't exist, zsh completion won't install
dodir /usr/share/zsh/site-functions
edo "${PYTHON}" setup.py install \
--staging-root="${ED}/usr" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
--staging-libdir="${ED}/usr/$(get_libdir)" \
--system-plugins-location="${EPREFIX}/usr/share/calibre/system-plugins"
cp -r man-pages/ "${ED}"/usr/share/man || die
find "${ED}"/usr/share -type d -empty -delete || die
python_fix_shebang "${ED}/usr/bin"
python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
}

View File

@@ -0,0 +1,255 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="sqlite,ssl"
inherit edo toolchain-funcs python-single-r1 qmake-utils verify-sig xdg
DESCRIPTION="Ebook management application"
HOMEPAGE="https://calibre-ebook.com/"
SRC_URI="
https://download.calibre-ebook.com/${PV}/${P}.tar.xz
verify-sig? ( https://calibre-ebook.com/signatures/${P}.tar.xz.sig )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kovidgoyal.gpg
LICENSE="
GPL-3+
GPL-3
GPL-2+
GPL-2
GPL-1+
LGPL-3+
LGPL-2.1+
LGPL-2.1
BSD
MIT
Old-MIT
Apache-2.0
public-domain
|| ( Artistic GPL-1+ )
CC-BY-3.0
OFL-1.1
PSF-2
"
SLOT="0"
KEYWORDS="amd64 ~arm64"
IUSE="+font-subsetting ios speech +system-mathjax test +udisks unrar"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Qt slotted dependencies are used because the libheadless.so plugin links to
# QT_*_PRIVATE_ABI. It only uses core/gui/dbus.
COMMON_DEPEND="${PYTHON_DEPS}
app-i18n/uchardet
>=app-text/hunspell-1.7:=
>=app-text/podofo-0.10.0:=
app-text/poppler[utils]
dev-libs/hyphen:=
>=dev-libs/icu-57.1:=
dev-libs/openssl:=
dev-libs/snowball-stemmer:=
$(python_gen_cond_dep '
>=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
>=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
dev-python/dnspython[${PYTHON_USEDEP}]
>=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
>=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
>=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
dev-python/jeepney[${PYTHON_USEDEP}]
>=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
dev-python/lxml-html-clean[${PYTHON_USEDEP}]
>=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
>=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
>=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
>=dev-python/pillow-3.2.0[jpeg,truetype,webp,zlib,${PYTHON_USEDEP}]
>=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
>=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
>=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
dev-python/pyqt6[gui,network,opengl,printsupport,quick,svg,widgets,${PYTHON_USEDEP}]
dev-python/pyqt6-webengine[widgets,${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/xxhash[${PYTHON_USEDEP}]
>=dev-python/zeroconf-0.75.0[${PYTHON_USEDEP}]
')
dev-qt/qtbase:6=[gui,widgets]
dev-qt/qtimageformats:6
dev-util/desktop-file-utils
dev-util/gtk-update-icon-cache
media-fonts/liberation-fonts
media-libs/fontconfig:=
>=media-libs/freetype-2:=
>=media-libs/libmtp-1.1.11:=
>=media-gfx/optipng-0.7.6
>=media-video/ffmpeg-6:=
virtual/libusb:1=
x11-misc/shared-mime-info
>=x11-misc/xdg-utils-1.0.2-r2
font-subsetting? ( $(python_gen_cond_dep 'dev-python/fonttools[${PYTHON_USEDEP}]') )
ios? (
>=app-pda/usbmuxd-1.0.8
>=app-pda/libimobiledevice-1.2.0
)
speech? (
$(python_gen_cond_dep 'app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]')
dev-python/pyqt6[multimedia,speech]
)
system-mathjax? ( >=dev-libs/mathjax-3:= )
udisks? ( virtual/libudev )
unrar? ( dev-python/unrardll )
"
RDEPEND="${COMMON_DEPEND}
udisks? ( sys-fs/udisks:2 )"
DEPEND="${COMMON_DEPEND}
test? ( $(python_gen_cond_dep '>=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]') )
"
BDEPEND="$(python_gen_cond_dep '
>=dev-python/pyqt-builder-1.10.3[${PYTHON_USEDEP}]
>=dev-python/sip-5[${PYTHON_USEDEP}]
')
virtual/pkgconfig
system-mathjax? ( dev-lang/rapydscript-ng )
verify-sig? ( sec-keys/openpgp-keys-kovidgoyal )
"
PATCHES=(
# Skip calling a binary (JxrDecApp) from libjxr which is used for tests
# We don't (yet?) package libjxr and it seems to be dead upstream
# (last commit in 2017)
"${FILESDIR}/${PN}-7.0.0-jxr-test.patch"
# fix tests with pillow 11
"${FILESDIR}"/0001-PIL-11.0-changes-its-webp-features-output.patch
)
src_prepare() {
default
# Warning:
#
# While it might be rather tempting to add yet another sed here,
# please don't. There have been several bugs in Gentoo's packaging
# of calibre from seds-which-become-stale. Please consider
# creating a patch instead, but in any case, run the test suite
# and ensure it passes.
#
# If in doubt about a problem, checking Fedora's packaging is recommended.
# Disable unnecessary privilege dropping for bug #287067.
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
-i setup/install.py || die "sed failed to patch install.py"
# This is only ever used at build time. It contains a small embedded copy
# of the rapydscript-ng compiler usable inside of qtwebengine, if you don't
# have rapydscript-ng (a nodejs package) itself installed. Its only purpose
# is to build some resources that come bundled in dist tarballs already...
# and which we may also need to regenerate e.g. to use system-mathjax.
#
# However, running qtwebengine violates the portage sandbox (among other
# things, it tries to create directories in /usr! amazing) so this is a
# wash anyway. The only real solution here is to package rapydscript-ng.
#
# We do not need it at build time, and *no one* needs it at install time.
# Delete the cruft.
rm -r resources/rapydscript/ || die
}
src_compile() {
# TODO: get qmake called by setup.py to respect CC and CXX too
tc-export CC CXX
# bug 821871
local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
export QMAKE="$(qt6_get_bindir)/qmake"
edo ${EPYTHON} setup.py build
edo ${EPYTHON} setup.py gui
# A few different resources are bundled in the distfile by default, because
# not all systems necessarily have them. We un-vendor them, using the
# upstream integrated approach if possible. See setup/revendor.py and
# consider migrating other resources to this if they do not use it, in
# *preference* over manual rm'ing.
edo ${EPYTHON} setup.py liberation_fonts \
--path-to-liberation_fonts "${EPREFIX}"/usr/share/fonts/liberation-fonts \
--system-liberation_fonts
if use system-mathjax; then
edo ${EPYTHON} setup.py mathjax --path-to-mathjax "${EPREFIX}"/usr/share/mathjax --system-mathjax
edo ${EPYTHON} setup.py rapydscript
fi
}
src_test() {
# Skipped tests:
local _test_excludes=(
# unpackaged Python dependency: py7zr
7z
# unpackaged Python dependency: pyzstd
test_zstd
# unpackaged TTS backend (optional at runtime): https://github.com/rhasspy/piper
piper
# tests if a completely unused module is bundled
pycryptodome
$(usev !speech speech_dispatcher)
$(usev !unrar test_unrar)
# undocumented reasons
test_mem_leaks
test_searching
)
# Some of these tests weren't practical to split out into distinct tests, so
# have a different control mechanism
use speech || export SKIP_SPEECH_TESTS=1
edo ${PYTHON} setup.py test "${_test_excludes[@]/#/--exclude-test-name=}"
}
src_install() {
# Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
# File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
# return _parse_localename(localename)
# File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
# raise ValueError, 'unknown locale: %s' % localename
#ValueError: unknown locale: 46
export -n LANG LANGUAGE ${!LC_*}
export LC_ALL=C.utf8 # bug #709682
# Bug #295672 - Avoid sandbox violation in ~/.config by forcing
# variables to point to our fake temporary $HOME.
export HOME="${T}/fake_homedir"
export CALIBRE_CONFIG_DIRECTORY="${HOME}/.config/calibre"
mkdir -p "${CALIBRE_CONFIG_DIRECTORY}" || die
addpredict /dev/dri #665310
# If this directory doesn't exist, zsh completion won't install
dodir /usr/share/zsh/site-functions
edo "${PYTHON}" setup.py install \
--staging-root="${ED}/usr" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
--staging-libdir="${ED}/usr/$(get_libdir)" \
--system-plugins-location="${EPREFIX}/usr/share/calibre/system-plugins"
cp -r man-pages/ "${ED}"/usr/share/man || die
find "${ED}"/usr/share -type d -empty -delete || die
python_fix_shebang "${ED}/usr/bin"
python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
}

View File

@@ -0,0 +1,253 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="sqlite,ssl"
inherit edo toolchain-funcs python-single-r1 qmake-utils verify-sig xdg
DESCRIPTION="Ebook management application"
HOMEPAGE="https://calibre-ebook.com/"
SRC_URI="
https://download.calibre-ebook.com/${PV}/${P}.tar.xz
verify-sig? ( https://calibre-ebook.com/signatures/${P}.tar.xz.sig )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kovidgoyal.gpg
LICENSE="
GPL-3+
GPL-3
GPL-2+
GPL-2
GPL-1+
LGPL-3+
LGPL-2.1+
LGPL-2.1
BSD
MIT
Old-MIT
Apache-2.0
public-domain
|| ( Artistic GPL-1+ )
CC-BY-3.0
OFL-1.1
PSF-2
"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="+font-subsetting ios speech +system-mathjax test +udisks unrar"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Qt slotted dependencies are used because the libheadless.so plugin links to
# QT_*_PRIVATE_ABI. It only uses core/gui/dbus.
COMMON_DEPEND="${PYTHON_DEPS}
app-i18n/uchardet
>=app-text/hunspell-1.7:=
>=app-text/podofo-0.10.0:=
app-text/poppler[utils]
dev-libs/hyphen:=
>=dev-libs/icu-57.1:=
dev-libs/openssl:=
dev-libs/snowball-stemmer:=
$(python_gen_cond_dep '
>=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
>=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
dev-python/dnspython[${PYTHON_USEDEP}]
>=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
>=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
>=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
dev-python/jeepney[${PYTHON_USEDEP}]
>=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
dev-python/lxml-html-clean[${PYTHON_USEDEP}]
>=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
>=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
>=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
>=dev-python/pillow-3.2.0[jpeg,truetype,webp,zlib,${PYTHON_USEDEP}]
>=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
>=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
>=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
dev-python/pyqt6[gui,network,opengl,printsupport,quick,svg,widgets,${PYTHON_USEDEP}]
dev-python/pyqt6-webengine[widgets,${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/xxhash[${PYTHON_USEDEP}]
>=dev-python/zeroconf-0.75.0[${PYTHON_USEDEP}]
')
dev-qt/qtbase:6=[gui,widgets]
dev-qt/qtimageformats:6
dev-util/desktop-file-utils
dev-util/gtk-update-icon-cache
media-fonts/liberation-fonts
media-libs/fontconfig:=
>=media-libs/freetype-2:=
>=media-libs/libmtp-1.1.11:=
>=media-gfx/optipng-0.7.6
>=media-video/ffmpeg-6:=
virtual/libusb:1=
x11-misc/shared-mime-info
>=x11-misc/xdg-utils-1.0.2-r2
font-subsetting? ( $(python_gen_cond_dep 'dev-python/fonttools[${PYTHON_USEDEP}]') )
ios? (
>=app-pda/usbmuxd-1.0.8
>=app-pda/libimobiledevice-1.2.0
)
speech? (
$(python_gen_cond_dep 'app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]')
dev-python/pyqt6[multimedia,speech]
)
system-mathjax? ( >=dev-libs/mathjax-3:= )
udisks? ( virtual/libudev )
unrar? ( dev-python/unrardll )
"
RDEPEND="${COMMON_DEPEND}
udisks? ( sys-fs/udisks:2 )"
DEPEND="${COMMON_DEPEND}
test? ( $(python_gen_cond_dep '>=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]') )
"
BDEPEND="$(python_gen_cond_dep '
>=dev-python/pyqt-builder-1.10.3[${PYTHON_USEDEP}]
>=dev-python/sip-5[${PYTHON_USEDEP}]
')
virtual/pkgconfig
system-mathjax? ( dev-lang/rapydscript-ng )
verify-sig? ( sec-keys/openpgp-keys-kovidgoyal )
"
PATCHES=(
# Skip calling a binary (JxrDecApp) from libjxr which is used for tests
# We don't (yet?) package libjxr and it seems to be dead upstream
# (last commit in 2017)
"${FILESDIR}/${PN}-7.0.0-jxr-test.patch"
)
src_prepare() {
default
# Warning:
#
# While it might be rather tempting to add yet another sed here,
# please don't. There have been several bugs in Gentoo's packaging
# of calibre from seds-which-become-stale. Please consider
# creating a patch instead, but in any case, run the test suite
# and ensure it passes.
#
# If in doubt about a problem, checking Fedora's packaging is recommended.
# Disable unnecessary privilege dropping for bug #287067.
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
-i setup/install.py || die "sed failed to patch install.py"
# This is only ever used at build time. It contains a small embedded copy
# of the rapydscript-ng compiler usable inside of qtwebengine, if you don't
# have rapydscript-ng (a nodejs package) itself installed. Its only purpose
# is to build some resources that come bundled in dist tarballs already...
# and which we may also need to regenerate e.g. to use system-mathjax.
#
# However, running qtwebengine violates the portage sandbox (among other
# things, it tries to create directories in /usr! amazing) so this is a
# wash anyway. The only real solution here is to package rapydscript-ng.
#
# We do not need it at build time, and *no one* needs it at install time.
# Delete the cruft.
rm -r resources/rapydscript/ || die
}
src_compile() {
# TODO: get qmake called by setup.py to respect CC and CXX too
tc-export CC CXX
# bug 821871
local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
export QMAKE="$(qt6_get_bindir)/qmake"
edo ${EPYTHON} setup.py build
edo ${EPYTHON} setup.py gui
# A few different resources are bundled in the distfile by default, because
# not all systems necessarily have them. We un-vendor them, using the
# upstream integrated approach if possible. See setup/revendor.py and
# consider migrating other resources to this if they do not use it, in
# *preference* over manual rm'ing.
edo ${EPYTHON} setup.py liberation_fonts \
--path-to-liberation_fonts "${EPREFIX}"/usr/share/fonts/liberation-fonts \
--system-liberation_fonts
if use system-mathjax; then
edo ${EPYTHON} setup.py mathjax --path-to-mathjax "${EPREFIX}"/usr/share/mathjax --system-mathjax
edo ${EPYTHON} setup.py rapydscript
fi
}
src_test() {
# Skipped tests:
local _test_excludes=(
# unpackaged Python dependency: py7zr
7z
# unpackaged Python dependency: pyzstd
test_zstd
# unpackaged TTS backend (optional at runtime): https://github.com/rhasspy/piper
piper
# tests if a completely unused module is bundled
pycryptodome
$(usev !speech speech_dispatcher)
$(usev !unrar test_unrar)
# undocumented reasons
test_mem_leaks
test_searching
)
# Some of these tests weren't practical to split out into distinct tests, so
# have a different control mechanism
use speech || export SKIP_SPEECH_TESTS=1
edo ${PYTHON} setup.py test "${_test_excludes[@]/#/--exclude-test-name=}"
}
src_install() {
# Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
# File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
# return _parse_localename(localename)
# File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
# raise ValueError, 'unknown locale: %s' % localename
#ValueError: unknown locale: 46
export -n LANG LANGUAGE ${!LC_*}
export LC_ALL=C.utf8 # bug #709682
# Bug #295672 - Avoid sandbox violation in ~/.config by forcing
# variables to point to our fake temporary $HOME.
export HOME="${T}/fake_homedir"
export CALIBRE_CONFIG_DIRECTORY="${HOME}/.config/calibre"
mkdir -p "${CALIBRE_CONFIG_DIRECTORY}" || die
addpredict /dev/dri #665310
# If this directory doesn't exist, zsh completion won't install
dodir /usr/share/zsh/site-functions
edo "${PYTHON}" setup.py install \
--staging-root="${ED}/usr" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
--staging-libdir="${ED}/usr/$(get_libdir)" \
--system-plugins-location="${EPREFIX}/usr/share/calibre/system-plugins"
cp -r man-pages/ "${ED}"/usr/share/man || die
find "${ED}"/usr/share -type d -empty -delete || die
python_fix_shebang "${ED}/usr/bin"
python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
}

View File

@@ -0,0 +1,254 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_REQ_USE="sqlite,ssl"
inherit edo toolchain-funcs python-single-r1 qmake-utils verify-sig xdg
DESCRIPTION="Ebook management application"
HOMEPAGE="https://calibre-ebook.com/"
SRC_URI="
https://download.calibre-ebook.com/${PV}/${P}.tar.xz
verify-sig? ( https://calibre-ebook.com/signatures/${P}.tar.xz.sig )
"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kovidgoyal.gpg
LICENSE="
GPL-3+
GPL-3
GPL-2+
GPL-2
GPL-1+
LGPL-3+
LGPL-2.1+
LGPL-2.1
BSD
MIT
Old-MIT
Apache-2.0
public-domain
|| ( Artistic GPL-1+ )
CC-BY-3.0
OFL-1.1
PSF-2
"
SLOT="0"
KEYWORDS="amd64"
IUSE="+font-subsetting ios speech +system-mathjax test +udisks unrar"
RESTRICT="!test? ( test )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Qt slotted dependencies are used because the libheadless.so plugin links to
# QT_*_PRIVATE_ABI. It only uses core/gui/dbus.
COMMON_DEPEND="${PYTHON_DEPS}
app-i18n/uchardet
>=app-text/hunspell-1.7:=
>=app-text/podofo-0.10.0:=
app-text/poppler[utils]
dev-libs/hyphen:=
>=dev-libs/icu-57.1:=
dev-libs/openssl:=
dev-libs/snowball-stemmer:=
$(python_gen_cond_dep '
>=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
>=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
dev-python/dnspython[${PYTHON_USEDEP}]
>=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
>=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
>=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
dev-python/jeepney[${PYTHON_USEDEP}]
>=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
dev-python/lxml-html-clean[${PYTHON_USEDEP}]
>=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
>=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
>=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
>=dev-python/pillow-3.2.0[jpeg,truetype,webp,zlib,${PYTHON_USEDEP}]
>=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
>=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
dev-python/pykakasi[${PYTHON_USEDEP}]
>=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
dev-python/pyqt6[gui,network,opengl,printsupport,quick,svg,widgets,${PYTHON_USEDEP}]
dev-python/pyqt6-webengine[widgets,${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/xxhash[${PYTHON_USEDEP}]
>=dev-python/zeroconf-0.75.0[${PYTHON_USEDEP}]
')
dev-qt/qtbase:6=[gui,widgets]
dev-qt/qtimageformats:6
dev-util/desktop-file-utils
dev-util/gtk-update-icon-cache
media-fonts/liberation-fonts
media-libs/fontconfig:=
>=media-libs/freetype-2:=
>=media-libs/libmtp-1.1.11:=
>=media-gfx/optipng-0.7.6
>=media-video/ffmpeg-6:=
virtual/libusb:1=
x11-misc/shared-mime-info
>=x11-misc/xdg-utils-1.0.2-r2
font-subsetting? ( $(python_gen_cond_dep 'dev-python/fonttools[${PYTHON_USEDEP}]') )
ios? (
>=app-pda/usbmuxd-1.0.8
>=app-pda/libimobiledevice-1.2.0
)
speech? (
$(python_gen_cond_dep 'app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]')
dev-python/pyqt6[multimedia,speech]
)
system-mathjax? ( >=dev-libs/mathjax-3:= )
udisks? ( virtual/libudev )
unrar? ( dev-python/unrardll )
"
RDEPEND="${COMMON_DEPEND}
udisks? ( sys-fs/udisks:2 )"
DEPEND="${COMMON_DEPEND}
test? ( $(python_gen_cond_dep '>=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]') )
"
BDEPEND="$(python_gen_cond_dep '
>=dev-python/pyqt-builder-1.10.3[${PYTHON_USEDEP}]
>=dev-python/sip-5[${PYTHON_USEDEP}]
')
virtual/pkgconfig
system-mathjax? ( dev-lang/rapydscript-ng )
verify-sig? ( sec-keys/openpgp-keys-kovidgoyal )
"
PATCHES=(
# Skip calling a binary (JxrDecApp) from libjxr which is used for tests
# We don't (yet?) package libjxr and it seems to be dead upstream
# (last commit in 2017)
"${FILESDIR}/${PN}-7.0.0-jxr-test.patch"
)
src_prepare() {
default
# Warning:
#
# While it might be rather tempting to add yet another sed here,
# please don't. There have been several bugs in Gentoo's packaging
# of calibre from seds-which-become-stale. Please consider
# creating a patch instead, but in any case, run the test suite
# and ensure it passes.
#
# If in doubt about a problem, checking Fedora's packaging is recommended.
# Disable unnecessary privilege dropping for bug #287067.
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
-i setup/install.py || die "sed failed to patch install.py"
# This is only ever used at build time. It contains a small embedded copy
# of the rapydscript-ng compiler usable inside of qtwebengine, if you don't
# have rapydscript-ng (a nodejs package) itself installed. Its only purpose
# is to build some resources that come bundled in dist tarballs already...
# and which we may also need to regenerate e.g. to use system-mathjax.
#
# However, running qtwebengine violates the portage sandbox (among other
# things, it tries to create directories in /usr! amazing) so this is a
# wash anyway. The only real solution here is to package rapydscript-ng.
#
# We do not need it at build time, and *no one* needs it at install time.
# Delete the cruft.
rm -r resources/rapydscript/ || die
}
src_compile() {
# TODO: get qmake called by setup.py to respect CC and CXX too
tc-export CC CXX
# bug 821871
local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
export QMAKE="$(qt6_get_bindir)/qmake"
edo ${EPYTHON} setup.py build
edo ${EPYTHON} setup.py gui
# A few different resources are bundled in the distfile by default, because
# not all systems necessarily have them. We un-vendor them, using the
# upstream integrated approach if possible. See setup/revendor.py and
# consider migrating other resources to this if they do not use it, in
# *preference* over manual rm'ing.
edo ${EPYTHON} setup.py liberation_fonts \
--path-to-liberation_fonts "${EPREFIX}"/usr/share/fonts/liberation-fonts \
--system-liberation_fonts
if use system-mathjax; then
edo ${EPYTHON} setup.py mathjax --path-to-mathjax "${EPREFIX}"/usr/share/mathjax --system-mathjax
edo ${EPYTHON} setup.py rapydscript
fi
}
src_test() {
# Skipped tests:
local _test_excludes=(
# unpackaged Python dependency: py7zr
7z
# unpackaged Python dependency: pyzstd
test_zstd
# unpackaged TTS backend (optional at runtime): https://github.com/rhasspy/piper
piper
# tests if a completely unused module is bundled
pycryptodome
$(usev !speech speech_dispatcher)
$(usev !unrar test_unrar)
# undocumented reasons
test_mem_leaks
test_searching
)
# Some of these tests weren't practical to split out into distinct tests, so
# have a different control mechanism
use speech || export SKIP_SPEECH_TESTS=1
edo ${PYTHON} setup.py test "${_test_excludes[@]/#/--exclude-test-name=}"
}
src_install() {
# Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
# File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
# return _parse_localename(localename)
# File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
# raise ValueError, 'unknown locale: %s' % localename
#ValueError: unknown locale: 46
export -n LANG LANGUAGE ${!LC_*}
export LC_ALL=C.utf8 # bug #709682
# Bug #295672 - Avoid sandbox violation in ~/.config by forcing
# variables to point to our fake temporary $HOME.
export HOME="${T}/fake_homedir"
export CALIBRE_CONFIG_DIRECTORY="${HOME}/.config/calibre"
mkdir -p "${CALIBRE_CONFIG_DIRECTORY}" || die
addpredict /dev/dri #665310
# If this directory doesn't exist, zsh completion won't install
dodir /usr/share/zsh/site-functions
edo "${PYTHON}" setup.py install \
--staging-root="${ED}/usr" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
--staging-libdir="${ED}/usr/$(get_libdir)" \
--system-plugins-location="${EPREFIX}/usr/share/calibre/system-plugins"
cp -r man-pages/ "${ED}"/usr/share/man || die
find "${ED}"/usr/share -type d -empty -delete || die
python_fix_shebang "${ED}/usr/bin"
python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
}

View File

@@ -0,0 +1,55 @@
From 57190699030dc6746320e49695a67ce83c62d549 Mon Sep 17 00:00:00 2001
From: Kovid Goyal <kovid@kovidgoyal.net>
Date: Sun, 28 May 2023 14:03:15 +0530
Subject: [PATCH] HTML Input: Dont add resources that exist outside the folder
hierarchy rooted at the parent folder of the input HTML file by default
(cherry picked from commit bbbddd2bf4ef4ddb467b0aeb0abe8765ed7f8a6b)
---
.../ebooks/conversion/plugins/html_input.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/calibre/ebooks/conversion/plugins/html_input.py b/src/calibre/ebooks/conversion/plugins/html_input.py
index 6f9c2084ea..742f3e0279 100644
--- a/src/calibre/ebooks/conversion/plugins/html_input.py
+++ b/src/calibre/ebooks/conversion/plugins/html_input.py
@@ -64,6 +64,16 @@ class HTMLInput(InputFormatPlugin):
)
),
+ OptionRecommendation(name='allow_local_files_outside_root',
+ recommended_value=False, level=OptionRecommendation.LOW,
+ help=_('Normally, resources linked to by the HTML file or its children will only be allowed'
+ ' if they are in a sub-folder of the original HTML file. This option allows including'
+ ' local files from any location on your computer. This can be a security risk if you'
+ ' are converting untrusted HTML and expecting to distribute the result of the conversion.'
+ )
+ ),
+
+
}
def convert(self, stream, opts, file_ext, log,
@@ -76,6 +86,7 @@ def convert(self, stream, opts, file_ext, log,
if hasattr(stream, 'name'):
basedir = os.path.dirname(stream.name)
fname = os.path.basename(stream.name)
+ self.root_dir_of_input = os.path.abspath(basedir) + os.sep
if file_ext != 'opf':
if opts.dont_package:
@@ -250,6 +261,11 @@ def link_to_local_path(self, link_, base=None):
frag = l.fragment
if not link:
return None, None
+ link = os.path.abspath(os.path.realpath(link))
+ if not link.startswith(self.root_dir_of_input):
+ if not self.opts.allow_local_files_outside_root:
+ self.log.warn('Not adding {} as it is outside the document root: {}'.format(link, self.root_dir_of_input))
+ return None, None
return link, frag
def resource_adder(self, link_, base=None):
--
2.41.0

View File

@@ -0,0 +1,36 @@
From a961ddbfcb96461fd830ccd6facb81d69cc679d8 Mon Sep 17 00:00:00 2001
From: Kovid Goyal <kovid@kovidgoyal.net>
Date: Tue, 29 Oct 2024 06:08:04 +0530
Subject: [PATCH] PIL 11.0 changes its webp features output
---
src/calibre/test_build.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py
index 4e3d740705..91c32eba38 100644
--- a/src/calibre/test_build.py
+++ b/src/calibre/test_build.py
@@ -436,16 +436,14 @@ def test_imaging(self):
out = StringIO()
features.pilinfo(out=out, supported_formats=False)
out = out.getvalue()
- for line in '''\
+ lines = '''\
--- PIL CORE support ok
--- FREETYPE2 support ok
--- WEBP support ok
- --- WEBP Transparency support ok
- --- WEBPMUX support ok
- --- WEBP Animation support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
- '''.splitlines():
+ '''.splitlines()
+ for line in lines:
self.assertIn(line.strip(), out)
with Image.open(I('lt.png', allow_user_override=False)) as i:
self.assertGreaterEqual(i.size, (20, 20))
--
2.45.2

View File

@@ -0,0 +1,24 @@
Avoid calling libjxr's JxrDecApp as we currently don't package it.
--- a/src/calibre/utils/img.py
+++ b/src/calibre/utils/img.py
@@ -118,8 +118,6 @@
i = QImage()
if not i.loadFromData(data):
q = what(None, data)
- if q == 'jxr':
- return load_jxr_data(data)
raise NotImage(f'Not a valid image (detected type: {q})')
return i
@@ -645,11 +643,6 @@
despeckle_image(img)
remove_borders_from_image(img)
image_to_data(img, fmt='GIF')
- raw = subprocess.Popen([get_exe_path('JxrDecApp'), '-h'],
- creationflags=subprocess.DETACHED_PROCESS if iswindows else 0,
- stdout=subprocess.PIPE).stdout.read()
- if b'JPEG XR Decoder Utility' not in raw:
- raise SystemExit('Failed to run JxrDecApp')
# }}}

View File

@@ -0,0 +1,26 @@
From 5d8d85c649b181747d182f676cfd76f843bd61f0 Mon Sep 17 00:00:00 2001
From: Kovid Goyal <kovid@kovidgoyal.net>
Date: Sun, 1 Oct 2023 15:08:59 +0530
Subject: [PATCH] Fix compatibility with zeroconf >= 0.73
Fixes #2038 (fix compatibility with newer zeroconf)
---
src/calibre/devices/smart_device_app/driver.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py
index 87608f305b..b41c3a0063 100644
--- a/src/calibre/devices/smart_device_app/driver.py
+++ b/src/calibre/devices/smart_device_app/driver.py
@@ -2175,6 +2175,8 @@ def monkeypatch_zeroconf():
# "monkeypatch" zeroconf with a function without the check
try:
from zeroconf._utils.name import service_type_name
+ # zeroconf 0.73 uses an lru cache so we need __wrapped__
+ service_type_name = getattr(service_type_name, '__wrapped__', service_type_name)
service_type_name.__kwdefaults__['strict'] = False
except ImportError:
import zeroconf
--
2.41.0

View File

@@ -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",

View File

@@ -0,0 +1,33 @@
Changelog:
Only relevant if you embed the calibre server within a larger server, it
means attackers who can convince users to click on a specially crafted
link, can run JavaScript code with the same origin as the larger server
calibre is embedded in.
From e75f85919a3c3a5f2d87861050d8483d66561c06 Mon Sep 17 00:00:00 2001
From: Kovid Goyal <kovid@kovidgoyal.net>
Date: Tue, 30 Jul 2024 13:40:21 +0530
Subject: [PATCH] Fix #2075130 [Private
bug](https://bugs.launchpad.net/calibre/+bug/2075130)
---
src/calibre/srv/legacy.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/calibre/srv/legacy.py b/src/calibre/srv/legacy.py
index 055228ebee..85586b07a6 100644
--- a/src/calibre/srv/legacy.py
+++ b/src/calibre/srv/legacy.py
@@ -255,7 +255,7 @@ def browse(ctx, rd, rest):
if rest.startswith('book/'):
# implementation of https://bugs.launchpad.net/calibre/+bug/1698411
# redirect old server book URLs to new URLs
- redirect = ctx.url_for(None) + '#book_id=' + rest[5:] + "&amp;panel=book_details"
+ redirect = ctx.url_for(None) + '#book_id=' + int(rest[5:]) + "&amp;panel=book_details"
from lxml import etree as ET
return html(ctx, rd, endpoint,
E.html(E.head(
--
2.44.2

View File

@@ -0,0 +1,27 @@
diff --git a/src/calibre/utils/img.py b/src/calibre/utils/img.py
index b61627b63e..ff51c76e75 100644
--- a/src/calibre/utils/img.py
+++ b/src/calibre/utils/img.py
@@ -129,8 +129,6 @@ def image_from_data(data):
i = QImage()
if not i.loadFromData(data):
q = what(None, data)
- if q == 'jxr':
- return load_jxr_data(data)
raise NotImage(f'Not a valid image (detected type: {q})')
return i
@@ -693,13 +691,6 @@ def test(): # {{{
despeckle_image(img)
remove_borders_from_image(img)
image_to_data(img, fmt='GIF')
- p = subprocess.Popen([get_exe_path('JxrDecApp'), '-h'],
- creationflags=subprocess.DETACHED_PROCESS if iswindows else 0,
- stdout=subprocess.PIPE)
- raw, _ = p.communicate()
- p.wait()
- if b'JPEG XR Decoder Utility' not in raw:
- raise SystemExit('Failed to run JxrDecApp')
# }}}

View File

@@ -0,0 +1,38 @@
From 6d87aa054724155c9413e5692fa1f242f9cc0efc Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz93@gmail.com>
Date: Fri, 23 Aug 2024 02:20:00 -0400
Subject: [PATCH] tests: delete qt TTS assert which is not yet used
It will be used in future versions of calibre, and should likely be
gated on USE=speech.
---
src/calibre/test_build.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py
index 4f19363680..898caad665 100644
--- a/src/calibre/test_build.py
+++ b/src/calibre/test_build.py
@@ -314,7 +314,7 @@ def test_apsw(self):
def test_qt(self):
if is_sanitized:
raise unittest.SkipTest('Skipping Qt build test as sanitizer is enabled')
- from qt.core import QApplication, QFontDatabase, QImageReader, QLoggingCategory, QNetworkAccessManager, QSslSocket, QTextToSpeech, QTimer
+ from qt.core import QApplication, QFontDatabase, QImageReader, QLoggingCategory, QNetworkAccessManager, QSslSocket, QTimer
QLoggingCategory.setFilterRules('''qt.webenginecontext.debug=true''')
if hasattr(os, 'geteuid') and os.geteuid() == 0:
# likely a container build, webengine cannot run as root with sandbox
@@ -348,10 +348,6 @@ def test_qt(self):
try:
ensure_app()
self.assertGreaterEqual(len(QFontDatabase.families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
- available_tts_engines = tuple(x for x in QTextToSpeech.availableEngines() if x != 'mock')
- self.assertTrue(available_tts_engines)
-
- self.assertGreaterEqual
from calibre.ebooks.oeb.transforms.rasterize import rasterize_svg
img = rasterize_svg(as_qimage=True)
self.assertFalse(img.isNull())
--
2.44.2

View File

@@ -0,0 +1,13 @@
# /etc/conf.d/calibre-server
# Change this to the user you want to run calibre-server as.
# You may specify a group too, after a colon
# NOTE: This must be set and not to root!
CALIBRE_USER=
# Set the path of the library to serve.
# Defaults to the default location for CALIBRE_USER.
#CALIBRE_LIBRARY='<user home directory>/Calibre Library'
# Extra options to pass to calibre-server.
# See the calibre-server man page for more options.
#CALIBRE_SERVER_OPTS="--userdb /srv/calibre/users.sqlite --enable-auth --worker-count 10 --port 8080"

View File

@@ -0,0 +1,58 @@
#!/sbin/openrc-run
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
depend() {
need net
need localmount
after bootmisc
}
checkconfig() {
if [ "${CALIBRE_USER}" = "" -o "${CALIBRE_USER}" = "root" ] ; then
eerror "Please edit /etc/conf.d/calibre-server"
eerror "You have to specify a user to run calibre-server as, as we will not run it as root!"
eerror "Modify CALIBRE_USER to your needs (you can also add a group, after a colon)"
return 1
fi
if ! getent passwd "${CALIBRE_USER%:*}" >/dev/null ; then
eerror "Please edit /etc/conf.d/calibre-server"
eerror "Your user has to exist!"
return 1
fi
if [ "${CALIBRE_USER%:*}" != "${CALIBRE_USER}" ] ; then
if ! getent group "${CALIBRE_USER#*:}" >/dev/null ; then
eerror "Please edit /etc/conf.d/calibre-server"
eerror "Your group has to exist too!"
return 1
fi
fi
if [ "${CALIBRE_LIBRARY}" = "" ] ; then
CALIBRE_USER_HOME=$(getent passwd "${CALIBRE_USER%:*}" | cut -d ':' -f 6)
CALIBRE_LIBRARY="${CALIBRE_USER_HOME}/Calibre Library"
fi
if [ ! -d "${CALIBRE_LIBRARY}" ] ; then
eerror "Please edit /etc/conf.d/calibre-server"
eerror "The Calibre library, '${CALIBRE_LIBRARY},' does not exist."
eerror "Please modify CALIBRE_LIBRARY to point to a valid library."
return 1
fi
return 0
}
start() {
checkconfig || return $?
local pidfile=/var/run/calibre-server.pid
ebegin "Starting calibre-server"
start-stop-daemon --user "${CALIBRE_USER}" \
--pidfile "${pidfile}" --make-pidfile --background --exec /usr/bin/calibre-server \
-- ${CALIBRE_OPTS} "${CALIBRE_LIBRARY}"
eend $?
}
stop() {
ebegin "Stopping calibre-server"
start-stop-daemon --stop --user "${CALIBRE_USER}" \
--pidfile /var/run/calibre-server.pid
eend $?
}

View File

@@ -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

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>eschwartz@gentoo.org</email>
<name>Eli Schwartz</name>
</maintainer>
<upstream>
<remote-id type="github">kovidgoyal/calibre</remote-id>
<changelog>https://calibre-ebook.com/whats-new</changelog>
</upstream>
<use>
<flag name="font-subsetting">Enable font subsetting support</flag>
<flag name="system-mathjax">Use a system copy of mathjax</flag>
<flag name="unrar">Enable support for comic books compressed with the non-free Rar format</flag>
</use>
</pkgmetadata>