ceph-9999.ebuild 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. # Copyright 1999-2016 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. COMMON_DEPEND="
  24. app-arch/snappy
  25. app-arch/lz4:=
  26. app-arch/bzip2
  27. dev-libs/boost:=[threads]
  28. dev-libs/fcgi
  29. dev-libs/libaio
  30. dev-libs/leveldb[snappy]
  31. nss? ( dev-libs/nss )
  32. libatomic? ( dev-libs/libatomic_ops )
  33. cryptopp? ( dev-libs/crypto++ )
  34. sys-apps/keyutils
  35. sys-apps/util-linux
  36. dev-libs/libxml2
  37. ldap? ( net-nds/openldap )
  38. babeltrace? ( dev-util/babeltrace )
  39. fuse? ( sys-fs/fuse )
  40. xfs? ( sys-fs/xfsprogs )
  41. zfs? ( sys-fs/zfs )
  42. gtk? (
  43. x11-libs/gtk+:2
  44. dev-cpp/gtkmm:2.4
  45. gnome-base/librsvg
  46. )
  47. radosgw? (
  48. dev-libs/fcgi
  49. dev-libs/expat
  50. net-misc/curl
  51. )
  52. jemalloc? ( dev-libs/jemalloc )
  53. !jemalloc? ( dev-util/google-perftools )
  54. lttng? ( dev-util/lttng-ust )
  55. ${PYTHON_DEPS}
  56. "
  57. DEPEND="${COMMON_DEPEND}
  58. dev-python/cython[${PYTHON_USEDEP}]
  59. app-arch/cpio
  60. sys-apps/lsb-release
  61. virtual/pkgconfig
  62. dev-python/sphinx
  63. test? (
  64. sys-fs/btrfs-progs
  65. sys-apps/grep[pcre]
  66. dev-python/tox[${PYTHON_USEDEP}]
  67. dev-python/virtualenv[${PYTHON_USEDEP}]
  68. )"
  69. RDEPEND="${COMMON_DEPEND}
  70. sys-apps/hdparm
  71. sys-block/parted
  72. sys-fs/cryptsetup
  73. sys-apps/gptfdisk
  74. dev-python/flask[${PYTHON_USEDEP}]
  75. dev-python/requests[${PYTHON_USEDEP}]
  76. "
  77. REQUIRED_USE="
  78. $(python_gen_useflags 'python2*')
  79. ${PYTHON_REQUIRED_USE}
  80. ^^ ( nss cryptopp )
  81. ?? ( jemalloc tcmalloc )
  82. "
  83. # work around bug in ceph compilation (rgw/ceph_dencoder-rgw_dencoder.o... undefined reference to `vtable for RGWZoneGroup')
  84. REQUIRED_USE+=" radosgw"
  85. RESTRICT="test? ( userpriv )"
  86. # distribution tarball does not include everything needed for tests
  87. RESTRICT+=" test"
  88. STRIP_MASK="/usr/lib*/rados-classes/*"
  89. PATCHES=(
  90. "${FILESDIR}/ceph-10.2.0-dont-use-virtualenvs.patch"
  91. )
  92. check-reqs_export_vars() {
  93. if use debug; then
  94. CHECKREQS_DISK_BUILD="23G"
  95. CHECKREQS_DISK_USR="7G"
  96. elif use amd64; then
  97. CHECKREQS_DISK_BUILD="12G"
  98. CHECKREQS_DISK_USR="450M"
  99. else
  100. CHECKREQS_DISK_BUILD="1400M"
  101. CHECKREQS_DISK_USR="450M"
  102. fi
  103. export CHECKREQS_DISK_BUILD CHECKREQS_DISK_USR
  104. }
  105. user_setup() {
  106. enewgroup ceph
  107. enewuser ceph -1 -1 /var/lib/ceph ceph
  108. }
  109. emake_python_bindings() {
  110. local action="${1}" params binding
  111. shift
  112. params=("${@}")
  113. __emake_python_bindings_do_impl() {
  114. emake "${params[@]}" PYTHON="${EPYTHON}" "${binding}-pybind-${action}"
  115. # these don't work and aren't needed on python3
  116. if [[ ${EBUILD_PHASE} == install ]] && python_is_python3; then
  117. rm -f "${ED}/$(python_get_sitedir)"/ceph_{argparse,volume_client}.py
  118. fi
  119. }
  120. pushd "${S}/src"
  121. for binding in rados rbd $(use cephfs && echo cephfs); do
  122. python_foreach_impl __emake_python_bindings_do_impl
  123. done
  124. popd
  125. unset __emake_python_bindings_do_impl
  126. }
  127. pkg_pretend() {
  128. check-reqs_export_vars
  129. check-reqs_pkg_pretend
  130. }
  131. pkg_setup() {
  132. python_setup
  133. check-reqs_export_vars
  134. check-reqs_pkg_setup
  135. user_setup
  136. }
  137. src_prepare() {
  138. default
  139. # remove tests that need root access
  140. rm src/test/cli/ceph-authtool/cap*.t
  141. append-flags -fPIC
  142. eautoreconf
  143. }
  144. src_configure() {
  145. local myeconfargs=(
  146. --without-hadoop
  147. --includedir=/usr/include
  148. $(use_with cephfs)
  149. $(use_with debug)
  150. $(use_with fuse)
  151. $(use_with libaio)
  152. $(use_with libatomic libatomic-ops)
  153. $(use_with nss)
  154. $(use_with cryptopp)
  155. $(use_with radosgw)
  156. $(use_with gtk gtk2)
  157. $(use_enable static-libs static)
  158. $(use_with jemalloc)
  159. $(use_with xfs libxfs)
  160. $(use_with zfs libzfs)
  161. $(use_with lttng )
  162. $(use_with babeltrace)
  163. $(use_with ldap openldap)
  164. $(use jemalloc || usex tcmalloc " --with-tcmalloc" " --with-tcmalloc-minimal")
  165. --with-mon
  166. --with-eventfd
  167. --with-cython
  168. --without-kinetic
  169. --without-librocksdb
  170. --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
  171. )
  172. # we can only use python2.7 for building at the moment
  173. python_export python2.7 PYTHON EPYTHON
  174. econf "${myeconfargs[@]}"
  175. }
  176. src_compile() {
  177. emake
  178. emake_python_bindings all
  179. use test && emake check-local
  180. }
  181. src_test() {
  182. make check || die "make check failed"
  183. }
  184. src_install() {
  185. default
  186. emake_python_bindings install-exec "DESTDIR=\"${D}\""
  187. prune_libtool_files --all
  188. exeinto /usr/$(get_libdir)/ceph
  189. newexe src/init-ceph ceph_init.sh
  190. insinto /etc/logrotate.d/
  191. newins "${FILESDIR}"/ceph.logrotate ${PN}
  192. keepdir /var/lib/${PN}{,/tmp} /var/log/${PN}/stat
  193. fowners ceph:ceph /var/lib/ceph
  194. newinitd "${FILESDIR}/rbdmap.initd" rbdmap
  195. newinitd "${FILESDIR}/${PN}.initd-r2" ${PN}
  196. newconfd "${FILESDIR}/${PN}.confd-r1" ${PN}
  197. systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" "ceph-mds@.service"
  198. systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" "ceph-osd@.service"
  199. systemd_install_serviced "${FILESDIR}/ceph-mon_at.service.conf" "ceph-mon@.service"
  200. python_fix_shebang "${ED}"/usr/{,s}bin/
  201. udev_dorules udev/*.rules
  202. readme.gentoo_create_doc
  203. }
  204. pkg_postinst() {
  205. readme.gentoo_print_elog
  206. }