Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/notmuch/
Date: Tue, 23 Aug 2022 05:30:32
Message-Id: 1661232492.8e4a0100e36949f4c4887f00f7dd438dd5a1be75.sam@gentoo
1 commit: 8e4a0100e36949f4c4887f00f7dd438dd5a1be75
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 23 05:28:12 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 23 05:28:12 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e4a0100
7
8 net-mail/notmuch: use python_check_deps for Sphinx
9
10 The configure script tries to import Sphinx so we need
11 Sphinx to be installed for the same Python.
12
13 Either we need python_setup in the ebuild because it actually tries to import
14 sphinx or something (then we need check_deps), or we don't need it at all
15 and we can simply BDEPEND on it.
16
17 And it does try to actually import Sphinx, at least for a configure
18 test: https://github.com/notmuch/notmuch/blob/master/configure#L935.
19
20 Closes: https://bugs.gentoo.org/856628
21 Signed-off-by: Sam James <sam <AT> gentoo.org>
22
23 net-mail/notmuch/notmuch-0.34.2-r1.ebuild | 306 ++++++++++++++++++++++++++++++
24 1 file changed, 306 insertions(+)
25
26 diff --git a/net-mail/notmuch/notmuch-0.34.2-r1.ebuild b/net-mail/notmuch/notmuch-0.34.2-r1.ebuild
27 new file mode 100644
28 index 000000000000..f375e69ff53c
29 --- /dev/null
30 +++ b/net-mail/notmuch/notmuch-0.34.2-r1.ebuild
31 @@ -0,0 +1,306 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +DISTUTILS_OPTIONAL=1
38 +NEED_EMACS="24.1"
39 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
40 +
41 +inherit bash-completion-r1 desktop distutils-r1 elisp-common flag-o-matic pax-utils toolchain-funcs xdg-utils
42 +
43 +DESCRIPTION="Thread-based e-mail indexer, supporting quick search and tagging"
44 +HOMEPAGE="https://notmuchmail.org/"
45 +SRC_URI="https://notmuchmail.org/releases/${P}.tar.xz
46 + test? ( https://notmuchmail.org/releases/test-databases/database-v1.tar.xz )"
47 +
48 +LICENSE="GPL-3"
49 +# Sub-slot corresponds to major wersion of libnotmuch.so.X.Y. Bump of Y is
50 +# meant to be binary backward compatible.
51 +SLOT="0/5"
52 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~x64-macos"
53 +REQUIRED_USE="
54 + apidoc? ( doc )
55 + nmbug? ( python )
56 + python? ( ${PYTHON_REQUIRED_USE} )
57 + test? ( crypt emacs python valgrind )
58 +"
59 +IUSE="apidoc crypt doc emacs mutt nmbug python test valgrind"
60 +RESTRICT="!test? ( test )"
61 +
62 +BDEPEND="
63 + app-arch/xz-utils[extra-filters(-)]
64 + virtual/pkgconfig
65 + apidoc? (
66 + app-doc/doxygen
67 + dev-lang/perl
68 + )
69 + doc? (
70 + $(python_gen_any_dep 'dev-python/sphinx[${PYTHON_USEDEP}]')
71 + sys-apps/texinfo
72 + )
73 + python? (
74 + dev-python/setuptools[${PYTHON_USEDEP}]
75 + test? ( dev-python/pytest[${PYTHON_USEDEP}] )
76 + )
77 + test? (
78 + app-shells/bash
79 + sys-process/parallel
80 + )
81 +"
82 +
83 +COMMON_DEPEND="
84 + dev-libs/glib
85 + dev-libs/gmime:3.0[crypt]
86 + >=dev-libs/xapian-1.4.0:=
87 + sys-libs/talloc
88 + sys-libs/zlib:=
89 + emacs? ( >=app-editors/emacs-${NEED_EMACS}:* )
90 + python? (
91 + ${PYTHON_DEPS}
92 + virtual/python-cffi[${PYTHON_USEDEP}]
93 + )
94 +"
95 +
96 +DEPEND="${COMMON_DEPEND}
97 + test? (
98 + >=app-editors/emacs-${NEED_EMACS}:*[libxml2]
99 + app-misc/dtach
100 + sys-devel/gdb[python]
101 + crypt? (
102 + app-crypt/gnupg
103 + dev-libs/openssl
104 + )
105 + )
106 + valgrind? ( dev-util/valgrind )
107 +"
108 +
109 +RDEPEND="${COMMON_DEPEND}
110 + crypt? ( app-crypt/gnupg )
111 + mutt? (
112 + dev-perl/File-Which
113 + dev-perl/Mail-Box
114 + dev-perl/MailTools
115 + dev-perl/String-ShellQuote
116 + dev-perl/Term-ReadLine-Gnu
117 + virtual/perl-Digest-SHA
118 + virtual/perl-File-Path
119 + virtual/perl-Getopt-Long
120 + dev-perl/Pod-Parser
121 + )
122 + nmbug? ( dev-vcs/git )
123 +"
124 +
125 +SITEFILE="50${PN}-gentoo.el"
126 +
127 +python_check_deps() {
128 + python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
129 +}
130 +
131 +pkg_setup() {
132 + use emacs && elisp-check-emacs-version
133 +}
134 +
135 +src_unpack() {
136 + unpack "${P}".tar.xz
137 + if use test; then
138 + mkdir -p "${S}"/test/test-databases || die
139 + cp "${DISTDIR}"/database-v1.tar.xz "${S}"/test/test-databases/ || die
140 + fi
141 +}
142 +
143 +src_prepare() {
144 + default
145 +
146 + use python && distutils-r1_src_prepare
147 +
148 + mv contrib/notmuch-mutt/README contrib/notmuch-mutt/README-mutt || die
149 +
150 + # Override 'install' target, we want to install manpages with doman, but let it install texinfo files.
151 + sed -i "s/all install-man install-info/all $(usex doc install-info '')/" "Makefile.local" || die
152 +
153 + use test && append-flags '-g'
154 +
155 + # Non-autoconf configure
156 + [[ ${CHOST} == *-solaris* ]] && append-ldflags '-lnsl' '-lsocket'
157 +
158 + # sphinx-4 broke everything. https://bugs.gentoo.org/789492
159 + echo 'man_make_section_directory = False' >> doc/conf.py || die
160 +}
161 +
162 +src_configure() {
163 + python_setup # For sphinx
164 +
165 + tc-export CC CXX
166 +
167 + local myconf=(
168 + --bashcompletiondir="$(get_bashcompdir)"
169 + --emacslispdir="${EPREFIX}/${SITELISP}/${PN}"
170 + --emacsetcdir="${EPREFIX}/${SITEETC}/${PN}"
171 + --without-desktop
172 + --without-ruby
173 + --zshcompletiondir="${EPREFIX}/usr/share/zsh/site-functions"
174 + $(use_with apidoc api-docs)
175 + $(use_with doc docs)
176 + $(use_with emacs)
177 + )
178 +
179 + # FIXME:
180 + # Checking for GMime session key extraction support... * ACCESS DENIED: open_wr: /dev/bus/usb/001/011
181 + # notmuch configure compiles a program _check_session_keys.c, inline in ./configure script
182 + # gmime/gpg/scdaemon tries to open usb devices in GMime test
183 + # we pretend to allow it, without actually allowing it to read or write.
184 + # https://bugs.gentoo.org/821328
185 + addpredict /dev/bus/usb
186 +
187 + econf "${myconf[@]}"
188 +}
189 +
190 +python_compile() {
191 + pushd bindings/python-cffi > /dev/null || die
192 + distutils-r1_python_compile
193 + # copy stuff just in case
194 + if use test; then
195 + mkdir -p build/stage/tests || die
196 + cp -v tests/*.py build/stage/tests || die
197 + fi
198 + popd > /dev/null || die
199 +
200 + # TODO: we want to drop those, research revdeps
201 + pushd bindings/python > /dev/null || die
202 + distutils-r1_python_compile
203 + popd > /dev/null || die
204 +}
205 +
206 +python_compile_all() {
207 + use doc && emake -C bindings/python/docs html
208 +}
209 +
210 +src_compile() {
211 + python_setup # For sphinx
212 +
213 + # prevent race in emacs doc generation
214 + # FileNotFoundError: [Errno 2] No such file or directory: '..work/notmuch-0.31/emacs/notmuch.rsti'
215 + if use emacs; then
216 + use doc && emake -j1 -C emacs docstring.stamp V=1 #nowarn
217 + fi
218 +
219 + emake V=1
220 +
221 + use python && distutils-r1_src_compile
222 +
223 + if use mutt; then
224 + pushd contrib/notmuch-mutt > /dev/null || die
225 + emake notmuch-mutt.1
226 + popd > /dev/null || die
227 + fi
228 +}
229 +
230 +python_test() {
231 + # we only have tests for cffi bindings
232 + pushd bindings/python-cffi > /dev/null || die
233 + rm -f tox.ini || die
234 + pytest -vv || die "Tests failed with ${EPYTHON}"
235 + popd > /dev/null || die
236 +}
237 +
238 +src_test() {
239 + local test_failures=()
240 + pax-mark -m notmuch
241 +
242 + # we run pytest via eclass phasefunc, so delete upstream launcher
243 + use python && { rm -v test/T391-python-cffi.sh || die ; }
244 +
245 + LD_LIBRARY_PATH="${S}/lib" \
246 + nonfatal emake test V=1 OPTIONS="--verbose --tee" || test_failures+=( "'emake tests'" )
247 + pax-mark -ze notmuch
248 +
249 + # both lib and bin needed for testsuite.
250 + if use python; then
251 + LD_LIBRARY_PATH="${S}/lib" \
252 + PATH="${S}:${PATH}" \
253 + nonfatal distutils-r1_src_test || test_failures+=( "'python tests'" )
254 + fi
255 +
256 + [[ ${test_failures} ]] && die "Tests failed: ${test_failures[@]}"
257 +}
258 +
259 +python_install() {
260 + pushd bindings/python-cffi > /dev/null || die
261 + distutils-r1_python_install
262 + popd > /dev/null || die
263 +
264 + pushd bindings/python > /dev/null || die
265 + distutils-r1_python_install
266 + popd > /dev/null || die
267 +}
268 +
269 +src_install() {
270 + default
271 +
272 + if use doc; then
273 + pushd doc/_build/man/man1 > /dev/null || die
274 + ln notmuch.1 notmuch-setup.1 || die
275 + popd > /dev/null || die
276 + if use apidoc; then
277 + # rename overly generic manpage to avoid clashes
278 + mv doc/_build/man/man3/deprecated.3 \
279 + doc/_build/man/man3/notmuch-deprecated.3 || die
280 + fi
281 + doman doc/_build/man/man?/*.?
282 + fi
283 +
284 + if use emacs; then
285 + elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
286 + domenu emacs/notmuch-emacs-mua.desktop
287 + fi
288 +
289 + if use nmbug; then
290 + # TODO: those guys need proper deps
291 + python_fix_shebang devel/nmbug/{nmbug,notmuch-report}
292 + dobin devel/nmbug/{nmbug,notmuch-report}
293 + fi
294 +
295 + if use mutt; then
296 + pushd contrib/notmuch-mutt > /dev/null || die
297 + dobin notmuch-mutt
298 + # this manpage is built by pod2man
299 + doman notmuch-mutt.1
300 + insinto /etc/mutt
301 + doins notmuch-mutt.rc
302 + dodoc README-mutt
303 + popd > /dev/null || die
304 + fi
305 +
306 + local DOCS=( README{,.rst} INSTALL NEWS )
307 + einstalldocs
308 +
309 + if use python; then
310 + use doc && local HTML_DOCS=( bindings/python/docs/html/. )
311 + distutils-r1_src_install
312 + fi
313 +}
314 +
315 +pkg_preinst() {
316 + local _rcfile="/etc/mutt/notmuch-mutt.rc"
317 + if use mutt && ! [[ -e "${EROOT}"${_rcfile} ]]; then
318 + elog "To enable notmuch support in mutt, add the following line"
319 + elog "to your mutt config file:"
320 + elog ""
321 + elog " source ${_rcfile}"
322 + fi
323 +}
324 +
325 +pkg_postinst() {
326 + if use emacs; then
327 + elisp-site-regen
328 + xdg_desktop_database_update
329 + fi
330 +}
331 +
332 +pkg_postrm() {
333 + if use emacs; then
334 + elisp-site-regen
335 + xdg_desktop_database_update
336 + fi
337 +}