aboutsummaryrefslogtreecommitdiffstats
path: root/community/ceph/APKBUILD
blob: 8c76df284cba218b8535df40c4a9e390c22aec90 (plain) (blame)
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# Contributor: John Coyle <dx9err@gmail.com>
# Contributor: Iggy Jackson <iggy@kws1.com>
# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=ceph
pkgver=16.2.0
pkgrel=1
pkgdesc="Ceph is a distributed object store and file system"
pkgusers="ceph"
pkggroups="ceph"
url="https://ceph.com/"
#32bit still WIP
arch="all !x86 !armv7 !armhf !mips !mips64"
# https://github.com/ceph/ceph/blob/master/COPYING
license="LGPL-2.1-only AND LGPL-2.0-or-later AND GPL-2.0-only AND GPL-3.0-only AND CC-BY-SA-1.0 AND BSL-1.0 AND GPL-2.0-or-later WITH Autoconf-exception-2.0 AND BSD-3-Clause AND MIT AND custom"
depends="ceph-osd ceph-mds ceph-mon"
_lua=5.3
_base_deps="
	cryptsetup
	e2fsprogs
	logrotate
	parted
	util-linux
	xfsprogs
	"
_osd_daemon_deps="fuse snappy lz4-libs"
_osd_tools_deps="lz4-libs"
_ceph_volume_deps="lvm2"
_ceph_test_deps="
	xmlstarlet
	py3-argparse
	py3-coverage
	py3-flake8
	py3-nodeenv
	py3-nose
	py3-pytest
	py3-tox
	py3-yaml
	"
makedepends="
	acl-dev
	argp-standalone
	bc
	boost1.75-dev
	btrfs-progs
	bzip2-dev
	cmake
	coreutils
	cryptsetup-dev
	cunit-dev
	curl-dev
	cython
	diffutils
	eudev-dev
	expat-dev
	fcgi-dev
	flex
	fmt-dev
	fuse
	fuse-dev
	git
	grep
	gperf
	jq
	keyutils-dev
	leveldb-dev
	libaio-dev
	libatomic_ops-dev
	libcap-ng-dev
	libedit-dev
	librdkafka-dev
	libnl3-dev
	libtirpc-dev
	libtool
	libxml2-dev
	linux-headers
	lua$_lua-dev
	lvm2-dev
	lz4-dev
	nodejs
	npm
	nss-dev
	oath-toolkit-dev
	openldap-dev
	openssl-dev
	procps
	python3-dev
	py3-sphinx
	rabbitmq-c-dev
	readline-dev
	rpcgen
	snappy-dev
	sqlite-dev
	userspace-rcu-dev
	xfsprogs-dev
	xmlstarlet
	yasm
	$_base_deps
	$_osd_daemon_deps
	$_osd_tools_deps
	$_ceph_volume_deps
	$_ceph_test_deps
	"

source="https://download.ceph.com/tarballs/ceph_$pkgver.orig.tar.gz
	ceph.confd
	ceph.initd
	10-musl-fixes.patch
	20-pci.patch
	30-32bit_fix.patch.noauto
	31-32bit_fix_tests.patch.noauto
	32-cypress.patch.noauto
	35-fix_ErasureCodeShec.patch
	37-fix_tests.patch
	42-no-virtualenvs.patch
	43-aarch64-erasure.patch
	44-LogClock.h.patch
	44-missing-include.patch
	44-staticcast.patch
	"

subpackages="
	$pkgname-doc
	$pkgname-base
	$pkgname-common
	$pkgname-mds
	$pkgname-mgr
	$pkgname-mgr-node:mgr_node:noarch
	$pkgname-mon::noarch
	$pkgname-mon-daemon:mon_daemon
	$pkgname-mon-tools:mon_tools
	$pkgname-fuse:ceph_fuse
	$pkgname-openrc
	$pkgname-osd::noarch
	$pkgname-osd-daemon:osd_daemon
	$pkgname-osd-tools:osd_tools
	$pkgname-volume:ceph_volume:noarch
	$pkgname-radosgw
	$pkgname-bash-completion:bash_completion:noarch
	$pkgname-dev
	$pkgname-user::noarch
	$pkgname-utils
	rbd-fuse:rbd_fuse
	rbd-mirror:rbd_mirror
	rbd-nbd:rbd_nbd
	librbd
	libcephfs
	librados
	py3-rados:_py3_rados
	libradosstriper
	py3-rbd:_py3_rbd
	py3-cephfs:_py3_cephfs
	"

# secfixes:
#   15.2.8-r0:
#     - CVE-2020-27781
#   15.2.6-r0:
#     - CVE-2020-25660
#     - CVE-2020-10736
#     - CVE-2020-10753
#   14.2.9-r0:
#     - CVE-2020-1759
#     - CVE-2020-1760
#   14.2.7-r0:
#     - CVE-2020-1699
#     - CVE-2020-1700
#   14.2.3-r0:
#     - CVE-2019-10222

_ceph_uid=167
_ceph_gid=167

_prefix=/usr
_bindir=$_prefix/bin
_datadir=$_prefix/share

_py3_sitelib() {
	python3 -c "import site; print(site.getsitepackages()[0])"
}

prepare() {
	default_prepare

	case "$CARCH" in
		x86|armv7|armhf)
			patch -p1 -i "$srcdir"/30-32bit_fix.patch.noauto
			patch -p1 -i "$srcdir"/32-cypress.patch.noauto
			patch -p1 -i "$srcdir"/31-32bit_fix_tests.patch.noauto ;;
	esac
}

build() {
	export CEPH_BUILD_VIRTUALENV="$builddir"

	# builders keep failing when -jN == nproc
	export MAKEFLAGS="$MAKEFLAGS -j$((JOBS<16 ? JOBS : 16))"

	cmake -B build \
		-DLUA_LIBRARIES=/usr/lib/lua"$_lua"/liblua.so \
		-DALLOCATOR=libc \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
		-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DWITH_REENTRANT_STRSIGNAL=ON \
		-DWITH_THREAD_SAFE_RES_QUERY=ON \
		-DWITH_MANPAGE=ON \
		-DWITH_SYSTEM_BOOST=ON \
		-DWITH_SYSTEM_NPM=ON \
		-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 \
		-DWITH_PYTHON2=OFF \
		-DWITH_PYTHON3=3 \
		-DMGR_PYTHON_VERSION=3 \
		-DWITH_LTTNG=OFF \
		-DWITH_RDMA=OFF \
		-DWITH_SYSTEMD=OFF \
		-DWITH_SPDK=OFF \
		-DWITH_BABELTRACE=OFF \
		-DWITH_RADOSGW_AMQP_ENDPOINT=OFF \
		-DWITH_TESTS=OFF
	make -C build

}

package() {
	make -C build DESTDIR="$pkgdir" install

	# Remove the upstream init file and put in openrc ones
	rm -f "$pkgdir"/etc/init.d/ceph
	install -D -m 0744 "$srcdir"/"$pkgname".initd "$pkgdir"/etc/init.d/ceph
	install -D -m 0744 "$srcdir"/"$pkgname".confd "$pkgdir"/etc/conf.d/ceph

	# Move mount.* binaries to /sbin
	mkdir -p "$pkgdir"/sbin
	mv "$pkgdir"/usr/sbin/mount.* "$pkgdir"/sbin

	install -m 0644 -D src/etc-rbdmap "$pkgdir"/etc/ceph/rbdmap
	install -m 0644 -D src/logrotate.conf "$pkgdir"/etc/logrotate.d/ceph
	install -m 0644 -D etc/sysctl/90-ceph-osd.conf "$pkgdir"/etc/sysctl.d/90-ceph-osd.conf

	# udev rules
	install -m 0644 -D udev/50-rbd.rules "$pkgdir"/etc/udev/rules.d/50-rbd.rules
	# sudoers.d
	install -m 0600 -D sudoers.d/ceph-osd-smartctl "$pkgdir"/etc/sudoers.d/ceph-osd-smartctl

	# copy out things that need splitting
	mv "$pkgdir"/usr/share/ceph/mgr/dashboard/frontend/node_modules "$builddir"/

	# delete systemd related stuff
	rm "$pkgdir"/usr/sbin/ceph-volume-systemd
}

check() {
	cd "$builddir"/build
	ctest
}

# This subpackage is a little weird and a side effect of trying to keep
# the daemon packages as small as possible. We might be able to roll this into
# the base/common package later if we can slim those down or break them up in a
# different way
user() {
	pkgdesc="Minimal package to create a user for other ceph packages."
	depends=""
	install="$pkgname-user.pre-install"
	mkdir -p "$subpkgdir"
}

base() {
	pkgdesc="Base is the package that includes all the files shared amongst ceph servers"
	depends="$_base_deps
		$pkgname-user=$pkgver-r$pkgrel
		$pkgname-common=$pkgver-r$pkgrel
		librbd=$pkgver-r$pkgrel
		librados=$pkgver-r$pkgrel
		libcephfs=$pkgver-r$pkgrel
	"

	_pkg $_bindir \
		ceph-crash \
		crushtool \
		monmaptool \
		osdmaptool \
		ceph-kvstore-tool \
		ceph-run
	amove usr/sbin/ceph-create-keys
	amove usr/libexec/ceph/ceph_common.sh
	amove usr/lib/rados-classes/*.so*
	amove usr/lib/ceph/erasure-code/libec_*.so*
	amove usr/lib/ceph/compressor/libceph_*.so*
	amove usr/lib/ceph/crypto/libceph_*.so*
	amove etc/logrotate.d/ceph
	for dir in crash crash/posted tmp bootstrap-osd bootstrap-mds \
			bootstrap-rgw bootstrap-mgr bootstrap-rbd \
			bootstrap-rbd-mirror; do

		install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
			"$subpkgdir"/var/lib/ceph/$dir
	done
}

common() {
	pkgdesc="Common utilities to mount and interact with a ceph storage cluster."
	depends="py3-rados py3-rbd py3-cephfs py3-prettytable"

	_pkg $_bindir ceph \
		ceph-authtool \
		ceph-conf \
		ceph-dencoder \
		ceph-rbdnamer \
		ceph-syn \
		cephfs-data-scan \
		cephfs-journal-tool \
		cephfs-table-tool \
		rados \
		rbd \
		rbd-replay \
		rbd-replay-many \
		rbdmap \
		ceph-post-file
	amove sbin/mount.ceph
	amove usr/share/ceph/*.ceph.com*
	amove etc/ceph/rbdmap

	_pkg "$(_py3_sitelib)" ceph_argparse.py* ceph_daemon.py*

	amove etc/udev/rules.d/50-rbd.rules
	install -m 3770 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/log/ceph
	install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/lib/ceph
}

mds() {
	pkgdesc="Metadata server daemon for the Ceph distributed file system."
	depends="ceph-base"

	amove usr/bin/ceph-mds
	install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/lib/ceph/mds
}

mon() {
	pkgdesc="Cluster monitor daemon virtual package for the Ceph distributed file system."
	depends="$pkgname-base
		$pkgname-mon-daemon=$pkgver-r$pkgrel
		$pkgname-mon-tools=$pkgver-r$pkgrel"

	mkdir -p "$subpkgdir"
}

mon_daemon() {
	pkgdesc="Cluster monitor daemon for the Ceph distributed file system."
	depends="$pkgname-user=$pkgver-r$pkgrel"

	amove usr/bin/ceph-mon
	install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/lib/ceph/mon
}

mon_tools() {
	pkgdesc="Cluster monitor tools for the Ceph distributed file system."
	depends=

	amove usr/bin/ceph-monstore-tool
	install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/lib/ceph/mon
}

ceph_fuse() {
	pkgdesc="FUSE based client for Ceph distributed network file system."
	depends=
	amove usr/bin/ceph-fuse
	amove sbin/mount.fuse.ceph
}

rbd_fuse() {
	pkgdesc="FUSE based client to map Ceph rbd images to files."
	depends=
	amove usr/bin/rbd-fuse
}

rbd_mirror() {
	pkgdesc="Daemon for mirroring RBD images between Ceph clusters."
	depends="ceph-common=$pkgver-r$pkgrel"
	amove usr/bin/rbd-mirror
}

rbd_nbd() {
	pkgdesc="NBD based client to map Ceph rbd images to local device."
	depends=
	amove usr/bin/rbd-nbd
}

radosgw() {
	pkgdesc="Rados REST gateway which implements Amazon's S3 and OpenStack's Swift APIs."
	depends="ceph-common oath-toolkit-liboath"
	_pkg $_bindir radosgw \
		radosgw-admin \
		radosgw-es \
		radosgw-object-expirer \
		radosgw-token
	mkdir -p "$subpkgdir"/var/lib/ceph/radosgw
}

osd() {
	pkgdesc="Object storage daemon virtual package for the Ceph distributed file system."
	depends="$pkgname-osd-daemon=$pkgver-r$pkgrel
		$pkgname-osd-tools=$pkgver-r$pkgrel
		$pkgname-volume=$pkgver-r$pkgrel"

	mkdir -p "$subpkgdir"
}

osd_daemon() {
	pkgdesc="Object storage daemon for the Ceph distributed file system."
	depends="$_osd_daemon_deps $pkgname-user=$pkgver-r$pkgrel"

	amove usr/bin/ceph-osd
	amove usr/libexec/ceph/ceph-osd-prestart.sh
	amove etc/sudoers.d/ceph-osd-smartctl
	amove etc/sysctl.d/90-ceph-osd.conf
	install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/lib/ceph/osd
}

osd_tools() {
	pkgdesc="Object storage daemon tools for the Ceph distributed file system."
	depends="$pkgname-base=$pkgver-r$pkgrel $_osd_tools_deps"

	_pkg $_bindir ceph-clsinfo \
		ceph-bluestore-tool \
		ceph-objectstore-tool \
		ceph-osdomap-tool
	install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/lib/ceph/osd
}

ceph_volume() {
	pkgdesc="ceph-volume tool for the Ceph distributed file system."
	depends="$_ceph_volume_deps"

	amove usr/sbin/ceph-volume
	amove "$(_py3_sitelib)"/ceph_volume
	amove "$(_py3_sitelib)"/ceph_volume-*
}

librados() {
	pkgdesc="RADOS distributed object store client library"
	depends=
	amove usr/lib/librados.so.*
	amove usr/lib/ceph/libceph-common.so.*
}

_py3_rados() {
	pkgdesc="Python libraries for the RADOS object store"
	depends=

	amove "$(_py3_sitelib)"/rados*
}

libradosstriper() {
	pkgdesc="RADOS striping library"
	depends=

	amove usr/lib/libradosstriper.so.*
}

librbd() {
	pkgdesc="RADOS block device client library"
	depends=
	amove usr/lib/librbd.so.*
}

_py3_rbd() {
	pkgdesc="Python libraries for the RADOS block device"
	depends="py3-rados"

	amove "$(_py3_sitelib)"/rbd*
}

libcephfs() {
	pkgdesc="Ceph distributed file system client library"
	depends=
	amove usr/lib/libcephfs.so.*
}

_py3_cephfs() {
	pkgdesc="Python libraries for Ceph distributed file system"
	depends="py3-rados"

	amove "$(_py3_sitelib)"/cephfs*
	amove "$(_py3_sitelib)"/ceph_volume_client.py
}

utils() {
	pkgdesc="Ceph utils"
	depends="ceph-common=$pkgver-r$pkgrel"

	amove usr/bin/ceph-diff-sorted
}

bash_completion() {
	pkgdesc="Bash completions for Ceph"
	depends=
	install_if="ceph=$pkgver-r$pkgrel bash-completion"
	amove etc/bash_completion.d/*
}

mgr() {
	pkgdesc="Ceph Manager Daemon"
	depends="ceph-base=$pkgver-r$pkgrel"

	amove usr/bin/ceph-mgr
	_pkg $_datadir/ceph mgr

	install -m 750 -o $_ceph_uid -g $_ceph_gid -d \
		"$subpkgdir"/var/lib/ceph/mgr
}

mgr_node() {
	pkgdesc="Ceph Manager NodeJS installed modules"
	depends="$pkgname-mgr=$pkgver-r$pkgrel nodejs npm"
	install="$subpkgname.post-install $subpkgname.post-deinstall"

	mkdir -p "$subpkgdir"/usr/share/ceph/mgr/dashboard/frontend
	cd "$subpkgdir"/usr/share/ceph/mgr/dashboard/frontend
	cp "$builddir"/src/pybind/mgr/dashboard/frontend/package*.json ./
	npm shrinkwrap
}

_pkg() {
	local path=$1
	shift
	if ! [ -d "$pkgdir"/$path ]; then
		error "$pkgdir/$path is not a directory"
		return 1
	fi
	mkdir -p "$subpkgdir"$path
	for _file in "$@"; do
		mv "$pkgdir"$path/$_file "$subpkgdir"$path
	done
}

sha512sums="aeb9a91c33221c64ea24603dc88cab346bf0abdf0d41ff85c2e1cf134130737ec1fab1246be0a2fa3af8a655ae1dabb69688855f229f54438e60cb8098175b8e  ceph_16.2.0.orig.tar.gz
110bdbcb40216c7ed155a8d23020784741b4992d895f4f04a146d275506e4e68053854d3b063b41e9c9b3e3e4f95b6b90602f92c185c853c0d8f47ad0c6b7121  ceph.confd
ce5f162501f6b67fe254546dddf880d1a5b1d1a0fa69e0b1918de17e8da45c5c6124512b8cbd98b76f29d931403de0d11c5ffd330ed8ee1f4dc75bb04baecae3  ceph.initd
c608f11cf358d76daf5281467a4ea941a81474fbe7f5faa41f7f4d0abaf9136a01576bbb1ab24bdd7bc91a49f66bd7f0a84717de5ec27250d74dd1e47e3b5dd3  10-musl-fixes.patch
427ab410aeb02d49c5caa8ff68c7b8df325229823d625b7069cd48c66dd9e129e742270850fb2be2238eb6fa12b8256845b4d94426ca96b2a9187b2726e78423  20-pci.patch
10ba6f106b3a5f81a3b1852df106a043e83b239ff4d558abd1ff421c644df0f66e84c728cc623adf8708a735e284d0682cd5e6be5c7e60817de4e7571f6f3766  30-32bit_fix.patch.noauto
f974ab36cd6fa49c1d4613203a4f2152723e4952a185dfb6349bc4ca8ee1a7a9d0477bea136c54248271de30a4e584734ba41e8ec41bf274b04074622888ae39  31-32bit_fix_tests.patch.noauto
0ea07b5bf8aeb3e0bffc04bf1058af9db0e1e773922be348ebf79594d860a1e734897ef34af143790ef12c3dffa7588b63e94390a1c236b0da0ddf4c689c8dbd  32-cypress.patch.noauto
8a3e902309238ae6917b4c5fe9fa371dad3ba8e01848f462a9b67ad8d69b8370a8957f6c88462a7016319fd323eb6d6c31415734db56485a8a8b279d2705aff5  35-fix_ErasureCodeShec.patch
cdd7cd0853ad0804415335e0e0c7dc72098de07c769e05d785ac1ebce77311eed6c5ab795c58eededdfa2eaeaf39e9b83c733be2e476b687cadf89c1b5b24a27  37-fix_tests.patch
985fbcfa83164fe6a5ea517be2a5529eeb9a061bf38ddbc4fa3e8363d0b88f93b00fd1b638344991e2cc6cb52392f02c55690949de38211d541366fd0bce7401  42-no-virtualenvs.patch
aea43c2a99f16f7fccf33aeca3565077bb2274816ca68db64b672addc85bde5c479bc9ad0fb33dbde79c9390f9acf1d98545e20e311e40dd428dad5ed02f0651  43-aarch64-erasure.patch
e47d736d3ab1417758fc5f92798a77272b978799e6d9f0728b2036d6cc5975c6c10f8dc4590c2e1cb31e1e9fc03c582394b30727e315a6889de524fc8bf95369  44-LogClock.h.patch
125627c9ce4d5c0be1cd9e371c7ac0ad9ffd3fc0ccc0290b2c3ff4cc9c8f8b3c2a5e96bf9eaf0de2426e5b05d5f221ec5e7b5d1ef0b085b56da45f664955f2c9  44-missing-include.patch
f89c913a53e2806c59508d26f5dc72abb428c7e4e3b7c1aeb6eaf92744ea9a13cac2f00a2ac90f91ad7682f66d876a5fffedd10feeceecd71a944793581da443  44-staticcast.patch"