dev-db/mongodb: improve ebuild
authorTomas Mozes <hydrapolic@gmail.com>
Wed, 14 Feb 2018 15:30:02 +0000 (16:30 +0100)
committerUltrabug <ultrabug@gentoo.org>
Thu, 15 Feb 2018 15:01:49 +0000 (16:01 +0100)
Package-Manager: Portage-2.3.24, Repoman-2.3.6
Closes: https://github.com/gentoo/gentoo/pull/7184

dev-db/mongodb/mongodb-3.4.13.ebuild

index f13cbc11f44904d3d6045c0ea7e50e71ddbefab5..3869755fe9f4bbfe95c56d3c08f1e355d2199283 100644 (file)
@@ -10,12 +10,12 @@ CHECKREQS_DISK_BUILD="2400M"
 CHECKREQS_DISK_USR="512M"
 CHECKREQS_MEMORY="1024M"
 
-inherit eutils flag-o-matic multilib multiprocessing pax-utils python-any-r1 scons-utils systemd toolchain-funcs user versionator check-reqs
+inherit check-reqs eutils flag-o-matic multilib multiprocessing pax-utils python-single-r1 scons-utils systemd toolchain-funcs user versionator
 
 MY_P=${PN}-src-r${PV/_rc/-rc}
 
 DESCRIPTION="A high-performance, open source, schema-free document-oriented database"
-HOMEPAGE="http://www.mongodb.org"
+HOMEPAGE="https://www.mongodb.com"
 SRC_URI="https://fastdl.mongodb.org/src/${MY_P}.tar.gz"
 
 LICENSE="AGPL-3 Apache-2.0"
@@ -36,16 +36,15 @@ RDEPEND=">=app-arch/snappy-1.1.3
                libressl? ( dev-libs/libressl:0= )
        )"
 DEPEND="${RDEPEND}
-       =dev-lang/python-2*
+       ${PYTHON_DEPS}
        <dev-util/scons-3
-       >=sys-devel/gcc-5.3.0:*
        sys-libs/ncurses
        sys-libs/readline
        debug? ( dev-util/valgrind )
        kerberos? ( dev-libs/cyrus-sasl[kerberos] )
        test? (
-               dev-python/pymongo
-               dev-python/pyyaml
+               dev-python/pymongo[${PYTHON_USEDEP}]
+               dev-python/pyyaml[${PYTHON_USEDEP}]
        )"
 PDEPEND="tools? ( >=app-admin/mongo-tools-${PV} )"
 
@@ -58,8 +57,8 @@ PATCHES=(
 S=${WORKDIR}/${MY_P}
 
 pkg_pretend() {
-       if [[ ${REPLACING_VERSIONS} < 3.0 ]]; then
-               ewarn "To upgrade from a version earlier than the 3.0-series, you must"
+       if [[ -n ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 3.2 ]]; then
+               ewarn "To upgrade from a version earlier than the 3.2-series, you must"
                ewarn "successively upgrade major releases until you have upgraded"
                ewarn "to 3.2-series. Then upgrade to 3.4 series."
        fi
@@ -69,10 +68,20 @@ pkg_setup() {
        enewgroup mongodb
        enewuser mongodb -1 -1 /var/lib/${PN} mongodb
 
-       # Maintainer notes
-       #
+       python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       # remove bundled libs
+       rm -rv src/third_party/{boost-*,pcre-*,scons-*,snappy-*,yaml-cpp-*,zlib-*} || die
+}
+
+src_configure() {
+       # https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
+       # --use-system-icu fails tests
        # --use-system-tcmalloc is strongly NOT recommended:
-       # https://www.mongodb.org/about/contributors/tutorial/build-mongodb-from-source/
 
        scons_opts=(
                CC="$(tc-getCC)"
@@ -87,38 +96,32 @@ pkg_setup() {
                --use-system-zlib
        )
 
-       if use debug; then
-               scons_opts+=( --dbg=on )
-       fi
-
-       if use prefix; then
-               scons_opts+=(
-                       --cpppath="${EPREFIX}/usr/include"
-                       --libpath="${EPREFIX}/usr/$(get_libdir)"
-               )
-       fi
-
-       if use kerberos; then
-               scons_opts+=( --use-sasl-client )
-       fi
+       use debug && scons_opts+=( --dbg=on )
+       use kerberos && scons_opts+=( --use-sasl-client )
+       use ssl && scons_opts+=( --ssl )
 
-       if use ssl; then
-               scons_opts+=( --ssl )
-       fi
-
-       python-any-r1_pkg_setup
-}
-
-src_compile() {
        # respect mongoDB upstream's basic recommendations
        # see bug #536688 and #526114
        if ! use debug; then
                filter-flags '-m*'
                filter-flags '-O?'
        fi
+
+       default
+}
+
+src_compile() {
        escons "${scons_opts[@]}" core tools
 }
 
+# FEATURES="test -usersandbox" emerge dev-db/mongodb
+src_test() {
+       # this one test fails
+       rm jstests/core/jsHeapLimit.js || die
+
+       "${EPYTHON}" ./buildscripts/resmoke.py --dbpathPrefix=test --suites core --jobs=$(makeopts_jobs) || die "Tests failed"
+}
+
 src_install() {
        escons "${scons_opts[@]}" --nostrip install --prefix="${ED}"/usr
 
@@ -157,37 +160,8 @@ pkg_preinst() {
        fi
 }
 
-# FEATURES="test -usersandbox" emerge dev-db/mongodb
-src_test() {
-       # this one test fails
-       rm jstests/core/jsHeapLimit.js || die
-
-       "${EPYTHON}" ./buildscripts/resmoke.py --dbpathPrefix=test --suites core --jobs=$(makeopts_jobs) || die "Tests failed"
-}
-
 pkg_postinst() {
-       local v
-       for v in ${REPLACING_VERSIONS}; do
-               if ! version_is_at_least 3.0 ${v}; then
-                       ewarn "!! IMPORTANT !!"
-                       ewarn " "
-                       ewarn "${PN} configuration files have changed !"
-                       ewarn " "
-                       ewarn "Make sure you migrate from /etc/conf.d/${PN} to the new YAML standard in /etc/${PN}.conf"
-                       ewarn "  http://docs.mongodb.org/manual/reference/configuration-options/"
-                       ewarn " "
-                       ewarn "Make sure you also follow the upgrading process :"
-                       ewarn "  http://docs.mongodb.org/master/release-notes/3.0-upgrade/"
-                       ewarn " "
-                       ewarn "MongoDB 3.0 introduces the WiredTiger storage engine."
-                       ewarn "WiredTiger is incompatible with MMAPv1 and you need to dump/reload your data if you want to use it."
-                       ewarn "Once you have your data dumped, you need to set storage.engine: wiredTiger in /etc/${PN}.conf"
-                       ewarn "  http://docs.mongodb.org/master/release-notes/3.0-upgrade/#change-storage-engine-to-wiredtiger"
-                       break
-               fi
-       done
-
        ewarn "Make sure to read the release notes and follow the upgrade process:"
-       ewarn "  https://docs.mongodb.org/manual/release-notes/3.4/"
-       ewarn "  https://docs.mongodb.com/manual/release-notes/3.4/#upgrade-procedures"
+       ewarn "  https://docs.mongodb.com/manual/release-notes/$(get_version_component_range 1-2)/"
+       ewarn "  https://docs.mongodb.com/manual/release-notes/$(get_version_component_range 1-2)/#upgrade-procedures"
 }