]>
Commit | Line | Data |
---|---|---|
5fff4a25 | 1 | # TODO |
5fff4a25 ER |
2 | # - --daemonize crashes (works under systemd only): https://github.com/fedora-infra/fedmsg/issues/302 |
3 | ||
700057e3 ER |
4 | # Conditional build: |
5 | %bcond_with tests # build with tests | |
6 | ||
05c04de3 ER |
7 | %define module fedmsg |
8 | %define egg_name fedmsg | |
9 | %define pypi_name fedmsg | |
700057e3 ER |
10 | Summary: Tools for Fedora Infrastructure real-time messaging |
11 | Name: fedmsg | |
143a3b9d | 12 | Version: 1.1.1 |
118d11bb | 13 | Release: 1 |
700057e3 ER |
14 | License: LGPL v2+ |
15 | Group: Applications/Networking | |
05c04de3 | 16 | Source0: https://files.pythonhosted.org/packages/source/f/%{pypi_name}/%{pypi_name}-%{version}.tar.gz |
143a3b9d | 17 | # Source0-md5: 95d88c12d430b44a57d805b00a3b65b7 |
700057e3 | 18 | Source1: %{name}-tmpfiles.conf |
1c757b06 ER |
19 | Source2: %{name}-gateway.init |
20 | Source3: %{name}-hub.init | |
21 | Source4: %{name}-irc.init | |
22 | Source5: %{name}-relay.init | |
d803d01c | 23 | Patch1: config.patch |
5fff4a25 | 24 | URL: https://github.com/fedora-infra/fedmsg |
700057e3 | 25 | BuildRequires: python-devel |
700057e3 | 26 | BuildRequires: python-setuptools |
de043d79 | 27 | BuildRequires: rpm-pythonprov |
f3fe7ede | 28 | BuildRequires: rpmbuild(macros) >= 1.710 |
700057e3 ER |
29 | %if %{with tests} |
30 | BuildRequires: python-mock | |
31 | BuildRequires: python-nose | |
32 | BuildRequires: python-six | |
33 | # Only for the test-replay test which is patched out | |
34 | BuildRequires: python-M2Crypto | |
35 | BuildRequires: python-arrow | |
36 | BuildRequires: python-bunch | |
37 | BuildRequires: python-daemon | |
38 | BuildRequires: python-fabulous | |
39 | BuildRequires: python-fedora | |
40 | BuildRequires: python-m2ext | |
41 | BuildRequires: python-moksha-hub >= 1.3.2 | |
42 | BuildRequires: python-psutil | |
43 | BuildRequires: python-pygments | |
44 | BuildRequires: python-requests | |
45 | #BuidlRequires: python-sqlalchemy | |
46 | %endif | |
fc495cef | 47 | Requires: python-M2Crypto >= 0.22.5 |
700057e3 ER |
48 | Requires: python-arrow |
49 | #Requires: python-daemon | |
50 | #Requires: python-fabulous | |
51 | #Requires: python-fedora | |
52 | Requires: python-kitchen | |
53 | Requires: python-m2ext | |
54 | Requires: python-moksha-hub >= 1.3.2 | |
55 | Requires: python-psutil | |
56 | Requires: python-pygments | |
57 | Requires: python-requests | |
58 | #Requires: python-simplejson | |
59 | Requires: python-six | |
60 | Requires: python-zmq | |
61 | BuildArch: noarch | |
62 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
63 | ||
64 | %description | |
65 | Python API used around Fedora Infrastructure to send and receive | |
66 | messages with zeromq. Includes some CLI tools. | |
67 | ||
68 | %package announce | |
69 | Summary: The fedmsg-announce command | |
70 | Group: Applications/Networking | |
71 | Requires: %{name} = %{version}-%{release} | |
72 | ||
73 | %description announce | |
74 | This package contains the fedmsg-announce command for sending | |
75 | announcements. | |
76 | ||
77 | %package collectd | |
78 | Summary: A fedmsg plugin for collectd | |
79 | Group: Applications/Networking | |
80 | Requires: %{name} = %{version}-%{release} | |
81 | ||
82 | %description collectd | |
83 | This package contains the fedmsg-collectd command which produces | |
84 | output suitable for consumption by a collectd plugin. | |
85 | ||
86 | %package hub | |
87 | Summary: The FedMsg Hub | |
88 | Group: Applications/Networking | |
1c757b06 ER |
89 | Requires: rc-scripts >= 0.4.0.20 |
90 | Requires(post,preun): /sbin/chkconfig | |
700057e3 ER |
91 | Requires: %{name} = %{version}-%{release} |
92 | ||
93 | %description hub | |
94 | This package contains configuration and init scripts for the FedMsg | |
95 | hub. | |
96 | ||
97 | %package relay | |
98 | Summary: The FedMsg Relay | |
99 | Group: Applications/Networking | |
100 | Requires: %{name} = %{version}-%{release} | |
1c757b06 ER |
101 | Requires: rc-scripts >= 0.4.0.20 |
102 | Requires(post,preun): /sbin/chkconfig | |
700057e3 ER |
103 | |
104 | %description relay | |
105 | This package contains configuration and init scripts for the FedMsg | |
106 | relay. | |
107 | ||
108 | %package irc | |
109 | Summary: The FedMsg IRC Bot | |
110 | Group: Applications/Networking | |
111 | Requires: %{name} = %{version}-%{release} | |
1c757b06 ER |
112 | Requires: rc-scripts >= 0.4.0.20 |
113 | Requires(post,preun): /sbin/chkconfig | |
700057e3 ER |
114 | |
115 | %description irc | |
116 | This package contains configuration and init scripts for the FedMsg | |
117 | IRC bot. | |
118 | ||
119 | %package gateway | |
120 | Summary: The FedMsg Gateway daemon | |
121 | Group: Applications/Networking | |
122 | Requires: %{name} = %{version}-%{release} | |
1c757b06 ER |
123 | Requires: rc-scripts >= 0.4.0.20 |
124 | Requires(post,preun): /sbin/chkconfig | |
700057e3 ER |
125 | |
126 | %description gateway | |
127 | This package contains configuration and init scripts for the FedMsg | |
128 | Gateway. It will rebroadcast messages from the bus to a specially | |
129 | designated ZMQ pub socket. Useful for repeating messages outside a | |
130 | firewall. | |
131 | ||
132 | %prep | |
133 | %setup -q | |
d803d01c | 134 | %patch1 -p1 |
700057e3 ER |
135 | |
136 | # This only got shipped with fedmsg-0.6.3 | |
137 | rm -f fedmsg.d/_tweet-real.py | |
138 | ||
139 | # These are failing in mock for fedora. Investigate why. | |
140 | # We probably just need a new BuildReq | |
141 | rm -f fedmsg/tests/test_replay.py | |
142 | rm -f fedmsg/tests/test_crypto_gpg.py | |
143 | ||
144 | # Also, sqlalchemy is required for those tests we're knocking out, | |
145 | # so knock it out too. | |
146 | sed -i "/'sqlalchemy.*$/d" setup.py | |
147 | ||
21b2b826 | 148 | sed -i "/cryptography/d" setup.py |
e3069903 ER |
149 | sed -i "/daemon/d" setup.py |
150 | ||
700057e3 ER |
151 | # Temporarily disable signature validation while the timestamp precision bug is |
152 | # worked out upstream. -- https://github.com/fedora-infra/fedmsg/pull/186 | |
153 | sed -i "s/validate_signatures=True/validate_signatures=False/g" fedmsg.d/ssl.py | |
154 | ||
155 | # Copy the development config into the tests dir for the check section | |
156 | cp -rf fedmsg.d fedmsg/tests/ | |
157 | ||
158 | %build | |
5252e5b8 | 159 | %py_build |
700057e3 ER |
160 | |
161 | # Create this temporary symlink that's only needed for the test suite. | |
162 | ln -s fedmsg/tests/test_certs dev_certs | |
163 | ||
164 | # Unfortunately, neither of these tests will run on koji since they require | |
165 | # some network connectivity. With a note of sadness, we destroy them. | |
166 | rm fedmsg/tests/test_hub.py | |
167 | rm fedmsg/tests/test_threads.py | |
168 | ||
169 | %if %{with tests} | |
170 | %check | |
171 | %if 0%{?rhel} && 0%{?rhel} <= 6 | |
172 | # Check section removed until a RHEL6 bug with python-repoze-what-plugins-sql | |
173 | # can be fixed. It causes a fatal error in the test suite. | |
174 | # https://bugzilla.redhat.com/show_bug.cgi?id=813925 | |
175 | %else | |
176 | PYTHONPATH=$(pwd) python setup.py test | |
177 | %endif | |
178 | %endif | |
179 | ||
180 | %install | |
181 | rm -rf $RPM_BUILD_ROOT | |
5252e5b8 | 182 | %py_install \ |
700057e3 ER |
183 | --install-data=%{_datadir} \ |
184 | --root $RPM_BUILD_ROOT | |
185 | ||
05c04de3 | 186 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/%{module}/tests |
700057e3 | 187 | |
d5a32506 ER |
188 | %py_postclean |
189 | ||
700057e3 ER |
190 | install -d $RPM_BUILD_ROOT{/etc/{logrotate.d,rc.d/init.d},%{_sysconfdir}/fedmsg.d,%{systemdtmpfilesdir},%{systemdunitdir},/var/{run,log}/fedmsg} |
191 | cp -p fedmsg.d/*.py $RPM_BUILD_ROOT%{_sysconfdir}/fedmsg.d | |
192 | ||
319bc186 ER |
193 | install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-gateway |
194 | install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-hub | |
195 | install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-irc | |
196 | install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-relay | |
700057e3 ER |
197 | |
198 | cp -p initsys/systemd/fedmsg-hub.service $RPM_BUILD_ROOT%{systemdunitdir} | |
199 | cp -p initsys/systemd/fedmsg-relay.service $RPM_BUILD_ROOT%{systemdunitdir} | |
200 | cp -p initsys/systemd/fedmsg-irc.service $RPM_BUILD_ROOT%{systemdunitdir} | |
201 | cp -p initsys/systemd/fedmsg-gateway.service $RPM_BUILD_ROOT%{systemdunitdir} | |
202 | ||
203 | # Logrotate configuration | |
204 | cp -p logrotate $RPM_BUILD_ROOT/etc/logrotate.d/fedmsg | |
205 | ||
206 | # tmpfiles.d | |
207 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf | |
208 | ||
209 | %clean | |
210 | rm -rf $RPM_BUILD_ROOT | |
211 | ||
212 | %pre | |
213 | %groupadd -g 313 -r fedmsg | |
214 | %useradd -u 313 -r -s /sbin/nologin -d %{_datadir}/%{name} -M -c 'FedMsg' -g fedmsg fedmsg | |
215 | ||
1c757b06 ER |
216 | %post hub |
217 | /sbin/chkconfig --add fedmsg-hub | |
218 | %service fedmsg-hub restart | |
219 | ||
700057e3 | 220 | %preun hub |
1c757b06 | 221 | if [ "$1" = "0" ]; then |
700057e3 ER |
222 | %service fedmsg-hub stop |
223 | /sbin/chkconfig --del fedmsg-hub | |
224 | fi | |
225 | ||
1c757b06 ER |
226 | %post relay |
227 | /sbin/chkconfig --add fedmsg-relay | |
228 | %service fedmsg-relay restart | |
229 | ||
700057e3 | 230 | %preun relay |
1c757b06 | 231 | if [ "$1" = "0" ]; then |
700057e3 ER |
232 | %service fedmsg-relay stop |
233 | /sbin/chkconfig --del fedmsg-relay | |
234 | fi | |
235 | ||
1c757b06 ER |
236 | %post irc |
237 | /sbin/chkconfig --add fedmsg-irc | |
238 | %service fedmsg-irc restart | |
239 | ||
700057e3 | 240 | %preun irc |
1c757b06 | 241 | if [ "$1" = "0" ]; then |
700057e3 ER |
242 | %service fedmsg-irc stop |
243 | /sbin/chkconfig --del fedmsg-irc | |
244 | fi | |
245 | ||
1c757b06 ER |
246 | %post gateway |
247 | /sbin/chkconfig --add fedmsg-gateway | |
248 | %service fedmsg-gateway restart | |
249 | ||
700057e3 | 250 | %preun gateway |
1c757b06 | 251 | if [ "$1" = "0" ]; then |
700057e3 ER |
252 | %service fedmsg-gateway stop |
253 | /sbin/chkconfig --del fedmsg-gateway | |
254 | fi | |
255 | ||
256 | %files | |
257 | %defattr(644,root,root,755) | |
258 | %doc doc/* README.rst LICENSE | |
259 | %dir %{_sysconfdir}/fedmsg.d | |
260 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/base.py* | |
261 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/endpoints.py* | |
262 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/logging.py* | |
263 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/ssl.py* | |
3523f169 | 264 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/relay.py* |
700057e3 | 265 | %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/fedmsg |
143a3b9d | 266 | %attr(755,root,root) %{_bindir}/fedmsg-check |
700057e3 ER |
267 | %attr(755,root,root) %{_bindir}/fedmsg-logger |
268 | %attr(755,root,root) %{_bindir}/fedmsg-tail | |
269 | %attr(755,root,root) %{_bindir}/fedmsg-trigger | |
270 | %attr(755,root,root) %{_bindir}/fedmsg-config | |
271 | %attr(755,root,root) %{_bindir}/fedmsg-dg-replay | |
272 | %attr(755,fedmsg,fedmsg) %dir /var/log/fedmsg | |
273 | %attr(775,fedmsg,fedmsg) %dir /var/run/fedmsg | |
274 | %dir %{py_sitescriptdir}/fedmsg | |
05c04de3 ER |
275 | %{py_sitescriptdir}/%{module}/*.py[co] |
276 | %{py_sitescriptdir}/%{module}/commands | |
277 | %{py_sitescriptdir}/%{module}/consumers | |
278 | %{py_sitescriptdir}/%{module}/crypto | |
279 | %{py_sitescriptdir}/%{module}/encoding | |
280 | %{py_sitescriptdir}/%{module}/meta | |
281 | %{py_sitescriptdir}/%{module}/replay | |
282 | %{py_sitescriptdir}/%{module}/text | |
283 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
700057e3 ER |
284 | %{systemdtmpfilesdir}/%{name}.conf |
285 | ||
286 | %files announce | |
287 | %defattr(644,root,root,755) | |
288 | %attr(755,root,root) %{_bindir}/fedmsg-announce | |
289 | ||
290 | %files collectd | |
291 | %defattr(644,root,root,755) | |
292 | %attr(755,root,root) %{_bindir}/fedmsg-collectd | |
293 | ||
294 | %files hub | |
295 | %defattr(644,root,root,755) | |
296 | %attr(755,root,root) %{_bindir}/fedmsg-hub | |
297 | %attr(754,root,root) /etc/rc.d/init.d/fedmsg-hub | |
298 | %{systemdunitdir}/fedmsg-hub.service | |
299 | ||
300 | %files relay | |
301 | %defattr(644,root,root,755) | |
302 | %attr(755,root,root) %{_bindir}/fedmsg-relay | |
143a3b9d | 303 | %attr(755,root,root) %{_bindir}/fedmsg-signing-relay |
700057e3 ER |
304 | %attr(754,root,root) /etc/rc.d/init.d/fedmsg-relay |
305 | %{systemdunitdir}/fedmsg-relay.service | |
700057e3 ER |
306 | |
307 | %files irc | |
308 | %defattr(644,root,root,755) | |
309 | %attr(755,root,root) %{_bindir}/fedmsg-irc | |
310 | %attr(754,root,root) /etc/rc.d/init.d/fedmsg-irc | |
311 | %{systemdunitdir}/fedmsg-irc.service | |
312 | ||
2eac5c13 | 313 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/ircbot.py* |
700057e3 ER |
314 | |
315 | %files gateway | |
316 | %defattr(644,root,root,755) | |
317 | %attr(755,root,root) %{_bindir}/fedmsg-gateway | |
318 | %attr(754,root,root) /etc/rc.d/init.d/fedmsg-gateway | |
319 | %{systemdunitdir}/fedmsg-gateway.service | |
2eac5c13 | 320 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/gateway.py* |