2 # - add initscript post scriptlets
3 # - --daemonize crashes (works under systemd only): https://github.com/fedora-infra/fedmsg/issues/302
6 %bcond_with tests # build with tests
8 Summary: Tools for Fedora Infrastructure real-time messaging
13 Group: Applications/Networking
14 Source0: http://pypi.python.org/packages/source/f/fedmsg/%{name}-%{version}.tar.gz
15 # Source0-md5: 43f00d123669f6a0506ee0f37035c5d7
16 Source1: %{name}-tmpfiles.conf
17 Source2: %{name}-gateway.init
18 Source3: %{name}-hub.init
19 Source4: %{name}-irc.init
20 Source5: %{name}-relay.init
22 URL: https://github.com/fedora-infra/fedmsg
23 BuildRequires: python-devel
24 BuildRequires: python-setuptools
25 BuildRequires: rpm-pythonprov
26 BuildRequires: rpmbuild(macros) >= 1.710
28 BuildRequires: python-mock
29 BuildRequires: python-nose
30 BuildRequires: python-six
31 # Only for the test-replay test which is patched out
32 BuildRequires: python-M2Crypto
33 BuildRequires: python-arrow
34 BuildRequires: python-bunch
35 BuildRequires: python-daemon
36 BuildRequires: python-fabulous
37 BuildRequires: python-fedora
38 BuildRequires: python-m2ext
39 BuildRequires: python-moksha-hub >= 1.3.2
40 BuildRequires: python-psutil
41 BuildRequires: python-pygments
42 BuildRequires: python-requests
43 #BuidlRequires: python-sqlalchemy
45 Requires: python-M2Crypto >= 0.22.5
46 Requires: python-arrow
47 #Requires: python-daemon
48 #Requires: python-fabulous
49 #Requires: python-fedora
50 Requires: python-kitchen
51 Requires: python-m2ext
52 Requires: python-moksha-hub >= 1.3.2
53 Requires: python-psutil
54 Requires: python-pygments
55 Requires: python-requests
56 #Requires: python-simplejson
60 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
63 Python API used around Fedora Infrastructure to send and receive
64 messages with zeromq. Includes some CLI tools.
67 Summary: The fedmsg-announce command
68 Group: Applications/Networking
69 Requires: %{name} = %{version}-%{release}
72 This package contains the fedmsg-announce command for sending
76 Summary: A fedmsg plugin for collectd
77 Group: Applications/Networking
78 Requires: %{name} = %{version}-%{release}
81 This package contains the fedmsg-collectd command which produces
82 output suitable for consumption by a collectd plugin.
85 Summary: The FedMsg Hub
86 Group: Applications/Networking
87 Requires: rc-scripts >= 0.4.0.20
88 Requires(post,preun): /sbin/chkconfig
89 Requires: %{name} = %{version}-%{release}
92 This package contains configuration and init scripts for the FedMsg
96 Summary: The FedMsg Relay
97 Group: Applications/Networking
98 Requires: %{name} = %{version}-%{release}
99 Requires: rc-scripts >= 0.4.0.20
100 Requires(post,preun): /sbin/chkconfig
103 This package contains configuration and init scripts for the FedMsg
107 Summary: The FedMsg IRC Bot
108 Group: Applications/Networking
109 Requires: %{name} = %{version}-%{release}
110 Requires: rc-scripts >= 0.4.0.20
111 Requires(post,preun): /sbin/chkconfig
114 This package contains configuration and init scripts for the FedMsg
118 Summary: The FedMsg Gateway daemon
119 Group: Applications/Networking
120 Requires: %{name} = %{version}-%{release}
121 Requires: rc-scripts >= 0.4.0.20
122 Requires(post,preun): /sbin/chkconfig
125 This package contains configuration and init scripts for the FedMsg
126 Gateway. It will rebroadcast messages from the bus to a specially
127 designated ZMQ pub socket. Useful for repeating messages outside a
134 # This only got shipped with fedmsg-0.6.3
135 rm -f fedmsg.d/_tweet-real.py
137 # These are failing in mock for fedora. Investigate why.
138 # We probably just need a new BuildReq
139 rm -f fedmsg/tests/test_replay.py
140 rm -f fedmsg/tests/test_crypto_gpg.py
142 # Also, sqlalchemy is required for those tests we're knocking out,
143 # so knock it out too.
144 sed -i "/'sqlalchemy.*$/d" setup.py
146 sed -i "/cryptography/d" setup.py
147 sed -i "/daemon/d" setup.py
149 # Temporarily disable signature validation while the timestamp precision bug is
150 # worked out upstream. -- https://github.com/fedora-infra/fedmsg/pull/186
151 sed -i "s/validate_signatures=True/validate_signatures=False/g" fedmsg.d/ssl.py
153 # Copy the development config into the tests dir for the check section
154 cp -rf fedmsg.d fedmsg/tests/
159 # Create this temporary symlink that's only needed for the test suite.
160 ln -s fedmsg/tests/test_certs dev_certs
162 # Unfortunately, neither of these tests will run on koji since they require
163 # some network connectivity. With a note of sadness, we destroy them.
164 rm fedmsg/tests/test_hub.py
165 rm fedmsg/tests/test_threads.py
169 %if 0%{?rhel} && 0%{?rhel} <= 6
170 # Check section removed until a RHEL6 bug with python-repoze-what-plugins-sql
171 # can be fixed. It causes a fatal error in the test suite.
172 # https://bugzilla.redhat.com/show_bug.cgi?id=813925
174 PYTHONPATH=$(pwd) python setup.py test
179 rm -rf $RPM_BUILD_ROOT
181 --install-data=%{_datadir} \
182 --root $RPM_BUILD_ROOT
184 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/fedmsg/tests
188 install -d $RPM_BUILD_ROOT{/etc/{logrotate.d,rc.d/init.d},%{_sysconfdir}/fedmsg.d,%{systemdtmpfilesdir},%{systemdunitdir},/var/{run,log}/fedmsg}
189 cp -p fedmsg.d/*.py $RPM_BUILD_ROOT%{_sysconfdir}/fedmsg.d
191 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-gateway
192 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-hub
193 install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-irc
194 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-relay
196 cp -p initsys/systemd/fedmsg-hub.service $RPM_BUILD_ROOT%{systemdunitdir}
197 cp -p initsys/systemd/fedmsg-relay.service $RPM_BUILD_ROOT%{systemdunitdir}
198 cp -p initsys/systemd/fedmsg-irc.service $RPM_BUILD_ROOT%{systemdunitdir}
199 cp -p initsys/systemd/fedmsg-gateway.service $RPM_BUILD_ROOT%{systemdunitdir}
201 # Logrotate configuration
202 cp -p logrotate $RPM_BUILD_ROOT/etc/logrotate.d/fedmsg
205 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
208 rm -rf $RPM_BUILD_ROOT
211 %groupadd -g 313 -r fedmsg
212 %useradd -u 313 -r -s /sbin/nologin -d %{_datadir}/%{name} -M -c 'FedMsg' -g fedmsg fedmsg
215 /sbin/chkconfig --add fedmsg-hub
216 %service fedmsg-hub restart
219 if [ "$1" = "0" ]; then
220 %service fedmsg-hub stop
221 /sbin/chkconfig --del fedmsg-hub
225 /sbin/chkconfig --add fedmsg-relay
226 %service fedmsg-relay restart
229 if [ "$1" = "0" ]; then
230 %service fedmsg-relay stop
231 /sbin/chkconfig --del fedmsg-relay
235 /sbin/chkconfig --add fedmsg-irc
236 %service fedmsg-irc restart
239 if [ "$1" = "0" ]; then
240 %service fedmsg-irc stop
241 /sbin/chkconfig --del fedmsg-irc
245 /sbin/chkconfig --add fedmsg-gateway
246 %service fedmsg-gateway restart
249 if [ "$1" = "0" ]; then
250 %service fedmsg-gateway stop
251 /sbin/chkconfig --del fedmsg-gateway
255 %defattr(644,root,root,755)
256 %doc doc/* README.rst LICENSE
257 %dir %{_sysconfdir}/fedmsg.d
258 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/base.py*
259 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/endpoints.py*
260 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/logging.py*
261 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fedmsg.d/ssl.py*
262 %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/fedmsg
263 %attr(755,root,root) %{_bindir}/fedmsg-logger
264 %attr(755,root,root) %{_bindir}/fedmsg-tail
265 %attr(755,root,root) %{_bindir}/fedmsg-trigger
266 %attr(755,root,root) %{_bindir}/fedmsg-config
267 %attr(755,root,root) %{_bindir}/fedmsg-dg-replay
268 %attr(755,fedmsg,fedmsg) %dir /var/log/fedmsg
269 %attr(775,fedmsg,fedmsg) %dir /var/run/fedmsg
270 %dir %{py_sitescriptdir}/fedmsg
271 %{py_sitescriptdir}/fedmsg/*.py[co]
272 %{py_sitescriptdir}/fedmsg/commands
273 %{py_sitescriptdir}/fedmsg/consumers
274 %{py_sitescriptdir}/fedmsg/crypto
275 %{py_sitescriptdir}/fedmsg/encoding
276 %{py_sitescriptdir}/fedmsg/meta
277 %{py_sitescriptdir}/fedmsg/replay
278 %{py_sitescriptdir}/fedmsg/text
279 %{py_sitescriptdir}/fedmsg-%{version}-py*.egg-info
280 %{systemdtmpfilesdir}/%{name}.conf
283 %defattr(644,root,root,755)
284 %attr(755,root,root) %{_bindir}/fedmsg-announce
287 %defattr(644,root,root,755)
288 %attr(755,root,root) %{_bindir}/fedmsg-collectd
291 %defattr(644,root,root,755)
292 %attr(755,root,root) %{_bindir}/fedmsg-hub
293 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-hub
294 %{systemdunitdir}/fedmsg-hub.service
297 %defattr(644,root,root,755)
298 %attr(755,root,root) %{_bindir}/fedmsg-relay
299 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-relay
300 %{systemdunitdir}/fedmsg-relay.service
301 %config(noreplace) %{_sysconfdir}/fedmsg.d/relay.py*
304 %defattr(644,root,root,755)
305 %attr(755,root,root) %{_bindir}/fedmsg-irc
306 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-irc
307 %{systemdunitdir}/fedmsg-irc.service
309 %config(noreplace) %{_sysconfdir}/fedmsg.d/ircbot.py*
312 %defattr(644,root,root,755)
313 %attr(755,root,root) %{_bindir}/fedmsg-gateway
314 %attr(754,root,root) /etc/rc.d/init.d/fedmsg-gateway
315 %{systemdunitdir}/fedmsg-gateway.service
316 %config(noreplace) %{_sysconfdir}/fedmsg.d/gateway.py*