Update specs to 2013.2.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.2.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}-dist.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 Source14:         %{name}-alarm-notifier.init
26 Source140:        %{name}-alarm-notifier.upstart
27 Source15:         %{name}-alarm-evaluator.init
28 Source150:        %{name}-alarm-evaluator.upstart
29
30 #
31 # patches_base=2013.2.3
32 #
33 Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
34
35 # This is EL6 specific and not upstream
36 Patch100:         openstack-ceilometer-newdeps.patch
37
38 BuildArch:        noarch
39 BuildRequires:    intltool
40 BuildRequires:    python-sphinx10
41 BuildRequires:    python-setuptools
42 BuildRequires:    python-pbr
43 BuildRequires:    python-d2to1
44 BuildRequires:    python2-devel
45
46 BuildRequires:    openstack-utils
47
48 # These are required to build due to the requirements check added
49 BuildRequires:    python-sqlalchemy0.7
50 BuildRequires:    python-webob1.2
51
52
53 %description
54 OpenStack ceilometer provides services to measure and
55 collect metrics from OpenStack components.
56
57
58 %package -n       python-ceilometer
59 Summary:          OpenStack ceilometer python libraries
60 Group:            Applications/System
61
62 Requires:         python-qpid
63 Requires:         python-kombu
64 Requires:         python-amqplib
65
66 Requires:         python-babel
67 Requires:         python-eventlet
68 Requires:         python-greenlet
69 Requires:         python-iso8601
70 Requires:         python-lxml
71 Requires:         python-anyjson
72 Requires:         python-stevedore
73 Requires:         python-msgpack
74 Requires:         python-netaddr
75 Requires:         python-six
76 Requires:         PyYAML
77
78 Requires:         python-sqlalchemy0.7
79 Requires:         python-alembic
80 Requires:         python-migrate
81
82 Requires:         python-webob >= 1.2
83
84 Requires:         python-oslo-config >= 1:1.2.0
85
86 %description -n   python-ceilometer
87 OpenStack ceilometer provides services to measure and
88 collect metrics from OpenStack components.
89
90 This package contains the ceilometer python library.
91
92
93 %package common
94 Summary:          Components common to all OpenStack ceilometer services
95 Group:            Applications/System
96
97 Requires:         python-ceilometer = %{version}-%{release}
98 Requires:         openstack-utils
99
100 Requires(post):   chkconfig
101 Requires(postun): initscripts
102 Requires(preun):  chkconfig
103 Requires(pre):    shadow-utils
104
105
106
107 %description common
108 OpenStack ceilometer provides services to measure and
109 collect metrics from OpenStack components.
110
111 This package contains components common to all OpenStack
112 ceilometer services.
113
114
115 %package compute
116 Summary:          OpenStack ceilometer compute agent
117 Group:            Applications/System
118
119 Requires:         %{name}-common = %{version}-%{release}
120
121 Requires:         python-novaclient
122 Requires:         python-keystoneclient
123 Requires:         libvirt-python
124
125 %description compute
126 OpenStack ceilometer provides services to measure and
127 collect metrics from OpenStack components.
128
129 This package contains the ceilometer agent for
130 running on OpenStack compute nodes.
131
132
133 %package central
134 Summary:          OpenStack ceilometer central agent
135 Group:            Applications/System
136
137 Requires:         %{name}-common = %{version}-%{release}
138
139 Requires:         python-novaclient
140 Requires:         python-keystoneclient
141 Requires:         python-glanceclient
142 Requires:         python-swiftclient
143
144 %description central
145 OpenStack ceilometer provides services to measure and
146 collect metrics from OpenStack components.
147
148 This package contains the central ceilometer agent.
149
150
151 %package collector
152 Summary:          OpenStack ceilometer collector agent
153 Group:            Applications/System
154
155 Requires:         %{name}-common = %{version}-%{release}
156
157 Requires:         python-pymongo
158
159 %description collector
160 OpenStack ceilometer provides services to measure and
161 collect metrics from OpenStack components.
162
163 This package contains the ceilometer collector agent.
164
165
166 %package api
167 Summary:          OpenStack ceilometer API service
168 Group:            Applications/System
169
170 Requires:         %{name}-common = %{version}-%{release}
171
172 Requires:         python-pymongo
173 Requires:         python-flask
174 Requires:         python-pecan
175 Requires:         python-wsme
176
177 %description api
178 OpenStack ceilometer provides services to measure and
179 collect metrics from OpenStack components.
180
181 This package contains the ceilometer API service.
182
183
184 %package alarm
185 Summary:          OpenStack ceilometer alarm services
186 Group:            Applications/System
187
188 Requires:         %{name}-common = %{version}-%{release}
189 Requires:         python-ceilometerclient
190
191 %description alarm
192 OpenStack ceilometer provides services to measure and
193 collect metrics from OpenStack components.
194
195 This package contains the ceilometer alarm notification
196 and evaluation services.
197
198
199 %if 0%{?with_doc}
200 %package doc
201 Summary:          Documentation for OpenStack ceilometer
202 Group:            Documentation
203
204 # Required to build module documents
205 BuildRequires:    python-eventlet
206 BuildRequires:    python-sqlalchemy0.7
207 BuildRequires:    python-webob
208 # while not strictly required, quiets the build down when building docs.
209 BuildRequires:    python-migrate, python-iso8601
210
211 %description      doc
212 OpenStack ceilometer provides services to measure and
213 collect metrics from OpenStack components.
214
215 This package contains documentation files for ceilometer.
216 %endif
217
218 %prep
219 %setup -q -n ceilometer-%{version}
220
221 %patch0001 -p1
222
223 # Apply EL6 patch
224 %patch100 -p1
225
226 find . \( -name .gitignore -o -name .placeholder \) -delete
227
228 find ceilometer -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
229
230 # TODO: Have the following handle multi line entries
231 sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
232
233 # Remove the requirements file so that pbr hooks don't add it
234 # to distutils requires_dist config
235 rm -rf {test-,}requirements.txt tools/{pip,test}-requires
236
237 # Programmatically update defaults in sample config
238 # which is installed at /etc/ceilometer/ceilometer.conf
239 # TODO: Make this more robust
240 # Note it only edits the first occurance, so assumes a section ordering in sample
241 # and also doesn't support multi-valued variables.
242 while read name eq value; do
243   test "$name" && test "$value" || continue
244   sed -i "0,/^# *$name=/{s!^# *$name=.*!#$name=$value!}" etc/ceilometer/ceilometer.conf.sample
245 done < %{SOURCE1}
246
247 %build
248 %{__python} setup.py build
249
250 %install
251 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
252
253 # docs generation requires everything to be installed first
254 export PYTHONPATH="$( pwd ):$PYTHONPATH"
255
256 pushd doc
257
258 %if 0%{?with_doc}
259 SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html
260 # Fix hidden-file-or-dir warnings
261 rm -fr build/html/.doctrees build/html/.buildinfo
262 %endif
263
264 popd
265
266 # Setup directories
267 install -d -m 755 %{buildroot}%{_sharedstatedir}/ceilometer
268 install -d -m 755 %{buildroot}%{_sharedstatedir}/ceilometer/tmp
269 install -d -m 755 %{buildroot}%{_localstatedir}/log/ceilometer
270
271 # Install config files
272 install -d -m 755 %{buildroot}%{_sysconfdir}/ceilometer
273 install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/ceilometer/ceilometer-dist.conf
274 install -p -D -m 640 etc/ceilometer/ceilometer.conf.sample %{buildroot}%{_sysconfdir}/ceilometer/ceilometer.conf
275 install -p -D -m 640 etc/ceilometer/policy.json %{buildroot}%{_sysconfdir}/ceilometer/policy.json
276 install -p -D -m 640 etc/ceilometer/sources.json %{buildroot}%{_sysconfdir}/ceilometer/sources.json
277 install -p -D -m 640 etc/ceilometer/pipeline.yaml %{buildroot}%{_sysconfdir}/ceilometer/pipeline.yaml
278
279 # Install initscripts for services
280 install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/%{name}-api
281 install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/%{name}-collector
282 install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/%{name}-compute
283 install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/%{name}-central
284 install -p -D -m 755 %{SOURCE14} %{buildroot}%{_initrddir}/%{name}-alarm-notifier
285 install -p -D -m 755 %{SOURCE15} %{buildroot}%{_initrddir}/%{name}-alarm-evaluator
286
287 # Install upstart jobs examples
288 install -d -m 755 %{buildroot}%{_datadir}/ceilometer
289 install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/ceilometer/
290 install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/ceilometer/
291 install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/ceilometer/
292 install -p -m 644 %{SOURCE130} %{buildroot}%{_datadir}/ceilometer/
293 install -p -m 644 %{SOURCE140} %{buildroot}%{_datadir}/ceilometer/
294 install -p -m 644 %{SOURCE150} %{buildroot}%{_datadir}/ceilometer/
295
296 # Install logrotate
297 install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
298
299 # Install pid directory
300 install -d -m 755 %{buildroot}%{_localstatedir}/run/ceilometer
301
302 # Remove unneeded in production stuff
303 rm -f %{buildroot}%{_bindir}/ceilometer-debug
304 rm -fr %{buildroot}%{python_sitelib}/tests/
305 rm -fr %{buildroot}%{python_sitelib}/run_tests.*
306 rm -f %{buildroot}/usr/share/doc/ceilometer/README*
307 rm -f %{buildroot}/%{python_sitelib}/ceilometer/api/v1/static/LICENSE.*
308
309
310 %pre common
311 getent group ceilometer >/dev/null || groupadd -r ceilometer --gid 166
312 if ! getent passwd ceilometer >/dev/null; then
313   # Id reservation request: https://bugzilla.redhat.com/923891
314   useradd -u 166 -r -g ceilometer -G ceilometer,nobody -d %{_sharedstatedir}/ceilometer -s /sbin/nologin -c "OpenStack ceilometer Daemons" ceilometer
315 fi
316 exit 0
317
318 %post compute
319 if [ $1 -eq 1 ] ; then
320     # Initial installation
321     /sbin/chkconfig --add %{name}-compute
322 fi
323
324 %post collector
325 if [ $1 -eq 1 ] ; then
326     # Initial installation
327     /sbin/chkconfig --add %{name}-collector
328 fi
329
330 %post api
331 if [ $1 -eq 1 ] ; then
332     # Initial installation
333     /sbin/chkconfig --add %{name}-api
334 fi
335
336 %post central
337 if [ $1 -eq 1 ] ; then
338     # Initial installation
339     /sbin/chkconfig --add %{name}-central
340 fi
341
342 %post alarm
343 if [ $1 -eq 1 ] ; then
344     # Initial installation
345     for svc in alarm-notifier alarm-evaluator; do
346         /sbin/chkconfig --add %{name}-${svc}
347     done
348 fi
349
350 %preun compute
351 if [ $1 -eq 0 ] ; then
352     for svc in compute; do
353         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
354         /sbin/chkconfig --del %{name}-${svc}
355     done
356 fi
357
358 %preun collector
359 if [ $1 -eq 0 ] ; then
360     for svc in collector; do
361         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
362         /sbin/chkconfig --del %{name}-${svc}
363     done
364 fi
365
366 %preun api
367 if [ $1 -eq 0 ] ; then
368     for svc in api; do
369         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
370         /sbin/chkconfig --del %{name}-${svc}
371     done
372 fi
373
374 %preun central
375 if [ $1 -eq 0 ] ; then
376     for svc in central; do
377         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
378         /sbin/chkconfig --del %{name}-${svc}
379     done
380 fi
381
382 %preun alarm
383 if [ $1 -eq 0 ] ; then
384     for svc in alarm-notifier alarm-evaluator; do
385         /sbin/service %{name}-${svc} stop > /dev/null 2>&1
386         /sbin/chkconfig --del %{name}-${svc}
387     done
388 fi
389
390 %postun compute
391 if [ $1 -ge 1 ] ; then
392     # Package upgrade, not uninstall
393     for svc in compute; do
394         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
395     done
396 fi
397
398 %postun collector
399 if [ $1 -ge 1 ] ; then
400     # Package upgrade, not uninstall
401     for svc in collector; do
402         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
403     done
404 fi
405
406 %postun api
407 if [ $1 -ge 1 ] ; then
408     # Package upgrade, not uninstall
409     for svc in api; do
410         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
411     done
412 fi
413
414 %postun central
415 if [ $1 -ge 1 ] ; then
416     # Package upgrade, not uninstall
417     for svc in central; do
418         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
419     done
420 fi
421
422 %postun alarm
423 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
424 if [ $1 -ge 1 ] ; then
425     # Package upgrade, not uninstall
426     for svc in alarm-notifier alarm-evaluator; do
427         /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
428     done
429 fi
430
431
432 %files common
433 %doc LICENSE
434 %dir %{_sysconfdir}/ceilometer
435 %attr(-, root, ceilometer) %{_datadir}/ceilometer/ceilometer-dist.conf
436 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/ceilometer.conf
437 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/policy.json
438 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/sources.json
439 %config(noreplace) %attr(-, root, ceilometer) %{_sysconfdir}/ceilometer/pipeline.yaml
440 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
441
442 %dir %attr(0755, ceilometer, root) %{_localstatedir}/log/ceilometer
443 %dir %attr(0755, ceilometer, root) %{_localstatedir}/run/ceilometer
444
445 %{_bindir}/ceilometer-dbsync
446 %{_bindir}/ceilometer-expirer
447
448
449 %defattr(-, ceilometer, ceilometer, -)
450 %dir %{_sharedstatedir}/ceilometer
451 %dir %{_sharedstatedir}/ceilometer/tmp
452
453
454 %files -n python-ceilometer
455 %{python_sitelib}/ceilometer
456 %{python_sitelib}/ceilometer-%{version}*.egg-info
457
458
459 %if 0%{?with_doc}
460 %files doc
461 %doc doc/build/html
462 %endif
463
464
465 %files compute
466 %{_bindir}/ceilometer-agent-compute
467 %{_initrddir}/%{name}-compute
468 %{_datarootdir}/ceilometer/%{name}-compute.upstart
469
470
471 %files collector
472 %{_bindir}/ceilometer-collector*
473 %{_initrddir}/%{name}-collector
474 %{_datarootdir}/ceilometer/%{name}-collector.upstart
475
476
477 %files api
478 %doc ceilometer/api/v1/static/LICENSE.*
479 %{_bindir}/ceilometer-api
480 %{_initrddir}/%{name}-api
481 %{_datarootdir}/ceilometer/%{name}-api.upstart
482
483
484 %files central
485 %{_bindir}/ceilometer-agent-central
486 %{_initrddir}/%{name}-central
487 %{_datarootdir}/ceilometer/%{name}-central.upstart
488
489
490 %files alarm
491 %{_bindir}/ceilometer-alarm-notifier
492 %{_bindir}/ceilometer-alarm-evaluator
493 %{_initrddir}/%{name}-alarm-notifier
494 %{_datarootdir}/ceilometer/%{name}-alarm-notifier.upstart
495 %{_initrddir}/%{name}-alarm-evaluator
496 %{_datarootdir}/ceilometer/%{name}-alarm-evaluator.upstart
497
498
499 %changelog
500 * Thu Apr 10 2014 Pádraig Brady <pbrady@redhat.com> - 2013.2.3-1
501 - Update to Havana stable release 2013.2.3
502
503 * Fri Feb 14 2014 Matthias Runge <mrunge@redhat.com> - 2014.2.2-1
504 - Update to havana stable release 2013.2.2
505
506 * Tue Feb 04 2014 Pádraig Brady <pbrady@redhat.com> - 2013.2.1-2
507 - Fix missing dependency on python-babel
508
509 * Tue Dec 17 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2.1-1
510 - Update to Havana stable release 2013.2.1
511
512 * Thu Oct 17 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-1
513 - Update to Havana release
514
515 * Tue Oct 15 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.12.rc2
516 - Update to Havana rc2
517 - openstack-ceilometer-alarm now depends on python-ceilometerclient
518
519 * Thu Oct 03 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.12.rc1
520 - Update to Havana rc1
521 - Separate out the new alarm services to the 'alarm' subpackage
522
523 * Fri Sep 13 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.10.b3
524 - Depend on python-oslo-config >= 1:1.2.0 so it upgraded automatically
525
526 * Mon Sep 10 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.8.b3
527 - Depend on python-pymongo rather than pymongo to avoid a puppet bug
528
529 * Mon Sep 9 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.7.b3
530 - Depend on python-alembic
531
532 * Mon Sep 9 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.6.b3
533 - Distribute dist defaults in ceilometer-dist.conf separate to user ceilometer.conf
534
535 * Mon Sep 9 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.5.b3
536 - Update to Havana milestone 3
537
538 * Tue Aug 27 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.4.b1
539 - Avoid python runtime dependency management
540
541 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2013.2-0.3.b1
542 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
543
544 * Thu Jun  6 2013 Pádraig Brady <P@draigBrady.com> - 2013.2-0.2.b1
545 - Fix uninstall for openstack-ceilometer-central
546
547 * Fri May 31 2013 Pádraig Brady <P@draigBrady.com> - 2013.2-0.1.b1
548 - Havana milestone 1
549
550 * Mon Apr  8 2013 Pádraig Brady <P@draigBrady.com> - 2013.1-2
551 - Grizzly release
552
553 * Tue Mar 26 2013 Pádraig Brady <P@draigBrady.com> - 2013.1-0.5.g3
554 - Initial package