commit:     361fb48dfdefd0b5442dd36e1b3d9a2cb47f8b07
Author:     Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 11 01:21:06 2016 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Mon Jul 11 01:21:47 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=361fb48d

sys-cluster/ceph: restore 0.94.x (hammer)

we decided to keep at least two LTS versions
also, allow user upgrade from old versions (sidely)

Gentoo-Bug: 587568

Package-Manager: portage-2.3.0_rc1

 sys-cluster/ceph/Manifest                          |   1 +
 sys-cluster/ceph/ceph-0.94.7.ebuild                | 177 +++++++++++++++++++++
 .../ceph/files/ceph-0.94.7-monitor-security.patch  | 109 +++++++++++++
 3 files changed, 287 insertions(+)

diff --git a/sys-cluster/ceph/Manifest b/sys-cluster/ceph/Manifest
index 5317942..1a120d4 100644
--- a/sys-cluster/ceph/Manifest
+++ b/sys-cluster/ceph/Manifest
@@ -1,2 +1,3 @@
+DIST ceph-0.94.7.tar.gz 9164375 SHA256 
aafe6cbab2f5db11376e5696a58d0711a90e93094a04eafe8d4d0910c8694d66 SHA512 
e27631dceb01d59fab5fab22eaf7a8d0cbb474b44834a3b62bff4562e32723711431ee3ae66e2de26368b3b0e8f3619282a91c6934b88e722fcdfe6215bf8e68
 WHIRLPOOL 
b2c0f5d26a1ffdfede29ec35cba6bf3c630cfcf0ea8d42542bcfc8ee36294d611c5316ff85e4ade9c8e1e66ad020cf5402bddcfa9557b29969ae6bb9a3870b60
 DIST ceph-10.2.2.tar.gz 11541035 SHA256 
7adaaeffb5a787108b5e1494df9165b6420069c0ab710e6e4aad185f423b0f6d SHA512 
b47138528af3078646b52e9ea9a561eca4120473e7584c9076e949f0e9bbbdd15aa88e2287a90bd1ddb09d06c29c40181c18da58f5126a442101169ef3419b8a
 WHIRLPOOL 
f744444f2064832cba46065bd0fe64996c92bf8ed7888c075dffa9efe1d84393bd2204b38cefe11d0804ea862d0f2ff2d114ea205ff163d60e061e2e4a01db15
 DIST ceph-9.2.1.tar.gz 9933444 SHA256 
1918dfc3df80df5986c5b7ff6bc6c78064eef0f6c5e8269dba30e08c703a7c2f SHA512 
1e84c1e2d64f4156a523658ed11552b045f75986922b7b7dbaf4719e73a0a6aadc71eb2b94ae363526f729534a592921a437468a41a3cea88c1b84e09de8505a
 WHIRLPOOL 
3a0eb6712e5b0235707e86129e1d66f1184f50cd4980c30f6d8cc0e7dfd96d30b91177ed16dd7abf2ad4983c6a543eb91915f74f661f7d3e3c810b5b1d656aca

diff --git a/sys-cluster/ceph/ceph-0.94.7.ebuild 
b/sys-cluster/ceph/ceph-0.94.7.ebuild
new file mode 100644
index 0000000..eb31594
--- /dev/null
+++ b/sys-cluster/ceph/ceph-0.94.7.ebuild
@@ -0,0 +1,177 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+
+if [[ $PV = *9999* ]]; then
+       scm_eclass=git-r3
+       EGIT_REPO_URI="
+               git://github.com/ceph/ceph.git
+               https://github.com/ceph/ceph.git";
+       SRC_URI=""
+else
+       [[ -n ${UPSTREAM_VER} ]] && \
+               
UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P}-upstream-patches-${UPSTREAM_VER}.tar.xz";
+
+       SRC_URI="http://ceph.com/download/${P}.tar.gz
+               ${UPSTREAM_PATCHSET_URI}"
+fi
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+
+inherit check-reqs autotools eutils multilib python-single-r1 udev 
readme.gentoo-r1 systemd ${scm_eclass}
+
+DESCRIPTION="Ceph distributed filesystem"
+HOMEPAGE="http://ceph.com/";
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="babeltrace cryptopp debug fuse gtk libatomic +libaio lttng +nss radosgw 
static-libs jemalloc python tcmalloc xfs zfs"
+
+COMMON_DEPEND="
+       app-arch/snappy
+       dev-libs/boost:=[threads]
+       dev-libs/fcgi
+       dev-libs/libaio
+       dev-libs/libedit
+       dev-libs/leveldb[snappy]
+       nss? ( dev-libs/nss )
+       cryptopp? ( dev-libs/crypto++ )
+       sys-apps/keyutils
+       sys-apps/util-linux
+       dev-libs/libxml2
+       babeltrace? ( dev-util/babeltrace )
+       fuse? ( sys-fs/fuse )
+       libatomic? ( dev-libs/libatomic_ops )
+       xfs? ( sys-fs/xfsprogs )
+       zfs? ( sys-fs/zfs )
+       gtk? (
+               x11-libs/gtk+:2
+               dev-cpp/gtkmm:2.4
+               gnome-base/librsvg
+       )
+       radosgw? (
+               dev-libs/fcgi
+               dev-libs/expat
+               net-misc/curl
+       )
+       jemalloc? ( dev-libs/jemalloc )
+       !jemalloc? ( dev-util/google-perftools )
+       lttng? ( dev-util/lttng-ust )
+       ${PYTHON_DEPS}
+       "
+DEPEND="${COMMON_DEPEND}
+       virtual/pkgconfig"
+RDEPEND="${COMMON_DEPEND}
+       sys-apps/hdparm
+       dev-python/flask[${PYTHON_USEDEP}]
+       dev-python/requests[${PYTHON_USEDEP}]
+       "
+REQUIRED_USE="
+       ${PYTHON_REQUIRED_USE}
+       ^^ ( nss cryptopp )
+       ?? ( jemalloc tcmalloc )
+       "
+
+STRIP_MASK="/usr/lib*/rados-classes/*"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.79-libzfs.patch
+       "${FILESDIR}"/${P}-monitor-security.patch
+)
+CHECKREQS_DISK_BUILD="1400M"
+
+pkg_setup() {
+       python_setup
+}
+
+src_prepare() {
+       # Upstream's patchset
+       if [[ -n ${UPSTREAM_VER} ]]; then
+               einfo "Try to apply Ceph Upstream patch set"
+               EPATCH_SUFFIX="patch" \
+               EPATCH_FORCE="yes" \
+               EPATCH_OPTS="-p1" \
+                       epatch "${WORKDIR}"/patches-upstream
+       fi
+
+       [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
+
+       epatch_user
+       eautoreconf
+}
+
+src_configure() {
+       local myeconfargs=(
+               --without-hadoop
+               --docdir="${EPREFIX}/usr/share/doc/${PF}"
+               --includedir=/usr/include
+               $(use_with debug)
+               $(use_with fuse)
+               $(use_with libaio)
+               $(use_with libatomic libatomic-ops)
+               $(use_with nss)
+               $(use_with cryptopp)
+               $(use_with radosgw)
+               $(use_with gtk gtk2)
+               $(use_enable static-libs static)
+               $(use_with jemalloc)
+               $(use_with xfs libxfs)
+               $(use_with zfs libzfs)
+               $(use_with lttng )
+               $(use_with babeltrace)
+               --without-kinetic
+               --without-librocksdb
+       )
+
+       use jemalloc || \
+               myeconfargs+=( $(usex tcmalloc " --with-tcmalloc" " 
--with-tcmalloc-minimal") )
+
+       PYTHON="${EPYTHON}" \
+               econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       prune_libtool_files --all
+
+       exeinto /usr/$(get_libdir)/ceph
+       newexe src/init-ceph ceph_init.sh
+
+       insinto /etc/logrotate.d/
+       newins "${FILESDIR}"/ceph.logrotate ${PN}
+
+       chmod 644 "${ED}"/usr/share/doc/${PF}/sample.*
+
+       keepdir /var/lib/${PN}
+       keepdir /var/lib/${PN}/tmp
+       keepdir /var/log/${PN}/stat
+
+       newinitd "${FILESDIR}/rbdmap.initd" rbdmap
+       newinitd "${FILESDIR}/${PN}.initd-r1.1" ${PN}
+       newconfd "${FILESDIR}/${PN}.confd-r1" ${PN}
+
+       systemd_dounit           "${FILESDIR}/ceph.target"
+       systemd_newunit          "${FILESDIR}/ceph-mds_at.service"      
"[email protected]"
+       systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" 
"[email protected]"
+       systemd_newunit          "${FILESDIR}/ceph-osd_at.service"      
"[email protected]"
+       systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" 
"[email protected]"
+       systemd_newunit          "${FILESDIR}/ceph-mon_at.service"      
"[email protected]"
+       systemd_install_serviced "${FILESDIR}/ceph-mon_at.service.conf" 
"[email protected]"
+
+       python_fix_shebang \
+               "${ED}"/usr/sbin/{ceph-disk,ceph-create-keys} \
+               "${ED}"/usr/bin/{ceph,ceph-rest-api}
+
+       #install udev rules
+       udev_dorules udev/50-rbd.rules
+       udev_dorules udev/95-ceph-osd.rules
+
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+}

diff --git a/sys-cluster/ceph/files/ceph-0.94.7-monitor-security.patch 
b/sys-cluster/ceph/files/ceph-0.94.7-monitor-security.patch
new file mode 100644
index 0000000..b225a6f
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-0.94.7-monitor-security.patch
@@ -0,0 +1,109 @@
+From b78a1be835706e7dabc505be343945d0ac05697d Mon Sep 17 00:00:00 2001
+From: Kefu Chai <[email protected]>
+Date: Thu, 30 Jun 2016 13:24:22 +0800
+Subject: [PATCH] mon: Monitor: validate prefix on handle_command()
+
+Fixes: http://tracker.ceph.com/issues/16297
+
+Signed-off-by: You Ji <[email protected]>
+(cherry picked from commit 7cb3434fed03a5497abfd00bcec7276b70df0654)
+
+Conflicts:
+    src/mon/Monitor.cc (the signature of Monitor::reply_command()
+                        changed a little bit in master, so adapt the
+                        commit to work with the old method)
+---
+ src/mon/Monitor.cc       | 23 ++++++++++++++++++++++-
+ src/test/librados/cmd.cc | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 57 insertions(+), 1 deletion(-)
+
+diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
+index 48563ad..d499f0c 100644
+--- a/src/mon/Monitor.cc
++++ b/src/mon/Monitor.cc
+@@ -2565,7 +2565,19 @@ void Monitor::handle_command(MMonCommand *m)
+     return;
+   }
+ 
+-  cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
++  // check return value. If no prefix parameter provided,
++  // return value will be false, then return error info.
++  if(!cmd_getval(g_ceph_context, cmdmap, "prefix", prefix)) {
++    reply_command(m, -EINVAL, "command prefix not found", 0);
++    return;
++  }
++
++  // check prefix is empty
++  if (prefix.empty()) {
++    reply_command(m, -EINVAL, "command prefix must not be empty", 0);
++    return;
++  }
++
+   if (prefix == "get_command_descriptions") {
+     bufferlist rdata;
+     Formatter *f = Formatter::create("json");
+@@ -2586,6 +2598,15 @@ void Monitor::handle_command(MMonCommand *m)
+   boost::scoped_ptr<Formatter> f(Formatter::create(format));
+ 
+   get_str_vec(prefix, fullcmd);
++
++  // make sure fullcmd is not empty.
++  // invalid prefix will cause empty vector fullcmd.
++  // such as, prefix=";,,;"
++  if (fullcmd.empty()) {
++    reply_command(m, -EINVAL, "command requires a prefix to be valid", 0);
++    return;
++  }
++
+   module = fullcmd[0];
+ 
+   // validate command is in leader map
+diff --git a/src/test/librados/cmd.cc b/src/test/librados/cmd.cc
+index 4f327a0..0a7ed16 100644
+--- a/src/test/librados/cmd.cc
++++ b/src/test/librados/cmd.cc
+@@ -49,6 +49,41 @@ TEST(LibRadosCmd, MonDescribe) {
+   rados_buffer_free(buf);
+   rados_buffer_free(st);
+ 
++  cmd[0] = (char *)"";
++  ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "{}", 
2, &buf, &buflen, &st, &stlen));
++  rados_buffer_free(buf);
++  rados_buffer_free(st);
++
++  cmd[0] = (char *)"{}";
++  ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, 
&buf, &buflen, &st, &stlen));
++  rados_buffer_free(buf);
++  rados_buffer_free(st);
++
++  cmd[0] = (char *)"{\"abc\":\"something\"}";
++  ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, 
&buf, &buflen, &st, &stlen));
++  rados_buffer_free(buf);
++  rados_buffer_free(st);
++
++  cmd[0] = (char *)"{\"prefix\":\"\"}";
++  ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, 
&buf, &buflen, &st, &stlen));
++  rados_buffer_free(buf);
++  rados_buffer_free(st);
++
++  cmd[0] = (char *)"{\"prefix\":\"    \"}";
++  ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, 
&buf, &buflen, &st, &stlen));
++  rados_buffer_free(buf);
++  rados_buffer_free(st);
++
++  cmd[0] = (char *)"{\"prefix\":\";;;,,,;;,,\"}";
++  ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, 
&buf, &buflen, &st, &stlen));
++  rados_buffer_free(buf);
++  rados_buffer_free(st);
++
++  cmd[0] = (char *)"{\"prefix\":\"extra command\"}";
++  ASSERT_EQ(-EINVAL, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, 
&buf, &buflen, &st, &stlen));
++  rados_buffer_free(buf);
++  rados_buffer_free(st);
++
+   cmd[0] = (char *)"{\"prefix\":\"mon_status\"}";
+   ASSERT_EQ(0, rados_mon_command(cluster, (const char **)cmd, 1, "", 0, &buf, 
&buflen, &st, &stlen));
+   ASSERT_LT(0u, buflen);
+-- 
+2.9.0
+

Reply via email to