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