-
Notifications
You must be signed in to change notification settings - Fork 0
/
openstack-sahara.spec
381 lines (314 loc) · 12.9 KB
/
openstack-sahara.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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
#######################
# Globals Declaration #
#######################
%global release_name liberty
%global service sahara
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global sahara_user sahara
%global sahara_group %{sahara_user}
%if 0%{?rhel} && 0%{?rhel} <= 7
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
%endif
####################
# openstack-sahara #
####################
Name: openstack-sahara
# Liberty semver reset
# https://review.openstack.org/#/q/I6a35fa0dda798fad93b804d00a46af80f08d475c,n,z
Epoch: 1
Version: XXX
Release: XXX
Provides: openstack-savanna
Summary: Apache Hadoop cluster management on OpenStack
License: ASL 2.0
URL: https://launchpad.net/sahara
Source0: http://tarballs.openstack.org/%{service}/%{service}-master.tar.gz
Source1: sahara.logrotate
Source2: openstack-sahara-all.service
Source3: openstack-sahara-api.service
Source4: openstack-sahara-engine.service
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-sphinx >= 1.1.2
BuildRequires: python-oslo-sphinx >= 2.5.0
BuildRequires: python-sphinxcontrib-httpdomain
BuildRequires: python-pbr >= 1.6
BuildRequires: systemd-units
BuildRequires: python-tooz >= 1.28.0
# config generator
BuildRequires: python-zmq
BuildRequires: python-redis
BuildRequires: python-oslo-config >= 2:2.3.0
BuildRequires: python-castellan >= 0.3.1
# test requirements
BuildRequires: python-testresources
BuildRequires: python-oslotest
BuildRequires: python-hacking
BuildRequires: python-alembic
BuildRequires: python-barbicanclient >= 3.3.0
BuildRequires: python-cinderclient >= 1.3.1
BuildRequires: python-flask >= 0.10
BuildRequires: python-heatclient >= 0.3.0
BuildRequires: python-jsonschema >= 2.0.0
BuildRequires: python-keystoneclient >= 1.6.0
BuildRequires: python-keystonemiddleware >= 2.0.0
BuildRequires: python-paramiko >= 1.13.0
BuildRequires: python-manilaclient >= 1.3.0
BuildRequires: python-neutronclient >= 2.6.0
BuildRequires: python-novaclient >= 2.28.1
BuildRequires: python-oslo-concurrency >= 2.3.0
BuildRequires: python-oslo-db >= 2.4.1
BuildRequires: python-oslo-i18n >= 1.5.0
BuildRequires: python-oslo-log >= 1.8.0
BuildRequires: python-oslo-messaging >= 2.5.0
BuildRequires: python-oslo-policy >= 0.5.0
BuildRequires: python-oslo-serialization >= 1.4.0
BuildRequires: python-swiftclient >= 2.2.0
BuildRequires: python-oslo-utils >= 2.0.0
BuildRequires: python-routes
Requires: openstack-sahara-common = %{epoch}:%{version}-%{release}
Requires: openstack-sahara-engine = %{epoch}:%{version}-%{release}
Requires: openstack-sahara-api = %{epoch}:%{version}-%{release}
%description
Sahara provides the ability to elastically manage Apache Hadoop clusters on
OpenStack.
%files
%{_unitdir}/openstack-sahara-all.service
%{_bindir}/sahara-all
%post
%systemd_post openstack-sahara-all.service
%preun
%systemd_preun openstack-sahara-all.service
%postun
%systemd_postun_with_restart openstack-sahara-all.service
#################
# python-sahara #
#################
%package -n python-sahara
Summary: Sahara Python libraries
Requires: python-alembic >= 0.8.0
Requires: python-babel >= 1.3
Requires: python-barbicanclient >= 3.3.0
Requires: python-castellan >= 0.3.1
Requires: python-cinderclient >= 1.3.1
Requires: python-eventlet >= 0.17.4
Requires: python-flask >= 0.10
Requires: python-heatclient >= 0.3.0
Requires: python-iso8601 >= 0.1.9
Requires: python-jinja2 >= 2.6
Requires: python-jsonschema >= 2.0.0
Requires: python-keystoneclient >= 1.6.0
Requires: python-keystonemiddleware >= 2.0.0
Requires: python-manilaclient >= 1.3.0
Requires: python-neutronclient >= 2.6.0
Requires: python-novaclient >= 2.28.1
Requires: python-oslo-concurrency >= 2.3.0
Requires: python-oslo-config >= 2:2.3.0
Requires: python-oslo-context >= 0.2.0
Requires: python-oslo-db >= 2.4.1
Requires: python-oslo-i18n >= 1.5.0
Requires: python-oslo-log >= 1.8.0
Requires: python-oslo-messaging >= 2.5.0
Requires: python-oslo-middleware >= 2.8.0
Requires: python-oslo-policy >= 0.5.0
Requires: python-oslo-rootwrap >= 2.0.0
Requires: python-oslo-serialization >= 1.4.0
Requires: python-oslo-service >= 0.7.0
Requires: python-oslo-utils >= 2.0.0
Requires: python-paramiko >= 1.13.0
Requires: python-pbr >= 1.6
Requires: python-requests >= 2.5.2
Requires: python-six >= 1.9.0
Requires: python-sqlalchemy >= 0.9.9
Requires: python-stevedore >= 1.5.0
Requires: python-swiftclient >= 2.2.0
Requires: python-tooz >= 1.28.0
Requires: python-webob >= 1.2.3
%description -n python-sahara
Sahara provides the ability to elastically manage Apache Hadoop clusters on
OpenStack. This package contains the Sahara Python library.
%files -n python-sahara
%doc README.rst
%license LICENSE
%{python2_sitelib}/sahara
%{python2_sitelib}/sahara-%{upstream_version}-py?.?.egg-info
%exclude %{python2_sitelib}/%{service}/tests
%package -n python-%{service}-tests
Summary: Sahara tests
Requires: openstack-%{service} = %{epoch}:%{version}-%{release}
%description -n python-%{service}-tests
Sahara provides the ability to elastically manage Apache Hadoop clusters on
OpenStack. This package contains the Sahara Python library.
This package contains the Sahara test files.
%files -n python-%{service}-tests
%license LICENSE
%{python2_sitelib}/%{service}/tests
####################
# openstack-common #
####################
%package common
Summary: Components common to all Sahara services
Requires: python-sahara = %{epoch}:%{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires(pre): shadow-utils
%description common
Sahara provides the ability to elastically manage Apache Hadoop clusters on
OpenStack. These components are common to all Sahara services.
%pre common
# Origin: http://fedoraproject.org/wiki/Packaging:UsersAndGroups#Dynamic_allocation
USERNAME=%{sahara_user}
GROUPNAME=%{sahara_group}
HOMEDIR=%{_sharedstatedir}/sahara
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 "Sahara Daemons" $USERNAME
exit 0
%files common
%doc README.rst
%license LICENSE
%dir %{_sysconfdir}/sahara
# Note: this file is not readable because it holds auth credentials
%config(noreplace) %attr(-, root, %{sahara_group}) %{_sysconfdir}/sahara/sahara.conf
%config(noreplace) %attr(-, root, %{sahara_group}) %{_sysconfdir}/sahara/policy.json
%config(noreplace) %attr(-, root, %{sahara_group}) %{_sysconfdir}/sahara/rootwrap.conf
%config(noreplace) %attr(-, root, %{sahara_group}) %{_sysconfdir}/sahara/api-paste.ini
%config(noreplace) %{_sysconfdir}/sudoers.d/sahara-rootwrap
%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-sahara
%{_sysconfdir}/sahara/rootwrap.d/
%{_bindir}/_sahara-subprocess
%{_bindir}/sahara-db-manage
%{_bindir}/sahara-rootwrap
%{_bindir}/sahara-templates
%{_bindir}/sahara-wsgi-api
%dir %attr(-, %{sahara_user}, %{sahara_group}) %{_sharedstatedir}/sahara
%dir %attr(0750, %{sahara_user}, %{sahara_group}) %{_localstatedir}/log/sahara
%{_datarootdir}/sahara/
# Note: permissions on sahara's home are intentionally 0700
%dir %{_datadir}/sahara
#################
# openstack-doc #
#################
%package doc
Group: Documentation
Summary: Usage documentation for the Sahara cluster management API
Requires: openstack-sahara-common = %{epoch}:%{version}-%{release}
%description doc
Sahara provides the ability to elastically manage Apache Hadoop clusters on
OpenStack. This documentation provides instructions and examples on how to
install, use, and manage the Sahara infrastructure.
%files doc
%license LICENSE
%{_pkgdocdir}/html
%{_mandir}/man1
####################
# openstack-engine #
####################
%package engine
Summary: The Sahara cluster management engine
Requires: openstack-sahara-common = %{epoch}:%{version}-%{release}
%description engine
Sahara provides the ability to elastically manage Apache Hadoop clusters on
OpenStack. This documentation provides instructions and examples on how to
install, use, and manage the Sahara infrastructure.
%files engine
%{_unitdir}/openstack-sahara-engine.service
%{_bindir}/sahara-engine
%post engine
%systemd_post openstack-sahara-engine.service
%preun engine
%systemd_preun openstack-sahara-engine.service
%postun engine
%systemd_postun_with_restart openstack-sahara-engine.service
#################
# openstack-api #
#################
%package api
Summary: The Sahara cluster management API
Requires: openstack-sahara-common = %{epoch}:%{version}-%{release}
%description api
Sahara provides the ability to elastically manage Apache Hadoop clusters on
OpenStack. This documentation provides instructions and examples on how to
install, use, and manage the Sahara infrastructure.
%files api
%{_unitdir}/openstack-sahara-api.service
%{_bindir}/sahara-api
%post api
%systemd_post openstack-sahara-api.service
%preun api
%systemd_preun openstack-sahara-api.service
%postun api
%systemd_postun_with_restart openstack-sahara-api.service
######################
# Common Build Steps #
######################
%prep
%setup -q -n sahara-%{upstream_version}
# let RPM handle deps
rm -rf {test-,}requirements.txt
# remove the shbang from these files to suppress rpmlint warnings, these are
# python based scripts that get processed to form the installed shell scripts.
for file in sahara/cli/*.py; do
sed 1,2d $file > $file.new &&
touch -r $file $file.new &&
mv $file.new $file
done
# set executable on these files to suppress rpmlint warnings, they are used as
# templates to create shell scripts.
chmod a+x sahara/plugins/vanilla/hadoop2/resources/post_conf.template
chmod a+x sahara/plugins/spark/resources/spark-env.sh.template
# also set executable on this topology script, should have been set upstream
chmod a+x sahara/plugins/spark/resources/topology.sh
%build
%{__python2} setup.py build
export PYTHONPATH=$PWD:${PYTHONPATH}
# Note: json warnings likely resolved w/ pygments 1.5 (not yet in Fedora)
sphinx-build doc/source html
rm -rf html/.{doctrees,buildinfo}
sphinx-build -b man doc/source build/man
PYTHONPATH=. oslo-config-generator --config-file=tools/config/config-generator.sahara.conf --output-file=etc/sahara/sahara.conf
sed -i 's#^\#api_paste_config.*#api_paste_config = /etc/sahara/api-paste.ini#' etc/sahara/sahara.conf
%install
%{__python2} setup.py install --skip-build --root %{buildroot}
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/openstack-sahara-all.service
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/openstack-sahara-api.service
install -p -D -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/openstack-sahara-engine.service
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-sahara
HOME=%{_sharedstatedir}/sahara
install -d -m 700 %{buildroot}$HOME
install -p -D -m 640 etc/sahara/sahara.conf %{buildroot}%{_sysconfdir}/sahara/sahara.conf
install -D -m 640 etc/sahara/policy.json %{buildroot}%{_sysconfdir}/sahara/policy.json
install -p -D -m 640 etc/sahara/rootwrap.conf %{buildroot}%{_sysconfdir}/sahara/rootwrap.conf
install -p -D -m 640 etc/sahara/api-paste.ini %{buildroot}%{_sysconfdir}/sahara/api-paste.ini
install -p -D -m 640 etc/sudoers.d/sahara-rootwrap %{buildroot}%{_sysconfdir}/sudoers.d/sahara-rootwrap
# Remove duplicate installations of config in share dir
rm %{buildroot}%{_datarootdir}/sahara/sahara.conf
rm %{buildroot}%{_datarootdir}/sahara/policy.json
rm %{buildroot}%{_datarootdir}/sahara/rootwrap.conf
rm %{buildroot}%{_datarootdir}/sahara/api-paste.ini
# Install rootwrap files in /usr/share/sahara/rootwrap
mkdir -p %{buildroot}%{_datarootdir}/sahara/rootwrap/
install -p -D -m 644 etc/sahara/rootwrap.d/* %{buildroot}%{_datarootdir}/sahara/rootwrap/
# And add symlink under /etc/sahara/rootwrap.d, because the default config file needs that
mkdir -p %{buildroot}%{_sysconfdir}/sahara/rootwrap.d
for filter in %{buildroot}%{_datarootdir}/sahara/rootwrap/*.filters; do
ln -s %{_datarootdir}/sahara/rootwrap/$(basename $filter) %{buildroot}%{_sysconfdir}/sahara/rootwrap.d/
done
mkdir -p -m0755 %{buildroot}/%{_localstatedir}/log/sahara
# Copy built doc files for doc subpackage
mkdir -p %{buildroot}/%{_pkgdocdir}
cp -rp html %{buildroot}/%{_pkgdocdir}
mkdir -p %{buildroot}%{_mandir}/man1
cp -rp build/man/*.1 %{buildroot}%{_mandir}/man1
%check
# FIXME: disabling tests in Rawhide until Sahara code is adapted to newest flake8
%if 0%{?fedora} < 24
sh run_tests.sh --no-virtual-env
%endif
#############
# Changelog #
#############
%changelog