Gentoo Archives: gentoo-commits

From: Alexys Jacob <ultrabug@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/uwsgi/
Date: Wed, 18 Jul 2018 09:41:22
Message-Id: 1531906869.21d72828fb3f83bb934bedd3aa204e262728da92.ultrabug@gentoo
1 commit: 21d72828fb3f83bb934bedd3aa204e262728da92
2 Author: Ultrabug <ultrabug <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 18 09:40:41 2018 +0000
4 Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 18 09:41:09 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21d72828
7
8 www-servers/uwsgi: version bump, add python3.7 support
9
10 Package-Manager: Portage-2.3.43, Repoman-2.3.10
11
12 www-servers/uwsgi/Manifest | 1 +
13 www-servers/uwsgi/uwsgi-2.0.17.1.ebuild | 410 ++++++++++++++++++++++++++++++++
14 2 files changed, 411 insertions(+)
15
16 diff --git a/www-servers/uwsgi/Manifest b/www-servers/uwsgi/Manifest
17 index 7656478b184..9aa577b098b 100644
18 --- a/www-servers/uwsgi/Manifest
19 +++ b/www-servers/uwsgi/Manifest
20 @@ -1 +1,2 @@
21 +DIST uwsgi-2.0.17.1.tar.gz 800156 BLAKE2B a8697263e6e7689c0062a06a9fdb1101a2df72e0ac9122b5f8a0acc78bbdbdeaa96faa1c8870b9c3a43e2e1fb5fc835e708e1bc3d0171ae746467b4734dc299d SHA512 10d357961fde3a3f5f8e77986cc647313f95a33243e24c2afc482fce21df68a8ae48f90e7b5b76d7edc3cf8fd474d99823d6d60ef7477349abc65a319222f11b
22 DIST uwsgi-2.0.17.tar.gz 798642 BLAKE2B 86efb2103efaeedb37ebb00de4c01477162d119ae3dea0dc0696385216e30ff2c74eb48576f86eb181b8ada4b9eaa63b0aa761e966e3301597633d33b81142e1 SHA512 639427fbb89a1c2610c1cafb6ff009398a3c0a8e27c3de3f00829428271ba97b64b1253368dd6150912cf44441052be2a63cbe81613bbe964be27ee2e570d2b2
23
24 diff --git a/www-servers/uwsgi/uwsgi-2.0.17.1.ebuild b/www-servers/uwsgi/uwsgi-2.0.17.1.ebuild
25 new file mode 100644
26 index 00000000000..623312528d1
27 --- /dev/null
28 +++ b/www-servers/uwsgi/uwsgi-2.0.17.1.ebuild
29 @@ -0,0 +1,410 @@
30 +# Copyright 1999-2018 Gentoo Foundation
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=6
34 +
35 +PYTHON_COMPAT=( python2_7 python3_{4,5,6,7} pypy )
36 +PYTHON_REQ_USE="threads(+)"
37 +
38 +RUBY_OPTIONAL="yes"
39 +USE_RUBY="ruby22 ruby23 ruby24"
40 +
41 +PHP_EXT_INI="no"
42 +PHP_EXT_NAME="dummy"
43 +PHP_EXT_OPTIONAL_USE="php"
44 +USE_PHP="php5-6 php7-0 php7-1 php7-2" # deps must be registered separately below
45 +
46 +MY_P="${P/_/-}"
47 +
48 +inherit apache-module eutils flag-o-matic multilib pax-utils php-ext-source-r3 python-r1 ruby-ng versionator
49 +
50 +DESCRIPTION="uWSGI server for Python web applications"
51 +HOMEPAGE="http://projects.unbit.it/uwsgi/"
52 +SRC_URI="https://github.com/unbit/uwsgi/archive/${PV}.tar.gz -> ${P}.tar.gz"
53 +
54 +LICENSE="GPL-2"
55 +SLOT="0"
56 +KEYWORDS="~amd64 ~x86 ~amd64-linux"
57 +
58 +UWSGI_PLUGINS_STD=( ping cache carbon nagios rpc rrdtool
59 + http ugreen signal syslog rsyslog
60 + router_{uwsgi,redirect,basicauth,rewrite,http,cache,static,memcached,redis,hash,expires,metrics}
61 + {core,fast,raw,ssl}router
62 + redislog mongodblog log{file,socket}
63 + spooler cheaper_busyness symcall
64 + transformation_{chunked,gzip,offload,tofile}
65 + zergpool )
66 +UWSGI_PLUGINS_OPT=( alarm_{curl,xmpp} clock_{monotonic,realtime} curl_cron
67 + dumbloop echo emperor_{amqp,pg,zeromq} forkptyrouter
68 + geoip graylog2 legion_cache_fetch ldap log{crypto,pipe} notfound pam
69 + rados router_{access,radius,spnego,xmldir}
70 + sqlite ssi stats_pusher_statsd
71 + systemd_logger transformation_toupper tuntap webdav xattr xslt zabbix )
72 +
73 +LANG_SUPPORT_SIMPLE=( cgi mono perl ) # plugins which can be built in the main build process
74 +LANG_SUPPORT_EXTENDED=( go lua php pypy python python_asyncio python_gevent ruby )
75 +
76 +# plugins to be ignored (for now):
77 +# cheaper_backlog2: example plugin
78 +# coroae: TODO
79 +# cplusplus: partially example code, needs explicit class
80 +# dummy: no idea
81 +# example: example plugin
82 +# exception_log: example plugin
83 +# *java*: TODO
84 +# v8: TODO
85 +# matheval: TODO
86 +IUSE="apache2 +caps debug +embedded expat jemalloc json libressl +pcre +routing selinux +ssl +xml yajl yaml zeromq"
87 +
88 +for plugin in ${UWSGI_PLUGINS_STD[@]}; do IUSE="${IUSE} +uwsgi_plugins_${plugin}"; done
89 +for plugin in ${UWSGI_PLUGINS_OPT[@]}; do IUSE="${IUSE} uwsgi_plugins_${plugin}"; done
90 +IUSE="${IUSE} ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]}"
91 +
92 +REQUIRED_USE="|| ( ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]} )
93 + uwsgi_plugins_logcrypto? ( ssl )
94 + uwsgi_plugins_sslrouter? ( ssl )
95 + routing? ( pcre )
96 + uwsgi_plugins_emperor_zeromq? ( zeromq )
97 + uwsgi_plugins_forkptyrouter? ( uwsgi_plugins_corerouter )
98 + uwsgi_plugins_router_xmldir? ( xml !expat )
99 + pypy? ( python_targets_python2_7 )
100 + python? ( ${PYTHON_REQUIRED_USE} )
101 + python_asyncio? ( || ( python_targets_python3_4 python_targets_python3_5 python_targets_python3_6 python_targets_python3_7 ) python_gevent )
102 + python_gevent? ( python )
103 + expat? ( xml )"
104 +
105 +# util-linux is required for libuuid when requesting zeromq support
106 +# Order:
107 +# 1. Unconditional
108 +# 2. General features
109 +# 3. Plugins
110 +# 4. Language/app support
111 +CDEPEND="sys-libs/zlib
112 + caps? ( sys-libs/libcap )
113 + json? ( !yajl? ( dev-libs/jansson )
114 + yajl? ( dev-libs/yajl ) )
115 + pcre? ( dev-libs/libpcre:3 )
116 + ssl? (
117 + !libressl? ( dev-libs/openssl:0 )
118 + libressl? ( dev-libs/libressl )
119 + )
120 + xml? ( !expat? ( dev-libs/libxml2 )
121 + expat? ( dev-libs/expat ) )
122 + yaml? ( dev-libs/libyaml )
123 + zeromq? ( net-libs/zeromq sys-apps/util-linux )
124 + uwsgi_plugins_alarm_curl? ( net-misc/curl )
125 + uwsgi_plugins_alarm_xmpp? ( net-libs/gloox )
126 + uwsgi_plugins_curl_cron? ( net-misc/curl )
127 + uwsgi_plugins_emperor_pg? ( dev-db/postgresql:= )
128 + uwsgi_plugins_geoip? ( dev-libs/geoip )
129 + uwsgi_plugins_ldap? ( net-nds/openldap )
130 + uwsgi_plugins_pam? ( virtual/pam )
131 + uwsgi_plugins_sqlite? ( dev-db/sqlite:3 )
132 + uwsgi_plugins_rados? ( sys-cluster/ceph )
133 + uwsgi_plugins_router_access? ( sys-apps/tcp-wrappers )
134 + uwsgi_plugins_router_spnego? ( virtual/krb5 )
135 + uwsgi_plugins_systemd_logger? ( sys-apps/systemd )
136 + uwsgi_plugins_webdav? ( dev-libs/libxml2 )
137 + uwsgi_plugins_xslt? ( dev-libs/libxslt )
138 + go? ( dev-lang/go:=[gccgo] )
139 + lua? ( dev-lang/lua:= )
140 + mono? ( =dev-lang/mono-4* )
141 + perl? ( dev-lang/perl:= )
142 + php? (
143 + php_targets_php5-6? ( dev-lang/php:5.6[embed] )
144 + php_targets_php7-0? ( dev-lang/php:7.0[embed] )
145 + php_targets_php7-1? ( dev-lang/php:7.1[embed] )
146 + php_targets_php7-2? ( dev-lang/php:7.2[embed] )
147 + )
148 + pypy? ( virtual/pypy )
149 + python? ( ${PYTHON_DEPS} )
150 + python_gevent? ( >=dev-python/gevent-1.3.5[${PYTHON_USEDEP}] )
151 + ruby? ( $(ruby_implementations_depend) )"
152 +DEPEND="${CDEPEND}
153 + virtual/pkgconfig"
154 +RDEPEND="${CDEPEND}
155 + selinux? ( sec-policy/selinux-uwsgi )
156 + uwsgi_plugins_rrdtool? ( net-analyzer/rrdtool )"
157 +
158 +want_apache2
159 +
160 +S="${WORKDIR}/${MY_P}"
161 +APXS2_S="${S}/apache2"
162 +APACHE2_MOD_CONF="42_mod_uwsgi-r2 42_mod_uwsgi"
163 +
164 +src_unpack() {
165 + default
166 +}
167 +
168 +pkg_setup() {
169 + python_setup
170 + use ruby && ruby-ng_pkg_setup
171 + depend.apache_pkg_setup
172 +}
173 +
174 +src_prepare() {
175 + default
176 +
177 + sed -i \
178 + -e "s|'-O2', ||" \
179 + -e "s|'-Werror', ||" \
180 + -e "s|uc.get('plugin_dir')|uc.get('plugin_build_dir')|" \
181 + uwsgiconfig.py || die "sed failed"
182 +
183 + sed -i \
184 + -e "s|/lib|/$(get_libdir)|" \
185 + plugins/php/uwsgiplugin.py || die "sed failed"
186 +}
187 +
188 +src_configure() {
189 + local embedded_plugins=()
190 + local plugins=()
191 + local malloc_impl="libc"
192 + local json="false"
193 + local xml="false"
194 +
195 + for p in ${UWSGI_PLUGINS_STD[@]} ${UWSGI_PLUGINS_OPT[@]} ; do
196 + use uwsgi_plugins_${p} && embedded_plugins+=("${p}")
197 + done
198 + for p in ${LANG_SUPPORT_SIMPLE[@]} ; do
199 + use ${p} && plugins+=("${p}")
200 + done
201 +
202 + # do not embed any plugins
203 + if ! use embedded; then
204 + plugins=( ${plugins[@]} ${embedded_plugins[@]} )
205 + embedded_plugins=()
206 + fi
207 +
208 + # flatten the arrays
209 + plugins=${plugins[@]}
210 + embedded_plugins=${embedded_plugins[@]}
211 +
212 + # rename some of the use flags, language plugins are always real plugins
213 + plugins="${plugins/perl/psgi}"
214 + plugins="${plugins/sqlite/sqlite3}"
215 + embedded_plugins="${embedded_plugins/sqlite/sqlite3}"
216 +
217 + # override defaults as requested by the user
218 + if use xml; then
219 + use expat && xml="expat" || xml="libxml2"
220 + fi
221 + if use json; then
222 + use yajl && json="yajl" || json="jansson"
223 + fi
224 + use jemalloc && malloc_impl="jemalloc"
225 +
226 + # prepare the buildconf for gentoo
227 + cp "${FILESDIR}"/gentoo.buildconf buildconf/gentoo.ini || die
228 + sed -i \
229 + -e "s|VAR_XML|${xml}|" \
230 + -e "s|VAR_YAML|$(usex yaml libyaml true)|" \
231 + -e "s|VAR_JSON|${json}|" \
232 + -e "s|VAR_SSL|$(usex ssl true false)|" \
233 + -e "s|VAR_PCRE|$(usex pcre true false)|" \
234 + -e "s|VAR_ZMQ|$(usex zeromq true false)|" \
235 + -e "s|VAR_ROUTING|$(usex routing true false)|" \
236 + -e "s|VAR_DEBUG|$(usex debug true false)|" \
237 + -e "s|VAR_MALLOC|${malloc_impl}|" \
238 + -e "s|VAR_PLUGINS|${plugins// /, }|" \
239 + -e "s|VAR_PLUGIN_DIR|${EPREFIX}/usr/$(get_libdir)/uwsgi|" \
240 + -e "s|VAR_BUILD_DIR|${T}/plugins|" \
241 + -e "s|VAR_EMBEDDED|${embedded_plugins// /, }|" \
242 + buildconf/gentoo.ini || die "sed failed"
243 +
244 + if ! use caps; then
245 + sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed"
246 + fi
247 +
248 + if ! use zeromq; then
249 + sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed"
250 + fi
251 +
252 + if use uwsgi_plugins_emperor_pg ; then
253 + PGPV="$(best_version dev-db/postgresql)"
254 + PGSLOT="$(get_version_component_range 1-2 ${PGPV##dev-db/postgresql-})"
255 + sed -i \
256 + -e "s|pg_config|pg_config${PGSLOT/.}|" \
257 + plugins/emperor_pg/uwsgiplugin.py || die "sed failed"
258 + fi
259 +}
260 +
261 +each_ruby_compile() {
262 + cd "${WORKDIR}/${MY_P}" || die "sed failed"
263 +
264 + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rack gentoo rack_${RUBY##*/} || die "building plugin for ${RUBY} failed"
265 + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/fiber gentoo fiber_${RUBY##*/}|| die "building fiber plugin for ${RUBY} failed"
266 + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rbthreads gentoo rbthreads_${RUBY##*/}|| die "building rbthreads plugin for ${RUBY} failed"
267 +}
268 +
269 +python_compile_plugins() {
270 + local EPYV
271 + local PYV
272 + EPYV=${EPYTHON/.}
273 + PYV=${EPYV/python}
274 +
275 + if [[ ${EPYTHON} == pypy* ]]; then
276 + einfo "skipping because pypy is not meant to build plugins on its own"
277 + return
278 + fi
279 +
280 + ${PYTHON} uwsgiconfig.py --plugin plugins/python gentoo ${EPYV} || die "building plugin for ${EPYTHON} failed"
281 +
282 + if use python_asyncio ; then
283 + if [[ "${PYV}" == "34" || "${PYV}" == "35" ]] ; then
284 + ${PYTHON} uwsgiconfig.py --plugin plugins/asyncio gentoo asyncio${PYV} || die "building plugin for asyncio-support in ${EPYTHON} failed"
285 + fi
286 + fi
287 +
288 + if use python_gevent ; then
289 + ${PYTHON} uwsgiconfig.py --plugin plugins/gevent gentoo gevent${PYV} || die "building plugin for gevent-support in ${EPYTHON} failed"
290 + fi
291 +
292 + if use pypy ; then
293 + if [[ "${PYV}" == "27" ]] ; then
294 + # TODO: do some proper patching ? The wiki didn't help... I gave up for now.
295 + # QA: RWX --- --- usr/lib64/uwsgi/pypy_plugin.so
296 + append-ldflags -Wl,-z,noexecstack
297 + ${PYTHON} uwsgiconfig.py --plugin plugins/pypy gentoo pypy || die "building plugin for pypy-support in ${EPYTHON} failed"
298 + fi
299 + fi
300 +}
301 +
302 +python_install_symlinks() {
303 + dosym uwsgi /usr/bin/uwsgi_${EPYTHON/.}
304 +}
305 +
306 +src_compile() {
307 + mkdir -p "${T}/plugins" || die
308 +
309 + python uwsgiconfig.py --build gentoo || die "building uwsgi failed"
310 +
311 + if use go ; then
312 + python uwsgiconfig.py --plugin plugins/gccgo gentoo || die "building plugin for go failed"
313 + fi
314 +
315 + if use lua ; then
316 + # setting the name for the pkg-config file to lua, since we don't have
317 + # slotted lua
318 + UWSGICONFIG_LUAPC="lua" python uwsgiconfig.py --plugin plugins/lua gentoo || die "building plugin for lua failed"
319 + fi
320 +
321 + if use php ; then
322 + for s in $(php_get_slots); do
323 + UWSGICONFIG_PHPDIR="/usr/$(get_libdir)/${s}" python uwsgiconfig.py --plugin plugins/php gentoo ${s/.} || die "building plugin for ${s} failed"
324 + done
325 + fi
326 +
327 + if use python ; then
328 + python_foreach_impl python_compile_plugins
329 + fi
330 +
331 + if use ruby ; then
332 + ruby-ng_src_compile
333 + fi
334 +
335 + if use apache2 ; then
336 + for m in proxy_uwsgi Ruwsgi uwsgi ; do
337 + APXS2_ARGS="-c mod_${m}.c"
338 + apache-module_src_compile
339 + done
340 + fi
341 +}
342 +
343 +src_install() {
344 + dobin uwsgi
345 + pax-mark m "${D}"/usr/bin/uwsgi
346 +
347 + insinto /usr/$(get_libdir)/uwsgi
348 + doins "${T}/plugins"/*.so
349 +
350 + use cgi && dosym uwsgi /usr/bin/uwsgi_cgi
351 + use go && dosym uwsgi /usr/bin/uwsgi_go
352 + use lua && dosym uwsgi /usr/bin/uwsgi_lua
353 + use mono && dosym uwsgi /usr/bin/uwsgi_mono
354 + use perl && dosym uwsgi /usr/bin/uwsgi_psgi
355 +
356 + if use php ; then
357 + for s in $(php_get_slots); do
358 + dosym uwsgi /usr/bin/uwsgi_${s/.}
359 + done
360 + fi
361 +
362 + if use python ; then
363 + python_foreach_impl python_install_symlinks
364 + python_foreach_impl python_domodule uwsgidecorators.py
365 + fi
366 +
367 + if use apache2; then
368 + for m in proxy_uwsgi Ruwsgi uwsgi ; do
369 + APACHE2_MOD_FILE="${APXS2_S}/.libs/mod_${m}.so"
370 + apache-module_src_install
371 + done
372 + fi
373 +
374 + newinitd "${FILESDIR}"/uwsgi.initd-r7 uwsgi
375 + newconfd "${FILESDIR}"/uwsgi.confd-r4 uwsgi
376 + keepdir /etc/"${PN}".d
377 + use uwsgi_plugins_spooler && keepdir /var/spool/"${PN}"
378 +}
379 +
380 +pkg_postinst() {
381 + if use apache2 ; then
382 + elog "Three Apache modules have been installed: mod_proxy_uwsgi, mod_uwsgi and mod_Ruwsgi."
383 + elog "You can enable them with -D PROXY_UWSGI, -DUWSGI or -DRUWSGI in /etc/conf.d/apache2."
384 + elog "mod_uwsgi and mod_Ruwsgi have the same configuration interface and define the same symbols."
385 + elog "Therefore you can enable only one of them at a time."
386 + elog "mod_uwsgi is commercially supported by Unbit and stable but a bit hacky."
387 + elog "mod_Ruwsgi is newer and more Apache-API friendly but not commercially supported."
388 + elog "mod_proxy_uwsgi is a proxy module, considered stable and is now the recommended module."
389 + fi
390 +
391 + elog "Append the following options to the uwsgi call to load the respective language plugin:"
392 + use cgi && elog " '--plugins cgi' for cgi"
393 + use lua && elog " '--plugins lua' for lua"
394 + use mono && elog " '--plugins mono' for mono"
395 + use perl && elog " '--plugins psgi' for perl"
396 +
397 + if use php ; then
398 + for s in $(php_get_slots); do
399 + elog " '--plugins ${s/.}' for ${s}"
400 + done
401 + fi
402 +
403 + python_pkg_postinst() {
404 + local EPYV
405 + local PYV
406 + EPYV=${EPYTHON/.}
407 + PYV=${EPYV/python}
408 +
409 + if [[ ${EPYTHON} == pypy* ]] ; then
410 + elog " '--plugins pypy' for pypy"
411 + return
412 + fi
413 +
414 + elog " "
415 + elog " '--plugins ${EPYV}' for ${EPYTHON}"
416 + if use python_asyncio ; then
417 + if [[ ${EPYV} == python34 ]] ; then
418 + elog " '--plugins ${EPYV},asyncio${PYV}' for asyncio support in ${EPYTHON}"
419 + else
420 + elog " (asyncio is only supported in python3.4)"
421 + fi
422 + fi
423 + if use python_gevent ; then
424 + elog " '--plugins ${EPYV},gevent${PYV}' for gevent support in ${EPYTHON}"
425 + fi
426 + }
427 +
428 + use python && python_foreach_impl python_pkg_postinst
429 +
430 + if use ruby ; then
431 + for ruby in $USE_RUBY; do
432 + if use ruby_targets_${ruby} ; then
433 + elog " '--plugins rack_${ruby/.}' for ${ruby}"
434 + elog " '--plugins fiber_${ruby/.}' for ${ruby} fibers"
435 + elog " '--plugins rbthreads_${ruby/.}' for ${ruby} rbthreads"
436 + fi
437 + done
438 + fi
439 +}