Update RPM-specs to 2013.1.3 version
[openstack-build/ceilometer-build.git] / rpm / SPECS / openstack-ceilometer.spec
1 %global _without_doc 1
2 %global with_doc %{!?_without_doc:1}%{?_without_doc:0}
3 %global pypi_name ceilometer
4
5 Name:             openstack-ceilometer
6 Version:          2013.1.3
7 Release:          1%{?dist}
8 Summary:          OpenStack measurement collection service
9
10 Group:            Applications/System
11 License:          ASL 2.0
12 URL:              https://wiki.openstack.org/wiki/Ceilometer
13 Source0:          http://tarballs.openstack.org/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
14 Source1:          %{pypi_name}.conf
15 Source2:          %{pypi_name}.logrotate
16
17 Source10:         %{name}-api.init
18 Source100:        %{name}-api.upstart
19 Source11:         %{name}-collector.init
20 Source110:        %{name}-collector.upstart
21 Source12:         %{name}-compute.init
22 Source120:        %{name}-compute.upstart
23 Source13:         %{name}-central.init
24 Source130:        %{name}-central.upstart
25
26 #
27 # patches_base=2013.1.3
28 #
29 Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
30 Patch0002: 0002-avoid-code-path-causing-qpid-exchange-leaks.patch
31
32 # This is EL6 specific and not upstream
33 Patch100:         openstack-ceilometer-newdeps.patch
34
35 BuildArch:        noarch
36 BuildRequires:    intltool
37 BuildRequires:    python-sphinx10
38 BuildRequires:    python-setuptools
39 BuildRequires:    python2-devel
40
41 BuildRequires:    openstack-utils
42
43 # These are required to build due to the requirements check added
44 BuildRequires:    python-sqlalchemy0.7
45 BuildRequires:    python-webob1.2
46
47
48 %description
49 OpenStack ceilometer provides services to measure and
50 collect metrics from OpenStack components.
51
52
53 %package -n       python-ceilometer
54 Summary:          OpenStack ceilometer python libraries
55 Group:            Applications/System
56
57 Requires:         python-qpid
58 Requires:         python-kombu
59 Requires:         python-amqplib
60
61 Requires:         python-eventlet
62 Requires:         python-greenlet
63 Requires:         python-iso8601
64 Requires:         python-lxml
65 Requires:         python-anyjson
66 Requires:         python-stevedore
67
68 Requires:         python-sqlalchemy0.7
69 Requires:         python-migrate
70
71 Requires:         python-webob >= 1.2
72 Requires:         python-oslo-config
73 Requires:         PyYAML
74
75 %description -n   python-ceilometer
76 OpenStack ceilometer provides services to measure and
77 collect metrics from OpenStack components.
78
79 This package contains the ceilometer python library.
80
81
82 %package common
83 Summary:          Components common to all OpenStack ceilometer services
84 Group:            Applications/System
85
86 Requires:         python-ceilometer = %{version}-%{release}
87 Requires:         openstack-utils
88
89 Requires(post):   chkconfig
90 Requires(postun): initscripts
91 Requires(preun):  chkconfig
92 Requires(pre):    shadow-utils
93
94
95
96 %description common
97 OpenStack ceilometer provides services to measure and
98 collect metrics from OpenStack components.
99
100 This package contains components common to all OpenStack
101 ceilometer services.
102
103
104 %package compute
105 Summary:          OpenStack ceilometer compute agent
106 Group:            Applications/System
107
108 Requires:         %{name}-common = %{version}-%{release}
109
110 Requires:         python-novaclient
111 Requires:         python-keystoneclient
112 Requires:         libvirt-python
113
114 %description compute
115 OpenStack ceilometer provides services to measure and
116 collect metrics from OpenStack components.
117
118 This package contains the ceilometer agent for
119 running on OpenStack compute nodes.
120
121
122 %package central
123 Summary:          OpenStack ceilometer central agent
124 Group:            Applications/System
125
126 Requires:         %{name}-common = %{version}-%{release}
127
128 Requires:         python-novaclient
129 Requires:         python-keystoneclient
130 Requires:         python-glanceclient
131 Requires:         python-swiftclient
132
133 %description central
134 OpenStack ceilometer provides services to measure and
135 collect metrics from OpenStack components.
136
137 This package contains the central ceilometer agent.
138
139
140 %package collector
141 Summary:          OpenStack ceilometer collector agent
142 Group:            Applications/System
143
144 Requires:         %{name}-common = %{version}-%{release}
145
146 Requires:         pymongo
147
148 %description collector
149 OpenStack ceilometer provides services to measure and
150 collect metrics from OpenStack components.
151
152 This package contains the ceilometer collector agent.
153
154
155 %package api
156 Summary:          OpenStack ceilometer API service
157 Group:            Applications/System
158
159 Requires:         %{name}-common = %{version}-%{release}
160
161 Requires:         pymongo
162 Requires:         python-flask
163 Requires:         python-pecan
164 Requires:         python-wsme
165
166 %description api
167 OpenStack ceilometer provides services to measure and
168 collect metrics from OpenStack components.
169
170 This package contains the ceilometer API service.
171
172
173 %if 0%{?with_doc}
174 %package doc
175 Summary:          Documentation for OpenStack ceilometer
176 Group:            Documentation
177
178 # Required to build module documents
179 BuildRequires:    python-eventlet
180 BuildRequires:    python-sqlalchemy0.7
181 BuildRequires:    python-webob
182 # while not strictly required, quiets the build down when building docs.
183 BuildRequires:    python-migrate, python-iso8601
184
185 %description      doc
186 OpenStack ceilometer provides services to measure and
187 collect metrics from OpenStack components.
188
189 This package contains documentation files for ceilometer.
190 %endif
191
192 %prep
193 %setup -q -n ceilometer-%{version}
194
195 %patch0001 -p1
196 %patch0002 -p1
197
198 # Apply EL6 patch
199 %patch100 -p1
200
201 find . \( -name .gitignore -o -name .placeholder \) -delete
202
203 find ceilometer -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
204
205 # TODO: Have the following handle multi line entries
206 sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
207
208 %build
209 %{__python} setup.py build
210
211 %install
212 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
213
214 # docs generation requires everything to be installed first
215 export PYTHONPATH="$( pwd ):$PYTHONPATH"
216
217 pushd doc
218
219 %if 0%{?with_doc}
220 SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html
221 # Fix hidden-file-or-dir warnings
222 rm -fr build/html/.doctrees build/html/.buildinfo
223 %endif
224
225 popd
226
227 # Setup directories
228 install -d -m 755 %{buildroot}%{_sharedstatedir}/ceilometer
229 install -d -m 755 %{buildroot}%{_sharedstatedir}/ceilometer/tmp
230 install -d -m 755 %{buildroot}%{_localstatedir}/log/ceilometer
231
232 # Install config files
233 install -d -m 755 %{buildroot}%{_sysconfdir}/ceilometer
234 install -p -D -m 640 %{SOURCE1} %{buildroot}%{_sysconfdir}/ceilometer/ceilometer.conf
235 install -p -D -m 640 etc/ceilometer/policy.json %{buildroot}%{_sysconfdir}/ceilometer/policy.json
236 install -p -D -m 640 etc/ceilometer/sources.json %{buildroot}%{_sysconfdir}/ceilometer/sources.json
237 install -p -D -m 640 etc/ceilometer/pipeline.yaml %{buildroot}%{_sysconfdir}/ceilometer/pipeline.yaml
238
239 # Install initscripts for services
240 install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/%{name}-api
241 install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/%{name}-collector
242 install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/%{name}-compute
243 install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/%{name}-central
244
245 # Install upstart jobs examples
246 install -d -m 755 %{buildroot}%{_datadir}/ceilometer
247 install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/ceilometer/
248 install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/ceilometer/
249 install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/ceilometer/
250 install -p -m 644 %{SOURCE130} %{buildroot}%{_datadir}/ceilometer/
251
252 # Install logrotate
253 install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
254
255 # Install pid directory
256 install -d -m 755 %{buildroot}%{_localstatedir}/run/ceilometer
257
258 # Remove unneeded in production stuff
259 rm -f %{buildroot}%{_bindir}/ceilometer-debug
260 rm -fr %{buildroot}%{python_sitelib}/tests/
261 rm -fr %{buildroot}%{python_sitelib}/run_tests.*
262 rm -f %{buildroot}/usr/share/doc/ceilometer/README*
263 rm -f %{buildroot}/%{python_sitelib}/ceilometer/api/v1/static/LICENSE.*
264
265
266 %pre common
267 getent group ceilometer >/dev/null || groupadd -r ceilometer --gid 166
268 if ! getent passwd ceilometer >/dev/null; then
269   # Id reservation request: https://bugzilla.redhat.com/923891
270   useradd -u 166 -r -g ceilometer -G ceilometer,nobody -d %{_sharedstatedir}/ceilometer -s /sbin/nologin -c "OpenStack ceilometer Daemons" ceilometer
271 fi
272 exit 0
273
274 %post compute
275 if [ $1 -eq 1 ] ; then
276     # Initial installation
277     /sbin/chkconfig --add %{name}-compute
278 fi
279
280 %post collector
281 if [ $1 -eq 1 ] ; then
282     # Initial installation
283     /sbin/chkconfig --add %{name}-collector
284 fi
285
286 %post api
287 if [ $1 -eq 1 ] ; then
288     # Initial installation
289     /sbin/chkconfig --add %{name}-api
290 fi
291
292 %post central
293 if [ $1 -eq 1 ] ; then
294     # Initial installation
295     /sbin/chkconfig --add %{name}-central
296 fi
297
298 %preun compute
299 if [ $1 -eq 0 ] ; then
300     for svc in compute; do
301         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
302         /sbin/chkconfig --del %{name}-${svc}
303     done
304 fi
305
306 %preun collector
307 if [ $1 -eq 0 ] ; then
308     for svc in collector; do
309         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
310         /sbin/chkconfig --del %{name}-${svc}
311     done
312 fi
313
314 %preun api
315 if [ $1 -eq 0 ] ; then
316     for svc in api; do
317         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
318         /sbin/chkconfig --del %{name}-${svc}
319     done
320 fi
321
322 %preun central
323 if [ $1 -eq 0 ] ; then
324     for svc in central; do
325         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
326         /sbin/chkconfig --del %{name}-${svc}
327     done
328 fi
329
330 %postun compute
331 if [ $1 -ge 1 ] ; then
332     # Package upgrade, not uninstall
333     for svc in compute; do
334         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
335     done
336 fi
337
338 %postun collector
339 if [ $1 -ge 1 ] ; then
340     # Package upgrade, not uninstall
341     for svc in collector; do
342         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
343     done
344 fi
345
346 %postun api
347 if [ $1 -ge 1 ] ; then
348     # Package upgrade, not uninstall
349     for svc in api; do
350         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
351     done
352 fi
353
354 %postun central
355 if [ $1 -ge 1 ] ; then
356     # Package upgrade, not uninstall
357     for svc in central; do
358         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
359     done
360 fi
361
362
363 %files common
364 %doc LICENSE
365 %dir %{_sysconfdir}/ceilometer
366 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/ceilometer.conf
367 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/policy.json
368 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/sources.json
369 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/pipeline.yaml
370 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
371
372 %dir %attr(0755, ceilometer, root) %{_localstatedir}/log/ceilometer
373 %dir %attr(0755, ceilometer, root) %{_localstatedir}/run/ceilometer
374
375 %{_bindir}/ceilometer-*
376
377 %defattr(-, ceilometer, ceilometer, -)
378 %dir %{_sharedstatedir}/ceilometer
379 %dir %{_sharedstatedir}/ceilometer/tmp
380
381
382 %files -n python-ceilometer
383 %{python_sitelib}/ceilometer
384 %{python_sitelib}/ceilometer-%{version}*.egg-info
385
386
387 %if 0%{?with_doc}
388 %files doc
389 %doc doc/build/html
390 %endif
391
392
393 %files compute
394 %{_bindir}/ceilometer-agent-compute
395 %{_initrddir}/%{name}-compute
396 %{_datarootdir}/ceilometer/%{name}-compute.upstart
397
398
399 %files collector
400 %{_bindir}/ceilometer-collector
401 %{_initrddir}/%{name}-collector
402 %{_datarootdir}/ceilometer/%{name}-collector.upstart
403
404
405 %files api
406 %doc ceilometer/api/v1/static/LICENSE.*
407 %{_bindir}/ceilometer-api
408 %{_initrddir}/%{name}-api
409 %{_datarootdir}/ceilometer/%{name}-api.upstart
410
411
412 %files central
413 %{_bindir}/ceilometer-agent-central
414 %{_initrddir}/%{name}-central
415 %{_datarootdir}/ceilometer/%{name}-central.upstart
416
417
418 %changelog
419 * Tue Aug 13 2013 Matthias Runge <mrunge@redhat.com> - 2013.1.3-1
420 - rebase to 2013.1.3
421
422 * Fri Jun 21 2013 Pádraig Brady <P@draigBrady.com> - 2013.1.2-2
423 - Avoid qpid exchange leaks
424
425 * Thu Jun  6 2013 Pádraig Brady <P@draigBrady.com> - 2013.1.2-1
426 - Update to stable/grizzly release 2013.1.2
427
428 * Thu Jun  6 2013 Pádraig Brady <P@draigBrady.com> - 2013.1-3
429 - Fix uninstall for openstack-ceilometer-central
430
431 * Mon Apr  8 2013 Pádraig Brady <P@draigBrady.com> - 2013.1-2
432 - Grizzly release
433
434 * Tue Mar 26 2013 Pádraig Brady <P@draigBrady.com> - 2013.1-0.5.g3
435 - Initial package