]> git.pld-linux.org Git - packages/fedmsg.git/blob - fedmsg.spec
initscript deps; restart daemons
[packages/fedmsg.git] / fedmsg.spec
1 # TODO
2 # - add initscript post scriptlets
3 # - --daemonize crashes (works under systemd only): https://github.com/fedora-infra/fedmsg/issues/302
4
5 # Conditional build:
6 %bcond_with     tests           # build with tests
7
8 Summary:        Tools for Fedora Infrastructure real-time messaging
9 Name:           fedmsg
10 Version:        0.16.4
11 Release:        1
12 License:        LGPL v2+
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
21 Patch1:         config.patch
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
27 %if %{with tests}
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
44 %endif
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
57 Requires:       python-six
58 Requires:       python-zmq
59 BuildArch:      noarch
60 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
61
62 %description
63 Python API used around Fedora Infrastructure to send and receive
64 messages with zeromq. Includes some CLI tools.
65
66 %package announce
67 Summary:        The fedmsg-announce command
68 Group:          Applications/Networking
69 Requires:       %{name} = %{version}-%{release}
70
71 %description announce
72 This package contains the fedmsg-announce command for sending
73 announcements.
74
75 %package collectd
76 Summary:        A fedmsg plugin for collectd
77 Group:          Applications/Networking
78 Requires:       %{name} = %{version}-%{release}
79
80 %description collectd
81 This package contains the fedmsg-collectd command which produces
82 output suitable for consumption by a collectd plugin.
83
84 %package hub
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}
90
91 %description hub
92 This package contains configuration and init scripts for the FedMsg
93 hub.
94
95 %package relay
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
101
102 %description relay
103 This package contains configuration and init scripts for the FedMsg
104 relay.
105
106 %package irc
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
112
113 %description irc
114 This package contains configuration and init scripts for the FedMsg
115 IRC bot.
116
117 %package gateway
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
123
124 %description gateway
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
128 firewall.
129
130 %prep
131 %setup -q
132 %patch1 -p1
133
134 # This only got shipped with fedmsg-0.6.3
135 rm -f fedmsg.d/_tweet-real.py
136
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
141
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
145
146 sed -i "/cryptography/d" setup.py
147 sed -i "/daemon/d" setup.py
148
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
152
153 # Copy the development config into the tests dir for the check section
154 cp -rf fedmsg.d fedmsg/tests/
155
156 %build
157 %py_build
158
159 # Create this temporary symlink that's only needed for the test suite.
160 ln -s fedmsg/tests/test_certs dev_certs
161
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
166
167 %if %{with tests}
168 %check
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
173 %else
174 PYTHONPATH=$(pwd) python setup.py test
175 %endif
176 %endif
177
178 %install
179 rm -rf $RPM_BUILD_ROOT
180 %py_install \
181     --install-data=%{_datadir} \
182         --root $RPM_BUILD_ROOT
183
184 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/fedmsg/tests
185
186 %py_postclean
187
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
190
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
195
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}
200
201 # Logrotate configuration
202 cp -p logrotate $RPM_BUILD_ROOT/etc/logrotate.d/fedmsg
203
204 # tmpfiles.d
205 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
206
207 %clean
208 rm -rf $RPM_BUILD_ROOT
209
210 %pre
211 %groupadd -g 313 -r fedmsg
212 %useradd -u 313  -r -s /sbin/nologin -d %{_datadir}/%{name} -M -c 'FedMsg' -g fedmsg fedmsg
213
214 %post hub
215 /sbin/chkconfig --add fedmsg-hub
216 %service fedmsg-hub restart
217
218 %preun hub
219 if [ "$1" = "0" ]; then
220         %service fedmsg-hub stop
221         /sbin/chkconfig --del fedmsg-hub
222 fi
223
224 %post relay
225 /sbin/chkconfig --add fedmsg-relay
226 %service fedmsg-relay restart
227
228 %preun relay
229 if [ "$1" = "0" ]; then
230         %service fedmsg-relay stop
231         /sbin/chkconfig --del fedmsg-relay
232 fi
233
234 %post irc
235 /sbin/chkconfig --add fedmsg-irc
236 %service fedmsg-irc restart
237
238 %preun irc
239 if [ "$1" = "0" ]; then
240         %service fedmsg-irc stop
241         /sbin/chkconfig --del fedmsg-irc
242 fi
243
244 %post gateway
245 /sbin/chkconfig --add fedmsg-gateway
246 %service fedmsg-gateway restart
247
248 %preun gateway
249 if [ "$1" = "0" ]; then
250         %service fedmsg-gateway stop
251         /sbin/chkconfig --del fedmsg-gateway
252 fi
253
254 %files
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
281
282 %files announce
283 %defattr(644,root,root,755)
284 %attr(755,root,root) %{_bindir}/fedmsg-announce
285
286 %files collectd
287 %defattr(644,root,root,755)
288 %attr(755,root,root) %{_bindir}/fedmsg-collectd
289
290 %files hub
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
295
296 %files relay
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*
302
303 %files irc
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
308
309 %config(noreplace) %{_sysconfdir}/fedmsg.d/ircbot.py*
310
311 %files gateway
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*
This page took 0.076201 seconds and 3 git commands to generate.