Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-cluster/ceph/files/, sys-cluster/ceph/
Date: Mon, 31 Jul 2017 23:06:49
Message-Id: 1501542396.457cc8d804957b769e7c44147a49237068351b9f.chutzpah@gentoo
1 commit: 457cc8d804957b769e7c44147a49237068351b9f
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 31 23:06:16 2017 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 31 23:06:36 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=457cc8d8
7
8 sys-cluster/ceph: Revision bump to 10.2.9-r2, fix bug in rbd-nbd mapping
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.3
11
12 sys-cluster/ceph/ceph-10.2.9-r2.ebuild | 299 +++++++++++++++++++++
13 ...elax_size_check_for_newer_kernel_versions.patch | 28 ++
14 2 files changed, 327 insertions(+)
15
16 diff --git a/sys-cluster/ceph/ceph-10.2.9-r2.ebuild b/sys-cluster/ceph/ceph-10.2.9-r2.ebuild
17 new file mode 100644
18 index 00000000000..a9d0eec50ea
19 --- /dev/null
20 +++ b/sys-cluster/ceph/ceph-10.2.9-r2.ebuild
21 @@ -0,0 +1,299 @@
22 +# Copyright 1999-2017 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=6
26 +PYTHON_COMPAT=( python{2_7,3_{4,5,6}} )
27 +
28 +inherit check-reqs autotools eutils python-r1 udev user \
29 + readme.gentoo-r1 systemd versionator flag-o-matic
30 +
31 +if [[ ${PV} == *9999* ]]; then
32 + inherit git-r3
33 + EGIT_REPO_URI="https://github.com/ceph/ceph.git"
34 + SRC_URI=""
35 +else
36 + SRC_URI="https://download.ceph.com/tarballs/${P}.tar.gz"
37 + KEYWORDS="~amd64 ~arm64 ~x86"
38 +fi
39 +
40 +DESCRIPTION="Ceph distributed filesystem"
41 +HOMEPAGE="https://ceph.com/"
42 +
43 +LICENSE="LGPL-2.1"
44 +SLOT="0"
45 +
46 +IUSE="babeltrace cephfs cryptopp debug fuse gtk jemalloc ldap +libaio"
47 +IUSE+=" libatomic lttng +nss +radosgw static-libs +tcmalloc test xfs zfs"
48 +
49 +# unbundling code commented out pending bugs 584056 and 584058
50 +#>=dev-libs/jerasure-2.0.0-r1
51 +#>=dev-libs/gf-complete-2.0.0
52 +COMMON_DEPEND="
53 + app-arch/snappy:=
54 + sys-libs/zlib:=
55 + app-arch/lz4:=
56 + app-arch/bzip2:=
57 + app-arch/zstd:=
58 + dev-libs/boost:=[threads]
59 + dev-libs/libaio:=
60 + dev-libs/leveldb:=[snappy]
61 + nss? ( dev-libs/nss:= )
62 + libatomic? ( dev-libs/libatomic_ops:= )
63 + cryptopp? ( dev-libs/crypto++:= )
64 + sys-apps/keyutils
65 + sys-apps/util-linux
66 + dev-libs/libxml2:=
67 + radosgw? ( dev-libs/fcgi:= )
68 + ldap? ( net-nds/openldap:= )
69 + babeltrace? ( dev-util/babeltrace )
70 + fuse? ( sys-fs/fuse:0= )
71 + xfs? ( sys-fs/xfsprogs:= )
72 + zfs? ( sys-fs/zfs:= )
73 + gtk? (
74 + x11-libs/gtk+:2=
75 + dev-cpp/gtkmm:2.4
76 + gnome-base/librsvg:=
77 + )
78 + radosgw? (
79 + dev-libs/fcgi:=
80 + dev-libs/expat:=
81 + net-misc/curl:=
82 + )
83 + jemalloc? ( dev-libs/jemalloc:= )
84 + !jemalloc? ( =dev-util/google-perftools-2.4*:= )
85 + lttng? ( dev-util/lttng-ust:= )
86 + ${PYTHON_DEPS}
87 + "
88 +DEPEND="${COMMON_DEPEND}
89 + dev-python/cython[${PYTHON_USEDEP}]
90 + app-arch/cpio
91 + virtual/pkgconfig
92 + dev-python/sphinx
93 + test? (
94 + sys-fs/btrfs-progs
95 + sys-apps/grep[pcre]
96 + dev-python/tox[${PYTHON_USEDEP}]
97 + dev-python/virtualenv[${PYTHON_USEDEP}]
98 + )"
99 +RDEPEND="${COMMON_DEPEND}
100 + sys-apps/hdparm
101 + sys-block/parted
102 + sys-fs/cryptsetup
103 + sys-apps/gptfdisk
104 + dev-python/flask[${PYTHON_USEDEP}]
105 + dev-python/requests[${PYTHON_USEDEP}]
106 + "
107 +REQUIRED_USE="
108 + $(python_gen_useflags 'python2*')
109 + ${PYTHON_REQUIRED_USE}
110 + ^^ ( nss cryptopp )
111 + ?? ( jemalloc tcmalloc )
112 + "
113 +
114 +# work around bug in ceph compilation (rgw/ceph_dencoder-rgw_dencoder.o... undefined reference to `vtable for RGWZoneGroup')
115 +REQUIRED_USE+=" radosgw"
116 +
117 +#RESTRICT="test? ( userpriv )"
118 +
119 +# distribution tarball does not include everything needed for tests
120 +RESTRICT+=" test"
121 +
122 +STRIP_MASK="/usr/lib*/rados-classes/*"
123 +
124 +UNBUNDLE_LIBS=(
125 + src/erasure-code/jerasure/jerasure
126 + src/erasure-code/jerasure/gf-complete
127 +)
128 +
129 +PATCHES=(
130 + "${FILESDIR}/ceph-10.2.0-dont-use-virtualenvs.patch"
131 + #"${FILESDIR}/ceph-10.2.1-unbundle-jerasure.patch"
132 + "${FILESDIR}/${PN}-10.2.1-libzfs.patch"
133 + "${FILESDIR}/${PN}-10.2.3-build-without-openldap.patch"
134 + "${FILESDIR}/${PN}-10.2.5-Make-RBD-Python-bindings-compatible-with-Python-3.patch"
135 + "${FILESDIR}/${PN}-10.2.5-Make-CephFS-bindings-and-tests-compatible-with-Python-3.patch"
136 + "${FILESDIR}/${PN}-10.2.7-fix-compilation-with-zstd.patch"
137 + "${FILESDIR}/${PN}-10.2.9-libradosstriper_fix_format_injection_vulnerability.patch"
138 + "${FILESDIR}/${PN}-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch"
139 +)
140 +
141 +check-reqs_export_vars() {
142 + if use debug; then
143 + CHECKREQS_DISK_BUILD="23G"
144 + CHECKREQS_DISK_USR="7G"
145 + elif use amd64; then
146 + CHECKREQS_DISK_BUILD="12G"
147 + CHECKREQS_DISK_USR="450M"
148 + else
149 + CHECKREQS_DISK_BUILD="1400M"
150 + CHECKREQS_DISK_USR="450M"
151 + fi
152 +
153 + export CHECKREQS_DISK_BUILD CHECKREQS_DISK_USR
154 +}
155 +
156 +user_setup() {
157 + enewgroup ceph ${CEPH_GID}
158 + enewuser ceph "${CEPH_UID:--1}" -1 /var/lib/ceph ceph
159 +}
160 +
161 +emake_python_bindings() {
162 + local action="${1}" params binding module
163 + shift
164 + params=("${@}")
165 +
166 + __emake_python_bindings_do_impl() {
167 + ceph_run_econf "${EPYTHON}"
168 + emake "${params[@]}" PYTHON="${EPYTHON}" "${binding}-pybind-${action}"
169 +
170 + # these don't work and aren't needed on python3
171 + if [[ ${EBUILD_PHASE} == install ]]; then
172 + for module in "${S}"/src/pybind/*.py; do
173 + module_basename="$(basename "${module}")"
174 + if [[ ${module_basename} == ceph_volume_client.py ]] && ! use cephfs; then
175 + continue
176 + elif [[ ! -e "${ED}/$(python_get_sitedir)/${module_basename}" ]]; then
177 + python_domodule ${module}
178 + fi
179 + done
180 + fi
181 + }
182 +
183 + pushd "${S}/src"
184 + for binding in rados rbd $(use cephfs && echo cephfs); do
185 + python_foreach_impl __emake_python_bindings_do_impl
186 + done
187 + popd
188 +
189 + unset __emake_python_bindings_do_impl
190 +}
191 +
192 +pkg_pretend() {
193 + check-reqs_export_vars
194 + check-reqs_pkg_pretend
195 +}
196 +
197 +pkg_setup() {
198 + python_setup
199 + check-reqs_export_vars
200 + check-reqs_pkg_setup
201 + user_setup
202 +}
203 +
204 +src_prepare() {
205 + default
206 +
207 + # remove tests that need root access
208 + rm src/test/cli/ceph-authtool/cap*.t
209 +
210 + #rm -rf "${UNBUNDLE_LIBS[@]}"
211 +
212 + append-flags -fPIC
213 + eautoreconf
214 +}
215 +
216 +src_configure() {
217 + ECONFARGS=(
218 + --without-hadoop
219 + --includedir=/usr/include
220 + $(use_with cephfs)
221 + $(use_with debug)
222 + $(use_with fuse)
223 + $(use_with libaio)
224 + $(use_with libatomic libatomic-ops)
225 + $(use_with nss)
226 + $(use_with cryptopp)
227 + $(use_with radosgw)
228 + $(use_with gtk gtk2)
229 + $(use_enable static-libs static)
230 + $(use_with jemalloc)
231 + $(use_with xfs libxfs)
232 + $(use_with zfs libzfs)
233 + $(use_with lttng )
234 + $(use_with babeltrace)
235 + $(use_with ldap openldap)
236 + $(use jemalloc || usex tcmalloc " --with-tcmalloc" " --with-tcmalloc-minimal")
237 + --with-mon
238 + --with-eventfd
239 + --with-cython
240 + --without-kinetic
241 + --without-librocksdb
242 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
243 + )
244 +
245 + # we can only use python2.7 for building at the moment
246 + ceph_run_econf "python2*"
247 +}
248 +
249 +ceph_run_econf() {
250 + [[ -z ${ECONFARGS} ]] && die "called ${FUNCNAME[0]} with ECONFARGS unset"
251 + [[ -z ${1} ]] && die "called ${FUNCNAME[0]} without passing python implementation"
252 +
253 + pushd "${S}" >/dev/null || die
254 + #
255 + # This generates a QA warning about running econf in src_compile
256 + # and src_install. Unfortunately the only other way to do this would
257 + # involve building all of for each python implementation times, which
258 + # wastes a _lot_ of CPU time and disk space. This hack will no longer
259 + # be needed with >=ceph-11.2.
260 + #
261 + python_setup "${1}"
262 + econf "${ECONFARGS[@]}"
263 +
264 + popd >/dev/null || die
265 +}
266 +
267 +src_compile() {
268 + emake
269 + emake_python_bindings all
270 +
271 + use test && emake check-local
272 +}
273 +
274 +src_test() {
275 + make check || die "make check failed"
276 +}
277 +
278 +src_install() {
279 + default
280 + emake_python_bindings install-exec "DESTDIR=\"${D}\""
281 +
282 + prune_libtool_files --all
283 +
284 + exeinto /usr/$(get_libdir)/ceph
285 + newexe src/init-ceph ceph_init.sh
286 +
287 + insinto /etc/logrotate.d/
288 + newins "${FILESDIR}"/ceph.logrotate ${PN}
289 +
290 + keepdir /var/lib/${PN}{,/tmp} /var/log/${PN}/stat
291 +
292 + fowners -R ceph:ceph /var/lib/ceph /var/log/ceph
293 +
294 + newinitd "${FILESDIR}/rbdmap.initd" rbdmap
295 + newinitd "${FILESDIR}/${PN}.initd-r5" ${PN}
296 + newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
297 +
298 + insinto /etc/sysctl.d
299 + newins "${FILESDIR}"/sysctld 90-${PN}.conf
300 +
301 + use tcmalloc && newenvd "${FILESDIR}"/envd-tcmalloc 99${PN}-tcmalloc
302 +
303 + systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" "ceph-mds@.service"
304 + systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" "ceph-osd@.service"
305 +
306 + udev_dorules udev/*.rules
307 +
308 + readme.gentoo_create_doc
309 +
310 + python_setup 'python2*'
311 + python_fix_shebang "${ED}"/usr/{,s}bin/
312 +
313 + # python_fix_shebang apparently is not idempotent
314 + sed -i -r 's:(/usr/lib/python-exec/python[0-9]\.[0-9]/python)[0-9]\.[0-9]:\1:' \
315 + "${ED}"/usr/{sbin/ceph-disk,bin/ceph-detect-init} || die "sed failed"
316 +}
317 +
318 +pkg_postinst() {
319 + readme.gentoo_print_elog
320 +}
321
322 diff --git a/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch b/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch
323 new file mode 100644
324 index 00000000000..5cb89be0edf
325 --- /dev/null
326 +++ b/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch
327 @@ -0,0 +1,28 @@
328 +diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc
329 +index 2e399ab832..88e1e0ff65 100644
330 +--- a/src/tools/rbd_nbd/rbd-nbd.cc
331 ++++ b/src/tools/rbd_nbd/rbd-nbd.cc
332 +@@ -469,6 +469,10 @@ static int open_device(const char* path, bool try_load_moudle = false)
333 +
334 + static int check_device_size(int nbd_index, unsigned long expected_size)
335 + {
336 ++ // There are bugs with some older kernel versions that result in an
337 ++ // overflow for large image sizes. This check is to ensure we are
338 ++ // not affected.
339 ++
340 + unsigned long size = 0;
341 + std::string path = "/sys/block/nbd" + stringify(nbd_index) + "/size";
342 + std::ifstream ifs;
343 +@@ -480,6 +484,12 @@ static int check_device_size(int nbd_index, unsigned long expected_size)
344 + ifs >> size;
345 + size *= RBD_NBD_BLKSIZE;
346 +
347 ++ if (size == 0) {
348 ++ // Newer kernel versions will report real size only after nbd
349 ++ // connect. Assume this is the case and return success.
350 ++ return 0;
351 ++ }
352 ++
353 + if (size != expected_size) {
354 + cerr << "rbd-nbd: kernel reported invalid device size (" << size
355 + << ", expected " << expected_size << ")" << std::endl;