Gentoo Archives: gentoo-commits

From: Justin Lecher <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/calibre/
Date: Wed, 04 Nov 2015 08:42:15
Message-Id: 1446626523.4c50703371629ca36a3ac2986e60a74ad891c332.jlec@gentoo
1 commit: 4c50703371629ca36a3ac2986e60a74ad891c332
2 Author: Justin Lecher <jlec <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 4 08:06:45 2015 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 4 08:42:03 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c507033
7
8 app-text/calibre: Drop dev-python/dnspython in favour of the virtual
9
10 Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=564648
11
12 Package-Manager: portage-2.2.23
13 Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>
14
15 app-text/calibre/calibre-2.35.0-r1.ebuild | 228 ++++++++++++++++++++++++++++++
16 1 file changed, 228 insertions(+)
17
18 diff --git a/app-text/calibre/calibre-2.35.0-r1.ebuild b/app-text/calibre/calibre-2.35.0-r1.ebuild
19 new file mode 100644
20 index 0000000..6192ca9
21 --- /dev/null
22 +++ b/app-text/calibre/calibre-2.35.0-r1.ebuild
23 @@ -0,0 +1,228 @@
24 +# Copyright 1999-2015 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +# $Id$
27 +
28 +EAPI=5
29 +inherit eutils fdo-mime bash-completion-r1 multilib toolchain-funcs
30 +
31 +DESCRIPTION="Ebook management application"
32 +HOMEPAGE="http://calibre-ebook.com/"
33 +SRC_URI="http://download.calibre-ebook.com/${PV}/${P}.tar.xz"
34 +
35 +LICENSE="
36 + GPL-3+
37 + GPL-3
38 + GPL-2+
39 + GPL-2
40 + GPL-1+
41 + LGPL-3+
42 + LGPL-2.1+
43 + LGPL-2.1
44 + BSD
45 + MIT
46 + Old-MIT
47 + Apache-2.0
48 + public-domain
49 + || ( Artistic GPL-1+ )
50 + CC-BY-3.0
51 + OFL-1.1
52 + PSF-2
53 + unRAR
54 +"
55 +KEYWORDS="~amd64 ~arm ~x86"
56 +SLOT="0"
57 +IUSE="+udisks"
58 +
59 +COMMON_DEPEND="
60 + >=app-text/podofo-0.8.2:=
61 + >=app-text/poppler-0.26.5[qt5]
62 + >=dev-lang/python-2.7.9:2.7[sqlite,ssl]
63 + >=dev-libs/chmlib-0.40:=
64 + dev-libs/glib:2
65 + >=dev-libs/icu-4.4:=
66 + >=dev-python/apsw-3.7.17[python_targets_python2_7(-)]
67 + >=dev-python/beautifulsoup-3.0.5:python-2[python_targets_python2_7(-)]
68 + virtual/dnspython[python_targets_python2_7(-)]
69 + >=dev-python/cssselect-0.7.1[python_targets_python2_7(-)]
70 + >=dev-python/cssutils-0.9.9[python_targets_python2_7(-)]
71 + >=dev-python/dbus-python-1.2.0[python_targets_python2_7(-)]
72 + >=dev-python/lxml-3.2.1[python_targets_python2_7(-)]
73 + >=dev-python/mechanize-0.1.11[python_targets_python2_7(-)]
74 + dev-python/netifaces[python_targets_python2_7(-)]
75 + dev-python/psutil[python_targets_python2_7(-)]
76 + >=dev-python/pygments-2.0.1[python_targets_python2_7(-)]
77 + >=dev-python/python-dateutil-1.4.1[python_targets_python2_7(-)]
78 + >=dev-python/PyQt5-5.3.1[gui,svg,webkit,widgets,network,printsupport,python_targets_python2_7(-)]
79 + dev-qt/qtcore:5
80 + dev-qt/qtgui:5
81 + dev-qt/qtwidgets:5
82 + media-fonts/liberation-fonts
83 + >=media-gfx/imagemagick-6.5.9[jpeg,png]
84 + media-libs/fontconfig
85 + >=media-libs/freetype-2:=
86 + >=media-libs/libmtp-1.1.5:=
87 + >=media-libs/libwmf-0.2.8
88 + sys-libs/zlib
89 + virtual/libusb:1=
90 + virtual/python-imaging[python_targets_python2_7(-)]
91 + x11-libs/libX11
92 + x11-libs/libXext
93 + x11-libs/libXrender
94 + >=x11-misc/xdg-utils-1.0.2-r2
95 + udisks? ( virtual/libudev )"
96 +RDEPEND="${COMMON_DEPEND}
97 + udisks? ( || ( sys-fs/udisks:2 sys-fs/udisks:0 ) )"
98 +DEPEND="${COMMON_DEPEND}
99 + >=dev-python/setuptools-0.6_rc5
100 + >=virtual/podofo-build-0.8.2"
101 +
102 +src_prepare() {
103 + # Fix outdated version constant.
104 + #sed -e "s#\\(^numeric_version =\\).*#\\1 (${PV//./, })#" \
105 + # -i src/calibre/constants.py || \
106 + # die "sed failed to patch constants.py"
107 +
108 + # Avoid sandbox violation in /usr/share/gnome/apps when linux.py
109 + # calls xdg-* (bug #258938).
110 + sed -e "s|'xdg-desktop-menu', 'install'|\\0, '--mode', 'user'|" \
111 + -e "s|check_call(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
112 + -e "s|\\(CurrentDir(tdir)\\), \\\\\$|\\1:|" \
113 + -e "s|PreserveMIMEDefaults():||" \
114 + -e "s|xdg-icon-resource install|\\0 --mode user|" \
115 + -e "s|cc(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
116 + -e "s|'xdg-mime', 'install'|\\0, '--mode', 'user'|" \
117 + -i src/calibre/linux.py || die "sed failed to patch linux.py"
118 +
119 + # Disable unnecessary privilege dropping for bug #287067.
120 + sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
121 + -i setup/install.py || die "sed failed to patch install.py"
122 +
123 + sed -e "/^ self\\.check_call(qmc + \\[.*\\.pro'\\])$/a\
124 +\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ self.check_call(['sed', \
125 +'-e', 's|^CFLAGS .*|\\\\\\\\0 ${CFLAGS}|', \
126 +'-e', 's|^CXXFLAGS .*|\\\\\\\\0 ${CXXFLAGS}|', \
127 +'-e', 's|^LFLAGS .*|\\\\\\\\0 ${LDFLAGS}|', \
128 +'-i', 'Makefile'])" \
129 + -i setup/extensions.py || die "sed failed to patch extensions.py"
130 +
131 + # use system beautifulsoup, instead of bundled
132 + rm -f "${S}"/src/calibre/ebooks/BeautifulSoup.py \
133 + || die "could not remove bundled beautifulsoup"
134 + find "${S}" -type f -name \*.py -exec \
135 + sed -e 's/calibre.ebooks.BeautifulSoup/BeautifulSoup/' -i {} + \
136 + || die "could not sed bundled beautifulsoup out of the source tree"
137 +
138 + # avoid failure of xdg tools to recognize vendor prefix
139 + sed -e "s|xdg-icon-resource install|xdg-icon-resource install --novendor|" \
140 + -e "s|'xdg-mime', 'install'|'xdg-mime', 'install', '--novendor'|" \
141 + -e "s|'xdg-desktop-menu', 'install'|'xdg-desktop-menu', 'install', '--novendor'|" \
142 + -i "${S}"/src/calibre/linux.py || die 'sed failed'
143 +
144 + # no_updates: do not annoy user with "new version is availible all the time
145 + # disable_plugins: walking sec-hole, wait for upstream to use GHNS interface
146 + epatch \
147 + "${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch" \
148 + "${FILESDIR}/${PN}-disable_plugins.patch"
149 +}
150 +
151 +src_install() {
152 + # Bypass kbuildsycoca and update-mime-database in order to
153 + # avoid sandbox violations if xdg-mime tries to call them.
154 + cat - > "${T}/kbuildsycoca" <<-EOF
155 + #!${BASH}
156 + echo $0 : $@
157 + exit 0
158 + EOF
159 +
160 + cp "${T}"/{kbuildsycoca,update-mime-database}
161 + chmod +x "${T}"/{kbuildsycoca,update-mime-database}
162 +
163 + export QMAKE="${EPREFIX}/usr/$(get_libdir)/qt5/bin/qmake"
164 +
165 + # Unset DISPLAY in order to prevent xdg-mime from triggering a sandbox
166 + # violation with kbuildsycoca as in bug #287067, comment #13.
167 + export -n DISPLAY
168 +
169 + # Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
170 + # File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
171 + # return _parse_localename(localename)
172 + # File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
173 + # raise ValueError, 'unknown locale: %s' % localename
174 + #ValueError: unknown locale: 46
175 + export -n LANGUAGE
176 +
177 + # Bug #295672 - Avoid sandbox violation in ~/.config by forcing
178 + # variables to point to our fake temporary $HOME.
179 + export HOME="${T}/fake_homedir"
180 + export XDG_CONFIG_HOME="${HOME}/.config"
181 + export XDG_DATA_HOME="${HOME}/.local/share"
182 + export CALIBRE_CONFIG_DIRECTORY="${XDG_CONFIG_HOME}/calibre"
183 + mkdir -p "${XDG_DATA_HOME}" "${CALIBRE_CONFIG_DIRECTORY}"
184 +
185 + tc-export CC CXX
186 + # Bug #334243 - respect LDFLAGS when building extensions
187 + export OVERRIDE_CFLAGS="$CFLAGS" OVERRIDE_LDFLAGS="$LDFLAGS"
188 + local libdir=$(get_libdir)
189 + [[ -n $libdir ]] || die "get_libdir returned an empty string"
190 +
191 + # Bug #472690 - Avoid sandbox violation for /dev/dri/card0.
192 + local x
193 + for x in /dev/dri/card[0-9] ; do
194 + [[ -e ${x} ]] && addpredict ${x}
195 + done
196 +
197 + dodir "/usr/$(get_libdir)/python2.7/site-packages" # for init_calibre.py
198 + PATH=${T}:${PATH} PYTHONPATH=${S}/src${PYTHONPATH:+:}${PYTHONPATH} \
199 + "${EPREFIX}"/usr/bin/python2.7 setup.py install \
200 + --root="${D}" \
201 + --prefix="${EPREFIX}/usr" \
202 + --libdir="${EPREFIX}/usr/${libdir}" \
203 + --staging-root="${ED}usr" \
204 + --staging-libdir="${ED}usr/${libdir}" || die
205 +
206 + grep -rlZ "${ED}" "${ED}" | xargs -0 sed -e "s:${D}:/:g" -i ||
207 + die "failed to fix harcoded \$D in paths"
208 +
209 + # The menu entries end up here due to '--mode user' being added to
210 + # xdg-* options in src_prepare.
211 + dodir /usr/share/mime/packages
212 + chmod -fR a+rX,u+w,g-w,o-w "${HOME}"/.local
213 + mv "${HOME}"/.local/share/mime/packages/* "${ED}"usr/share/mime/packages/ ||
214 + die "failed to register mime types"
215 + dodir /usr/share/icons
216 + mv "${HOME}"/.local/share/icons/* "${ED}"usr/share/icons/ ||
217 + die "failed to install icon files"
218 +
219 + domenu "${HOME}"/.local/share/applications/*.desktop ||
220 + die "failed to install .desktop menu files"
221 +
222 + find "${ED}"usr/share -type d -empty -delete
223 +
224 + cd "${ED}"/usr/share/calibre/fonts/liberation || die
225 + local x
226 + for x in * ; do
227 + [[ -f ${EROOT}usr/share/fonts/liberation-fonts/${x} ]] || continue
228 + ln -sf "../../../fonts/liberation-fonts/${x}" "${x}" || die
229 + done
230 +
231 + einfo "Converting python shebangs"
232 + while read -r -d $'\0' ; do
233 + local shebang=$(head -n1 "$REPLY")
234 + if [[ ${shebang} == "#!"*python* ]] ; then
235 + sed -i -e "1s:.*:#!${EPREFIX}/usr/bin/python2.7:" "$REPLY" || \
236 + die "sed failed"
237 + fi
238 + done < <(find "${ED}" -type f -print0)
239 +
240 + einfo "Compiling python modules"
241 + "${EPREFIX}"/usr/bin/python2.7 -m compileall -q -f \
242 + -d "${EPREFIX}"/usr/lib/calibre "${ED}"usr/lib/calibre || die
243 +
244 + newinitd "${FILESDIR}"/calibre-server.init calibre-server
245 + newconfd "${FILESDIR}"/calibre-server.conf calibre-server
246 +}
247 +
248 +pkg_postinst() {
249 + fdo-mime_desktop_database_update
250 + fdo-mime_mime_database_update
251 +}