2 # - --daemonize crashes (works under systemd only): https://github.com/fedora-infra/fedmsg/issues/302
5 %bcond_with tests # build with tests
8 %define egg_name fedmsg
9 %define pypi_name fedmsg
10 Summary: Tools for Fedora Infrastructure real-time messaging
15 Group: Applications/Networking
16 Source0: https://files.pythonhosted.org/packages/source/f/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
17 # Source0-md5: 638b1a889e7ecfdd05ddf5ef0b53731b
18 Source1: %{name}-tmpfiles.conf
19 Source2: %{name}-gateway.init
20 Source3: %{name}-hub.init
21 Source4: %{name}-irc.init
22 Source5: %{name}-relay.init
24 URL: https://github.com/fedora-infra/fedmsg
25 BuildRequires: python-devel
26 BuildRequires: python-setuptools
27 BuildRequires: rpm-pythonprov
28 BuildRequires: rpmbuild(macros) >= 1.710
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
47 Requires: python-M2Crypto >= 0.22.5
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
62 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
65 Python API used around Fedora Infrastructure to send and receive
66 messages with zeromq. Includes some CLI tools.
69 Summary: The fedmsg-announce command
70 Group: Applications/Networking
71 Requires: %{name} = %{version}-%{release}
74 This package contains the fedmsg-announce command for sending
78 Summary: A fedmsg plugin for collectd
79 Group: Applications/Networking
80 Requires: %{name} = %{version}-%{release}
83 This package contains the fedmsg-collectd command which produces
84 output suitable for consumption by a collectd plugin.
87 Summary: The FedMsg Hub
88 Group: Applications/Networking
89 Requires: rc-scripts >= 0.4.0.20
90 Requires(post,preun): /sbin/chkconfig
91 Requires: %{name} = %{version}-%{release}
94 This package contains configuration and init scripts for the FedMsg
98 Summary: The FedMsg Relay
99 Group: Applications/Networking
100 Requires: %{name} = %{version}-%{release}
101 Requires: rc-scripts >= 0.4.0.20
102 Requires(post,preun): /sbin/chkconfig
105 This package contains configuration and init scripts for the FedMsg
109 Summary: The FedMsg IRC Bot
110 Group: Applications/Networking
111 Requires: %{name} = %{version}-%{release}
112 Requires: rc-scripts >= 0.4.0.20
113 Requires(post,preun): /sbin/chkconfig
116 This package contains configuration and init scripts for the FedMsg
120 Summary: The FedMsg Gateway daemon
121 Group: Applications/Networking
122 Requires: %{name} = %{version}-%{release}
123 Requires: rc-scripts >= 0.4.0.20
124 Requires(post,preun): /sbin/chkconfig
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
136 # This only got shipped with fedmsg-0.6.3
137 rm -f fedmsg.d/_tweet-real.py
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
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
148 sed -i "/cryptography/d" setup.py
149 sed -i "/daemon/d" setup.py
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
155 # Copy the development config into the tests dir for the check section
156 cp -rf fedmsg.d fedmsg/tests/
161 # Create this temporary symlink that's only needed for the test suite.
162 ln -s fedmsg/tests/test_certs dev_certs
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
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
176 PYTHONPATH=$(pwd) python setup.py test
181 rm -rf $RPM_BUILD_ROOT
183 --install-data=%{_datadir} \
184 --root $RPM_BUILD_ROOT
186 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/%{module}/tests
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
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
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}
203 # Logrotate configuration
204 cp -p logrotate $RPM_BUILD_ROOT/etc/logrotate.d/fedmsg
207 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
210 rm -rf $RPM_BUILD_ROOT
213 %groupadd -g 313 -r fedmsg
214 %useradd -u 313 -r -s /sbin/nologin -d %{_datadir}/%{name} -M -c 'FedMsg' -g fedmsg fedmsg
217 /sbin/chkconfig --add fedmsg-hub
218 %service fedmsg-hub restart
221 if [ "$1" = "0" ]; then
222 %service fedmsg-hub stop
223 /sbin/chkconfig --del fedmsg-hub
227 /sbin/chkconfig --add fedmsg-relay
228 %service fedmsg-relay restart
231 if [ "$1" = "0" ]; then
232 %service fedmsg-relay stop
233 /sbin/chkconfig --del fedmsg-relay
237 /sbin/chkconfig --add fedmsg-irc
238 %service fedmsg-irc restart
241 if [ "$1" = "0" ]; then
242 %service fedmsg-irc stop
243 /sbin/chkconfig --del fedmsg-irc
247 /sbin/chkconfig --add fedmsg-gateway
248 %service fedmsg-gateway restart
251 if [ "$1" = "0" ]; then
252 %service fedmsg-gateway stop
253 /sbin/chkconfig --del fedmsg-gateway
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*
264 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/relay.py*
265 %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/fedmsg
266 %attr(755,root,root) %{_bindir}/fedmsg-logger
267 %attr(755,root,root) %{_bindir}/fedmsg-tail
268 %attr(755,root,root) %{_bindir}/fedmsg-trigger
269 %attr(755,root,root) %{_bindir}/fedmsg-config
270 %attr(755,root,root) %{_bindir}/fedmsg-dg-replay
271 %attr(755,fedmsg,fedmsg) %dir /var/log/fedmsg
272 %attr(775,fedmsg,fedmsg) %dir /var/run/fedmsg
273 %dir %{py_sitescriptdir}/fedmsg
274 %{py_sitescriptdir}/%{module}/*.py[co]
275 %{py_sitescriptdir}/%{module}/commands
276 %{py_sitescriptdir}/%{module}/consumers
277 %{py_sitescriptdir}/%{module}/crypto
278 %{py_sitescriptdir}/%{module}/encoding
279 %{py_sitescriptdir}/%{module}/meta
280 %{py_sitescriptdir}/%{module}/replay
281 %{py_sitescriptdir}/%{module}/text
282 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
283 %{systemdtmpfilesdir}/%{name}.conf
286 %defattr(644,root,root,755)
287 %attr(755,root,root) %{_bindir}/fedmsg-announce
290 %defattr(644,root,root,755)
291 %attr(755,root,root) %{_bindir}/fedmsg-collectd
294 %defattr(644,root,root,755)
295 %attr(755,root,root) %{_bindir}/fedmsg-hub
296 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-hub
297 %{systemdunitdir}/fedmsg-hub.service
300 %defattr(644,root,root,755)
301 %attr(755,root,root) %{_bindir}/fedmsg-relay
302 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-relay
303 %{systemdunitdir}/fedmsg-relay.service
306 %defattr(644,root,root,755)
307 %attr(755,root,root) %{_bindir}/fedmsg-irc
308 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-irc
309 %{systemdunitdir}/fedmsg-irc.service
311 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/ircbot.py*
314 %defattr(644,root,root,755)
315 %attr(755,root,root) %{_bindir}/fedmsg-gateway
316 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-gateway
317 %{systemdunitdir}/fedmsg-gateway.service
318 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/gateway.py*