-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathheketi.spec
504 lines (407 loc) · 15.8 KB
/
heketi.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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
%if 0%{?fedora}
%global with_devel 1
%global with_python 1
%global with_bundled 1
%global with_debug 0
%global with_check 1
%global with_unit_test 1
%else
%global with_devel 0
%global with_python 0
%global with_bundled 1
%global with_debug 0
# there is a race in the test-cases:
# https://github.com/heketi/heketi/issues/1468
%global with_check 0
%global with_unit_test 0
%endif
# Determine if systemd will be used
%if ( 0%{?fedora} && 0%{?fedora} > 16 ) || ( 0%{?rhel} && 0%{?rhel} > 6 )
%global with_systemd 1
%endif
%if 0%{?with_debug}
%global _dwz_low_mem_die_limit 0
%else
%global debug_package %{nil}
%endif
%global provider github
%global provider_tld com
%global project heketi
%global repo heketi
# https://github.com/heketi/heketi
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
Name: %{repo}
Version: 9.0.0
Release: 1%{?dist}
Summary: RESTful based volume management framework for GlusterFS
License: LGPLv3+ and GPLv2
URL: https://%{provider_prefix}
Source0: https://%{provider_prefix}/archive/v%{version}/%{name}-v%{version}.tar.gz
Source1: https://%{provider_prefix}/releases/download/v%{version}/%{name}-deps-v%{version}.tar.gz
Source2: %{name}.json
Source3: %{name}.service
Source4: %{name}.initd
# go-toolset SCLo is not available for non-x86_64 architectures
ExclusiveArch: x86_64
BuildRequires: go-toolset-7-golang-bin
BuildRequires: go-toolset-7-runtime
BuildRequires: openssl-devel
Requires(pre): shadow-utils
%if 0%{?with_systemd}
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(preun): /sbin/chkconfig
Requires(postun): /sbin/service
%endif
%description
Heketi provides a RESTful management interface which can be used to manage
the life cycle of GlusterFS volumes. With Heketi, cloud services like
OpenStack Manila, Kubernetes, and OpenShift can dynamically provision
GlusterFS volumes with any of the supported durability types. Heketi
will automatically determine the location for bricks across the cluster,
making sure to place bricks and its replicas across different failure
domains. Heketi also supports any number of GlusterFS clusters, allowing
cloud services to provide network file storage without being limited to a
single GlusterFS cluster.
%if 0%{?with_devel}
%package devel
Summary: %{summary}
BuildArch: noarch
%if 0%{?with_check} && ! 0%{?with_bundled}
BuildRequires: golang(github.com/auth0/go-jwt-middleware)
BuildRequires: golang(github.com/boltdb/bolt)
BuildRequires: golang(github.com/codegangsta/negroni)
BuildRequires: golang(github.com/dgrijalva/jwt-go)
BuildRequires: golang(github.com/gorilla/context)
BuildRequires: golang(github.com/gorilla/mux)
BuildRequires: golang(github.com/lpabon/godbc)
BuildRequires: golang(golang.org/x/crypto/ssh)
BuildRequires: golang(golang.org/x/crypto/ssh/agent)
%endif
%if 0%{?with_bundled} && 0%{?fedora}
Provides: bundled(golang(github.com/auth0/go-jwt-middleware)) = 8c897f7c3631a9e9405b9496fd8ce241acdef230
Provides: bundled(golang(github.com/boltdb/bolt)) = 980670afcebfd86727505b3061d8667195234816
Provides: bundled(golang(github.com/codegangsta/negroni)) = c7477ad8e330bef55bf1ebe300cf8aa67c492d1b
Provides: bundled(golang(github.com/dgrijalva/jwt-go)) = 5ca80149b9d3f8b863af0e2bb6742e608603bd99
Provides: bundled(golang(github.com/gorilla/context)) = 215affda49addc4c8ef7e2534915df2c8c35c6cd
Provides: bundled(golang(github.com/gorilla/mux)) = f15e0c49460fd49eebe2bcc8486b05d1bef68d3a
Provides: bundled(golang(github.com/lpabon/godbc)) = 9577782540c1398b710ddae1b86268ba03a19b0c
Provides: bundled(golang(golang.org/x/crypto/ssh)) = fcdb74e78f2621098ebc0376bbadffcf580ccfe4
Provides: bundled(golang(golang.org/x/crypto/ssh/agent)) = fcdb74e78f2621098ebc0376bbadffcf580ccfe4
%endif
Provides: golang(%{import_path}/apps) = %{version}-%{release}
Provides: golang(%{import_path}/apps/glusterfs) = %{version}-%{release}
Provides: golang(%{import_path}/client/api/go-client) = %{version}-%{release}
Provides: golang(%{import_path}/client/cli/go/commands) = %{version}-%{release}
Provides: golang(%{import_path}/executors) = %{version}-%{release}
Provides: golang(%{import_path}/executors/mockexec) = %{version}-%{release}
Provides: golang(%{import_path}/executors/sshexec) = %{version}-%{release}
Provides: golang(%{import_path}/middleware) = %{version}-%{release}
Provides: golang(%{import_path}/rest) = %{version}-%{release}
Provides: golang(%{import_path}/tests) = %{version}-%{release}
Provides: golang(%{import_path}/utils) = %{version}-%{release}
Provides: golang(%{import_path}/utils/ssh) = %{version}-%{release}
%description devel
%{summary}
This package contains library source intended for
building other packages which use import path with
%{import_path} prefix.
%endif
%if 0%{?with_unit_test} && 0%{?with_devel}
%package unit-test-devel
Summary: Unit tests for %{name} package
%if 0%{?with_check}
#Here comes all BuildRequires: PACKAGE the unit tests
#in %%check section need for running
%endif
# test subpackage tests code from devel subpackage
Requires: %{name}-devel = %{version}-%{release}
%description unit-test-devel
%{summary}
This package contains unit tests for project
providing packages with %{import_path} prefix.
%endif
%package client
Summary: Command line client for Heketi
Group: System Environment/Libraries
License: LGPLv3+ and GPLv2
%description client
%{summary}
Command line program to interact with Heketi
%package templates
Summary: Heketi and GlusterFS templates for Heketi
Group: System Environment/Libraries
License: ASL 2.0
%description templates
%{summary}
Heketi and GlusterFS templates for Heketi
%if 0%{with_python}
%package -n python-heketi
Summary: Python libraries for Heketi
Group: System Environment/Libraries
License: ASL 2.0 and LGPLv3+
Requires: python-jwt
Requires: python-requests
BuildRequires: python-setuptools
BuildRequires: python2-devel
%description -n python-heketi
%{summary}
This package contains python libraries for interacting with Heketi
%endif
%enable_gotoolset7
%{?!gopath: %global gopath %{_datadir}/gocode}
%prep
%setup -q
%build
mkdir -p src/%{provider}.%{provider_tld}/%{project}
ln -s $(pwd) src/%{provider}.%{provider_tld}/%{project}/%{repo}
# ! Bundled
%if ! 0%{?with_bundled}
export GOPATH=$(pwd):%{gopath}
export LDFLAGS="-X main.HEKETI_VERSION=%{version}"
go build -o %{name}
export LDFLAGS="-X main.HEKETI_CLI_VERSION=%{version}"
cd client/cli/go
go build -o %{name}-cli
cd ../../..
%else
# Bundled
# workaround for vendor directory which doesn't have src
# which is needed by the GOPATH
mkdir -p ./src
tar -xvf %{SOURCE1} -C ./src
# Setup GOPATH
export GOPATH=$(pwd):%{gopath}
%define gohash %(head -c20 /dev/urandom | od -An -tx1 | tr -d '\ \\n')
# -s strips debug information
%if 0%{?rhel} && 0%{?rhel} > 6
go build -ldflags "-X main.HEKETI_VERSION=%{version} -B 0x%{gohash} -s -extldflags '-z relro -z now'" -o %{name}
cd client/cli/go
go build -ldflags "-X main.HEKETI_CLI_VERSION=%{version} -B 0x%{gohash} -s -extldflags '-z relro -z now'" -o %{name}-cli
cd ../../..
%else
go build -ldflags "-X main.HEKETI_VERSION=%{version} -B 0x%{gohash} -s -extldflags '-z relro -z now'" -o %{name}
cd client/cli/go
go build -ldflags "-X main.HEKETI_CLI_VERSION=%{version} -B 0x%{gohash} -s -extldflags '-z relro -z now'" -o %{name}-cli
cd ../../..
%endif
%endif
# Python
%if 0%{with_python}
cd client/api/python
%{__python2} setup.py build
%endif
%install
# Python
%if 0%{with_python}
cd client/api/python
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
cd ../../..
%endif
install -D -p -m 0755 client/cli/go/%{name}-cli.sh \
%{buildroot}%{_datadir}/bash-completion/completions/%{name}-cli.sh
install -D -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
install -D -p -m 0755 client/cli/go/%{name}-cli %{buildroot}%{_bindir}/%{name}-cli
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}
install -m 644 -t %{buildroot}%{_sysconfdir}/%{name} %{SOURCE2}
install -D -p -m 0644 docs/man/heketi-cli.8 %{buildroot}%{_mandir}/man8/heketi-cli.8
install -D -p -m 0644 client/cli/go/topology-sample.json \
%{buildroot}%{_datadir}/%{name}/topology-sample.json
install -D -p -m 0644 extras/openshift/templates/glusterfs-template.json \
%{buildroot}%{_datadir}/%{name}/templates/glusterfs-template.json
install -D -p -m 0644 extras/openshift/templates/heketi-template.json \
%{buildroot}%{_datadir}/%{name}/templates/heketi-template.json
install -D -p -m 0644 extras/openshift/templates/deploy-heketi-template.json \
%{buildroot}%{_datadir}/%{name}/templates/deploy-heketi-template.json
install -D -p -m 0644 extras/openshift/endpoint/sample-gluster-endpoint.json \
%{buildroot}%{_datadir}/%{name}/openshift/sample-gluster-endpoint.json
install -D -p -m 0644 extras/openshift/service/sample-gluster-service.json \
%{buildroot}%{_datadir}/%{name}/openshift/sample-gluster-service.json
%if 0%{?with_systemd}
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
%else
install -D -p -m 0755 %{SOURCE4} %{buildroot}%{_sysconfdir}/init.d/%{name}
%endif
# And create /var/lib/heketi
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}
# source codes for building projects
%if 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
# find all *.go but no *_test.go files and generate devel.file-list
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
done
%endif
# testing files for this project
%if 0%{?with_unit_test} && 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
# find all *_test.go files and generate unit-test-devel.file-list
for file in $(find . -iname "*_test.go"); do
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
done
%endif
%if 0%{?with_devel}
sort -u -o devel.file-list devel.file-list
%endif
%check
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
%if ! 0%{?with_bundled}
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
%gotest %{import_path}/apps/glusterfs
%gotest %{import_path}/client/api/go-client
%gotest %{import_path}/middleware
%else
export GOPATH=$(pwd):%{gopath}
go test -v %{import_path}/apps/glusterfs
go test -v %{import_path}/client/api/go-client
go test -v %{import_path}/middleware
go test -v %{import_path}/executors/kubeexec
go test -v %{import_path}/executors/sshexec
%endif
%endif
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin -c "heketi user" %{name}
%post
%if 0%{?with_systemd}
%systemd_post %{name}.service
%else
/sbin/chkconfig --add %{name}
%endif
%preun
%if 0%{?with_systemd}
%systemd_preun %{name}.service
%else
/sbin/service %{name} stop &> /dev/null
%endif
%postun
%if 0%{?with_systemd}
%systemd_postun %{name}.service
%else
/sbin/chkconfig --del %{name}
%endif
#define license tag if not already defined
%{!?_licensedir:%global license %doc}
%files
%license LICENSE
%doc README.md AUTHORS
%config(noreplace) %{_sysconfdir}/%{name}
%{_bindir}/%{name}
%dir %attr(-,%{name},%{name}) %{_sharedstatedir}/%{name}
%if 0%{?with_systemd}
%{_unitdir}/%{name}.service
%else
%{_sysconfdir}/init.d/%{name}
%endif
%if 0%{with_python}
%files -n python-heketi
%license LICENSE
%doc README.md AUTHORS
%{python_sitelib}/heketi
%{python_sitelib}/heketi-*.egg-info
%endif
%files client
%license LICENSE
%doc README.md AUTHORS
%{_bindir}/%{name}-cli
%{_mandir}/man8/heketi-cli.8*
%{_datadir}/%{name}/topology-sample.json
%{_datadir}/bash-completion/completions/%{name}-cli.sh
%files templates
%license LICENSE
%doc README.md AUTHORS
%{_datadir}/%{name}/templates/*
%{_datadir}/%{name}/openshift/*
%if 0%{?with_devel}
%files devel -f devel.file-list
%license LICENSE
%doc README.md AUTHORS
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
%dir %{gopath}/src/%{import_path}
%endif
%if 0%{?with_unit_test} && 0%{?with_devel}
%files unit-test-devel -f unit-test-devel.file-list
%license LICENSE
%doc README.md AUTHORS
%endif
%changelog
* Fri Apr 12 2019 Niels de Vos <[email protected]> - 9.0.0-1
- Release 9.0.0
- Use SCL go-toolset for building
- Build for x86_64 only due to missing go-toolset on other arches
* Thu Sep 13 2018 Niels de Vos <[email protected]> - 8.0.0-1
- Release 8.0.0
* Thu Jul 26 2018 Niels de Vos <[email protected]> - 7.0.0-2
- Update heketi.service (Pete Travis PR#4)
* Tue Jun 5 2018 Niels de Vos <[email protected]> - 7.0.0-1
- Release 7.0.0
* Fri Feb 23 2018 Niels de Vos <[email protected]> - 6.0.0-1
- Release 6,0.0 final
- Do not build python-heketi
* Tue Dec 19 2017 Niels de Vos <[email protected]> - 5.0.1-1
- Release 5.0.1 final
* Tue Sep 19 2017 Michael Adam <[email protected]> - 5.0.0-1
- Release 5 final
* Thu May 25 2017 Jose A. Rivera <[email protected]> - 4.0.0-1
- Release 4 Final
* Fri Feb 10 2017 Fedora Release Engineering <[email protected]> - 3.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Oct 28 2016 Jose A. Rivera <[email protected]> - 3.0.0-2
- Add full RELRO support
* Wed Oct 12 2016 Luis Pabón <[email protected]> - 3.0.0-1
- Release 3 Final
* Sat Aug 06 2016 Luis Pabón <[email protected]> - 2.0.6-1
- Release 2 Final
* Thu Jul 21 2016 Fedora Release Engineering <[email protected]> - 2.0.3-3
- https://fedoraproject.org/wiki/Changes/golang1.7
* Tue Jul 19 2016 Fedora Release Engineering <[email protected]> - 2.0.3-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Mon Jun 20 2016 Luis Pabón <[email protected]> - 2.0.2-3
- Fixed glusterfs templates
* Mon Jun 13 2016 lpabon <[email protected]> - 2.0.1-2
- Updated deploy-heketi template
* Mon Jun 13 2016 lpabon <[email protected]> - 2.0.1-1
- Support for Heketi Storage in OpenShift
* Thu Jun 02 2016 lpabon <[email protected]> - 2.0.0-2
- Do not create devel or unit_test packages in RHEL
* Thu Jun 02 2016 lpabon <[email protected]> - 2.0.0-1
- Release 2.0.0
* Tue May 24 2016 lpabon <[email protected]> - 1.4.2-1
- Update to the latest template and cli changes
* Tue May 24 2016 lpabon <[email protected]> - 1.4.0-2
- Add patch to use downstream RHGS containers
* Tue May 24 2016 lpabon <[email protected]> - 1.4.0-1
- Able to talk to /hello w/o authentication
- Heketi-cli can now create PV specs
- Templates
* Tue May 10 2016 lpabon <[email protected]> - 1.3.0-1
- Kube exec support
* Tue May 03 2016 lpabon <[email protected]> - 1.2.0-2
- Remove dependency on clients
* Sun May 01 2016 lpabon <[email protected]> - 1.2.0-1
- Created client and python rpms
* Sun Apr 03 2016 lpabon <[email protected]> - 1.0.2-4
- Update godeps and strip bundled build
* Mon Feb 22 2016 Fedora Release Engineering <[email protected]> - 1.0.2-3
- https://fedoraproject.org/wiki/Changes/golang1.6
* Wed Feb 03 2016 Fedora Release Engineering <[email protected]> - 1.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Dec 03 2015 lpabon <[email protected]> - 1.0.2-1
- Heketi 1.0.2
* Tue Nov 03 2015 lpabon <[email protected]> - 1.0.1-1
- Heketi 1.0.1
* Mon Oct 12 2015 lpabon <[email protected]> - 1.0.0-1
- First package for Fedora