ceph-10.2.5-r1.ebuild 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python{2_7,3_{4,5}} )
  5. inherit check-reqs autotools eutils python-r1 udev user \
  6. readme.gentoo-r1 systemd versionator flag-o-matic
  7. if [[ ${PV} == *9999* ]]; then
  8. inherit git-r3
  9. EGIT_REPO_URI="
  10. git://github.com/ceph/ceph.git
  11. https://github.com/ceph/ceph.git"
  12. SRC_URI=""
  13. else
  14. SRC_URI="http://ceph.com/download/${P}.tar.gz"
  15. KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
  16. fi
  17. DESCRIPTION="Ceph distributed filesystem"
  18. HOMEPAGE="http://ceph.com/"
  19. LICENSE="LGPL-2.1"
  20. SLOT="0"
  21. IUSE="babeltrace cephfs cryptopp debug fuse gtk jemalloc ldap +libaio"
  22. IUSE+=" libatomic lttng +nss +radosgw static-libs +tcmalloc test xfs zfs"
  23. # unbundling code commented out pending bugs 584056 and 584058
  24. #>=dev-libs/jerasure-2.0.0-r1
  25. #>=dev-libs/gf-complete-2.0.0
  26. COMMON_DEPEND="
  27. app-arch/snappy
  28. app-arch/lz4:=
  29. app-arch/bzip2
  30. dev-libs/boost:=[threads]
  31. dev-libs/libaio
  32. dev-libs/leveldb[snappy]
  33. nss? ( dev-libs/nss )
  34. libatomic? ( dev-libs/libatomic_ops )
  35. cryptopp? ( dev-libs/crypto++:= )
  36. sys-apps/keyutils
  37. sys-apps/util-linux
  38. dev-libs/libxml2
  39. radosgw? ( dev-libs/fcgi )
  40. ldap? ( net-nds/openldap )
  41. babeltrace? ( dev-util/babeltrace )
  42. fuse? ( sys-fs/fuse )
  43. xfs? ( sys-fs/xfsprogs )
  44. zfs? ( sys-fs/zfs )
  45. gtk? (
  46. x11-libs/gtk+:2
  47. dev-cpp/gtkmm:2.4
  48. gnome-base/librsvg
  49. )
  50. radosgw? (
  51. dev-libs/fcgi
  52. dev-libs/expat
  53. net-misc/curl
  54. )
  55. jemalloc? ( dev-libs/jemalloc )
  56. !jemalloc? ( dev-util/google-perftools )
  57. lttng? ( dev-util/lttng-ust )
  58. ${PYTHON_DEPS}
  59. "
  60. DEPEND="${COMMON_DEPEND}
  61. dev-python/cython[${PYTHON_USEDEP}]
  62. app-arch/cpio
  63. sys-apps/lsb-release
  64. virtual/pkgconfig
  65. dev-python/sphinx
  66. test? (
  67. sys-fs/btrfs-progs
  68. sys-apps/grep[pcre]
  69. dev-python/tox[${PYTHON_USEDEP}]
  70. dev-python/virtualenv[${PYTHON_USEDEP}]
  71. )"
  72. RDEPEND="${COMMON_DEPEND}
  73. sys-apps/hdparm
  74. sys-block/parted
  75. sys-fs/cryptsetup
  76. sys-apps/gptfdisk
  77. dev-python/flask[${PYTHON_USEDEP}]
  78. dev-python/requests[${PYTHON_USEDEP}]
  79. "
  80. REQUIRED_USE="
  81. $(python_gen_useflags 'python2*')
  82. ${PYTHON_REQUIRED_USE}
  83. ^^ ( nss cryptopp )
  84. ?? ( jemalloc tcmalloc )
  85. "
  86. # work around bug in ceph compilation (rgw/ceph_dencoder-rgw_dencoder.o... undefined reference to `vtable for RGWZoneGroup')
  87. REQUIRED_USE+=" radosgw"
  88. RESTRICT="test? ( userpriv )"
  89. # distribution tarball does not include everything needed for tests
  90. RESTRICT+=" test"
  91. STRIP_MASK="/usr/lib*/rados-classes/*"
  92. UNBUNDLE_LIBS=(
  93. src/erasure-code/jerasure/jerasure
  94. src/erasure-code/jerasure/gf-complete
  95. )
  96. PATCHES=(
  97. "${FILESDIR}/ceph-10.2.0-dont-use-virtualenvs.patch"
  98. #"${FILESDIR}/ceph-10.2.1-unbundle-jerasure.patch"
  99. "${FILESDIR}/${PN}-10.2.1-libzfs.patch"
  100. "${FILESDIR}/${PN}-10.2.3-build-without-openldap.patch"
  101. )
  102. check-reqs_export_vars() {
  103. if use debug; then
  104. CHECKREQS_DISK_BUILD="23G"
  105. CHECKREQS_DISK_USR="7G"
  106. elif use amd64; then
  107. CHECKREQS_DISK_BUILD="12G"
  108. CHECKREQS_DISK_USR="450M"
  109. else
  110. CHECKREQS_DISK_BUILD="1400M"
  111. CHECKREQS_DISK_USR="450M"
  112. fi
  113. export CHECKREQS_DISK_BUILD CHECKREQS_DISK_USR
  114. }
  115. user_setup() {
  116. enewgroup ceph ${CEPH_GID}
  117. enewuser ceph "${CEPH_UID:--1}" -1 /var/lib/ceph ceph
  118. }
  119. emake_python_bindings() {
  120. local action="${1}" params binding
  121. shift
  122. params=("${@}")
  123. __emake_python_bindings_do_impl() {
  124. emake "${params[@]}" PYTHON="${EPYTHON}" "${binding}-pybind-${action}"
  125. # these don't work and aren't needed on python3
  126. if [[ ${EBUILD_PHASE} == install ]] && python_is_python3; then
  127. rm -f "${ED}/$(python_get_sitedir)"/ceph_{argparse,volume_client}.py
  128. fi
  129. }
  130. pushd "${S}/src"
  131. for binding in rados rbd $(use cephfs && echo cephfs); do
  132. python_foreach_impl __emake_python_bindings_do_impl
  133. done
  134. popd
  135. unset __emake_python_bindings_do_impl
  136. }
  137. pkg_pretend() {
  138. check-reqs_export_vars
  139. check-reqs_pkg_pretend
  140. }
  141. pkg_setup() {
  142. python_setup
  143. check-reqs_export_vars
  144. check-reqs_pkg_setup
  145. user_setup
  146. }
  147. src_prepare() {
  148. default
  149. # remove tests that need root access
  150. rm src/test/cli/ceph-authtool/cap*.t
  151. #rm -rf "${UNBUNDLE_LIBS[@]}"
  152. append-flags -fPIC
  153. eautoreconf
  154. }
  155. src_configure() {
  156. local myeconfargs=(
  157. --without-hadoop
  158. --includedir=/usr/include
  159. $(use_with cephfs)
  160. $(use_with debug)
  161. $(use_with fuse)
  162. $(use_with libaio)
  163. $(use_with libatomic libatomic-ops)
  164. $(use_with nss)
  165. $(use_with cryptopp)
  166. $(use_with radosgw)
  167. $(use_with gtk gtk2)
  168. $(use_enable static-libs static)
  169. $(use_with jemalloc)
  170. $(use_with xfs libxfs)
  171. $(use_with zfs libzfs)
  172. $(use_with lttng )
  173. $(use_with babeltrace)
  174. $(use_with ldap openldap)
  175. $(use jemalloc || usex tcmalloc " --with-tcmalloc" " --with-tcmalloc-minimal")
  176. --with-mon
  177. --with-eventfd
  178. --with-cython
  179. --without-kinetic
  180. --without-librocksdb
  181. --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
  182. )
  183. # we can only use python2.7 for building at the moment
  184. python_setup 'python2*'
  185. econf "${myeconfargs[@]}"
  186. }
  187. src_compile() {
  188. emake
  189. emake_python_bindings all
  190. use test && emake check-local
  191. }
  192. src_test() {
  193. make check || die "make check failed"
  194. }
  195. src_install() {
  196. default
  197. emake_python_bindings install-exec "DESTDIR=\"${D}\""
  198. prune_libtool_files --all
  199. exeinto /usr/$(get_libdir)/ceph
  200. newexe src/init-ceph ceph_init.sh
  201. insinto /etc/logrotate.d/
  202. newins "${FILESDIR}"/ceph.logrotate ${PN}
  203. keepdir /var/lib/${PN}{,/tmp} /var/log/${PN}/stat
  204. fowners -R ceph:ceph /var/lib/ceph /var/log/ceph
  205. newinitd "${FILESDIR}/rbdmap.initd" rbdmap
  206. newinitd "${FILESDIR}/${PN}.initd-r3" ${PN}
  207. newconfd "${FILESDIR}/${PN}.confd-r1" ${PN}
  208. systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" "ceph-mds@.service"
  209. systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" "ceph-osd@.service"
  210. systemd_install_serviced "${FILESDIR}/ceph-mon_at.service.conf" "ceph-mon@.service"
  211. udev_dorules udev/*.rules
  212. readme.gentoo_create_doc
  213. python_setup 'python2*'
  214. python_fix_shebang "${ED}"/usr/{,s}bin/
  215. # python_fix_shebang apparently is not idempotent
  216. sed -i -r 's:(/usr/lib/python-exec/python[0-9]\.[0-9]/python)[0-9]\.[0-9]:\1:' \
  217. "${ED}"/usr/{sbin/ceph-disk,bin/ceph-detect-init} || die "sed failed"
  218. }
  219. pkg_postinst() {
  220. readme.gentoo_print_elog
  221. }