Merge "Added python-importlib to python-cinder requirement" into openstack-ci/build...
[openstack-build/cinder-build.git] / rpm / SPECS / openstack-cinder.spec
1 %global with_doc %{!?_without_doc:1}%{?_without_doc:0}
2
3 Name:             openstack-cinder
4 Version:          2013.2
5 Release:          0.9.b3%{?dist}
6 Summary:          OpenStack Volume service
7
8 Group:            Applications/System
9 License:          ASL 2.0
10 URL:              http://www.openstack.org/software/openstack-storage/
11 Source0:          https://launchpad.net/cinder/havana/havana-3/+download/cinder-%{version}.b3.tar.gz
12 Source1:          cinder-dist.conf
13 Source2:          cinder.logrotate
14 Source3:          cinder-tgt.conf
15
16 Source10:         openstack-cinder-api.init
17 Source100:        openstack-cinder-api.upstart
18 Source11:         openstack-cinder-scheduler.init
19 Source110:        openstack-cinder-scheduler.upstart
20 Source12:         openstack-cinder-volume.init
21 Source120:        openstack-cinder-volume.upstart
22 Source13:         openstack-cinder-backup.init
23 Source130:        openstack-cinder-backup.upstart
24
25 Source20:         cinder-sudoers
26
27 #
28 # patches_base=2013.2.b3
29 #
30 Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
31 Patch0002: 0002-Use-updated-parallel-install-versions-of-epel-packag.patch
32 Patch0003: 0003-Remove-runtime-dep-on-python-pbr-python-d2to1.patch
33 Patch0004: 0004-Revert-Use-oslo.sphinx-and-remove-local-copy-of-doc-.patch
34
35 BuildArch:        noarch
36 BuildRequires:    intltool
37 BuildRequires:    python-d2to1
38 BuildRequires:    python-pbr
39 BuildRequires:    python-sphinx10
40 BuildRequires:    python-setuptools
41 BuildRequires:    python-netaddr
42 BuildRequires:    openstack-utils
43 BuildRequires:    python-paste-deploy1.5
44 BuildRequires:    python-routes1.12
45 BuildRequires:    python-sqlalchemy0.7
46 BuildRequires:    python-webob1.2
47
48 Requires:         openstack-utils
49 Requires:         python-cinder = %{version}-%{release}
50
51 # as convenience
52 Requires:         python-cinderclient
53
54 Requires(post):   chkconfig
55 Requires(postun): initscripts
56 Requires(preun):  chkconfig
57 Requires(pre):    shadow-utils
58
59 Requires:         lvm2
60 Requires:         scsi-target-utils
61
62 %description
63 OpenStack Volume (codename Cinder) provides services to manage and
64 access block storage volumes for use by Virtual Machine instances.
65
66
67 %package -n       python-cinder
68 Summary:          OpenStack Volume Python libraries
69 Group:            Applications/System
70
71 Requires:         sudo
72
73 Requires:         MySQL-python
74
75 Requires:         qemu-img
76 Requires:         sysfsutils
77
78 Requires:         python-paramiko
79
80 Requires:         python-qpid
81 Requires:         python-kombu
82 Requires:         python-amqplib
83 Requires:         python-importlib
84
85 Requires:         python-eventlet
86 Requires:         python-greenlet
87 Requires:         python-iso8601
88 Requires:         python-netaddr
89 Requires:         python-lxml
90 Requires:         python-anyjson
91 Requires:         python-cheetah
92 Requires:         python-stevedore
93 Requires:         python-suds
94
95 Requires:         python-sqlalchemy0.7
96 Requires:         python-migrate
97
98 Requires:         python-paste-deploy1.5
99 Requires:         python-routes1.12
100 Requires:         python-webob1.2
101
102 Requires:         python-glanceclient >= 1:0
103 Requires:         python-swiftclient >= 1.2
104 Requires:         python-keystoneclient
105 Requires:         python-novaclient >= 2.14
106
107 Requires:         python-oslo-config >= 1:1.2.0
108 Requires:         python-six
109
110 Requires:         python-babel
111 Requires:         python-lockfile
112
113 %description -n   python-cinder
114 OpenStack Volume (codename Cinder) provides services to manage and
115 access block storage volumes for use by Virtual Machine instances.
116
117 This package contains the cinder Python library.
118
119 %if 0%{?with_doc}
120 %package doc
121 Summary:          Documentation for OpenStack Volume
122 Group:            Documentation
123
124 Requires:         %{name} = %{version}-%{release}
125
126 BuildRequires:    graphviz
127
128 # Required to build module documents
129 BuildRequires:    python-eventlet
130 BuildRequires:    python-routes1.12
131 BuildRequires:    python-sqlalchemy0.7
132 BuildRequires:    python-webob1.2
133 # while not strictly required, quiets the build down when building docs.
134 BuildRequires:    python-migrate, python-iso8601
135
136 %description      doc
137 OpenStack Volume (codename Cinder) provides services to manage and
138 access block storage volumes for use by Virtual Machine instances.
139
140 This package contains documentation files for cinder.
141 %endif
142
143 %prep
144 %setup -q -n cinder-%{version}
145
146 %patch0001 -p1
147 %patch0002 -p1
148 %patch0003 -p1
149 %patch0004 -p1
150
151 find . \( -name .gitignore -o -name .placeholder \) -delete
152
153 find cinder -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
154
155 # TODO: Have the following handle multi line entries
156 sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
157
158 # Remove the requirements file so that pbr hooks don't add it
159 # to distutils requires_dist config
160 rm -rf {test-,}requirements.txt tools/{pip,test}-requires
161
162 # We add REDHATCINDERVERSION/RELEASE with the pbr removal patch
163 sed -i s/REDHATCINDERVERSION/%{version}/ cinder/version.py
164 sed -i s/REDHATCINDERRELEASE/%{release}/ cinder/version.py
165
166 %build
167
168 # Move authtoken configuration out of paste.ini
169 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_tenant_name
170 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_user
171 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_password
172 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_host
173 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_port
174 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_protocol
175
176 %{__python} setup.py build
177
178 %install
179 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
180
181 # docs generation requires everything to be installed first
182 export PYTHONPATH="$( pwd ):$PYTHONPATH"
183
184 pushd doc
185
186 %if 0%{?with_doc}
187 SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html
188 # Fix hidden-file-or-dir warnings
189 rm -fr build/html/.doctrees build/html/.buildinfo
190 %endif
191
192 # Create dir link to avoid a sphinx-build exception
193 mkdir -p build/man/.doctrees/
194 ln -s .  build/man/.doctrees/man
195 SPHINX_DEBUG=1 sphinx-1.0-build -b man -c source source/man build/man
196 mkdir -p %{buildroot}%{_mandir}/man1
197 install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/
198
199 popd
200
201 # Setup directories
202 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder
203 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder/tmp
204 install -d -m 755 %{buildroot}%{_localstatedir}/log/cinder
205
206 # Install config files
207 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder
208 install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/cinder/cinder-dist.conf
209 install -p -D -m 640 etc/cinder/cinder.conf.sample %{buildroot}%{_sysconfdir}/cinder/cinder.conf
210 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder/volumes
211 install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt/conf.d/cinder.conf
212 install -p -D -m 640 etc/cinder/rootwrap.conf %{buildroot}%{_sysconfdir}/cinder/rootwrap.conf
213 install -p -D -m 640 etc/cinder/api-paste.ini %{buildroot}%{_sysconfdir}/cinder/api-paste.ini
214 install -p -D -m 640 etc/cinder/policy.json %{buildroot}%{_sysconfdir}/cinder/policy.json
215
216 # Install initscripts for services
217 install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-cinder-api
218 install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-cinder-scheduler
219 install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/openstack-cinder-volume
220 install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/openstack-cinder-backup
221
222 # Install sudoers
223 install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/cinder
224
225 # Install logrotate
226 install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-cinder
227
228 # Install pid directory
229 install -d -m 755 %{buildroot}%{_localstatedir}/run/cinder
230
231 # Install upstart jobs examples
232 install -d -m 755 %{buildroot}%{_datadir}/cinder
233 install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/cinder/
234 install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/cinder/
235 install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/cinder/
236 install -p -m 644 %{SOURCE130} %{buildroot}%{_datadir}/cinder/
237
238 # Install rootwrap files in /usr/share/cinder/rootwrap
239 mkdir -p %{buildroot}%{_datarootdir}/cinder/rootwrap/
240 install -p -D -m 644 etc/cinder/rootwrap.d/* %{buildroot}%{_datarootdir}/cinder/rootwrap/
241
242 # Remove unneeded in production stuff
243 rm -f %{buildroot}%{_bindir}/cinder-debug
244 rm -fr %{buildroot}%{python_sitelib}/cinder/tests/
245 rm -fr %{buildroot}%{python_sitelib}/run_tests.*
246 rm -f %{buildroot}/usr/share/doc/cinder/README*
247
248 %pre
249 getent group cinder >/dev/null || groupadd -r cinder --gid 165
250 if ! getent passwd cinder >/dev/null; then
251   useradd -u 165 -r -g cinder -G cinder,nobody -d %{_sharedstatedir}/cinder -s /sbin/nologin -c "OpenStack Cinder Daemons" cinder
252 fi
253 exit 0
254
255 %post
256 if [ $1 -eq 1 ] ; then
257     # Initial installation
258     for svc in volume api scheduler; do
259         /sbin/chkconfig --add openstack-cinder-$svc
260     done
261 fi
262
263 %preun
264 if [ $1 -eq 0 ] ; then
265     for svc in volume api scheduler; do
266         /sbin/service openstack-cinder-${svc} stop > /dev/null 2>&1
267         /sbin/chkconfig --del openstack-cinder-${svc}
268     done
269 fi
270
271 %postun
272 if [ $1 -ge 1 ] ; then
273     # Package upgrade, not uninstall
274     for svc in volume api scheduler; do
275         /sbin/service openstack-cinder-${svc} condrestart > /dev/null 2>&1 || :
276     done
277 fi
278
279 %files
280 %doc LICENSE
281
282 %dir %{_sysconfdir}/cinder
283 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/cinder.conf
284 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/api-paste.ini
285 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/rootwrap.conf
286 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/policy.json
287 %config(noreplace) %{_sysconfdir}/logrotate.d/openstack-cinder
288 %config(noreplace) %{_sysconfdir}/sudoers.d/cinder
289 %config(noreplace) %{_sysconfdir}/tgt/conf.d/cinder.conf
290 %attr(-, root, cinder) %{_datadir}/cinder/cinder-dist.conf
291
292 %dir %attr(0750, cinder, root) %{_localstatedir}/log/cinder
293 %dir %attr(0755, cinder, root) %{_localstatedir}/run/cinder
294 %dir %attr(0755, cinder, root) %{_sysconfdir}/cinder/volumes
295
296 %{_bindir}/cinder-*
297 %{_initrddir}/openstack-cinder-*
298 %{_datarootdir}/cinder
299 %{_mandir}/man1/cinder*.1.gz
300
301 %defattr(-, cinder, cinder, -)
302 %dir %{_sharedstatedir}/cinder
303 %dir %{_sharedstatedir}/cinder/tmp
304
305 %files -n python-cinder
306 %doc LICENSE
307 %{python_sitelib}/cinder
308 %{python_sitelib}/cinder-%{version}*.egg-info
309
310 %if 0%{?with_doc}
311 %files doc
312 %doc doc/build/html
313 %endif
314
315 %changelog
316 * Wed Sep 18 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.9.b3
317 - Add cinder-dist.conf
318 - Tighten permissions on /var/log/cinder
319
320 * Mon Sep 9 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.8.b3
321 - Update to Havana milestone 3
322 - Add dependency on python-novaclient
323
324 * Thu Aug 29 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.7.b2
325 - Add dependency on sysfsutils to support the fiber channel driver
326
327 * Mon Aug 26 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.5.b2
328 - Add cinder-backup service init script
329
330 * Mon Jul 22 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.4.b2
331 - Add dependency on python-suds to support the netapp driver
332 - Add dependency on python-keystoneclient for auth token middleware
333 - Add dependency on qemu-img for volume creation from Glance images
334
335 * Sun Jul 21 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.3.b2
336 - Update to Havana milestone 2
337
338 * Thu Jun 13 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.2.b1
339 - Update to Havana milestone 1
340
341 * Fri May 10 2013 Eric Harney <eharney@redhat.com> - 2013.1.1-1
342 - Update to Grizzly stable release 1
343
344 * Mon Apr 08 2013 Eric Harney <eharney@redhat.com> - 2013.1-2
345 - Backport fix for GlusterFS driver get_volume_stats
346 - Adjust to support sqlalchemy-0.8.0
347
348 * Thu Apr 04 2013 Eric Harney <eharney@redhat.com> - 2013.1-1
349 - Update to Grizzly final release
350
351 * Wed Mar 27 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.5.rc3
352 - Update to Grizzly RC3 release
353
354 * Mon Mar 25 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.5.rc2
355 - Update to Grizzly RC2 release
356
357 * Mon Mar 18 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.5.rc1
358 - Update to Grizzly RC1 release
359
360 * Tue Mar 05 2013 Pádraig Brady <P@draigBrady.com> - 2013.1-0.4.g3
361 - Add dependency on python-stevedore
362
363 * Wed Feb 27 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.2.g3
364 - Update to Grizzly milestone 3
365
366 * Thu Jan 10 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g2
367 - Update to Grizzly milestone 2
368
369 * Thu Dec 20 2012 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g1
370 - Update to Grizzly milestone 1
371
372 * Mon Dec 03 2012 Eric Harney <eharney@redhat.com> - 2012.2.1-1
373 - Update to Folsom stable release 1
374
375 * Wed Nov 14 2012 Eric Harney <eharney@redhat.com> - 2012.2-4
376 - Remove unused dependency on python-daemon
377
378 * Wed Oct 31 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-3
379 - Adjust to be compatible with python-migrate-0.6
380
381 * Wed Oct 24 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-2
382 - Initial Folsom release