-
Notifications
You must be signed in to change notification settings - Fork 0
/
openstack-trove.spec
365 lines (280 loc) · 11.4 KB
/
openstack-trove.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
%global release_name mitaka
%global service trove
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global with_doc 0
Name: openstack-%{service}
Epoch: 1
Version: XXX
Release: XXX
Summary: OpenStack DBaaS (%{service})
License: ASL 2.0
URL: https://wiki.openstack.org/wiki/Trove
Source0: http://tarballs.openstack.org/%{service}/%{service}-%{upstream_version}.tar.gz
Source1: %{service}.logrotate
Source2: guest_info
Source10: %{name}-api.service
Source11: %{name}-taskmanager.service
Source12: %{name}-conductor.service
Source13: %{name}-guestagent.service
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-pbr >= 1.8
BuildRequires: python-d2to1
BuildRequires: python-sphinx
BuildRequires: crudini
BuildRequires: intltool
Requires: %{name}-api = %{epoch}:%{version}-%{release}
Requires: %{name}-taskmanager = %{epoch}:%{version}-%{release}
Requires: %{name}-conductor = %{epoch}:%{version}-%{release}
%description
OpenStack DBaaS (codename %{service}) provisioning service.
%package common
Summary: Components common to all OpenStack %{service} services
Requires: python-%{service} = %{epoch}:%{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
Requires(pre): shadow-utils
Requires: python-pbr >= 1.8
%description common
OpenStack DBaaS (codename %{service}) provisioning service.
This package contains scripts, config and dependencies shared
between all the OpenStack %{service} services.
%package api
Summary: OpenStack %{service} API service
Requires: %{name}-common = %{epoch}:%{version}-%{release}
%description api
OpenStack DBaaS (codename %{service}) provisioning service.
This package contains the %{service} interface daemon.
%package taskmanager
Summary: OpenStack %{service} taskmanager service
Requires: %{name}-common = %{epoch}:%{version}-%{release}
%description taskmanager
OpenStack DBaaS (codename %{service}) provisioning service.
This package contains the %{service} taskmanager service.
%package conductor
Summary: OpenStack %{service} conductor service
Requires: %{name}-common = %{epoch}:%{version}-%{release}
%description conductor
OpenStack DBaaS (codename %{service}) provisioning service.
This package contains the %{service} conductor service.
%package guestagent
Summary: OpenStack %{service} guest agent
%if 0%{?rhel}
Requires: pexpect
%else
Requires: python-pexpect
%endif
Requires: python-netifaces
Requires: %{name}-common = %{epoch}:%{version}-%{release}
%description guestagent
OpenStack DBaaS (codename %{service}) provisioning service.
This package contains the %{service} guest agent service
that runs within the database VM instance.
%package -n python-%{service}
Summary: Python libraries for %{service}
Requires: MySQL-python
Requires: python-kombu
Requires: python-eventlet
Requires: python-iso8601
Requires: python-netaddr
Requires: python-lxml
Requires: python-six >= 1.9.0
Requires: python-stevedore >= 1.5.0
Requires: python-webob >= 1.2.3
Requires: python-migrate >= 0.9.6
Requires: python-sqlalchemy >= 1.0.10
Requires: python-paste
Requires: python-paste-deploy
Requires: python-routes
Requires: python-troveclient
Requires: python-cinderclient >= 1.6.0
Requires: python-designateclient >= 2.0.0
Requires: python-heatclient >= 1.0.0
Requires: python-keystoneclient >= 1:2.3.1
Requires: python-keystonemiddleware >= 4.3.0
Requires: python-neutronclient >= 4.1.1
Requires: python-novaclient >= 3.3.0
Requires: python-swiftclient >= 3.0.0
Requires: python-oslo-concurrency >= 3.6.0
Requires: python-oslo-config >= 2:3.9.0
Requires: python-oslo-context >= 0.2.0
Requires: python-oslo-db >= 4.6.0
Requires: python-oslo-i18n >= 3.4.0
Requires: python-oslo-log >= 3.2.0
Requires: python-oslo-messaging >= 4.5.0
Requires: python-oslo-middleware >= 3.7.0
Requires: python-oslo-serialization >= 2.4.0
Requires: python-oslo-service >= 1.7.0
Requires: python-oslo-utils >= 3.7.0
Requires: python-osprofiler >= 1.2.0
Requires: python-jsonschema
Requires: python-babel
Requires: python-jinja2
Requires: python-httplib2
Requires: python-passlib
%description -n python-%{service}
OpenStack DBaaS (codename %{service}) provisioning service.
This package contains the %{service} python library.
%package -n python-%{service}-tests
Summary: Trove tests
Requires: python-%{service} = %{epoch}:%{version}-%{release}
%description -n python-%{service}-tests
This package contains the Trove test files
%if 0%{?with_doc}
%package doc
Summary: Documentation for OpenStack %{service}
%description doc
OpenStack DBaaS (codename %{service}) provisioning service.
This package contains documentation files for %{service}.
%endif
%prep
%autosetup -n %{service}-%{upstream_version} -S git
# Avoid non-executable-script rpmlint while maintaining timestamps
find %{service} -name \*.py |
while read source; do
if head -n1 "$source" | grep -F '/usr/bin/env'; then
touch --ref="$source" "$source".ts
sed -i '/\/usr\/bin\/env python/{d;q}' "$source"
touch --ref="$source".ts "$source"
rm "$source".ts
fi
done
# Remove the requirements file so that pbr hooks don't add it
# to distutils requires_dist config
rm -rf {test-,}requirements.txt
%build
%{__python2} setup.py build
%install
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
# docs generation requires everything to be installed first
export PYTHONPATH="$( pwd ):$PYTHONPATH"
%if 0%{?with_doc}
pushd doc
SPHINX_DEBUG=1 sphinx-build -b html source build/html
# Fix hidden-file-or-dir warnings
rm -fr build/html/.doctrees build/html/.buildinfo
# Create dir link to avoid a sphinx-build exception
mkdir -p build/man/.doctrees/
ln -s . build/man/.doctrees/man
SPHINX_DEBUG=1 sphinx-build -b man -c source source/man build/man
mkdir -p %{buildroot}%{_mandir}/man1
install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/
popd
%endif
# Setup directories
%if 0%{?rhel} != 6
install -d -m 755 %{buildroot}%{_unitdir}
%endif
install -d -m 755 %{buildroot}%{_datadir}/%{service}
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{service}
install -d -m 750 %{buildroot}%{_localstatedir}/log/%{service}
# Install config files
install -p -D -m 640 etc/%{service}/%{service}.conf.sample %{buildroot}%{_sysconfdir}/%{service}/%{service}.conf
# Use crudini to set some configuration keys
crudini --set %{buildroot}%{_sysconfdir}/%{service}/%{service}.conf database connection mysql://trove:trove@localhost/trove
crudini --set %{buildroot}%{_sysconfdir}/%{service}/%{service}.conf DEFAULT log_file %{_localstatedir}/log/%{service}/%{service}.log
install -p -D -m 644 etc/%{service}/api-paste.ini %{buildroot}%{_sysconfdir}/%{service}/api-paste.ini
install -d -m 755 %{buildroot}%{_sysconfdir}/%{service}
install -p -D -m 640 etc/%{service}/trove-taskmanager.conf.sample %{buildroot}%{_sysconfdir}/%{service}/trove-taskmanager.conf
install -p -D -m 640 etc/%{service}/trove-conductor.conf.sample %{buildroot}%{_sysconfdir}/%{service}/trove-conductor.conf
install -p -D -m 640 etc/%{service}/trove-guestagent.conf.sample %{buildroot}%{_sysconfdir}/%{service}/trove-guestagent.conf
install -p -D -m 640 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{service}/guest_info
# Install initscripts
%if 0%{?rhel} == 6
install -p -D -m 755 %{SOURCE20} %{buildroot}%{_initrddir}/%{name}-api
install -p -D -m 755 %{SOURCE21} %{buildroot}%{_initrddir}/%{name}-taskmanager
install -p -D -m 755 %{SOURCE22} %{buildroot}%{_initrddir}/%{name}-conductor
install -p -D -m 755 %{SOURCE23} %{buildroot}%{_initrddir}/%{name}-guestagent
install -p -m 755 %{SOURCE30} %{SOURCE31} %{SOURCE32} %{SOURCE33} %{buildroot}%{_datadir}/%{service}
%else
install -p -m 644 %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{buildroot}%{_unitdir}
%endif
# Install logrotate
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# Install pid directory
install -d -m 755 %{buildroot}%{_localstatedir}/run/%{service}
# Remove unneeded in production stuff
rm -fr %{buildroot}%{_bindir}/trove-fake-mode
rm -fr %{buildroot}%{python_sitelib}/run_tests.*
%pre common
# Origin: http://fedoraproject.org/wiki/Packaging:UsersAndGroups#Dynamic_allocation
USERNAME=%{service}
GROUPNAME=$USERNAME
HOMEDIR=%{_sharedstatedir}/$USERNAME
getent group $GROUPNAME >/dev/null || groupadd -r $GROUPNAME
getent passwd $USERNAME >/dev/null || \
useradd -r -g $GROUPNAME -G $GROUPNAME -d $HOMEDIR -s /sbin/nologin \
-c "$USERNAME Daemons" $USERNAME
exit 0
%post api
%systemd_post openstack-trove-api.service
%post taskmanager
%systemd_post openstack-trove-taskmanager.service
%post conductor
%systemd_post openstack-trove-conductor.service
%post guestagent
%systemd_post openstack-trove-guestagent.service
%preun api
%systemd_preun openstack-trove-api.service
%preun taskmanager
%systemd_preun openstack-trove-taskmanager.service
%preun conductor
%systemd_preun openstack-trove-conductor.service
%preun guestagent
%systemd_preun openstack-trove-guestagent.service
%postun api
%systemd_postun_with_restart openstack-trove-api.service
%postun taskmanager
%systemd_postun_with_restart openstack-trove-taskmanager.service
%postun conductor
%systemd_postun_with_restart openstack-trove-conductor.service
%postun guestagent
%systemd_postun_with_restart openstack-trove-guestagent.service
%files
%license LICENSE
%files common
%license LICENSE
%dir %{_sysconfdir}/%{service}
%config(noreplace) %attr(0640, root, %{service}) %{_sysconfdir}/%{service}/%{service}.conf
%attr(0640, root, %{service}) %{_sysconfdir}/%{service}/api-paste.ini
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0750, %{service}, root) %{_localstatedir}/log/%{service}
%dir %attr(0755, %{service}, root) %{_localstatedir}/run/%{service}
%{_bindir}/%{service}-manage
%{_bindir}/trove-mgmt-taskmanager
%{_datarootdir}/%{service}
%defattr(-, %{service}, %{service}, -)
%dir %{_sharedstatedir}/%{service}
%files api
%{_bindir}/%{service}-api
%{_unitdir}/%{name}-api.service
%files taskmanager
%{_bindir}/%{service}-taskmanager
%{_unitdir}/%{name}-taskmanager.service
%config(noreplace) %attr(0640, root, %{service}) %{_sysconfdir}/%{service}/%{service}-taskmanager.conf
%files conductor
%{_bindir}/%{service}-conductor
%{_unitdir}/%{name}-conductor.service
%config(noreplace) %attr(0640, root, %{service}) %{_sysconfdir}/%{service}/%{service}-conductor.conf
%files guestagent
%{_bindir}/%{service}-guestagent
%{_unitdir}/%{name}-guestagent.service
%config(noreplace) %attr(0640, root, %{service}) %{_sysconfdir}/%{service}/%{service}-guestagent.conf
%config(noreplace) %attr(0640, root, %{service}) %{_sysconfdir}/%{service}/guest_info
%files -n python-%{service}
%license LICENSE
%{python2_sitelib}/%{service}
%{python2_sitelib}/%{service}-%{version}*.egg-info
%exclude %{python2_sitelib}/%{service}/tests
%files -n python-%{service}-tests
%license LICENSE
%{python2_sitelib}/%{service}/tests
%if 0%{?with_doc}
%files doc
%license LICENSE
%doc doc/build/html
%endif
%changelog