]> review.fuel-infra Code Review - openstack-build/cinder-build.git/blob - rpm/SPECS/openstack-cinder.spec
added cinder rpm files
[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.1
5 Release:          0.4.g3%{?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/grizzly/grizzly-3/+download/cinder-2013.1.g3.tar.gz
12 Source1:          cinder.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
23 Source20:         cinder-sudoers
24
25 #
26 # patches_base=grizzly-3
27 #
28 Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
29
30 # This is EPEL specific and not upstream
31 Patch100:         openstack-cinder-newdeps.patch
32
33 BuildArch:        noarch
34 BuildRequires:    intltool
35 BuildRequires:    python-sphinx10
36 BuildRequires:    python-setuptools
37 BuildRequires:    python-netaddr
38 BuildRequires:    openstack-utils
39 # These are required to build due to the requirements check added
40 BuildRequires:    python-paste-deploy1.5
41 BuildRequires:    python-routes1.12
42 BuildRequires:    python-sqlalchemy0.7
43 BuildRequires:    python-webob1.0
44
45 Requires:         openstack-utils
46 Requires:         python-cinder = %{version}-%{release}
47
48 # as convenience
49 Requires:         python-cinderclient
50
51 Requires(post):   chkconfig
52 Requires(postun): initscripts
53 Requires(preun):  chkconfig
54 Requires(pre):    shadow-utils
55
56 Requires:         lvm2
57 Requires:         scsi-target-utils
58
59 %description
60 OpenStack Volume (codename Cinder) provides services to manage and
61 access block storage volumes for use by Virtual Machine instances.
62
63
64 %package -n       python-cinder
65 Summary:          OpenStack Volume Python libraries
66 Group:            Applications/System
67
68 Requires:         sudo
69
70 Requires:         MySQL-python
71
72 Requires:         python-paramiko
73
74 Requires:         python-qpid
75 Requires:         python-kombu
76 Requires:         python-amqplib
77
78 Requires:         python-eventlet
79 Requires:         python-greenlet
80 Requires:         python-iso8601
81 Requires:         python-netaddr
82 Requires:         python-lxml
83 Requires:         python-anyjson
84 Requires:         python-cheetah
85 Requires:         python-stevedore
86
87 Requires:         python-sqlalchemy0.7
88 Requires:         python-migrate
89
90 Requires:         python-paste-deploy1.5
91 Requires:         python-routes1.12
92 Requires:         python-webob1.0
93
94 Requires:         python-glanceclient >= 1:0
95
96 %description -n   python-cinder
97 OpenStack Volume (codename Cinder) provides services to manage and
98 access block storage volumes for use by Virtual Machine instances.
99
100 This package contains the cinder Python library.
101
102 %if 0%{?with_doc}
103 %package doc
104 Summary:          Documentation for OpenStack Volume
105 Group:            Documentation
106
107 Requires:         %{name} = %{version}-%{release}
108
109 BuildRequires:    graphviz
110
111 # Required to build module documents
112 BuildRequires:    python-eventlet
113 BuildRequires:    python-routes1.12
114 BuildRequires:    python-sqlalchemy0.7
115 BuildRequires:    python-webob1.0
116 # while not strictly required, quiets the build down when building docs.
117 BuildRequires:    python-migrate, python-iso8601
118
119 %description      doc
120 OpenStack Volume (codename Cinder) provides services to manage and
121 access block storage volumes for use by Virtual Machine instances.
122
123 This package contains documentation files for cinder.
124 %endif
125
126 %prep
127 %setup -q -n cinder-%{version}.g3
128
129 %patch0001 -p1
130
131 # Apply EPEL patch
132 %patch100 -p1
133
134 find . \( -name .gitignore -o -name .placeholder \) -delete
135
136 find cinder -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
137
138 # TODO: Have the following handle multi line entries
139 sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
140
141 %build
142
143 # Move authtoken configuration out of paste.ini
144 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_tenant_name
145 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_user
146 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_password
147 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_host
148 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_port
149 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_protocol
150
151 %{__python} setup.py build
152
153 %install
154 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
155
156 # docs generation requires everything to be installed first
157 export PYTHONPATH="$( pwd ):$PYTHONPATH"
158
159 pushd doc
160
161 %if 0%{?with_doc}
162 SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html
163 # Fix hidden-file-or-dir warnings
164 rm -fr build/html/.doctrees build/html/.buildinfo
165 %endif
166
167 # Create dir link to avoid a sphinx-build exception
168 mkdir -p build/man/.doctrees/
169 ln -s .  build/man/.doctrees/man
170 SPHINX_DEBUG=1 sphinx-1.0-build -b man -c source source/man build/man
171 mkdir -p %{buildroot}%{_mandir}/man1
172 install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/
173
174 popd
175
176 # Setup directories
177 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder
178 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder/tmp
179 install -d -m 755 %{buildroot}%{_localstatedir}/log/cinder
180
181 # Install config files
182 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder
183 install -p -D -m 640 %{SOURCE1} %{buildroot}%{_sysconfdir}/cinder/cinder.conf
184 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder/volumes
185 install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt/conf.d/cinder.conf
186 install -p -D -m 640 etc/cinder/rootwrap.conf %{buildroot}%{_sysconfdir}/cinder/rootwrap.conf
187 install -p -D -m 640 etc/cinder/api-paste.ini %{buildroot}%{_sysconfdir}/cinder/api-paste.ini
188 install -p -D -m 640 etc/cinder/policy.json %{buildroot}%{_sysconfdir}/cinder/policy.json
189
190 # Install initscripts for services
191 install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-cinder-api
192 install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-cinder-scheduler
193 install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/openstack-cinder-volume
194
195 # Install sudoers
196 install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/cinder
197
198 # Install logrotate
199 install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-cinder
200
201 # Install pid directory
202 install -d -m 755 %{buildroot}%{_localstatedir}/run/cinder
203
204 # Install upstart jobs examples
205 install -d -m 755 %{buildroot}%{_datadir}/cinder
206 install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/cinder/
207 install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/cinder/
208 install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/cinder/
209
210 # Install rootwrap files in /usr/share/cinder/rootwrap
211 mkdir -p %{buildroot}%{_datarootdir}/cinder/rootwrap/
212 install -p -D -m 644 etc/cinder/rootwrap.d/* %{buildroot}%{_datarootdir}/cinder/rootwrap/
213
214 # Remove unneeded in production stuff
215 rm -f %{buildroot}%{_bindir}/cinder-debug
216 rm -fr %{buildroot}%{python_sitelib}/cinder/tests/
217 rm -fr %{buildroot}%{python_sitelib}/run_tests.*
218 rm -f %{buildroot}/usr/share/doc/cinder/README*
219
220 %pre
221 getent group cinder >/dev/null || groupadd -r cinder --gid 165
222 if ! getent passwd cinder >/dev/null; then
223   useradd -u 165 -r -g cinder -G cinder,nobody -d %{_sharedstatedir}/cinder -s /sbin/nologin -c "OpenStack Cinder Daemons" cinder
224 fi
225 exit 0
226
227 %post
228 if [ $1 -eq 1 ] ; then
229     # Initial installation
230     for svc in volume api scheduler; do
231         /sbin/chkconfig --add openstack-cinder-$svc
232     done
233 fi
234
235 %preun
236 if [ $1 -eq 0 ] ; then
237     for svc in volume api scheduler; do
238         /sbin/service openstack-cinder-${svc} stop > /dev/null 2>&1
239         /sbin/chkconfig --del openstack-cinder-${svc}
240     done
241 fi
242
243 %postun
244 if [ $1 -ge 1 ] ; then
245     # Package upgrade, not uninstall
246     for svc in volume api scheduler; do
247         /sbin/service openstack-cinder-${svc} condrestart > /dev/null 2>&1 || :
248     done
249 fi
250
251 %files
252 %doc LICENSE
253
254 %dir %{_sysconfdir}/cinder
255 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/cinder.conf
256 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/api-paste.ini
257 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/rootwrap.conf
258 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/policy.json
259 %config(noreplace) %{_sysconfdir}/logrotate.d/openstack-cinder
260 %config(noreplace) %{_sysconfdir}/sudoers.d/cinder
261 %config(noreplace) %{_sysconfdir}/tgt/conf.d/cinder.conf
262
263 %dir %attr(0755, cinder, root) %{_localstatedir}/log/cinder
264 %dir %attr(0755, cinder, root) %{_localstatedir}/run/cinder
265 %dir %attr(0755, cinder, root) %{_sysconfdir}/cinder/volumes
266
267 %{_bindir}/cinder-*
268 %{_initrddir}/openstack-cinder-*
269 %{_datarootdir}/cinder
270 %{_mandir}/man1/cinder*.1.gz
271
272 %defattr(-, cinder, cinder, -)
273 %dir %{_sharedstatedir}/cinder
274 %dir %{_sharedstatedir}/cinder/tmp
275
276 %files -n python-cinder
277 %doc LICENSE
278 %{python_sitelib}/cinder
279 %{python_sitelib}/cinder-%{version}*.egg-info
280
281 %if 0%{?with_doc}
282 %files doc
283 %doc doc/build/html
284 %endif
285
286 %changelog
287 * Tue Mar 05 2013 Pádraig Brady <P@draigBrady.com> - 2013.1.0.4.g3
288 - Add dependency on python-stevedore
289
290 * Wed Feb 27 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.2.g3
291 - Update to Grizzly milestone 3
292
293 * Thu Jan 10 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g2
294 - Update to Grizzly milestone 2
295
296 * Thu Dec 20 2012 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g1
297 - Update to Grizzly milestone 1
298
299 * Mon Dec 03 2012 Eric Harney <eharney@redhat.com> - 2012.2.1-1
300 - Update to Folsom stable release 1
301
302 * Wed Nov 14 2012 Eric Harney <eharney@redhat.com> - 2012.2-4
303 - Remove unused dependency on python-daemon
304
305 * Wed Oct 31 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-3
306 - Adjust to be compatible with python-migrate-0.6
307
308 * Wed Oct 24 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-2
309 - Initial Folsom release