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