Gentoo Archives: gentoo-commits

From: Patrick Lauer <patrick@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-cluster/ceph/, sys-cluster/ceph/files/
Date: Tue, 06 Feb 2018 17:43:42
Message-Id: 1517938974.e811f82167b11dff8adb188dc07f7a5b7e856699.patrick@gentoo
1 commit: e811f82167b11dff8adb188dc07f7a5b7e856699
2 Author: Patrick Lauer <patrick <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 6 17:42:54 2018 +0000
4 Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 6 17:42:54 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e811f821
7
8 sys-cluster/ceph: Fix init script
9
10 The previous defaults were subtly insane, and very wrong.
11 "supervise-daemon: unable to open the logfile for stdout '/dev/null.96-stdout.log': Permission denied" ?
12 No thanks, let's set some values that allow ceph to start, and log to a reasonable place.
13
14 Package-Manager: Portage-2.3.24, Repoman-2.3.6
15
16 sys-cluster/ceph/ceph-10.2.10-r2.ebuild | 306 ++++++++++++++++++++++++++++++++
17 sys-cluster/ceph/ceph-12.2.2-r1.ebuild | 288 ++++++++++++++++++++++++++++++
18 sys-cluster/ceph/files/ceph.initd-r7 | 87 +++++++++
19 3 files changed, 681 insertions(+)
20
21 diff --git a/sys-cluster/ceph/ceph-10.2.10-r2.ebuild b/sys-cluster/ceph/ceph-10.2.10-r2.ebuild
22 new file mode 100644
23 index 00000000000..bf6eaeec4b6
24 --- /dev/null
25 +++ b/sys-cluster/ceph/ceph-10.2.10-r2.ebuild
26 @@ -0,0 +1,306 @@
27 +# Copyright 1999-2018 Gentoo Foundation
28 +# Distributed under the terms of the GNU General Public License v2
29 +
30 +EAPI=6
31 +PYTHON_COMPAT=( python{2_7,3_{4,5,6}} )
32 +
33 +inherit check-reqs autotools eutils python-r1 udev user \
34 + readme.gentoo-r1 systemd versionator flag-o-matic toolchain-funcs
35 +
36 +if [[ ${PV} == *9999* ]]; then
37 + inherit git-r3
38 + EGIT_REPO_URI="https://github.com/ceph/ceph.git"
39 + SRC_URI=""
40 +else
41 + SRC_URI="https://download.ceph.com/tarballs/${P}.tar.gz"
42 + KEYWORDS="~amd64 ~arm64 ~x86"
43 +fi
44 +
45 +DESCRIPTION="Ceph distributed filesystem"
46 +HOMEPAGE="https://ceph.com/"
47 +
48 +LICENSE="LGPL-2.1"
49 +SLOT="0"
50 +
51 +IUSE="babeltrace cephfs cryptopp debug fuse gtk jemalloc ldap +libaio"
52 +IUSE+=" libatomic lttng +nss +radosgw static-libs +tcmalloc test xfs zfs"
53 +
54 +# unbundling code commented out pending bugs 584056 and 584058
55 +#>=dev-libs/jerasure-2.0.0-r1
56 +#>=dev-libs/gf-complete-2.0.0
57 +COMMON_DEPEND="
58 + app-arch/snappy:=
59 + sys-libs/zlib:=
60 + app-arch/lz4:=
61 + app-arch/bzip2:=
62 + app-arch/zstd:=
63 + dev-libs/boost:=[threads]
64 + dev-libs/libaio:=
65 + dev-libs/leveldb:=[snappy]
66 + nss? ( dev-libs/nss:= )
67 + libatomic? ( dev-libs/libatomic_ops:= )
68 + cryptopp? ( dev-libs/crypto++:= )
69 + sys-apps/keyutils
70 + sys-apps/util-linux
71 + dev-libs/libxml2:=
72 + radosgw? ( dev-libs/fcgi:= )
73 + ldap? ( net-nds/openldap:= )
74 + babeltrace? ( dev-util/babeltrace )
75 + fuse? ( sys-fs/fuse:0= )
76 + xfs? ( sys-fs/xfsprogs:= )
77 + zfs? ( sys-fs/zfs:= )
78 + gtk? (
79 + x11-libs/gtk+:2=
80 + dev-cpp/gtkmm:2.4
81 + gnome-base/librsvg:=
82 + )
83 + radosgw? (
84 + dev-libs/fcgi:=
85 + dev-libs/expat:=
86 + net-misc/curl:=
87 + )
88 + jemalloc? ( dev-libs/jemalloc:= )
89 + !jemalloc? ( =dev-util/google-perftools-2.4*:= )
90 + lttng? ( dev-util/lttng-ust:= )
91 + ${PYTHON_DEPS}
92 + "
93 +DEPEND="${COMMON_DEPEND}
94 + dev-python/cython[${PYTHON_USEDEP}]
95 + app-arch/cpio
96 + dev-lang/yasm
97 + virtual/pkgconfig
98 + dev-python/sphinx
99 + test? (
100 + sys-fs/btrfs-progs
101 + sys-apps/grep[pcre]
102 + dev-python/tox[${PYTHON_USEDEP}]
103 + dev-python/virtualenv[${PYTHON_USEDEP}]
104 + )"
105 +RDEPEND="${COMMON_DEPEND}
106 + sys-apps/hdparm
107 + sys-block/parted
108 + sys-fs/cryptsetup
109 + sys-apps/gptfdisk
110 + !<sys-apps/openrc-0.26.3
111 + dev-python/flask[${PYTHON_USEDEP}]
112 + dev-python/requests[${PYTHON_USEDEP}]
113 + "
114 +REQUIRED_USE="
115 + $(python_gen_useflags 'python2*')
116 + ${PYTHON_REQUIRED_USE}
117 + ^^ ( nss cryptopp )
118 + ?? ( jemalloc tcmalloc )
119 + "
120 +
121 +# work around bug in ceph compilation (rgw/ceph_dencoder-rgw_dencoder.o... undefined reference to `vtable for RGWZoneGroup')
122 +REQUIRED_USE+=" radosgw"
123 +
124 +#RESTRICT="test? ( userpriv )"
125 +
126 +# distribution tarball does not include everything needed for tests
127 +RESTRICT+=" test"
128 +
129 +STRIP_MASK="/usr/lib*/rados-classes/*"
130 +
131 +UNBUNDLE_LIBS=(
132 + src/erasure-code/jerasure/jerasure
133 + src/erasure-code/jerasure/gf-complete
134 +)
135 +
136 +PATCHES=(
137 + "${FILESDIR}/ceph-10.2.0-dont-use-virtualenvs.patch"
138 + #"${FILESDIR}/ceph-10.2.1-unbundle-jerasure.patch"
139 + "${FILESDIR}/${PN}-10.2.1-libzfs.patch"
140 + "${FILESDIR}/${PN}-10.2.3-build-without-openldap.patch"
141 + "${FILESDIR}/${PN}-10.2.5-Make-RBD-Python-bindings-compatible-with-Python-3.patch"
142 + "${FILESDIR}/${PN}-10.2.5-Make-CephFS-bindings-and-tests-compatible-with-Python-3.patch"
143 + "${FILESDIR}/${PN}-10.2.7-fix-compilation-with-zstd.patch"
144 + "${FILESDIR}/${PN}-10.2.9-cflags.patch"
145 + "${FILESDIR}/${PN}-10.2.9-dont-run-lsb_release.patch"
146 +)
147 +
148 +check-reqs_export_vars() {
149 + if use debug; then
150 + CHECKREQS_DISK_BUILD="23G"
151 + CHECKREQS_DISK_USR="7G"
152 + elif use amd64; then
153 + CHECKREQS_DISK_BUILD="12G"
154 + CHECKREQS_DISK_USR="450M"
155 + else
156 + CHECKREQS_DISK_BUILD="1400M"
157 + CHECKREQS_DISK_USR="450M"
158 + fi
159 +
160 + export CHECKREQS_DISK_BUILD CHECKREQS_DISK_USR
161 +}
162 +
163 +user_setup() {
164 + enewgroup ceph ${CEPH_GID}
165 + enewuser ceph "${CEPH_UID:--1}" -1 /var/lib/ceph ceph
166 +}
167 +
168 +emake_python_bindings() {
169 + local action="${1}" params binding module
170 + shift
171 + params=("${@}")
172 +
173 + __emake_python_bindings_do_impl() {
174 + ceph_run_econf "${EPYTHON}"
175 + emake "${params[@]}" PYTHON="${EPYTHON}" "${binding}-pybind-${action}"
176 +
177 + # these don't work and aren't needed on python3
178 + if [[ ${EBUILD_PHASE} == install ]]; then
179 + for module in "${S}"/src/pybind/*.py; do
180 + module_basename="$(basename "${module}")"
181 + if [[ ${module_basename} == ceph_volume_client.py ]] && ! use cephfs; then
182 + continue
183 + elif [[ ! -e "${ED}/$(python_get_sitedir)/${module_basename}" ]]; then
184 + python_domodule ${module}
185 + fi
186 + done
187 + fi
188 + }
189 +
190 + pushd "${S}/src"
191 + for binding in rados rbd $(use cephfs && echo cephfs); do
192 + python_foreach_impl __emake_python_bindings_do_impl
193 + done
194 + popd
195 +
196 + unset __emake_python_bindings_do_impl
197 +}
198 +
199 +pkg_pretend() {
200 + check-reqs_export_vars
201 + check-reqs_pkg_pretend
202 +}
203 +
204 +pkg_setup() {
205 + python_setup
206 + check-reqs_export_vars
207 + check-reqs_pkg_setup
208 + user_setup
209 +}
210 +
211 +src_prepare() {
212 + default
213 +
214 + # remove tests that need root access
215 + rm src/test/cli/ceph-authtool/cap*.t
216 +
217 + #rm -rf "${UNBUNDLE_LIBS[@]}"
218 +
219 + append-flags -fPIC
220 +
221 + if tc-is-gcc && [[ $(gcc-fullversion) == "7.2.0" ]] && is-flag "-g*"; then
222 + ewarn "Filtering out -g* flags since gcc-7.2 tends to ICE with them and ceph"
223 + filter-flags "-g*"
224 + fi
225 + eautoreconf
226 +}
227 +
228 +src_configure() {
229 + ECONFARGS=(
230 + --without-hadoop
231 + --includedir=/usr/include
232 + $(use_with cephfs)
233 + $(use_with debug)
234 + $(use_with fuse)
235 + $(use_with libaio)
236 + $(use_with libatomic libatomic-ops)
237 + $(use_with nss)
238 + $(use_with cryptopp)
239 + $(use_with radosgw)
240 + $(use_with gtk gtk2)
241 + $(use_enable static-libs static)
242 + $(use_with jemalloc)
243 + $(use_with xfs libxfs)
244 + $(use_with zfs libzfs)
245 + $(use_with lttng )
246 + $(use_with babeltrace)
247 + $(use_with ldap openldap)
248 + $(use jemalloc || usex tcmalloc " --with-tcmalloc" " --with-tcmalloc-minimal")
249 + --with-mon
250 + --with-eventfd
251 + --with-cython
252 + --without-kinetic
253 + --without-librocksdb
254 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
255 + )
256 +
257 + # we can only use python2.7 for building at the moment
258 + ceph_run_econf "python2*"
259 +}
260 +
261 +ceph_run_econf() {
262 + [[ -z ${ECONFARGS} ]] && die "called ${FUNCNAME[0]} with ECONFARGS unset"
263 + [[ -z ${1} ]] && die "called ${FUNCNAME[0]} without passing python implementation"
264 +
265 + pushd "${S}" >/dev/null || die
266 + #
267 + # This generates a QA warning about running econf in src_compile
268 + # and src_install. Unfortunately the only other way to do this would
269 + # involve building all of for each python implementation times, which
270 + # wastes a _lot_ of CPU time and disk space. This hack will no longer
271 + # be needed with >=ceph-11.2.
272 + #
273 + python_setup "${1}"
274 + econf "${ECONFARGS[@]}"
275 +
276 + popd >/dev/null || die
277 +}
278 +
279 +src_compile() {
280 + emake
281 + emake_python_bindings all
282 +
283 + use test && emake check-local
284 +}
285 +
286 +src_test() {
287 + make check || die "make check failed"
288 +}
289 +
290 +src_install() {
291 + default
292 + emake_python_bindings install-exec "DESTDIR=\"${D}\""
293 +
294 + prune_libtool_files --all
295 +
296 + exeinto /usr/$(get_libdir)/ceph
297 + newexe src/init-ceph ceph_init.sh
298 +
299 + insinto /etc/logrotate.d/
300 + newins "${FILESDIR}"/ceph.logrotate ${PN}
301 +
302 + keepdir /var/lib/${PN}{,/tmp} /var/log/${PN}/stat
303 +
304 + fowners -R ceph:ceph /var/lib/ceph /var/log/ceph
305 +
306 + newinitd "${FILESDIR}/rbdmap.initd" rbdmap
307 + newinitd "${FILESDIR}/${PN}.initd-r7" ${PN}
308 + newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
309 +
310 + insinto /etc/sysctl.d
311 + newins "${FILESDIR}"/sysctld 90-${PN}.conf
312 +
313 + use tcmalloc && newenvd "${FILESDIR}"/envd-tcmalloc 99${PN}-tcmalloc
314 +
315 + systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" "ceph-mds@.service"
316 + systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" "ceph-osd@.service"
317 +
318 + udev_dorules udev/*.rules
319 +
320 + readme.gentoo_create_doc
321 +
322 + python_setup 'python2*'
323 + python_fix_shebang "${ED}"/usr/{,s}bin/
324 +
325 + # python_fix_shebang apparently is not idempotent
326 + sed -i -r 's:(/usr/lib/python-exec/python[0-9]\.[0-9]/python)[0-9]\.[0-9]:\1:' \
327 + "${ED}"/usr/{sbin/ceph-disk,bin/ceph-detect-init} || die "sed failed"
328 +}
329 +
330 +pkg_postinst() {
331 + readme.gentoo_print_elog
332 +}
333
334 diff --git a/sys-cluster/ceph/ceph-12.2.2-r1.ebuild b/sys-cluster/ceph/ceph-12.2.2-r1.ebuild
335 new file mode 100644
336 index 00000000000..370a0220f86
337 --- /dev/null
338 +++ b/sys-cluster/ceph/ceph-12.2.2-r1.ebuild
339 @@ -0,0 +1,288 @@
340 +# Copyright 1999-2018 Gentoo Foundation
341 +# Distributed under the terms of the GNU General Public License v2
342 +
343 +EAPI=6
344 +PYTHON_COMPAT=( python{2_7,3_{4,5,6}} )
345 +DISTUTILS_OPTIONAL=1
346 +
347 +inherit check-reqs cmake-utils distutils-r1 python-r1 udev user systemd \
348 + readme.gentoo-r1 flag-o-matic
349 +
350 +if [[ ${PV} == *9999* ]]; then
351 + inherit git-r3
352 + EGIT_REPO_URI="https://github.com/ceph/ceph.git"
353 + SRC_URI=""
354 +else
355 + SRC_URI="https://download.ceph.com/tarballs/${P}.tar.gz"
356 + KEYWORDS="~amd64 ~arm64 ~x86"
357 +fi
358 +
359 +DESCRIPTION="Ceph distributed filesystem"
360 +HOMEPAGE="https://ceph.com/"
361 +
362 +LICENSE="LGPL-2.1 CC-BY-SA-1.0 GPL-2 BSD Boost-1.0 MIT"
363 +SLOT="0"
364 +
365 +CPU_FLAGS_X86=(sse{,2,3,4_1,4_2} ssse3)
366 +
367 +IUSE="babeltrace cephfs fuse jemalloc ldap lttng +mgr nss +radosgw +ssl"
368 +IUSE+=" static-libs systemd +tcmalloc test xfs zfs"
369 +IUSE+=" $(printf "cpu_flags_x86_%s\n" ${CPU_FLAGS_X86[@]})"
370 +
371 +# unbundling code commented out pending bugs 584056 and 584058
372 +#>=dev-libs/jerasure-2.0.0-r1
373 +#>=dev-libs/gf-complete-2.0.0
374 +COMMON_DEPEND="
375 + virtual/libudev
376 + app-arch/bzip2:=[static-libs?]
377 + app-arch/lz4:=[static-libs?]
378 + app-arch/snappy:=[static-libs?]
379 + app-arch/zstd:=[static-libs?]
380 + app-misc/jq:=[static-libs?]
381 + dev-libs/boost:=[threads,context,python,static-libs?,${PYTHON_USEDEP}]
382 + dev-libs/crypto++:=[static-libs?]
383 + dev-libs/leveldb:=[snappy,static-libs?]
384 + dev-libs/libaio:=[static-libs?]
385 + dev-libs/libxml2:=[static-libs?]
386 + sys-apps/keyutils:=[static-libs?]
387 + sys-apps/util-linux:=[static-libs?]
388 + sys-libs/zlib:=[static-libs?]
389 + babeltrace? ( dev-util/babeltrace )
390 + ldap? ( net-nds/openldap:=[static-libs?] )
391 + lttng? ( dev-util/lttng-ust:= )
392 + nss? ( dev-libs/nss:= )
393 + fuse? ( sys-fs/fuse:0=[static-libs?] )
394 + ssl? ( dev-libs/openssl:=[static-libs?] )
395 + xfs? ( sys-fs/xfsprogs:=[static-libs?] )
396 + zfs? ( sys-fs/zfs:=[static-libs?] )
397 + radosgw? (
398 + dev-libs/expat:=[static-libs?]
399 + dev-libs/openssl:=[static-libs?]
400 + net-misc/curl:=[static-libs?]
401 + )
402 + jemalloc? ( dev-libs/jemalloc:=[static-libs?] )
403 + !jemalloc? ( >=dev-util/google-perftools-2.4:=[static-libs?] )
404 + ${PYTHON_DEPS}
405 + "
406 +DEPEND="${COMMON_DEPEND}
407 + app-arch/cpio
408 + dev-lang/yasm
409 + dev-python/cython[${PYTHON_USEDEP}]
410 + dev-python/sphinx
411 + dev-util/gperf
412 + dev-util/valgrind
413 + sys-apps/which
414 + sys-devel/bc
415 + virtual/pkgconfig
416 + test? (
417 + dev-python/tox[${PYTHON_USEDEP}]
418 + dev-python/virtualenv[${PYTHON_USEDEP}]
419 + sys-apps/grep[pcre]
420 + sys-fs/btrfs-progs
421 + )"
422 +RDEPEND="${COMMON_DEPEND}
423 + net-misc/socat
424 + sys-apps/gptfdisk
425 + sys-block/parted
426 + sys-fs/cryptsetup
427 + !<sys-apps/openrc-0.26.3
428 + dev-python/cherrypy[${PYTHON_USEDEP}]
429 + dev-python/flask[${PYTHON_USEDEP}]
430 + dev-python/pecan[${PYTHON_USEDEP}]
431 + dev-python/prettytable[${PYTHON_USEDEP}]
432 + dev-python/pyopenssl[${PYTHON_USEDEP}]
433 + dev-python/requests[${PYTHON_USEDEP}]
434 + dev-python/werkzeug[${PYTHON_USEDEP}]
435 + "
436 +REQUIRED_USE="
437 + $(python_gen_useflags 'python2*')
438 + ${PYTHON_REQUIRED_USE}
439 + ?? ( ssl nss )
440 + ?? ( jemalloc tcmalloc )
441 + "
442 +
443 +RESTRICT="test? ( userpriv )"
444 +
445 +# distribution tarball does not include everything needed for tests
446 +RESTRICT+=" test"
447 +
448 +STRIP_MASK="/usr/lib*/rados-classes/*"
449 +
450 +UNBUNDLE_LIBS=(
451 + src/erasure-code/jerasure/jerasure
452 + src/erasure-code/jerasure/gf-complete
453 +)
454 +
455 +PATCHES=(
456 + "${FILESDIR}/ceph-12.2.0-use-provided-cpu-flag-values.patch"
457 + "${FILESDIR}/ceph-12.2.0-cflags.patch"
458 + "${FILESDIR}/ceph-12.2.1-systemd-unitdir.patch"
459 + "${FILESDIR}/ceph-12.2.2-build-without-radosgw.patch"
460 +)
461 +
462 +check-reqs_export_vars() {
463 + if use amd64; then
464 + CHECKREQS_DISK_BUILD="12G"
465 + CHECKREQS_DISK_USR="460M"
466 + else
467 + CHECKREQS_DISK_BUILD="1400M"
468 + CHECKREQS_DISK_USR="450M"
469 + fi
470 +
471 + export CHECKREQS_DISK_BUILD CHECKREQS_DISK_USR
472 +}
473 +
474 +user_setup() {
475 + enewgroup ceph ${CEPH_GID}
476 + enewuser ceph "${CEPH_UID:--1}" -1 /var/lib/ceph ceph
477 +}
478 +
479 +pkg_pretend() {
480 + check-reqs_export_vars
481 + check-reqs_pkg_pretend
482 +}
483 +
484 +pkg_setup() {
485 + python_setup 'python2*'
486 + check-reqs_export_vars
487 + check-reqs_pkg_setup
488 + user_setup
489 +}
490 +
491 +src_prepare() {
492 + default
493 +
494 + # remove tests that need root access
495 + rm src/test/cli/ceph-authtool/cap*.t
496 +
497 + #rm -rf "${UNBUNDLE_LIBS[@]}"
498 +}
499 +
500 +ceph_src_configure() {
501 + local flag
502 + local mycmakeargs=(
503 + -DWITH_BABELTRACE=$(usex babeltrace)
504 + -DWITH_CEPHFS=$(usex cephfs)
505 + -DWITH_FUSE=$(usex fuse)
506 + -DWITH_LTTNG=$(usex lttng)
507 + -DWITH_MGR=$(usex mgr)
508 + -DWITH_NSS=$(usex nss)
509 + -DWITH_OPENLDAP=$(usex ldap)
510 + -DWITH_RADOSGW=$(usex radosgw)
511 + -DWITH_SSL=$(usex ssl)
512 + -DWITH_SYSTEMD=$(usex systemd)
513 + -DWITH_TESTS=$(usex test)
514 + -DWITH_XFS=$(usex xfs)
515 + -DWITH_ZFS=$(usex zfs)
516 + -DENABLE_SHARED=$(usex static-libs '' 'yes' 'no')
517 + -DALLOCATOR=$(usex tcmalloc 'tcmalloc' '' "$(usex jemalloc 'jemalloc' '' 'libc' '')" '')
518 + -DWITH_SYSTEM_BOOST=yes
519 + -DWITH_RDMA=no
520 + -DSYSTEMD_UNITDIR=$(systemd_get_systemunitdir)
521 + )
522 + if use amd64 || use x86; then
523 + for flag in ${CPU_FLAGS_X86[@]}; do
524 + mycmakeargs+=("$(usex cpu_flags_x86_${flag} "-DHAVE_INTEL_${flag^^}=1")")
525 + done
526 + fi
527 +
528 + rm -f "${BUILD_DIR:-${S}}/CMakeCache.txt"
529 + cmake-utils_src_configure
530 +
531 + # bug #630232
532 + sed -i "s:\"${T//:\\:}/${EPYTHON}/bin/python\":\"${PYTHON}\":" \
533 + "${BUILD_DIR:-${CMAKE_BUILD_DIR:-${S}}}"/include/acconfig.h \
534 + || die "sed failed"
535 +}
536 +
537 +src_configure() {
538 + ceph_src_configure
539 +}
540 +
541 +python_compile() {
542 + local CMAKE_USE_DIR="${S}"
543 +
544 + ceph_src_configure
545 + pushd "${BUILD_DIR}/src/pybind" >/dev/null || die
546 + emake VERBOSE=1 all
547 +
548 + # python modules are only compiled with "make install" so we need to do this to
549 + # prevent doing a bunch of compilation in src_install
550 + DESTDIR="${T}" emake VERBOSE=1 install
551 + popd >/dev/null || die
552 +}
553 +
554 +src_compile() {
555 + cmake-utils_src_make all
556 +
557 + # we have to do this here to prevent from building everything multiple times
558 + BUILD_DIR="${CMAKE_BUILD_DIR}" python_copy_sources
559 + python_foreach_impl python_compile
560 +}
561 +
562 +src_test() {
563 + make check || die "make check failed"
564 +}
565 +
566 +python_install() {
567 + local CMAKE_USE_DIR="${S}"
568 + pushd "${BUILD_DIR}/src/pybind" >/dev/null || die
569 + DESTDIR="${D}" emake install
570 + popd >/dev/null || die
571 +}
572 +
573 +src_install() {
574 + cmake-utils_src_install
575 + python_foreach_impl python_install
576 +
577 + prune_libtool_files --all
578 +
579 + exeinto /usr/$(get_libdir)/ceph
580 + newexe "${CMAKE_BUILD_DIR}/bin/init-ceph" ceph_init.sh
581 +
582 + insinto /etc/logrotate.d/
583 + newins "${FILESDIR}"/ceph.logrotate ${PN}
584 +
585 + keepdir /var/lib/${PN}{,/tmp} /var/log/${PN}/stat
586 +
587 + fowners -R ceph:ceph /var/lib/ceph /var/log/ceph
588 +
589 + newinitd "${FILESDIR}/rbdmap.initd" rbdmap
590 + newinitd "${FILESDIR}/${PN}.initd-r7" ${PN}
591 + newconfd "${FILESDIR}/${PN}.confd-r4" ${PN}
592 +
593 + insinto /etc/sysctl.d
594 + newins "${FILESDIR}"/sysctld 90-${PN}.conf
595 +
596 + use tcmalloc && newenvd "${FILESDIR}"/envd-tcmalloc 99${PN}-tcmalloc
597 +
598 + # units aren't installed by the build system unless systemd is enabled
599 + # so no point installing these with the USE flag disabled
600 + if use systemd; then
601 + systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" \
602 + "ceph-mds@.service"
603 +
604 + systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" \
605 + "ceph-osd@.service"
606 + fi
607 +
608 + udev_dorules udev/*.rules
609 +
610 + readme.gentoo_create_doc
611 +
612 + python_setup 'python2*'
613 +
614 + # bug #630232
615 + sed -i -r "s:${T//:/\\:}/${EPYTHON}:/usr:" "${ED}"/usr/bin/ceph \
616 + || die "sed failed"
617 +
618 + python_fix_shebang "${ED}"/usr/{,s}bin/
619 +
620 + # python_fix_shebang apparently is not idempotent
621 + sed -i -r 's:(/usr/lib/python-exec/python[0-9]\.[0-9]/python)[0-9]\.[0-9]:\1:' \
622 + "${ED}"/usr/{sbin/ceph-disk,bin/ceph-detect-init} || die "sed failed"
623 +}
624 +
625 +pkg_postinst() {
626 + readme.gentoo_print_elog
627 +}
628
629 diff --git a/sys-cluster/ceph/files/ceph.initd-r7 b/sys-cluster/ceph/files/ceph.initd-r7
630 new file mode 100644
631 index 00000000000..110d7bd0b63
632 --- /dev/null
633 +++ b/sys-cluster/ceph/files/ceph.initd-r7
634 @@ -0,0 +1,87 @@
635 +#!/sbin/openrc-run
636 +
637 +ceph_conf="${ceph_conf:-/etc/ceph/ceph.conf}"
638 +extra_commands="reload"
639 +daemon_type="${RC_SVCNAME#ceph-}"
640 +daemon_type="${daemon_type%%.*}"
641 +daemon_id="${RC_SVCNAME#ceph-*.}"
642 +daemon_id="${daemon_id:-0}"
643 +: ${rundir:=/run/ceph}
644 +: ${user:=ceph}
645 +: ${group:=ceph}
646 +: ${rc_ulimit:=-n 1048576 -u 1048576}
647 +
648 +pidfile="${rundir}/supervisor-${daemon_type}.${daemon_id}.pid"
649 +daemon_pidfile="${rundir}/${daemon_type}.${daemon_id}.pid"
650 +
651 +command="/usr/bin/${RC_SVCNAME%%.*}"
652 +command_args="-i ${daemon_id} --pid-file ${daemon_pidfile} -c ${ceph_conf}"
653 +command_args_foreground="--foreground"
654 +
655 +retry="${CEPH_TERMTIMEOUT:-TERM/120/KILL/5}"
656 +start_stop_daemon_args="--user ${user} --group ${group}"
657 +supervise_daemon_args="--user ${user} --group ${group}"
658 +
659 +: ${supervisor:=supervise-daemon}
660 +: ${stdout:=/var/log/ceph/ceph}
661 +: ${stderr:=/var/log/ceph/ceph}
662 +: ${respawn_delay:=10}
663 +: ${respawn_max:=5}
664 +: ${respawn_period:=1800}
665 +
666 +: ${osd_respawn_delay:=15}
667 +: ${osd_respawn_max:=10}
668 +
669 +: ${radosgw_respawn_max:=5}
670 +: ${radosgw_respawn_period:=30}
671 +
672 +depend() {
673 + use dns logger
674 + after net ntpd ntp-client chronyd
675 + before netmount
676 +}
677 +
678 +is_type_valid() {
679 + case ${daemon_type} in
680 + mon|mds|osd|mgr|radosgw) return 0;;
681 + *) return 1;;
682 + esac
683 +}
684 +
685 +start_pre() {
686 + export CEPH_CONF="${ceph_conf}"
687 +
688 + checkpath -d -q -o "${user}:${group}" "${rundir}"
689 +
690 + if ! is_type_valid ;then
691 + eerror "Please give valid Ceph Server Type: mds, mon, osd"
692 + return 1
693 +
694 + elif pgrep -f "[c]eph-${daemon_type} -i ${daemon_id} "; then
695 + eerror "${daemon_type}.${daemon_id} is still running, refusing to start"
696 + return 1
697 + fi
698 +
699 + local arg_name arg_val
700 + for arg_name in std{out,err} respawn_{delay,max,period}; do
701 + eval arg_val="\${${daemon_type}_${arg_name}}"
702 +
703 + if [ -z "${arg_val}" ]; then
704 + eval arg_val="\${${arg_name}}"
705 + else
706 + eval "${arg_name}=\"${arg_val}\""
707 + fi
708 +
709 + if [ "${arg_name}" = "stderr" ] || [ "${arg_name}" = "stdout" ]; then
710 + supervise_daemon_args="${supervise_daemon_args} --${arg_name//_/-}=${arg_val}.${daemon_id}-${arg_name}.log"
711 + fi
712 + done
713 +}
714 +
715 +reload() {
716 + ebegin "Reloading Ceph ${daemon_type}.${daemon_id}"
717 + start-stop-daemon --signal 1 "${start_stop_daemon_args}"
718 + eend ${?}
719 +}
720 +
721 +# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet: