]> git.pld-linux.org Git - packages/uwsgi.git/blame - uwsgi.spec
Version: 2.0.10
[packages/uwsgi.git] / uwsgi.spec
CommitLineData
635d4df2 1
8c88d03f
JK
2%bcond_without xml
3%bcond_without yaml
4%bcond_without zeromq
5%bcond_without ssl
6%bcond_without pcre
7%bcond_without routing
8%bcond_without matheval
b698a6be
JK
9%bcond_without python2
10%bcond_without python3
8c88d03f
JK
11%bcond_with json
12
fb7b42d0 13# TODO:
7b5bd0fa 14# - pl desc
134b53b7 15# - apache, module?
59ca712c
JK
16# - 'gevent' plugin depends on python and works only after python plugin is loaded
17# this can probably be fixed by better linking
18
4dbfa3ab 19Summary: Fast WSGI server
20Summary(pl.UTF-8): Szybki serwer WSGI
21Name: uwsgi
3c58037d 22Version: 2.0.10
fd3962bc 23Release: 1
4dbfa3ab 24License: GPL v2
25Group: Networking/Daemons
26Source0: http://projects.unbit.it/downloads/%{name}-%{version}.tar.gz
3c58037d 27# Source0-md5: 7a9be0db5f6a8d4150dc5e9e0517ce80
7b5bd0fa 28Source1: %{name}.init
0eec4912
JK
29Source2: emperor.ini
30Source3: %{name}.tmpfiles
a2e939cb 31Source4: %{name}.service
b698a6be 32Patch0: %{name}-plugin_build_dir.patch
4dbfa3ab 33URL: http://projects.unbit.it/uwsgi/
8c88d03f
JK
34%{?with_xml:BuildRequires: libxml2-devel}
35%{?with_yaml:BuildRequires: yaml-devel}
36%{?with_json:BuildRequires: jansson-devel}
37%{?with_zeromq:BuildRequires: zeromq-devel}
38%{?with_ssl:BuildRequires: openssl-devel}
39%{?with_matheval:BuildRequires: libmatheval-devel}
40%{!?with_matheval:BuildConflicts: libmatheval-devel}
41%if %{with pcre} || %{with routing}
42BuildRequires: pcre-devel
43%endif
44BuildRequires: libcap-devel
45BuildRequires: libuuid-devel
46BuildRequires: zlib-devel
635d4df2 47BuildRequires: python-modules
b698a6be
JK
48%if %{with python2}
49BuildRequires: python-devel >= 1:2.7
50%endif
51%if %{with python3}
52BuildRequires: python3-devel >= 1:2.7
53BuildRequires: python3-modules
54%endif
a2e939cb
JK
55Requires(post,preun): /sbin/chkconfig
56Requires(postun): /usr/sbin/groupdel
57Requires(postun): /usr/sbin/userdel
58Requires(pre): /bin/id
59Requires(pre): /usr/bin/getgid
60Requires(pre): /usr/sbin/groupadd
61Requires(pre): /usr/sbin/useradd
62Requires: rc-scripts >= 0.4.3.0
63Requires: systemd-units >= 38
0eec4912 64Suggests: uwsgi-plugin-python
4dbfa3ab 65BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
66
b698a6be
JK
67%define pyver %(echo %{py_ver} | tr -d .)
68%define py3ver %(echo %{py3_ver} | tr -d .)
69
380ddf7d
JK
70%define _noautoprovfiles %{_libdir}/%{name}/.*
71
4dbfa3ab 72%description
73uWSGI is a fast (pure C), self-healing, developer-friendly WSGI
74server, aimed for professional python webapps deployment and
75development. Over time it has evolved in a complete stack for
76networked/clustered python applications, implementing message/object
77passing and process management. It uses the uwsgi (all lowercase)
78protocol for all the networking/interprocess communications. From the
790.9.5 release it includes a plugin loading technology that can be used
80to add support for other languages or platform. A Lua wsapi adaptor, a
81PSGI handler and an Erlang message exchanger are already available.
82
b698a6be
JK
83%package plugin-python
84Summary: Python 2.x plugin for uWSGI
85Group: Networking/Daemons
86Requires: %{name} = %{version}-%{release}
87
88%description plugin-python
89Python 2.x plugin for uWSGI.
90
91%package plugin-python3
92Summary: Python 3.x plugin for uWSGI
93Group: Networking/Daemons
94Requires: %{name} = %{version}-%{release}
95
96%description plugin-python3
97Python 3.x plugin for uWSGI.
98
4dbfa3ab 99%prep
100%setup -q
101
b698a6be
JK
102%patch0 -p1
103
4dbfa3ab 104%build
8c88d03f
JK
105cat >buildconf/pld.ini <<EOF
106[uwsgi]
b698a6be
JK
107main_plugin =
108embedded_plugins =
8c88d03f 109inherit = base
b698a6be 110plugin_dir = %{_libdir}/uwsgi
8c88d03f
JK
111
112xml = %{?with_xml:true}%{!?with_xml:false}
113yaml = %{?with_yaml:true}%{!?with_yaml:false}
114zeromq = %{?with_zeromq:true}%{!?with_zeromq:false}
115ssl = %{?with_ssl:true}%{!?with_ssl:false}
116pcre = %{?with_pcre:true}%{!?with_pcre:false}
117routing = %{?with_routing:true}%{!?with_routing:false}
118matheval = %{?with_matheval:true}%{!?with_matheval:false}
119json = %{?with_json:true}%{!?with_json:false}
120
121%{?with_xml:xml_implementation = libxml2}
122EOF
123
124%{__python} uwsgiconfig.py --build pld
4dbfa3ab 125
b698a6be
JK
126# base plugin list from buildconf/base.ini
127for plugin in \
128 ping cache nagios rrdtool carbon rpc corerouter \
129 fastrouter http ugreen signal syslog rsyslog logsocket \
130 router_uwsgi router_redirect router_basicauth zergpool \
131 redislog mongodblog router_rewrite router_http logfile \
132 router_cache rawrouter router_static sslrouter spooler \
133 cheaper_busyness symcall transformation_tofile \
134 transformation_gzip transformation_chunked \
135 transformation_offload router_memcached router_redis \
136 router_hash ; do
137
138 %{__python} uwsgiconfig.py --plugin plugins/${plugin} pld ${plugin}
139done
140
7565c7ee
JK
141# extra non-base plugins
142for plugin in cgi ; do
143 %{__python} uwsgiconfig.py --plugin plugins/${plugin} pld ${plugin}
144done
145
b698a6be
JK
146%if %{with python2}
147%{__python} uwsgiconfig.py --plugin plugins/python pld python%{pyver}
59ca712c 148%{__python} uwsgiconfig.py --plugin plugins/gevent pld gevent_py%{pyver}
b698a6be
JK
149%endif
150%if %{with python3}
151%{__python3} uwsgiconfig.py --plugin plugins/python pld python%{py3ver}
59ca712c 152%{__python3} uwsgiconfig.py --plugin plugins/gevent pld gevent_py%{py3ver}
b698a6be
JK
153%endif
154
4dbfa3ab 155%install
156rm -rf $RPM_BUILD_ROOT
b698a6be
JK
157install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir}/%{name}} \
158 $RPM_BUILD_ROOT{%{_sysconfdir}/rc.d/init.d,%{_sysconfdir}/sysconfig} \
0eec4912 159 $RPM_BUILD_ROOT{%{_sysconfdir}/uwsgi/vassals,/var/{run/uwsgi,log}} \
a2e939cb 160 $RPM_BUILD_ROOT{%{systemdtmpfilesdir},%{systemdunitdir}}
b698a6be 161
7b5bd0fa 162touch $RPM_BUILD_ROOT/var/log/%{name}.log
5ac287b5 163install uwsgi $RPM_BUILD_ROOT%{_bindir}
7b5bd0fa 164install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name}
0eec4912
JK
165install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/uwsgi/emperor.ini
166install %{SOURCE3} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
a2e939cb 167install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
4dbfa3ab 168
b698a6be
JK
169install *_plugin.so $RPM_BUILD_ROOT%{_libdir}/%{name}
170
59ca712c 171# the symlinks must be absolute – otherwise strange things happen in strace
b698a6be 172%if %{with python2}
59ca712c
JK
173ln -s %{_libdir}/%{name}/python%{pyver}_plugin.so $RPM_BUILD_ROOT%{_libdir}/%{name}/python_plugin.so
174ln -s %{_libdir}/%{name}/gevent_py%{pyver}_plugin.so $RPM_BUILD_ROOT%{_libdir}/%{name}/gevent_plugin.so
b698a6be
JK
175%endif
176%if %{with python3}
59ca712c
JK
177ln -s %{_libdir}/%{name}/python%{py3ver}_plugin.so $RPM_BUILD_ROOT%{_libdir}/%{name}/python3_plugin.so
178ln -s %{_libdir}/%{name}/gevent_py%{py3ver}_plugin.so $RPM_BUILD_ROOT%{_libdir}/%{name}/gevent_py3_plugin.so
b698a6be
JK
179%endif
180
4dbfa3ab 181%clean
182rm -rf $RPM_BUILD_ROOT
183
7b5bd0fa
ŁC
184%pre
185%groupadd -r -g 270 %{name}
186%useradd -r -u 270 -d /usr/share/empty -s /bin/false -c "uWSGI User" -g %{name} %{name}
187
188%post
189/sbin/chkconfig --add %{name}
190touch /var/log/%{name}.log
191chown uwsgi:uwsgi /var/log/%{name}.log
192chmod 644 /var/log/%{name}.log
193%service %{name} restart
a2e939cb 194%systemd_post %{name}.service
7b5bd0fa
ŁC
195
196%preun
197if [ "$1" = "0" ];then
198 %service %{name} stop
199 /sbin/chkconfig --del %{name}
200fi
a2e939cb 201%systemd_preun %{name}.service
7b5bd0fa
ŁC
202
203%postun
204if [ "$1" = "0" ]; then
205 %userremove %{name}
206 %groupremove %{name}
207fi
a2e939cb 208%systemd_reload
7b5bd0fa 209
0eec4912
JK
210%triggerpostun -- %{name} < 1.9.12-1.1
211UWSGI_CONFIG_FORMAT="xml"
212[ -f /etc/sysconfig/uwsgi.rpmsave ] && . /etc/sysconfig/uwsgi.rpmsave || :
213if [ "$UWSGI_CONFIG_FORMAT" = "xml" ] ; then
214 if [ -f /etc/uwsgi/uwsgi.xml.rpmsave ] ; then
215 sed -e 's/<daemonize>.*<\/daemonize>//' \
216 -e 's/<uwsgi>/<uwsgi>\n<plugins>python,gevent,ping,cache,nagios,rrdtool,carbon,rpc,corerouter,fastrouter,http,ugreen,signal,syslog,rsyslog,logsocket,router_uwsgi,router_redirect,router_basicauth,zergpool,redislog,mongodblog,router_rewrite,router_http,logfile,router_cache,rawrouter<\/plugins>/' \
217 < /etc/uwsgi/uwsgi.xml.rpmsave \
218 > /etc/uwsgi/vassals/uwsgi.xml || :
219 else
220 cat >/etc/uwsgi/vassals/uwsgi.xml << 'EOF'
221<uwsgi>
222 <plugins>python,gevent,ping,cache,nagios,rrdtool,carbon,rpc,corerouter,fastrouter,http,ugreen,signal,syslog,rsyslog,logsocket,router_uwsgi,router_redirect,router_basicauth,zergpool,redislog,mongodblog,router_rewrite,router_http,logfile,router_cache,rawrouter</plugins>
223 <pidfile>/var/run/uwsgi/uwsgi.pid</pidfile>
224 <uid>uwsgi</uid>
225 <gid>uwsgi</gid>
226 <socket>/var/run/uwsgi/uwsgi.sock</socket>
227</uwsgi>
228EOF
229 fi
230elif [ "$UWSGI_CONFIG_FORMAT" = "ini" ] ; then
231 if [ -f /etc/uwsgi/uwsgi.ini.rpmsave ] ; then
232 mv /etc/uwsgi/vassals/uwsgi.ini{,.rpmorig}
233 sed -e 's/[ \t]*daemonize.*//' \
234 -e 's/^\[uwsgi\]/[uwsgi]\nplugins=python,gevent,ping,cache,nagios,rrdtool,carbon,rpc,corerouter,fastrouter,http,ugreen,signal,syslog,rsyslog,logsocket,router_uwsgi,router_redirect,router_basicauth,zergpool,redislog,mongodblog,router_rewrite,router_http,logfile,router_cache,rawrouter/' \
235 < /etc/uwsgi/uwsgi.ini.rpmsave \
236 > /etc/uwsgi/vassals/uwsgi.ini || :
237 else
238 cat >/etc/uwsgi/vassals/uwsgi.ini << 'EOF'
239[uwsgi]
240plugins = python,gevent,ping,cache,nagios,rrdtool,carbon,rpc,corerouter,fastrouter,http,ugreen,signal,syslog,rsyslog,logsocket,router_uwsgi,router_redirect,router_basicauth,zergpool,redislog,mongodblog,router_rewrite,router_http,logfile,router_cache,rawrouter
241socket = /var/run/uwsgi/uwsgi.sock
242uid = uwsgi
243gid = uwsgi
244pidfile = /var/run/uwsgi/uwsgi.pid
245EOF
246 fi
247fi
248
249if [ -f /var/run/uwsgi/uwsgi.pid ] ; then
250 # for the service restart to work
251 mv /var/run/uwsgi/uwsgi.pid /var/run/uwsgi-emperor.pid || :
252fi
253
254%banner -e %{name} << 'EOF'
255uWSGI instance configuration has been moved to
256the %{_sysconfdir}/%{name}/vassals directory and
257updated to be started via uWSGI emperor with loadable plugins.
258
259The automatic configuration update might have failed, though.
260
261You should probably install uwsgi-plugin-python too.
262EOF
0eec4912 263%service %{name} restart
a2e939cb 264%systemd_trigger %{name}.service
0eec4912 265
4dbfa3ab 266%files
267%defattr(644,root,root,755)
44740c10 268%doc README
bb5f8c47 269%attr(755,root,root) %{_bindir}/uwsgi
b9f650ca 270%{systemdtmpfilesdir}/%{name}.conf
a2e939cb 271%{systemdunitdir}/%{name}.service
0eec4912
JK
272%dir %{_sysconfdir}/%{name}
273%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/uwsgi/emperor.ini
274%dir %{_sysconfdir}/%{name}/vassals
7b5bd0fa
ŁC
275%attr(754,root,root) /etc/rc.d/init.d/%{name}
276%attr(755,uwsgi,uwsgi) %dir /var/run/uwsgi
277%attr(644,uwsgi,uwsgi) %ghost /var/log/%{name}.log
b698a6be
JK
278%dir %{_libdir}/%{name}
279%{_libdir}/%{name}/cache_plugin.so
280%{_libdir}/%{name}/carbon_plugin.so
7565c7ee 281%{_libdir}/%{name}/cgi_plugin.so
b698a6be
JK
282%{_libdir}/%{name}/cheaper_busyness_plugin.so
283%{_libdir}/%{name}/corerouter_plugin.so
284%{_libdir}/%{name}/fastrouter_plugin.so
285%{_libdir}/%{name}/http_plugin.so
286%{_libdir}/%{name}/logfile_plugin.so
287%{_libdir}/%{name}/logsocket_plugin.so
288%{_libdir}/%{name}/mongodblog_plugin.so
289%{_libdir}/%{name}/nagios_plugin.so
290%{_libdir}/%{name}/ping_plugin.so
291%{_libdir}/%{name}/rawrouter_plugin.so
292%{_libdir}/%{name}/redislog_plugin.so
293%{_libdir}/%{name}/router_basicauth_plugin.so
294%{_libdir}/%{name}/router_cache_plugin.so
295%{_libdir}/%{name}/router_hash_plugin.so
296%{_libdir}/%{name}/router_http_plugin.so
297%{_libdir}/%{name}/router_memcached_plugin.so
298%{_libdir}/%{name}/router_redirect_plugin.so
299%{_libdir}/%{name}/router_redis_plugin.so
300%{_libdir}/%{name}/router_rewrite_plugin.so
301%{_libdir}/%{name}/router_static_plugin.so
302%{_libdir}/%{name}/router_uwsgi_plugin.so
303%{_libdir}/%{name}/rpc_plugin.so
304%{_libdir}/%{name}/rrdtool_plugin.so
305%{_libdir}/%{name}/rsyslog_plugin.so
306%{_libdir}/%{name}/signal_plugin.so
307%{_libdir}/%{name}/spooler_plugin.so
308%{_libdir}/%{name}/sslrouter_plugin.so
309%{_libdir}/%{name}/symcall_plugin.so
310%{_libdir}/%{name}/syslog_plugin.so
311%{_libdir}/%{name}/transformation_chunked_plugin.so
312%{_libdir}/%{name}/transformation_gzip_plugin.so
313%{_libdir}/%{name}/transformation_offload_plugin.so
314%{_libdir}/%{name}/transformation_tofile_plugin.so
315%{_libdir}/%{name}/ugreen_plugin.so
316%{_libdir}/%{name}/zergpool_plugin.so
317
318%files plugin-python
319%defattr(644,root,root,755)
320%{_libdir}/%{name}/python_plugin.so
321%{_libdir}/%{name}/python%{pyver}_plugin.so
322%{_libdir}/%{name}/gevent_py%{pyver}_plugin.so
323%{_libdir}/%{name}/gevent_plugin.so
324
325%files plugin-python3
326%defattr(644,root,root,755)
327%{_libdir}/%{name}/python3_plugin.so
328%{_libdir}/%{name}/python%{py3ver}_plugin.so
329%{_libdir}/%{name}/gevent_py%{py3ver}_plugin.so
330%{_libdir}/%{name}/gevent_py3_plugin.so
This page took 0.178746 seconds and 4 git commands to generate.