From 28e3d252dc8ac8a5635206dfefe1cfe05058d1db Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 12 Aug 2018 06:32:46 +0100 Subject: gentoo resync : 12.08.2018 --- dev-db/Manifest.gz | Bin 20646 -> 20644 bytes dev-db/couchdb/Manifest | 2 - dev-db/couchdb/couchdb-1.7.1.ebuild | 77 -- dev-db/mariadb/Manifest | 27 +- dev-db/mariadb/mariadb-10.0.35-r2.ebuild | 8 +- dev-db/mariadb/mariadb-10.0.35.ebuild | 210 ------ dev-db/mariadb/mariadb-10.0.36.ebuild | 848 +++++++++++++++++++++ dev-db/mariadb/mariadb-10.1.34.ebuild | 8 +- dev-db/mariadb/mariadb-10.1.35.ebuild | 887 ++++++++++++++++++++++ dev-db/mariadb/mariadb-10.2.15.ebuild | 1011 ------------------------- dev-db/mariadb/mariadb-10.2.16.ebuild | 8 +- dev-db/mariadb/mariadb-10.3.6_rc.ebuild | 1022 -------------------------- dev-db/mariadb/mariadb-10.3.8.ebuild | 8 +- dev-db/mariadb/mariadb-5.5.60.ebuild | 124 ---- dev-db/mariadb/mariadb-5.5.61.ebuild | 831 +++++++++++++++++++++ dev-db/mariadb/metadata.xml | 4 - dev-db/mongodb/Manifest | 4 +- dev-db/mongodb/metadata.xml | 8 - dev-db/mongodb/mongodb-4.0.1.ebuild | 164 +++++ dev-db/postgresql/Manifest | 16 +- dev-db/postgresql/metadata.xml | 3 + dev-db/postgresql/postgresql-10.5.ebuild | 460 ++++++++++++ dev-db/postgresql/postgresql-11_beta3.ebuild | 452 ++++++++++++ dev-db/postgresql/postgresql-9.3.24.ebuild | 450 ++++++++++++ dev-db/postgresql/postgresql-9.4.19.ebuild | 482 ++++++++++++ dev-db/postgresql/postgresql-9.5.14.ebuild | 488 ++++++++++++ dev-db/postgresql/postgresql-9.6.10.ebuild | 493 +++++++++++++ dev-db/postgresql/postgresql-9999.ebuild | 94 ++- dev-db/pspg/Manifest | 2 + dev-db/pspg/pspg-1.3.0.ebuild | 16 + 30 files changed, 5695 insertions(+), 2512 deletions(-) delete mode 100644 dev-db/couchdb/couchdb-1.7.1.ebuild delete mode 100644 dev-db/mariadb/mariadb-10.0.35.ebuild create mode 100644 dev-db/mariadb/mariadb-10.0.36.ebuild create mode 100644 dev-db/mariadb/mariadb-10.1.35.ebuild delete mode 100644 dev-db/mariadb/mariadb-10.2.15.ebuild delete mode 100644 dev-db/mariadb/mariadb-10.3.6_rc.ebuild delete mode 100644 dev-db/mariadb/mariadb-5.5.60.ebuild create mode 100644 dev-db/mariadb/mariadb-5.5.61.ebuild create mode 100644 dev-db/mongodb/mongodb-4.0.1.ebuild create mode 100644 dev-db/postgresql/postgresql-10.5.ebuild create mode 100644 dev-db/postgresql/postgresql-11_beta3.ebuild create mode 100644 dev-db/postgresql/postgresql-9.3.24.ebuild create mode 100644 dev-db/postgresql/postgresql-9.4.19.ebuild create mode 100644 dev-db/postgresql/postgresql-9.5.14.ebuild create mode 100644 dev-db/postgresql/postgresql-9.6.10.ebuild create mode 100644 dev-db/pspg/pspg-1.3.0.ebuild (limited to 'dev-db') diff --git a/dev-db/Manifest.gz b/dev-db/Manifest.gz index f3856dbfd703..0bce49426700 100644 Binary files a/dev-db/Manifest.gz and b/dev-db/Manifest.gz differ diff --git a/dev-db/couchdb/Manifest b/dev-db/couchdb/Manifest index 90a82af5fa2c..d97b3d55f2f2 100644 --- a/dev-db/couchdb/Manifest +++ b/dev-db/couchdb/Manifest @@ -1,7 +1,5 @@ AUX couchdb.conf-2 234 BLAKE2B ced08a5fc870703da6ab1e743cb421e7f1d5e8831923dc9115e708c728b27955650e69e323567bf6ad0041eca968f6cf152e097b962d496450ac90fd3d4f6d38 SHA512 5c40927957362a7431be6980be3a239e4ee0ca47d28f1b4d4fb3014b307e459eb429f5b50e0c8aa58b3e9f2285371616a58f06207e272feae1bed33f8c32d836 AUX couchdb.init-4 439 BLAKE2B 4b334d42238616a1bfef41f915e7e42038457b6e52b713af698aa625dcf8364008d2e0763b1b5c90bd01121778447a86646730836bacc4cafe3477bec99b77f7 SHA512 a1e0a9403082e1c336454584d78d15e5d76861b3b3d0e56fcfb25ab50c0dbbdcf658e251e25f22e2a58dc72f38ec16ce82759bf9c7b5330a569ffb5fab912999 -DIST apache-couchdb-1.7.1.tar.gz 9963069 BLAKE2B 69a3f835f6a7b5752e4707b02edfa726cfdb76813e36e570566641b999eea556ff788b0ca8ce1e66beb819119d90e387beab3bba8618e3b7a606870794307fef SHA512 cd7417ef4b1eaeb1fe4251b559d904238fd25881c542f1498e6e9f1c4a55a79e34e06e711f90ce39e5e65fcac8be9c611943b8ed57d4a7465859b5811ac0a21f DIST apache-couchdb-1.7.2.tar.gz 10009424 BLAKE2B 3d3b4922fe5b2c55e4851e48993442ba23369753fb17d5cafba936947624af0d3dac70e0a23d0c22c79e7e2776a3a441d5b1020a4a420b7d9a621fb59aad48d9 SHA512 507a35a7f1e826b1562eec86146cc6fcff3c65fa7762f9742e6e8fdacfca735473105772757624183778f7a532c742f6644b301677607bb81c1f3f0ceb742867 -EBUILD couchdb-1.7.1.ebuild 1833 BLAKE2B 40ee843a46d254f64cf4b7de9927db335f2c928f8ceca249b8cdfc3e45dc5051a28da81a8bbd286f9a0e45ece27b0a21872067f59c5fff50ecf9792fec795b83 SHA512 48561428b5da0cf6afc118c782e9d627dc82208e7bc9825cdf186e51c746d0bca6040dac52586b56d42f4ecb01d08fb7b12c431641a23de47cd814a2648372f0 EBUILD couchdb-1.7.2.ebuild 1833 BLAKE2B 7f7e685bf752daf2b0a968543956b8b3debf293e01441c9e812f9740407b6df6d324f75c146f0eec8be39dc423f37991cd4b69b68cf0a3e2c7688c93dd00799e SHA512 cb0ce76bdef08e39fa286486da0b0787ef9d5c0c894aa31eb750875de5f5562c19a4ecc8216c67c5c7cb87ccee6f9ce53bc33b3acdf8e41bcc9d8c1827616b1c MISC metadata.xml 168 BLAKE2B 28995e217ebfd4a11f4738455bcd495fccb2214a7e4f48a820d2057a7d29a1d510707f94d15bff49abf69d68fdecd658381f34692181502eb587de9f2c7e0f9e SHA512 9f2101e330a89b03cbbc1814dcf7ad75f3dd4117abeeed5047cb695f81cd8f0719d3285b39acfb93f3ea1ba1b98911cc452b5d332d266b84a19791190ca123b6 diff --git a/dev-db/couchdb/couchdb-1.7.1.ebuild b/dev-db/couchdb/couchdb-1.7.1.ebuild deleted file mode 100644 index a86f1de84856..000000000000 --- a/dev-db/couchdb/couchdb-1.7.1.ebuild +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=5 - -inherit autotools eutils multilib pax-utils user - -DESCRIPTION="Distributed, fault-tolerant and schema-free document-oriented database" -HOMEPAGE="https://couchdb.apache.org/" -SRC_URI="mirror://apache/couchdb/source/${PV}/apache-${P}.tar.gz" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="amd64 ppc x86" -IUSE="libressl selinux test" - -RDEPEND=">=dev-libs/icu-4.3.1:= - =dev-libs/openssl-0.9.8j:0 ) - libressl? ( dev-libs/libressl ) - >=net-misc/curl-7.18.2 - "${S%/}/plugin/${1}/CMakeLists.txt" || die } - java-pkg-opt-2_src_prepare if use tcmalloc; then echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die fi @@ -249,6 +248,7 @@ src_prepare() { fi cmake-utils_src_prepare + java-pkg-opt-2_src_prepare } src_configure(){ @@ -458,6 +458,10 @@ src_install() { for script in "${S%/}"/scripts/mysql* ; do [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" fi #Remove mytop if perl is not selected diff --git a/dev-db/mariadb/mariadb-10.0.35.ebuild b/dev-db/mariadb/mariadb-10.0.35.ebuild deleted file mode 100644 index e4d1ee85dcfc..000000000000 --- a/dev-db/mariadb/mariadb-10.0.35.ebuild +++ /dev/null @@ -1,210 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI="6" -MY_EXTRAS_VER="20170926-1321Z" -SUBSLOT="18" -MYSQL_PV_MAJOR="5.6" - -JAVA_PKG_OPT_USE="jdbc" - -inherit toolchain-funcs java-pkg-opt-2 mysql-multilib-r1 - -HOMEPAGE="https://mariadb.org/" -DESCRIPTION="An enhanced, drop-in replacement for MySQL" - -IUSE="bindist jdbc odbc oqgraph pam sphinx tokudb xml" -RESTRICT="!bindist? ( bindist )" - -REQUIRED_USE="jdbc? ( extraengine server !static ) server? ( tokudb? ( jemalloc !tcmalloc ) ) static? ( !pam )" - -# REMEMBER: also update eclass/mysql*.eclass before committing! -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" - -MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" -PATCHES=( - "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch" - "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-10.0.33.patch" - "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch" - "${MY_PATCH_DIR}/20018_all_mariadb-10.0.20-without-clientlibs-tools.patch" -) -COMMON_DEPEND=" - !bindist? ( >=sys-libs/readline-4.1:0= ) - server? ( - extraengine? ( - odbc? ( dev-db/unixODBC:0= ) - xml? ( dev-libs/libxml2:2= ) - sys-libs/zlib[minizip] - ) - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) - pam? ( virtual/pam:0= ) - tokudb? ( app-arch/snappy ) - ) - >=dev-libs/libpcre-8.41-r1:3=[${MULTILIB_USEDEP}] - openssl? ( !>=dev-libs/openssl-1.1 ) -" -DEPEND="|| ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) - ${COMMON_DEPEND}" -RDEPEND="${RDEPEND} ${COMMON_DEPEND} - perl? ( !dev-db/mytop - virtual/perl-Getopt-Long - dev-perl/TermReadKey - virtual/perl-Term-ANSIColor - virtual/perl-Time-HiRes ) - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) -" -MULTILIB_WRAPPED_HEADERS+=( /usr/include/mysql/mysql_version.h - /usr/include/mysql/private/probes_mysql_nodtrace.h - /usr/include/mysql/private/probes_mysql_dtrace.h ) - -pkg_setup() { - java-pkg-opt-2_pkg_setup - mysql-multilib-r1_pkg_setup -} - -pkg_preinst() { - java-pkg-opt-2_pkg_preinst - mysql-multilib-r1_pkg_preinst -} - -src_prepare() { - java-pkg-opt-2_src_prepare - mysql-multilib-r1_src_prepare -} - -src_configure(){ - # bug 508724 mariadb cannot use ld.gold - tc-ld-disable-gold - local MYSQL_CMAKE_NATIVE_DEFINES=( - -DWITH_JEMALLOC=$(usex jemalloc system) - -DWITH_PCRE=system - ) - if use server ; then - # Federated{,X} must be treated special otherwise they will not be built as plugins - if ! use extraengine ; then - MYSQL_CMAKE_NATIVE_DEFINES+=( - -DWITHOUT_FEDERATED=1 - -DWITHOUT_FEDERATEDX=1 ) - fi - - # Connect with Zip is currently broken and does not compile - # Reported upstream https://jira.mariadb.org/browse/MDEV-11809 - - MYSQL_CMAKE_NATIVE_DEFINES+=( - $(mysql-cmake_use_plugin oqgraph OQGRAPH) - $(mysql-cmake_use_plugin sphinx SPHINX) - $(mysql-cmake_use_plugin tokudb TOKUDB) - $(mysql-cmake_use_plugin pam AUTH_PAM) - $(mysql-cmake_use_plugin extraengine SEQUENCE) - $(mysql-cmake_use_plugin extraengine SPIDER) - $(mysql-cmake_use_plugin extraengine CONNECT) - -DCONNECT_WITH_LIBXML2=$(usex xml) - -DCONNECT_WITH_ODBC=$(usex odbc) - -DCONNECT_WITH_JDBC=$(usex jdbc) - -DWITHOUT_MROONGA=1 - ) - fi - mysql-multilib-r1_src_configure -} - -# Official test instructions: -# USE='extraengine perl server openssl static-libs' \ -# FEATURES='test userpriv -usersandbox' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -multilib_src_test() { - - if ! multilib_is_native_abi ; then - einfo "Server tests not available on non-native abi". - return 0; - fi - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - if use server ; then - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ $UID -eq 0 ]]; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox" - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - addpredict /this-dir-does-not-exist/t9.MYI - - # Run CTest (test-units) - cmake-utils_src_test - retstatus_unit=$? - [[ $retstatus_unit -eq 0 ]] || eerror "test-unit failed" - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - # Enable parallel testing, auto will try to detect number of cores - # You may set this by hand. - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased - export MTR_PARALLEL="${MTR_PARALLEL:-auto}" - - # create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} - - # These are failing in MariaDB 10.0 for now and are believed to be - # false positives: - # - # main.information_schema, binlog.binlog_statement_insert_delayed, - # main.mysqld--help, funcs_1.is_triggers, funcs_1.is_tables_mysql, - # funcs_1.is_columns_mysql main.bootstrap - # fails due to USE=-latin1 / utf8 default - # - # main.mysql_client_test, main.mysql_client_test_nonblock - # main.mysql_client_test_comp: - # segfaults at random under Portage only, suspect resource limits. - # - # archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam - # fails due to bad cleanup of previous tests when run in parallel - # The tool is deprecated anyway - # Bug 532288 - -#main.bootstrap \ - for t in connect.drop-open-error ; do -# main.mysql_client_test_comp \ -# binlog.binlog_statement_insert_delayed main.information_schema \ -# main.mysqld--help \ -# archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam \ -# funcs_1.is_triggers funcs_1.is_tables_mysql funcs_1.is_columns_mysql ; do - mysql-multilib-r1_disable_test "$t" "False positives in Gentoo" - done - - # Run mysql tests - pushd "${TESTDIR}" || die - - # run mysql-test tests - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder - - retstatus_tests=$? - [[ $retstatus_tests -eq 0 ]] || eerror "tests failed" - has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox" - - popd || die - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" - - else - einfo "Skipping server tests due to minimal build." - fi -} diff --git a/dev-db/mariadb/mariadb-10.0.36.ebuild b/dev-db/mariadb/mariadb-10.0.36.ebuild new file mode 100644 index 000000000000..cf27b4e51080 --- /dev/null +++ b/dev-db/mariadb/mariadb-10.0.36.ebuild @@ -0,0 +1,848 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" +MY_EXTRAS_VER="20180809-1700Z" +SUBSLOT="18" + +JAVA_PKG_OPT_USE="jdbc" + +# Keeping eutils in EAPI=6 for emktemp in pkg_config + +inherit eutils flag-o-matic prefix toolchain-funcs java-pkg-opt-2 user cmake-utils multilib-build + +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " + +# Gentoo patches to MySQL +if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then + SRC_URI="${SRC_URI} + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" +fi + +HOMEPAGE="https://mariadb.org/" +DESCRIPTION="An enhanced, drop-in replacement for MySQL" +LICENSE="GPL-2" +SLOT="0/${SUBSLOT:-0}" +IUSE="bindist client-libs debug extraengine jdbc jemalloc latin1 libressl + numa odbc oqgraph pam +perl profiling selinux +server sphinx + static static-libs systemtap tcmalloc + test tokudb xml yassl" + +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests +RESTRICT="!bindist? ( bindist ) libressl? ( test )" + +REQUIRED_USE="jdbc? ( extraengine server !static ) + server? ( tokudb? ( jemalloc !tcmalloc ) ) + ?? ( tcmalloc jemalloc ) + static? ( yassl !pam )" + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" + inherit git-r3 + EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" + EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" + EGIT_CLONE_TYPE=shallow +else + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" +fi + +PATCHES=( + "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch" + "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-10.0.33.patch" + "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch" + "${MY_PATCH_DIR}/20018_all_mariadb-10.0.20-without-clientlibs-tools.patch" +) + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +COMMON_DEPEND=" + kernel_linux? ( + sys-process/procps:0= + dev-libs/libaio:0= + ) + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + jemalloc? ( dev-libs/jemalloc:0= ) + tcmalloc? ( dev-util/google-perftools:0= ) + systemtap? ( >=dev-util/systemtap-1.3:0= ) + !yassl? ( + !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 ) + libressl? ( dev-libs/libressl:0= ) + ) + >=sys-libs/zlib-1.2.3:0= + sys-libs/ncurses:0= + !bindist? ( + >=sys-libs/readline-4.1:0= + ) + server? ( + extraengine? ( + odbc? ( dev-db/unixODBC:0= ) + xml? ( dev-libs/libxml2:2= ) + ) + numa? ( sys-process/numactl ) + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) + pam? ( virtual/pam:0= ) + tokudb? ( app-arch/snappy ) + ) + >=dev-libs/libpcre-8.41-r1:3= + !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) +" +DEPEND="virtual/yacc + static? ( sys-libs/ncurses[static-libs] ) + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) + server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) + ${COMMON_DEPEND}" +RDEPEND="selinux? ( sec-policy/selinux-mysql ) + client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster + server? ( !prefix? ( dev-db/mysql-init-scripts ) ) + ${COMMON_DEPEND} + perl? ( !dev-db/mytop + virtual/perl-Getopt-Long + dev-perl/TermReadKey + virtual/perl-Term-ANSIColor + virtual/perl-Time-HiRes ) + server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) +" +# For other stuff to bring us in +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + local GCC_MAJOR_SET=$(gcc-major-version) + local GCC_MINOR_SET=$(gcc-minor-version) + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on + # non x86{,_64} arches + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + fi + java-pkg-opt-2_pkg_setup + if has test ${FEATURES} && \ + use server && ! has userpriv ${FEATURES} ; then + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + + # This should come after all of the die statements + enewgroup mysql 60 || die "problem adding 'mysql' group" + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" +} + +pkg_preinst() { + java-pkg-opt-2_pkg_preinst +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" + + if use server ; then + if use pam; then + einfo + elog "This install includes the PAM authentication plugin." + elog "To activate and configure the PAM plugin, please read:" + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" + einfo + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + elog + elog "If you are switching server implentations, you should run the" + elog "mysql_upgrade tool." + einfo + else + einfo + elog "If you are upgrading major versions, you should run the" + elog "mysql_upgrade tool." + einfo + fi + + einfo + elog "Be sure to edit the my.cnf file to activate your cluster settings." + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" + elog "The first time the cluster is activated, you should add" + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." + elog "This option should then be removed for subsequent starts." + einfo + fi +} + +src_unpack() { + unpack ${A} + # Grab the patches + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack + + mv -f "${WORKDIR%/}/${P}" "${S}" || die +} + +src_prepare() { + _disable_engine() { + echo > "${S%/}/storage/${1}/CMakeLists.txt" || die + } + + _disable_plugin() { + echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die + } + + if use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die + fi + + # Don't build bundled xz-utils for tokudb + echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die + + local plugin + local server_plugins=( handler_socket auth_socket feedback metadata_lock_info + locale_info qc_info server_audit semisync sql_errlog ) + local test_plugins=( audit_null auth_examples daemon_example fulltext ) + if ! use server; then # These plugins are for the server + for plugin in "${server_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + if ! use test; then # These plugins are only used during testing + for plugin in "${test_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + # Collides with mariadb-connector-c bug 655980 + _disable_plugin auth_dialog + + # Don't build Mroonga or example + _disable_engine mroonga + _disable_engine example + + if ! use oqgraph ; then # avoids extra library checks + _disable_engine oqgraph + fi + + cmake-utils_src_prepare + java-pkg-opt-2_src_prepare +} + +src_configure(){ + # bug 508724 mariadb cannot use ld.gold + tc-ld-disable-gold + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + append-cxxflags -felide-constructors + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + CMAKE_BUILD_TYPE="RelWithDebInfo" + + # debug hack wrt #497532 + mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" + -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql" + -DINSTALL_BINDIR=bin + -DINSTALL_DOCDIR=share/doc/${PF} + -DINSTALL_DOCREADMEDIR=share/doc/${PF} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_LIBDIR=$(get_libdir) + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mariadb + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin + -DINSTALL_SCRIPTDIR=share/mariadb/scripts + -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb" + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + -DWITH_ZLIB=system + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" + -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" + # The build forces this to be defined when cross-compiling. We pass it + # all the time for simplicity and to make sure it is actually correct. + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) + -DWITHOUT_CLIENTLIBS=YES + -DWITH_READLINE=$(usex bindist 1 0) + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) + -DENABLE_DTRACE=$(usex systemtap) + ) + if use test ; then + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) + else + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) + fi + + if ! use yassl ; then + mycmakeargs+=( -DWITH_SSL=system ) + else + mycmakeargs+=( -DWITH_SSL=bundled ) + fi + + if use server ; then + + # Federated{,X} must be treated special otherwise they will not be built as plugins + if ! use extraengine ; then + mycmakeargs+=( + -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 + -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 ) + fi + + mycmakeargs+=( + -DWITH_JEMALLOC=$(usex jemalloc system) + -DWITH_PCRE=system + -D$(usex sphinx WITH WITHOUT)_SPHINX_STORAGE_ENGINE=1 + -D$(usex tokudb WITH WITHOUT)_TOKUDB_STORAGE_ENGINE=1 + -D$(usex oqgraph WITH WITHOUT)_AUTH_PAM=1 + -D$(usex extraengine WITH WITHOUT)_SEQUENCE_STORAGE_ENGINE=1 + -D$(usex extraengine WITH WITHOUT)_SPIDER_STORAGE_ENGINE=1 + -D$(usex extraengine WITH WITHOUT)_CONNECT_STORAGE_ENGINE=1 + -DCONNECT_WITH_LIBXML2=$(usex xml) + -DCONNECT_WITH_ODBC=$(usex odbc) + -DCONNECT_WITH_JDBC=$(usex jdbc) + # Build failure and autodep wrt bug 639144 + -DCONNECT_WITH_MONGO=OFF + -DINSTALL_SQLBENCHDIR=share/mariadb + ) + + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + + elif ! use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + fi + mycmakeargs+=( + -DEXTRA_CHARSETS=all + -DDISABLE_SHARED=$(usex static YES NO) + -DWITH_EMBEDDED_SERVER=OFF + -DENABLED_PROFILING=$(usex profiling) + ) + + if use static; then + mycmakeargs+=( -DWITH_PIC=1 ) + fi + + if use jemalloc || use tcmalloc ; then + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + -DWITH_PARTITION_STORAGE_ENGINE=1 + ) + + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DEXTRA_CHARSETS=none + -DINSTALL_SQLBENCHDIR= + ) + fi + + cmake-utils_src_configure +} + +src_compile() { + cmake-utils_src_compile +} + +src_install() { + cmake-utils_src_install + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then + rm "${ED%/}/usr/include/mysql/server/private/config.h" || die + fi + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "mysqlcheck" "/usr/bin/mysqlrepair" + dosym "mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED%/}/usr/data" ]] ; then + rm -Rf "${ED%/}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf + local mycnf_src="my.cnf-5.6-r1" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR%/}/${mycnf_src}" \ + > "${TMPDIR%/}/my.cnf.ok" || die + use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok" + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR%/}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR%/}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" my.cnf + + if use server ; then + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S%/}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S%/}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" + fi + + #Remove mytop if perl is not selected + [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop" +} + +# Official test instructions: +# USE='extraengine perl server' \ +# FEATURES='test userpriv -usersandbox' \ +# ebuild mariadb-X.X.XX.ebuild \ +# digest clean package +src_test() { + + _disable_test() { + local rawtestname reason + rawtestname="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}'" + echo ${rawtestname} : ${reason} >> "${T}/disabled.def" + } + + local TESTDIR="${BUILD_DIR}/mysql-test" + local retstatus_unit + local retstatus_tests + + if ! use server ; then + einfo "Skipping server tests due to minimal build." + return 0 + fi + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ $UID -eq 0 ]]; then + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" + + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + # Run CTest (test-units) + cmake-utils_src_test + retstatus_unit=$? + + # Ensure that parallel runs don't die + export MTR_BUILD_THREAD="$((${RANDOM} % 100))" + # Enable parallel testing, auto will try to detect number of cores + # You may set this by hand. + # The default maximum is 8 unless MTR_MAX_PARALLEL is increased + export MTR_PARALLEL="${MTR_PARALLEL:-auto}" + + # create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + # Run mysql tests + pushd "${TESTDIR}" > /dev/null || die + + touch "${T}/disabled.def" + # These are failing in MariaDB 10.0 for now and are believed to be + # false positives: + # + # main.mysql_client_test, main.mysql_client_test_nonblock + # main.mysql_client_test_comp: + # segfaults at random under Portage only, suspect resource limits. + + local t + for t in main.mysql_client_test main.mysql_client_test_nonblock \ + main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam \ + rpl.rpl_semi_sync_uninstall_plugin ; do + _disable_test "$t" "False positives in Gentoo" + done + + if ! use client-libs ; then + _disable_test main.plugin_auth "Needs client libraries built" + fi + + # run mysql-test tests + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" + retstatus_tests=$? + + popd > /dev/null || die + + # Cleanup is important for these testcases. + pkill -9 -f "${S}/ndb" 2>/dev/null + pkill -9 -f "${S}/sql" 2>/dev/null + + local failures="" + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" + + [[ -z "$failures" ]] || die "Test failures: $failures" + einfo "Tests successfully completed" +} + +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1` + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_config() { + _getoptval() { + local mypd="${EROOT}"/usr/bin/my_print_defaults + local section="$1" + local flag="--${2}=" + local extra_options="${3}" + "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" + } + local old_MY_DATADIR="${MY_DATADIR}" + local old_HOME="${HOME}" + # my_print_defaults needs to read stuff in $HOME/.my.cnf + export HOME=${EPREFIX}/root + + # Make sure the vars are correctly initialized + mysql_init_vars + + [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" + if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then + die "Minimal builds do NOT include the MySQL server" + fi + + if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then + local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" + MY_DATADIR_s="${MY_DATADIR_s%%/}" + local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" + old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" + + if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" + ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" + else + elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" + mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ + || die "Moving MY_DATADIR failed" + fi + else + ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Attempting to use ${MY_DATADIR_s}" + else + eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" + die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" + fi + fi + fi + + local pwd1="a" + local pwd2="b" + local maxtry=15 + + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then + local tmp_mysqld_password_source= + + for tmp_mysqld_password_source in mysql client; do + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" + MYSQL_ROOT_PASSWORD= + continue + fi + + einfo "Found password in '${tmp_mysqld_password_source}' section!" + break + fi + done + + # Sometimes --show is required to display passwords in some implementations of my_print_defaults + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" + fi + + unset tmp_mysqld_password_source + fi + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" + # These are dir+prefix + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + + if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then + einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" + fi + if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then + einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" + fi + if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then + einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" + fi + + if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then + ewarn "You have already a MySQL database in place." + ewarn "(${ROOT}/${MY_DATADIR}/*)" + ewarn "Please rename or delete it if you wish to replace it." + die "MySQL database already exists!" + fi + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then + + einfo "Please provide a password for the mysql 'root' user now" + einfo "or through the ${HOME}/.my.cnf file." + ewarn "Avoid [\"'\\_%] characters in the password" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x$pwd1" != "x$pwd2" ]] ; then + die "Passwords are not the same" + fi + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 + fi + + local options + local sqltmp="$(emktemp)" + + # Fix bug 446200. Don't reference host my.cnf, needs to come first, + # see https://bugs.mysql.com/bug.php?id=31312 + use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" + + # Figure out which options we need to disable to do the setup + local helpfile="${TMPDIR}/mysqld-help" + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null + for opt in grant-tables host-cache name-resolve networking slave-start \ + federated ssl log-bin relay-log slow-query-log external-locking \ + log-slave-updates \ + ; do + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" + done + + einfo "Creating the mysql database and setting proper permissions on it ..." + + # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it + PID_DIR="${EROOT}/var/run/mysqld" + if [[ ! -d "${PID_DIR}" ]]; then + install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" + fi + + if [[ ! -d "${MY_DATADIR}" ]]; then + install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" + fi + + pushd "${TMPDIR}" &>/dev/null || die + + # Filling timezones, see + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null + + local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) + [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) + cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) + einfo "Command: ${cmd[*]}" + su -s /bin/sh -c "${cmd[*]}" mysql \ + >"${TMPDIR}"/mysql_install_db.log 2>&1 + if [ $? -ne 0 ]; then + grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 + die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" + fi + popd &>/dev/null || die + [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ + || die "MySQL databases not installed" + + use prefix || options="${options} --user=mysql" + + local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" + local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" + local mysqld="${EROOT}/usr/sbin/mysqld \ + ${options} \ + --log-warnings=0 \ + --basedir=${EROOT}/usr \ + --datadir=${ROOT}/${MY_DATADIR} \ + --max_allowed_packet=8M \ + --net_buffer_length=16K \ + --socket=${socket} \ + --pid-file=${pidfile} + --tmpdir=${ROOT}/${MYSQL_TMPDIR}" + #einfo "About to start mysqld: ${mysqld}" + ebegin "Starting mysqld" + einfo "Command ${mysqld}" + ${mysqld} & + rc=$? + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + eend $rc + + if ! [[ -S "${socket}" ]]; then + die "Completely failed to start up mysqld with: ${mysqld}" + fi + + ebegin "Setting root password" + # Do this from memory, as we don't want clear text passwords in temp files + local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" + "${EROOT}/usr/bin/mysql" \ + "--socket=${socket}" \ + -hlocalhost \ + -e "${sql}" + eend $? + + if [[ -n "${sqltmp}" ]] ; then + ebegin "Loading \"zoneinfo\", this step may require a few seconds" + "${EROOT}/usr/bin/mysql" \ + "--socket=${socket}" \ + -hlocalhost \ + -uroot \ + --password="${MYSQL_ROOT_PASSWORD}" \ + mysql < "${sqltmp}" + rc=$? + eend $? + [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" + fi + + # Stop the server and cleanup + einfo "Stopping the server ..." + kill $(< "${pidfile}" ) + rm -f "${sqltmp}" + wait %1 + einfo "Done" +} diff --git a/dev-db/mariadb/mariadb-10.1.34.ebuild b/dev-db/mariadb/mariadb-10.1.34.ebuild index 214896029dfe..036920e712cc 100644 --- a/dev-db/mariadb/mariadb-10.1.34.ebuild +++ b/dev-db/mariadb/mariadb-10.1.34.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 EAPI="6" -MY_EXTRAS_VER="20180621-0218Z" +MY_EXTRAS_VER="20180809-1700Z" SUBSLOT="18" JAVA_PKG_OPT_USE="jdbc" @@ -234,7 +234,6 @@ src_prepare() { echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die } - java-pkg-opt-2_src_prepare if use tcmalloc; then echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die fi @@ -269,6 +268,7 @@ src_prepare() { _disable_engine example cmake-utils_src_prepare + java-pkg-opt-2_src_prepare } src_configure(){ @@ -491,6 +491,10 @@ src_install() { for script in "${S}"/scripts/mysql* ; do [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" fi #Remove mytop if perl is not selected diff --git a/dev-db/mariadb/mariadb-10.1.35.ebuild b/dev-db/mariadb/mariadb-10.1.35.ebuild new file mode 100644 index 000000000000..549fe3bb2db6 --- /dev/null +++ b/dev-db/mariadb/mariadb-10.1.35.ebuild @@ -0,0 +1,887 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" +MY_EXTRAS_VER="20180809-1700Z" +SUBSLOT="18" + +JAVA_PKG_OPT_USE="jdbc" + +# Keeping eutils in EAPI=6 for emktemp in pkg_config + +inherit eutils systemd flag-o-matic prefix toolchain-funcs java-pkg-opt-2 user cmake-utils multilib-build + +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " + +# Gentoo patches to MySQL +if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then + SRC_URI="${SRC_URI} + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" +fi + +HOMEPAGE="https://mariadb.org/" +DESCRIPTION="An enhanced, drop-in replacement for MySQL" +LICENSE="GPL-2" +SLOT="0/${SUBSLOT:-0}" +IUSE="+backup bindist client-libs cracklib debug extraengine galera jdbc jemalloc kerberos + innodb-lz4 innodb-lzo innodb-snappy latin1 libressl mroonga numa odbc oqgraph pam + +perl profiling selinux +server sphinx sst-rsync sst-mariabackup sst-xtrabackup + systemd systemtap static static-libs tcmalloc test tokudb xml yassl" + +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests +RESTRICT="!bindist? ( bindist ) libressl? ( test )" + +REQUIRED_USE="jdbc? ( extraengine server !static ) + server? ( tokudb? ( jemalloc !tcmalloc ) ) + ?? ( tcmalloc jemalloc ) + static? ( yassl !pam )" + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" + inherit git-r3 + EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" + EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" + EGIT_CLONE_TYPE=shallow +else + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" +fi + +PATCHES=( + "${MY_PATCH_DIR}"/20006_all_cmake_elib-mariadb-10.1.27.patch + "${MY_PATCH_DIR}"/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch + "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch + "${MY_PATCH_DIR}"/20018_all_mariadb-10.1.16-without-clientlibs-tools.patch + "${MY_PATCH_DIR}"/20025_all_mariadb-10.1.26-gssapi-detect.patch + "${MY_PATCH_DIR}"/20029_all_mariadb-10.1.31-enable-numa.patch + "${MY_PATCH_DIR}"/20035_all_mariadb-10.1-atomic-detection.patch +) + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +COMMON_DEPEND=" + kernel_linux? ( + sys-process/procps:0= + dev-libs/libaio:0= + ) + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + jemalloc? ( dev-libs/jemalloc:0= ) + tcmalloc? ( dev-util/google-perftools:0= ) + systemtap? ( >=dev-util/systemtap-1.3:0= ) + !yassl? ( + !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 ) + libressl? ( dev-libs/libressl:0= ) + ) + >=sys-libs/zlib-1.2.3:0= + sys-libs/ncurses:0= + !bindist? ( + sys-libs/binutils-libs:0= + >=sys-libs/readline-4.1:0= + ) + server? ( + backup? ( app-arch/libarchive:0= ) + cracklib? ( sys-libs/cracklib:0= ) + extraengine? ( + odbc? ( dev-db/unixODBC:0= ) + xml? ( dev-libs/libxml2:2= ) + sys-libs/zlib[minizip] + ) + innodb-lz4? ( app-arch/lz4 ) + innodb-lzo? ( dev-libs/lzo ) + innodb-snappy? ( app-arch/snappy ) + kerberos? ( virtual/krb5 ) + mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) + numa? ( sys-process/numactl ) + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) + pam? ( virtual/pam:0= ) + systemd? ( sys-apps/systemd:= ) + tokudb? ( app-arch/snappy ) + ) + !yassl? ( !libressl? ( !>=dev-libs/openssl-1.1.0 ) ) + >=dev-libs/libpcre-8.41-r1:3= + !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) +" +DEPEND="virtual/yacc + static? ( sys-libs/ncurses[static-libs] ) + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) + server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) + ${COMMON_DEPEND}" +RDEPEND="selinux? ( sec-policy/selinux-mysql ) + client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster + server? ( !prefix? ( dev-db/mysql-init-scripts ) ) + ${COMMON_DEPEND} + server? ( galera? ( + sys-apps/iproute2 + =sys-cluster/galera-25* + sst-rsync? ( sys-process/lsof ) + sst-mariabackup? ( net-misc/socat[ssl] ) + sst-xtrabackup? ( net-misc/socat[ssl] ) + ) ) + perl? ( !dev-db/mytop + virtual/perl-Getopt-Long + dev-perl/TermReadKey + virtual/perl-Term-ANSIColor + virtual/perl-Time-HiRes ) + server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) +" +# For other stuff to bring us in +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) + server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )" + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + local GCC_MAJOR_SET=$(gcc-major-version) + local GCC_MINOR_SET=$(gcc-minor-version) + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on + # non x86{,_64} arches + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + fi + java-pkg-opt-2_pkg_setup + if has test ${FEATURES} && \ + use server && ! has userpriv ${FEATURES} ; then + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + + # This should come after all of the die statements + enewgroup mysql 60 || die "problem adding 'mysql' group" + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" +} + +pkg_preinst() { + java-pkg-opt-2_pkg_preinst +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" + + if use server ; then + if use pam; then + einfo + elog "This install includes the PAM authentication plugin." + elog "To activate and configure the PAM plugin, please read:" + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" + einfo + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + elog + elog "If you are switching server implentations, you should run the" + elog "mysql_upgrade tool." + einfo + else + einfo + elog "If you are upgrading major versions, you should run the" + elog "mysql_upgrade tool." + einfo + fi + + einfo + elog "Be sure to edit the my.cnf file to activate your cluster settings." + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" + elog "The first time the cluster is activated, you should add" + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." + elog "This option should then be removed for subsequent starts." + einfo + fi +} + +src_unpack() { + unpack ${A} + # Grab the patches + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack + + mv -f "${WORKDIR%/}/${PN%%-galera}-${PV}" "${S}" || die +} + +src_prepare() { + _disable_engine() { + echo > "${S%/}/storage/${1}/CMakeLists.txt" || die + } + + _disable_plugin() { + echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die + } + + if use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die + fi + + # Don't build bundled xz-utils for tokudb + echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die + + local plugin + local server_plugins=( handler_socket auth_socket feedback metadata_lock_info + locale_info qc_info server_audit semisync sql_errlog ) + local test_plugins=( audit_null auth_examples daemon_example fulltext ) + if ! use server; then # These plugins are for the server + for plugin in "${server_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + if ! use test; then # These plugins are only used during testing + for plugin in "${test_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + # Collides with mariadb-connector-c bug 655980 + _disable_plugin auth_dialog + + # Avoid useless library checks + use mroonga || _disable_engine mroonga + use oqgraph || _disable_engine oqgraph + _disable_engine example + + cmake-utils_src_prepare + java-pkg-opt-2_src_prepare +} + +src_configure(){ + # bug 508724 mariadb cannot use ld.gold + tc-ld-disable-gold + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + append-cxxflags -felide-constructors + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + CMAKE_BUILD_TYPE="RelWithDebInfo" + + # debug hack wrt #497532 + mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" + -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql" + -DINSTALL_BINDIR=bin + -DINSTALL_DOCDIR=share/doc/${PF} + -DINSTALL_DOCREADMEDIR=share/doc/${PF} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_LIBDIR=$(get_libdir) + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mariadb + -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mariadb/mysql-test' '') + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin + -DINSTALL_SCRIPTDIR=share/mariadb/scripts + -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb" + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + -DWITH_ZLIB=system + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" + -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" + -DWITH_DEFAULT_COMPILER_OPTIONS=0 + -DWITH_DEFAULT_FEATURE_SET=0 + -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" + # The build forces this to be defined when cross-compiling. We pass it + # all the time for simplicity and to make sure it is actually correct. + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) + -DWITHOUT_CLIENTLIBS=YES + -DWITH_READLINE=$(usex bindist 1 0) + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) + -DENABLE_DTRACE=$(usex systemtap) + -DWITH_SSL=$(usex yassl bundled system) + ) + + if use server ; then + + # Federated{,X} must be treated special otherwise they will not be built as plugins + if ! use extraengine ; then + mycmakeargs+=( + -DPLUGIN_FEDERATED=NO + -DPLUGIN_FEDERATEDX=NO ) + fi + + mycmakeargs+=( + -DWITH_JEMALLOC=$(usex jemalloc system) + -DWITH_PCRE=system + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) + -DPLUGIN_SPHINX=$(usex sphinx YES NO) + -DPLUGIN_TOKUDB=$(usex tokudb YES NO) + -DPLUGIN_AUTH_PAM=$(usex pam YES NO) + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) + -DPLUGIN_CASSANDRA=NO + -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) + -DPLUGIN_SPIDER=$(usex extraengine YES NO) + -DPLUGIN_CONNECT=$(usex extraengine YES NO) + -DCONNECT_WITH_MYSQL=1 + -DCONNECT_WITH_LIBXML2=$(usex xml) + -DCONNECT_WITH_ODBC=$(usex odbc) + -DCONNECT_WITH_JDBC=$(usex jdbc) + # Build failure and autodep wrt bug 639144 + -DCONNECT_WITH_MONGO=OFF + -DWITH_WSREP=$(usex galera) + -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) + -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) + -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DPLUGIN_AUTH_GSSAPI_CLIENT=NO + -DWITH_MARIABACKUP=$(usex backup ON OFF) + -DWITH_LIBARCHIVE=$(usex backup ON OFF) + -DWITH_SYSTEMD=$(usex systemd yes no) + -DWITH_NUMA=$(usex numa ON OFF) + -DINSTALL_SQLBENCHDIR='' + ) + + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + + elif ! use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + fi + mycmakeargs+=( + -DEXTRA_CHARSETS=all + -DMYSQL_USER=mysql + -DDISABLE_SHARED=$(usex static YES NO) + -DWITH_DEBUG=$(usex debug) + -DWITH_EMBEDDED_SERVER=OFF + -DENABLED_PROFILING=$(usex profiling) + ) + + if use static; then + mycmakeargs+=( -DWITH_PIC=1 ) + fi + + if use jemalloc || use tcmalloc ; then + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + -DWITH_PARTITION_STORAGE_ENGINE=1 + ) + + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DWITH_EMBEDDED_SERVER=OFF + -DEXTRA_CHARSETS=none + -DINSTALL_SQLBENCHDIR= + -DWITH_SYSTEMD=no + ) + fi + + cmake-utils_src_configure +} + +src_compile() { + cmake-utils_src_compile +} + +src_install() { + cmake-utils_src_install + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then + rm "${ED}/usr/include/mysql/server/private/config.h" || die + fi + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "mysqlcheck" "/usr/bin/mysqlrepair" + dosym "mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED}/usr/data" ]] ; then + rm -Rf "${ED}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + local mycnf_src="my.cnf-5.6-r1" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR}/${mycnf_src}" \ + > "${TMPDIR}/my.cnf.ok" || die + use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok" + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" my.cnf + + if use server ; then + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" + fi + + #Remove mytop if perl is not selected + [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" +} + +# Official test instructions: +# USE='extraengine perl server' \ +# FEATURES='test userpriv -usersandbox' \ +# ebuild mariadb-X.X.XX.ebuild \ +# digest clean package +src_test() { + + _disable_test() { + local rawtestname reason + rawtestname="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}'" + echo ${rawtestname} : ${reason} >> "${T}/disabled.def" + } + + local TESTDIR="${BUILD_DIR}/mysql-test" + local retstatus_unit + local retstatus_tests + + if ! use server ; then + einfo "Skipping server tests due to minimal build." + return 0 + fi + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ $UID -eq 0 ]]; then + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" + + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + # Run CTest (test-units) +# cmake-utils_src_test +# retstatus_unit=$? + + # Ensure that parallel runs don't die + export MTR_BUILD_THREAD="$((${RANDOM} % 100))" + # Enable parallel testing, auto will try to detect number of cores + # You may set this by hand. + # The default maximum is 8 unless MTR_MAX_PARALLEL is increased + export MTR_PARALLEL="${MTR_PARALLEL:-auto}" + + # create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + # Run mysql tests + pushd "${TESTDIR}" > /dev/null || die + + touch "${T}/disabled.def" + # These are failing in MariaDB 10.0 for now and are believed to be + # false positives: + # + # main.mysql_client_test, main.mysql_client_test_nonblock + # main.mysql_client_test_comp: + # segfaults at random under Portage only, suspect resource limits. + + local t + for t in plugins.cracklib_password_check plugins.two_password_validations ; do + _disable_test "$t" "False positive due to varying policies" + done + + for t in main.mysql_client_test main.mysql_client_test_nonblock \ + rpl.rpl_semi_sync_uninstall_plugin \ + main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do + _disable_test "$t" "False positives in Gentoo" + done + + if ! use client-libs ; then + _disable_test main.plugin_auth "Needs client libraries built" + fi + + _disable_test sys_vars.sysvars_server_notembedded "Broken test" # bug #661700 required profiling always on + + # run mysql-test tests + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" + retstatus_tests=$? + + popd > /dev/null || die + + # Cleanup is important for these testcases. + pkill -9 -f "${S}/ndb" 2>/dev/null + pkill -9 -f "${S}/sql" 2>/dev/null + + local failures="" + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" + + [[ -z "$failures" ]] || die "Test failures: $failures" + einfo "Tests successfully completed" +} + +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1` + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_config() { + _getoptval() { + local mypd="${EROOT}"/usr/bin/my_print_defaults + local section="$1" + local flag="--${2}=" + local extra_options="${3}" + "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" + } + local old_MY_DATADIR="${MY_DATADIR}" + local old_HOME="${HOME}" + # my_print_defaults needs to read stuff in $HOME/.my.cnf + export HOME=${EPREFIX}/root + + # Make sure the vars are correctly initialized + mysql_init_vars + + [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" + if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then + die "Minimal builds do NOT include the MySQL server" + fi + + if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then + local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" + MY_DATADIR_s="${MY_DATADIR_s%%/}" + local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" + old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" + + if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" + ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" + else + elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" + mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ + || die "Moving MY_DATADIR failed" + fi + else + ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Attempting to use ${MY_DATADIR_s}" + else + eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" + die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" + fi + fi + fi + + local pwd1="a" + local pwd2="b" + local maxtry=15 + + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then + local tmp_mysqld_password_source= + + for tmp_mysqld_password_source in mysql client; do + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" + MYSQL_ROOT_PASSWORD= + continue + fi + + einfo "Found password in '${tmp_mysqld_password_source}' section!" + break + fi + done + + # Sometimes --show is required to display passwords in some implementations of my_print_defaults + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" + fi + + unset tmp_mysqld_password_source + fi + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" + # These are dir+prefix + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + + if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then + einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" + fi + if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then + einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" + fi + if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then + einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" + fi + + if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then + ewarn "You have already a MySQL database in place." + ewarn "(${ROOT}/${MY_DATADIR}/*)" + ewarn "Please rename or delete it if you wish to replace it." + die "MySQL database already exists!" + fi + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then + + einfo "Please provide a password for the mysql 'root' user now" + einfo "or through the ${HOME}/.my.cnf file." + ewarn "Avoid [\"'\\_%] characters in the password" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x$pwd1" != "x$pwd2" ]] ; then + die "Passwords are not the same" + fi + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 + fi + + local options + local sqltmp="$(emktemp)" + + # Fix bug 446200. Don't reference host my.cnf, needs to come first, + # see https://bugs.mysql.com/bug.php?id=31312 + use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" + + # Figure out which options we need to disable to do the setup + local helpfile="${TMPDIR}/mysqld-help" + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null + for opt in grant-tables host-cache name-resolve networking slave-start \ + federated ssl log-bin relay-log slow-query-log external-locking \ + log-slave-updates \ + ; do + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" + done + + einfo "Creating the mysql database and setting proper permissions on it ..." + + # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it + PID_DIR="${EROOT}/var/run/mysqld" + if [[ ! -d "${PID_DIR}" ]]; then + install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" + fi + + if [[ ! -d "${MY_DATADIR}" ]]; then + install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" + fi + + pushd "${TMPDIR}" &>/dev/null || die + + # Filling timezones, see + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null + + local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) + [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) + cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) + einfo "Command: ${cmd[*]}" + su -s /bin/sh -c "${cmd[*]}" mysql \ + >"${TMPDIR}"/mysql_install_db.log 2>&1 + if [ $? -ne 0 ]; then + grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 + die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" + fi + popd &>/dev/null || die + [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ + || die "MySQL databases not installed" + + use prefix || options="${options} --user=mysql" + + local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" + local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" + local mysqld="${EROOT}/usr/sbin/mysqld \ + ${options} \ + --log-warnings=0 \ + --basedir=${EROOT}/usr \ + --datadir=${ROOT}/${MY_DATADIR} \ + --max_allowed_packet=8M \ + --net_buffer_length=16K \ + --socket=${socket} \ + --pid-file=${pidfile} + --tmpdir=${ROOT}/${MYSQL_TMPDIR}" + #einfo "About to start mysqld: ${mysqld}" + ebegin "Starting mysqld" + einfo "Command ${mysqld}" + ${mysqld} & + rc=$? + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + eend $rc + + if ! [[ -S "${socket}" ]]; then + die "Completely failed to start up mysqld with: ${mysqld}" + fi + + ebegin "Setting root password" + # Do this from memory, as we don't want clear text passwords in temp files + local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" + "${EROOT}/usr/bin/mysql" \ + "--socket=${socket}" \ + -hlocalhost \ + -e "${sql}" + eend $? + + if [[ -n "${sqltmp}" ]] ; then + ebegin "Loading \"zoneinfo\", this step may require a few seconds" + "${EROOT}/usr/bin/mysql" \ + "--socket=${socket}" \ + -hlocalhost \ + -uroot \ + --password="${MYSQL_ROOT_PASSWORD}" \ + mysql < "${sqltmp}" + rc=$? + eend $? + [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" + fi + + # Stop the server and cleanup + einfo "Stopping the server ..." + kill $(< "${pidfile}" ) + rm -f "${sqltmp}" + wait %1 + einfo "Done" +} diff --git a/dev-db/mariadb/mariadb-10.2.15.ebuild b/dev-db/mariadb/mariadb-10.2.15.ebuild deleted file mode 100644 index 6e8b31cdccb1..000000000000 --- a/dev-db/mariadb/mariadb-10.2.15.ebuild +++ /dev/null @@ -1,1011 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI="6" -MY_EXTRAS_VER="20180515-1334Z" -SUBSLOT="18" - -JAVA_PKG_OPT_USE="jdbc" - -# Keeping eutils in EAPI=6 for emktemp in pkg_config - -inherit eutils systemd flag-o-matic prefix toolchain-funcs \ - java-pkg-opt-2 user cmake-utils multilib-minimal - -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " - -# Gentoo patches to MySQL -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then - SRC_URI="${SRC_URI} - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" -fi - -HOMEPAGE="https://mariadb.org/" -DESCRIPTION="An enhanced, drop-in replacement for MySQL" -LICENSE="GPL-2 LGPL-2.1+" -SLOT="0/${SUBSLOT:-0}" -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx - sst-rsync sst-mariabackup sst-xtrabackup static static-libs systemd systemtap tcmalloc - test tokudb xml yassl" - -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests -RESTRICT="!bindist? ( bindist ) libressl? ( test )" - -REQUIRED_USE="jdbc? ( extraengine server !static ) - server? ( tokudb? ( jemalloc !tcmalloc ) ) - !server? ( !extraengine ) - ?? ( tcmalloc jemalloc ) - static? ( yassl !pam )" - -KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" - -# Shorten the path because the socket path length must be shorter than 107 chars -# and we will run a mysql server during test phase -S="${WORKDIR}/mysql" - -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" - inherit git-r3 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" - EGIT_CLONE_TYPE=shallow -else - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" -fi - -PATCHES=( - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch - "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.9-without-clientlibs-tools.patch - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch - "${MY_PATCH_DIR}"/20035_all_mariadb-10.2-atomic-detection.patch -) - -# Be warned, *DEPEND are version-dependant -# These are used for both runtime and compiletime -# MULTILIB_USEDEP only set for libraries used by the client library -COMMON_DEPEND=" - kernel_linux? ( - sys-process/procps:0= - dev-libs/libaio:0= - ) - >=sys-apps/sed-4 - >=sys-apps/texinfo-4.7-r1 - jemalloc? ( dev-libs/jemalloc:0= ) - tcmalloc? ( dev-util/google-perftools:0= ) - systemtap? ( >=dev-util/systemtap-1.3:0= ) - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] - kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] ) - yassl? ( net-libs/gnutls:0=[${MULTILIB_USEDEP},static-libs?] ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] ) - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] ) - ) - ) - !client-libs? ( >=sys-libs/zlib-1.2.3:0= kerberos? ( virtual/krb5 ) - yassl? ( net-libs/gnutls:0= ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - ) - sys-libs/ncurses:0= - !bindist? ( - sys-libs/binutils-libs:0= - >=sys-libs/readline-4.1:0= - ) - server? ( - backup? ( app-arch/libarchive:0= ) - cracklib? ( sys-libs/cracklib:0= ) - extraengine? ( - odbc? ( dev-db/unixODBC:0= ) - xml? ( dev-libs/libxml2:2= ) - ) - innodb-lz4? ( app-arch/lz4 ) - innodb-lzo? ( dev-libs/lzo ) - innodb-snappy? ( app-arch/snappy ) - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) - numa? ( sys-process/numactl ) - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) - pam? ( virtual/pam:0= ) - systemd? ( sys-apps/systemd:= ) - tokudb? ( app-arch/snappy ) - ) - >=dev-libs/libpcre-8.41-r1:3= - !client-libs? ( dev-db/mariadb-connector-c[${MULTILIB_USEDEP}] dev-db/mysql-connector-c[${MULTILIB_USEDEP}] ) -" -DEPEND="virtual/yacc - static? ( sys-libs/ncurses[static-libs] ) - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) - ${COMMON_DEPEND}" -RDEPEND="selinux? ( sec-policy/selinux-mysql ) - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster - server? ( !prefix? ( dev-db/mysql-init-scripts ) ) - !=virtual/jre-1.6 ) ) ) -" -# For other stuff to bring us in -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) - server? ( ~virtual/mysql-5.6[static=] - galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )" - -pkg_setup() { - if [[ ${MERGE_TYPE} != binary ]] ; then - local GCC_MAJOR_SET=$(gcc-major-version) - local GCC_MINOR_SET=$(gcc-minor-version) - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on - # non x86{,_64} arches - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - fi - java-pkg-opt-2_pkg_setup - if has test ${FEATURES} && \ - use server && ! has userpriv ${FEATURES} ; then - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - - # This should come after all of the die statements - enewgroup mysql 60 || die "problem adding 'mysql' group" - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" -} - -pkg_preinst() { - java-pkg-opt-2_pkg_preinst - - # Here we need to see if the implementation switched client libraries - # We check if this is a new instance of the package and a client library already exists - local SHOW_ABI_MESSAGE libpath - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") - elog "Due to ABI changes when switching between different client libraries," - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." - elog "Please run: revdep-rebuild --library ${libpath}" - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" - fi -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" - - if use server ; then - if use pam; then - einfo - elog "This install includes the PAM authentication plugin." - elog "To activate and configure the PAM plugin, please read:" - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" - einfo - fi - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog "\"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - elog - elog "If you are switching server implentations, you should run the" - elog "mysql_upgrade tool." - einfo - else - einfo - elog "If you are upgrading major versions, you should run the" - elog "mysql_upgrade tool." - einfo - fi - - if use galera ; then - einfo - elog "Be sure to edit the my.cnf file to activate your cluster settings." - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" - elog "The first time the cluster is activated, you should add" - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." - elog "This option should then be removed for subsequent starts." - einfo - fi - fi - - # Note about configuration change - einfo - elog "This version of mariadb reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/${PN}.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." - elog "You may have as many files as needed and they are read alphabetically." - elog "Be sure the options have the appropitate section headers, i.e. [mysqld]." - einfo -} - -src_unpack() { - unpack ${A} - # Grab the patches - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack - - mv -f "${WORKDIR%/}/${P}" "${S}" || die -} - -src_prepare() { - java-pkg-opt-2_src_prepare - if use tcmalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - # Don't build bundled xz-utils for tokudb - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die - - # Remove the bundled groonga - # There is no CMake flag, it simply checks for existance - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" - - if ! use server; then - rm -r "${S}"/plugin/handler_socket || die - fi - - cmake-utils_src_prepare -} - -src_configure(){ - # bug 508724 mariadb cannot use ld.gold - tc-ld-disable-gold - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - append-cxxflags -felide-constructors - - # bug #283926, with GCC4.4, this is required to get correct behavior. - append-flags -fno-strict-aliasing - - if use client-libs ; then - multilib-minimal_src_configure - else - multilib_src_configure - fi -} - -multilib_src_configure() { - debug-print-function ${FUNCNAME} "$@" - - if ! multilib_is_native_abi && ! use client-libs ; then - return - fi - - CMAKE_BUILD_TYPE="RelWithDebInfo" - - # debug hack wrt #497532 - mycmakeargs=( - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" - -DSYSCONFDIR="${EPREFIX}/etc/mysql" - -DINSTALL_BINDIR=bin - -DINSTALL_DOCDIR=share/doc/${PF} - -DINSTALL_DOCREADMEDIR=share/doc/${PF} - -DINSTALL_INCLUDEDIR=include/mysql - -DINSTALL_INFODIR=share/info - -DINSTALL_LIBDIR=$(get_libdir) - -DINSTALL_MANDIR=share/man - -DINSTALL_MYSQLSHAREDIR=share/mariadb - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin - -DINSTALL_SCRIPTDIR=share/mariadb/scripts - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_SBINDIR=sbin - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" - -DWITH_COMMENT="Gentoo Linux ${PF}" - -DWITH_UNIT_TESTS=$(usex test ON OFF) - -DWITH_LIBEDIT=0 - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - -DENABLED_LOCAL_INFILE=1 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DWITH_DEFAULT_COMPILER_OPTIONS=0 - -DWITH_DEFAULT_FEATURE_SET=0 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" - -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF) - # The build forces this to be defined when cross-compiling. We pass it - # all the time for simplicity and to make sure it is actually correct. - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) - -DCONC_WITH_EXTERNAL_ZLIB=YES - -DWITH_EXTERNAL_ZLIB=YES - -DSUFFIX_INSTALL_DIR="" - -DWITH_UNITTEST=OFF - ) - if use test ; then - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) - else - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) - fi - - if ! use yassl ; then - mycmakeargs+=( -DWITH_SSL=system ) - else - mycmakeargs+=( -DWITH_SSL=bundled ) - fi - - if ! use client-libs ; then - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) - fi - - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION - # systemtap only works on native ABI bug 530132 - if multilib_is_native_abi; then - mycmakeargs+=( - -DWITH_READLINE=$(usex bindist 1 0) - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) - -DENABLE_DTRACE=$(usex systemtap) - ) - else - mycmakeargs+=( - -DWITHOUT_TOOLS=1 - -DWITH_READLINE=1 - -DNOT_FOR_DISTRIBUTION=0 - -DENABLE_DTRACE=0 - ) - fi - - if multilib_is_native_abi && use server ; then - - # Federated{,X} must be treated special otherwise they will not be built as plugins - if ! use extraengine ; then - mycmakeargs+=( - -DPLUGIN_FEDERATED=NO - -DPLUGIN_FEDERATEDX=NO ) - fi - - mycmakeargs+=( - -DWITH_JEMALLOC=$(usex jemalloc system) - -DWITH_PCRE=system - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) - -DPLUGIN_SPHINX=$(usex sphinx YES NO) - -DPLUGIN_TOKUDB=$(usex tokudb YES NO) - -DPLUGIN_AUTH_PAM=$(usex pam YES NO) - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) - -DPLUGIN_CASSANDRA=NO - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) - -DPLUGIN_SPIDER=$(usex extraengine YES NO) - -DPLUGIN_CONNECT=$(usex extraengine YES NO) - -DCONNECT_WITH_MYSQL=1 - -DCONNECT_WITH_LIBXML2=$(usex xml) - -DCONNECT_WITH_ODBC=$(usex odbc) - -DCONNECT_WITH_JDBC=$(usex jdbc) - # Build failure and autodep wrt bug 639144 - -DCONNECT_WITH_MONGO=OFF - -DWITH_WSREP=$(usex galera) - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DWITH_MARIABACKUP=$(usex backup ON OFF) - -DWITH_LIBARCHIVE=$(usex backup ON OFF) - -DINSTALL_SQLBENCHDIR=share/mariadb - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) - # systemd is only linked to for server notification - -DWITH_SYSTEMD=$(usex systemd yes no) - -DWITH_NUMA=$(usex numa ON OFF) - ) - - # Workaround for MDEV-14524 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) - - if use test ; then - # This is needed for the new client lib which tests a real, open server - mycmakeargs+=( -DSKIP_TESTS=ON ) - fi - - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." - ewarn "You MUST file bugs without these variables set." - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - - elif ! use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8 - -DDEFAULT_COLLATION=utf8_general_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - fi - mycmakeargs+=( - -DEXTRA_CHARSETS=all - -DMYSQL_USER=mysql - -DDISABLE_SHARED=$(usex static YES NO) - -DWITH_DEBUG=$(usex debug) - -DWITH_EMBEDDED_SERVER=OFF - -DWITH_PROFILING=$(usex profiling) - ) - - if use static; then - mycmakeargs+=( -DWITH_PIC=1 ) - fi - - if use jemalloc || use tcmalloc ; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - -DWITH_PARTITION_STORAGE_ENGINE=1 - ) - - else - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITH_EMBEDDED_SERVER=OFF - -DEXTRA_CHARSETS=none - -DINSTALL_SQLBENCHDIR= - -DWITH_SYSTEMD=no - ) - fi - - cmake-utils_src_configure -} - -src_compile() { - if use client-libs ; then - multilib-minimal_src_compile - else - multilib_src_compile - fi -} - -multilib_src_compile() { - cmake-utils_src_compile -} - -src_install() { - local MULTILIB_WRAPPED_HEADERS - local MULTILIB_CHOST_TOOLS - if use client-libs ; then - # headers with ABI specific data - MULTILIB_WRAPPED_HEADERS=( - /usr/include/mysql/server/my_config.h - /usr/include/mysql/server/private/embedded_priv.h - /usr/include/mysql/server/mysql_version.h - /usr/include/mariadb/mariadb_version.h - /usr/include/mysql/mariadb_version.h - /usr/include/mysql/server/private/probes_mysql_nodtrace.h - /usr/include/mysql/server/private/probes_mysql_dtrace.h ) - - # wrap the config scripts - MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config ) - multilib-minimal_src_install - else - multilib_src_install - multilib_src_install_all - fi -} - -# Intentionally override eclass function -multilib_src_install() { - - cmake-utils_src_install - - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then - rm "${ED}/usr/include/mysql/server/private/config.h" || die - fi - - if ! multilib_is_native_abi && use server ; then - insinto /usr/include/mysql/server/private - doins "${S}"/sql/*.h - fi - - if use client-libs ; then - # Install compatible symlinks to libmysqlclient -# use static-libs && dosym libmariadbclient.a "/usr/$(get_libdir)/libmysqlclient.a" -# dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so" - dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}" - fi - - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die -} - -multilib_src_install_all() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Convenience links - einfo "Making Convenience links for mysqlcheck multi-call binary" - dosym "mysqlcheck" "/usr/bin/mysqlanalyze" - dosym "mysqlcheck" "/usr/bin/mysqlrepair" - dosym "mysqlcheck" "/usr/bin/mysqloptimize" - - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir - if [[ -d "${ED}/usr/data" ]] ; then - rm -Rf "${ED}/usr/data" || die - fi - - # Unless they explicitly specific USE=test, then do not install the - # testsuite. It DOES have a use to be installed, esp. when you want to do a - # validation of your database configuration after tuning it. - if ! use test ; then - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" - fi - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#${EPREFIX}}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - if use server ; then - mycnf_src="my.cnf.distro-server" - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ - "${FILESDIR}/${mycnf_src}" \ - > "${TMPDIR}/my.cnf.ok" || die - if use prefix ; then - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ - "${TMPDIR}/my.cnf.ok" || die - fi - if use latin1 ; then - sed -i \ - -e "/character-set/s|utf8|latin1|g" \ - "${TMPDIR}/my.cnf.ok" || die - fi - eprefixify "${TMPDIR}/my.cnf.ok" - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - einfo "Including support files and sample configurations" - docinto "support-files" - local script - for script in \ - "${S}"/support-files/magic - do - [[ -f "$script" ]] && dodoc "${script}" - done - - docinto "scripts" - for script in "${S}"/scripts/mysql* ; do - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" - done - fi - - #Remove mytop if perl is not selected - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" -} - -# Official test instructions: -# USE='extraengine perl server static-libs' \ -# FEATURES='test userpriv -usersandbox' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -src_test() { - - _disable_test() { - local rawtestname reason - rawtestname="${1}" ; shift - reason="${@}" - ewarn "test '${rawtestname}' disabled: '${reason}'" - echo ${rawtestname} : ${reason} >> "${T}/disabled.def" - } - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - if ! use server ; then - einfo "Skipping server tests due to minimal build." - return 0 - fi - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ $UID -eq 0 ]]; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - - # Run CTest (test-units) - cmake-utils_src_test - retstatus_unit=$? - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - # Enable parallel testing, auto will try to detect number of cores - # You may set this by hand. - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased - export MTR_PARALLEL="${MTR_PARALLEL:-auto}" - - # create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - # Run mysql tests - pushd "${TESTDIR}" > /dev/null || die - - touch "${T}/disabled.def" - # These are failing in MariaDB 10.0 for now and are believed to be - # false positives: - # - # main.mysql_client_test, main.mysql_client_test_nonblock - # main.mysql_client_test_comp: - # segfaults at random under Portage only, suspect resource limits. - - local t - for t in plugins.cracklib_password_check plugins.two_password_validations ; do - _disable_test "$t" "False positive due to varying policies" - done - - for t in main.mysql_client_test main.mysql_client_test_nonblock \ - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do - _disable_test "$t" "False positives in Gentoo" - done - - if ! use client-libs ; then - _disable_test main.plugin_auth "Needs client libraries built" - fi - - # run mysql-test tests - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" - retstatus_tests=$? - - popd > /dev/null || die - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - local failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" -} - -mysql_init_vars() { - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="" - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1` - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ - | sed -e 's/.*=\s*//' \ - | tail -n1` - fi - fi - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="${MY_LOCALSTATEDIR}" - einfo "Using default MY_DATADIR" - fi - elog "MySQL MY_DATADIR is ${MY_DATADIR}" - - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then - if [[ -e "${MY_DATADIR}" ]] ; then - # If you get this and you're wondering about it, see bug #207636 - elog "MySQL datadir found in ${MY_DATADIR}" - elog "A new one will not be created." - PREVIOUS_DATADIR="yes" - else - PREVIOUS_DATADIR="no" - fi - export PREVIOUS_DATADIR - fi - else - if [[ ${EBUILD_PHASE} == "config" ]]; then - local new_MY_DATADIR - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1` - - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then - ewarn "MySQL MY_DATADIR has changed" - ewarn "from ${MY_DATADIR}" - ewarn "to ${new_MY_DATADIR}" - MY_DATADIR="${new_MY_DATADIR}" - fi - fi - fi - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_config() { - _getoptval() { - local mypd="${EROOT}"/usr/bin/my_print_defaults - local section="$1" - local flag="--${2}=" - local extra_options="${3}" - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" - } - local old_MY_DATADIR="${MY_DATADIR}" - local old_HOME="${HOME}" - # my_print_defaults needs to read stuff in $HOME/.my.cnf - export HOME=${EPREFIX}/root - - # Make sure the vars are correctly initialized - mysql_init_vars - - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then - die "Minimal builds do NOT include the MySQL server" - fi - - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" - MY_DATADIR_s="${MY_DATADIR_s%%/}" - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" - - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then - if [[ -d "${MY_DATADIR_s}" ]]; then - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" - else - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ - || die "Moving MY_DATADIR failed" - fi - else - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" - if [[ -d "${MY_DATADIR_s}" ]]; then - ewarn "Attempting to use ${MY_DATADIR_s}" - else - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" - fi - fi - fi - - local pwd1="a" - local pwd2="b" - local maxtry=15 - - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then - local tmp_mysqld_password_source= - - for tmp_mysqld_password_source in mysql client; do - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" - MYSQL_ROOT_PASSWORD= - continue - fi - - einfo "Found password in '${tmp_mysqld_password_source}' section!" - break - fi - done - - # Sometimes --show is required to display passwords in some implementations of my_print_defaults - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" - fi - - unset tmp_mysqld_password_source - fi - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" - # These are dir+prefix - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" - fi - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" - fi - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" - fi - - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then - ewarn "You have already a MySQL database in place." - ewarn "(${ROOT}/${MY_DATADIR}/*)" - ewarn "Please rename or delete it if you wish to replace it." - die "MySQL database already exists!" - fi - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then - - einfo "Please provide a password for the mysql 'root' user now" - einfo "or through the ${HOME}/.my.cnf file." - ewarn "Avoid [\"'\\_%] characters in the password" - read -rsp " >" pwd1 ; echo - - einfo "Retype the password" - read -rsp " >" pwd2 ; echo - - if [[ "x$pwd1" != "x$pwd2" ]] ; then - die "Passwords are not the same" - fi - MYSQL_ROOT_PASSWORD="${pwd1}" - unset pwd1 pwd2 - fi - - local options - local sqltmp="$(emktemp)" - - # Fix bug 446200. Don't reference host my.cnf, needs to come first, - # see https://bugs.mysql.com/bug.php?id=31312 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" - - # Figure out which options we need to disable to do the setup - local helpfile="${TMPDIR}/mysqld-help" - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null - for opt in grant-tables host-cache name-resolve networking slave-start \ - federated ssl log-bin relay-log slow-query-log external-locking \ - log-slave-updates \ - ; do - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" - done - - einfo "Creating the mysql database and setting proper permissions on it ..." - - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it - PID_DIR="${EROOT}/var/run/mysqld" - if [[ ! -d "${PID_DIR}" ]]; then - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" - fi - - if [[ ! -d "${MY_DATADIR}" ]]; then - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" - fi - - pushd "${TMPDIR}" &>/dev/null || die - - # Filling timezones, see - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null - - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) - einfo "Command: ${cmd[*]}" - su -s /bin/sh -c "${cmd[*]}" mysql \ - >"${TMPDIR}"/mysql_install_db.log 2>&1 - if [ $? -ne 0 ]; then - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" - fi - popd &>/dev/null || die - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ - || die "MySQL databases not installed" - - use prefix || options="${options} --user=mysql" - - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" - local mysqld="${EROOT}/usr/sbin/mysqld \ - ${options} \ - --log-warnings=0 \ - --basedir=${EROOT}/usr \ - --datadir=${ROOT}/${MY_DATADIR} \ - --max_allowed_packet=8M \ - --net_buffer_length=16K \ - --socket=${socket} \ - --pid-file=${pidfile} - --tmpdir=${ROOT}/${MYSQL_TMPDIR}" - #einfo "About to start mysqld: ${mysqld}" - ebegin "Starting mysqld" - einfo "Command ${mysqld}" - ${mysqld} & - rc=$? - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - eend $rc - - if ! [[ -S "${socket}" ]]; then - die "Completely failed to start up mysqld with: ${mysqld}" - fi - - ebegin "Setting root password" - # Do this from memory, as we don't want clear text passwords in temp files - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" - "${EROOT}/usr/bin/mysql" \ - "--socket=${socket}" \ - -hlocalhost \ - -e "${sql}" - eend $? - - if [[ -n "${sqltmp}" ]] ; then - ebegin "Loading \"zoneinfo\", this step may require a few seconds" - "${EROOT}/usr/bin/mysql" \ - "--socket=${socket}" \ - -hlocalhost \ - -uroot \ - --password="${MYSQL_ROOT_PASSWORD}" \ - mysql < "${sqltmp}" - rc=$? - eend $? - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" - fi - - # Stop the server and cleanup - einfo "Stopping the server ..." - kill $(< "${pidfile}" ) - rm -f "${sqltmp}" - wait %1 - einfo "Done" -} diff --git a/dev-db/mariadb/mariadb-10.2.16.ebuild b/dev-db/mariadb/mariadb-10.2.16.ebuild index 6e8b31cdccb1..cd2563db8cc8 100644 --- a/dev-db/mariadb/mariadb-10.2.16.ebuild +++ b/dev-db/mariadb/mariadb-10.2.16.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 EAPI="6" -MY_EXTRAS_VER="20180515-1334Z" +MY_EXTRAS_VER="20180809-1700Z" SUBSLOT="18" JAVA_PKG_OPT_USE="jdbc" @@ -260,7 +260,6 @@ src_unpack() { } src_prepare() { - java-pkg-opt-2_src_prepare if use tcmalloc; then echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" fi @@ -279,6 +278,7 @@ src_prepare() { fi cmake-utils_src_prepare + java-pkg-opt-2_src_prepare } src_configure(){ @@ -622,6 +622,10 @@ multilib_src_install_all() { for script in "${S}"/scripts/mysql* ; do [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" fi #Remove mytop if perl is not selected diff --git a/dev-db/mariadb/mariadb-10.3.6_rc.ebuild b/dev-db/mariadb/mariadb-10.3.6_rc.ebuild deleted file mode 100644 index 57430a63fa37..000000000000 --- a/dev-db/mariadb/mariadb-10.3.6_rc.ebuild +++ /dev/null @@ -1,1022 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI="6" -MY_EXTRAS_VER="20180515-1334Z" -SUBSLOT="18" - -JAVA_PKG_OPT_USE="jdbc" - -# Keeping eutils in EAPI=6 for emktemp in pkg_config - -inherit eutils systemd flag-o-matic prefix toolchain-funcs \ - java-pkg-opt-2 user cmake-utils multilib-minimal - -SRC_URI="https://downloads.mariadb.org/interstitial/${P/_rc/}/source/${P/_rc/}.tar.gz " - -# Gentoo patches to MySQL -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then - SRC_URI="${SRC_URI} - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" -fi - -HOMEPAGE="https://mariadb.org/" -DESCRIPTION="An enhanced, drop-in replacement for MySQL" -LICENSE="GPL-2 LGPL-2.1+" -SLOT="0/${SUBSLOT:-0}" -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx - sst-rsync sst-mariabackup sst-xtrabackup static static-libs systemd systemtap tcmalloc - test tokudb xml yassl" - -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests -RESTRICT="!bindist? ( bindist ) libressl? ( test )" - -REQUIRED_USE="jdbc? ( extraengine server !static ) - server? ( tokudb? ( jemalloc !tcmalloc ) ) - !server? ( !extraengine ) - ?? ( tcmalloc jemalloc ) - static? ( yassl !pam )" - -# REMEMBER: also update eclass/mysql*.eclass before committing! -KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" - -# Shorten the path because the socket path length must be shorter than 107 chars -# and we will run a mysql server during test phase -S="${WORKDIR}/mysql" - -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then - inherit git-r3 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" - EGIT_CLONE_TYPE=shallow - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" -else - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" -fi - -PATCHES=( - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch - "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.9-without-clientlibs-tools.patch - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch - "${MY_PATCH_DIR}"/20035_all_mariadb-10.3-atomic-detection.patch -) - -# Be warned, *DEPEND are version-dependant -# These are used for both runtime and compiletime -# MULTILIB_USEDEP only set for libraries used by the client library -COMMON_DEPEND=" - kernel_linux? ( - sys-process/procps:0= - dev-libs/libaio:0= - ) - >=sys-apps/sed-4 - >=sys-apps/texinfo-4.7-r1 - jemalloc? ( dev-libs/jemalloc:0= ) - tcmalloc? ( dev-util/google-perftools:0= ) - systemtap? ( >=dev-util/systemtap-1.3:0= ) - client-libs? ( - >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] - kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] ) - yassl? ( net-libs/gnutls:0=[${MULTILIB_USEDEP},static-libs?] ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] ) - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] ) - ) - ) - !client-libs? ( - >=sys-libs/zlib-1.2.3:0= - kerberos? ( virtual/krb5 ) - yassl? ( net-libs/gnutls:0= ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - ) - sys-libs/ncurses:0= - !bindist? ( - sys-libs/binutils-libs:0= - >=sys-libs/readline-4.1:0= - ) - server? ( - backup? ( app-arch/libarchive:0= ) - cracklib? ( sys-libs/cracklib:0= ) - extraengine? ( - odbc? ( dev-db/unixODBC:0= ) - xml? ( dev-libs/libxml2:2= ) - ) - innodb-lz4? ( app-arch/lz4 ) - innodb-lzo? ( dev-libs/lzo ) - innodb-snappy? ( app-arch/snappy ) - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) - numa? ( sys-process/numactl ) - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) - pam? ( virtual/pam:0= ) - systemd? ( sys-apps/systemd:= ) - tokudb? ( app-arch/snappy ) - ) - >=dev-libs/libpcre-8.41-r1:3= -" -DEPEND="virtual/yacc - static? ( sys-libs/ncurses[static-libs] ) - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) - ${COMMON_DEPEND}" -RDEPEND="selinux? ( sec-policy/selinux-mysql ) - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster - server? ( !prefix? ( dev-db/mysql-init-scripts ) ) - !=virtual/jre-1.6 ) ) ) -" -# For other stuff to bring us in -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) - !client-libs? ( dev-db/mariadb-connector-c[${MULTILIB_USEDEP}] dev-db/mysql-connector-c[${MULTILIB_USEDEP}] ) - server? ( ~virtual/mysql-5.6[static=] - galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )" - -pkg_setup() { - if [[ ${MERGE_TYPE} != binary ]] ; then - local GCC_MAJOR_SET=$(gcc-major-version) - local GCC_MINOR_SET=$(gcc-minor-version) - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on - # non x86{,_64} arches - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - fi - java-pkg-opt-2_pkg_setup - if has test ${FEATURES} && \ - use server && ! has userpriv ${FEATURES} ; then - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - - # This should come after all of the die statements - enewgroup mysql 60 || die "problem adding 'mysql' group" - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" -} - -pkg_preinst() { - java-pkg-opt-2_pkg_preinst - - # Here we need to see if the implementation switched client libraries - # We check if this is a new instance of the package and a client library already exists - local SHOW_ABI_MESSAGE libpath - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") - elog "Due to ABI changes when switching between different client libraries," - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." - elog "Please run: revdep-rebuild --library ${libpath}" - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" - fi -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" - - if use server ; then - if use pam; then - einfo - elog "This install includes the PAM authentication plugin." - elog "To activate and configure the PAM plugin, please read:" - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" - einfo - fi - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog "\"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - elog - elog "If you are switching server implentations, you should run the" - elog "mysql_upgrade tool." - einfo - else - einfo - elog "If you are upgrading major versions, you should run the" - elog "mysql_upgrade tool." - einfo - fi - - if use galera ; then - einfo - elog "Be sure to edit the my.cnf file to activate your cluster settings." - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" - elog "The first time the cluster is activated, you should add" - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." - elog "This option should then be removed for subsequent starts." - einfo - fi - fi - - # Note about configuration change - einfo - elog "This version of mariadb reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/${PN}.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." - elog "You may have as many files as needed and they are read alphabetically." - elog "Be sure the options have the appropitate section headers, i.e. [mysqld]." - einfo -} - -src_unpack() { - - # Initialize the proper variables first - mysql_init_vars - - unpack ${A} - # Grab the patches - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack - - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die -} - -src_prepare() { - java-pkg-opt-2_src_prepare - if use tcmalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - # Don't build bundled xz-utils for tokudb - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die - - # Remove the bundled groonga - # There is no CMake flag, it simply checks for existance - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" - - if ! use server; then - rm -r "${S}"/plugin/handler_socket || die - fi - - cmake-utils_src_prepare -} - -src_configure(){ - # bug 508724 mariadb cannot use ld.gold - tc-ld-disable-gold - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - append-cxxflags -felide-constructors - - # bug #283926, with GCC4.4, this is required to get correct behavior. - append-flags -fno-strict-aliasing - - if use client-libs ; then - multilib-minimal_src_configure - else - multilib_src_configure - fi -} - -multilib_src_configure() { - debug-print-function ${FUNCNAME} "$@" - - if ! multilib_is_native_abi && ! use client-libs ; then - return - fi - - CMAKE_BUILD_TYPE="RelWithDebInfo" - - # debug hack wrt #497532 - mycmakeargs=( - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" - -DSYSCONFDIR="${EPREFIX}/etc/mysql" - -DINSTALL_BINDIR=bin - -DINSTALL_DOCDIR=share/doc/${PF} - -DINSTALL_DOCREADMEDIR=share/doc/${PF} - -DINSTALL_INCLUDEDIR=include/mysql - -DINSTALL_INFODIR=share/info - -DINSTALL_LIBDIR=$(get_libdir) - -DINSTALL_MANDIR=share/man - -DINSTALL_MYSQLSHAREDIR=share/mariadb - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin - -DINSTALL_SCRIPTDIR=share/mariadb/scripts - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_SBINDIR=sbin - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" - -DWITH_COMMENT="Gentoo Linux ${PF}" - -DWITH_UNIT_TESTS=$(usex test ON OFF) - -DWITH_LIBEDIT=0 - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - -DENABLED_LOCAL_INFILE=1 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DWITH_DEFAULT_COMPILER_OPTIONS=0 - -DWITH_DEFAULT_FEATURE_SET=0 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" - -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF) - # The build forces this to be defined when cross-compiling. We pass it - # all the time for simplicity and to make sure it is actually correct. - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) - -DCONC_WITH_EXTERNAL_ZLIB=YES - -DWITH_EXTERNAL_ZLIB=YES - -DSUFFIX_INSTALL_DIR="" - -DWITH_UNITTEST=OFF - ) - if use test ; then - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) - else - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) - fi - - if ! use yassl ; then - mycmakeargs+=( -DWITH_SSL=system ) - else - mycmakeargs+=( -DWITH_SSL=bundled ) - fi - - if ! use client-libs ; then - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) - fi - - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION - # systemtap only works on native ABI bug 530132 - if multilib_is_native_abi; then - mycmakeargs+=( - -DWITH_READLINE=$(usex bindist 1 0) - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) - -DENABLE_DTRACE=$(usex systemtap) - ) - else - mycmakeargs+=( - -DWITHOUT_TOOLS=1 - -DWITH_READLINE=1 - -DNOT_FOR_DISTRIBUTION=0 - -DENABLE_DTRACE=0 - ) - fi - - if multilib_is_native_abi && use server ; then - - # Federated{,X} must be treated special otherwise they will not be built as plugins - if ! use extraengine ; then - mycmakeargs+=( - -DPLUGIN_FEDERATED=NO - -DPLUGIN_FEDERATEDX=NO ) - fi - - mycmakeargs+=( - -DWITH_JEMALLOC=$(usex jemalloc system) - -DWITH_PCRE=system - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) - -DPLUGIN_SPHINX=$(usex sphinx YES NO) - -DPLUGIN_TOKUDB=$(usex tokudb YES NO) - -DPLUGIN_AUTH_PAM=$(usex pam YES NO) - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) - -DPLUGIN_CASSANDRA=NO - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) - -DPLUGIN_SPIDER=$(usex extraengine YES NO) - -DPLUGIN_CONNECT=$(usex extraengine YES NO) - -DCONNECT_WITH_MYSQL=1 - -DCONNECT_WITH_LIBXML2=$(usex xml) - -DCONNECT_WITH_ODBC=$(usex odbc) - -DCONNECT_WITH_JDBC=$(usex jdbc) - # Build failure and autodep wrt bug 639144 - -DCONNECT_WITH_MONGO=OFF - -DWITH_WSREP=$(usex galera) - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DWITH_MARIABACKUP=$(usex backup ON OFF) - -DWITH_LIBARCHIVE=$(usex backup ON OFF) - -DINSTALL_SQLBENCHDIR=share/mariadb - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) - # systemd is only linked to for server notification - -DWITH_SYSTEMD=$(usex systemd yes no) - -DWITH_NUMA=$(usex numa ON OFF) - ) - - # Workaround for MDEV-14524 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) - - if use test ; then - # This is needed for the new client lib which tests a real, open server - mycmakeargs+=( -DSKIP_TESTS=ON ) - fi - - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." - ewarn "You MUST file bugs without these variables set." - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - - elif ! use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8 - -DDEFAULT_COLLATION=utf8_general_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - fi - mycmakeargs+=( - -DEXTRA_CHARSETS=all - -DMYSQL_USER=mysql - -DDISABLE_SHARED=$(usex static YES NO) - -DWITH_DEBUG=$(usex debug) - -DWITH_EMBEDDED_SERVER=OFF - -DWITH_PROFILING=$(usex profiling) - ) - - if use static; then - mycmakeargs+=( -DWITH_PIC=1 ) - fi - - if use jemalloc || use tcmalloc ; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - -DWITH_PARTITION_STORAGE_ENGINE=1 - ) - - else - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITH_EMBEDDED_SERVER=OFF - -DEXTRA_CHARSETS=none - -DINSTALL_SQLBENCHDIR= - -DWITH_SYSTEMD=no - ) - fi - - cmake-utils_src_configure -} - -src_compile() { - if use client-libs ; then - multilib-minimal_src_compile - else - multilib_src_compile - fi -} - -multilib_src_compile() { - cmake-utils_src_compile -} - -src_install() { - local MULTILIB_WRAPPED_HEADERS - local MULTILIB_CHOST_TOOLS - if use client-libs ; then - # headers with ABI specific data - MULTILIB_WRAPPED_HEADERS=( - /usr/include/mysql/server/my_config.h - /usr/include/mysql/server/private/embedded_priv.h - /usr/include/mysql/server/mysql_version.h - /usr/include/mariadb/mariadb_version.h - /usr/include/mysql/mariadb_version.h - /usr/include/mysql/server/private/probes_mysql_nodtrace.h - /usr/include/mysql/server/private/probes_mysql_dtrace.h ) - - # wrap the config scripts - MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config ) - multilib-minimal_src_install - else - multilib_src_install - multilib_src_install_all - fi -} - -# Intentionally override eclass function -multilib_src_install() { - - cmake-utils_src_install - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then - rm "${ED}/usr/include/mysql/server/private/config.h" || die - fi - - if ! multilib_is_native_abi && use server ; then - insinto /usr/include/mysql/server/private - doins "${S}"/sql/*.h - fi - - if use client-libs ; then - # Install compatible symlinks to libmysqlclient -# use static-libs && dosym libmariadbclient.a "/usr/$(get_libdir)/libmysqlclient.a" -# dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so" - dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}" - fi - - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die -} - -multilib_src_install_all() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Convenience links - einfo "Making Convenience links for mysqlcheck multi-call binary" - dosym "mysqlcheck" "/usr/bin/mysqlanalyze" - dosym "mysqlcheck" "/usr/bin/mysqlrepair" - dosym "mysqlcheck" "/usr/bin/mysqloptimize" - - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir - if [[ -d "${ED}/usr/data" ]] ; then - rm -Rf "${ED}/usr/data" || die - fi - - # Unless they explicitly specific USE=test, then do not install the - # testsuite. It DOES have a use to be installed, esp. when you want to do a - # validation of your database configuration after tuning it. - if ! use test ; then - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" - fi - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#${EPREFIX}}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - if use server ; then - mycnf_src="my.cnf.distro-server" - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ - "${FILESDIR}/${mycnf_src}" \ - > "${TMPDIR}/my.cnf.ok" || die - if use prefix ; then - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ - "${TMPDIR}/my.cnf.ok" || die - fi - if use latin1 ; then - sed -i \ - -e "/character-set/s|utf8|latin1|g" \ - "${TMPDIR}/my.cnf.ok" || die - fi - eprefixify "${TMPDIR}/my.cnf.ok" - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - einfo "Including support files and sample configurations" - docinto "support-files" - local script - for script in \ - "${S}"/support-files/magic - do - [[ -f "$script" ]] && dodoc "${script}" - done - - docinto "scripts" - for script in "${S}"/scripts/mysql* ; do - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" - done - fi - - #Remove mytop if perl is not selected - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" -} - -# Official test instructions: -# USE='extraengine perl server static-libs' \ -# FEATURES='test userpriv -usersandbox' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -src_test() { - - _disable_test() { - local rawtestname reason - rawtestname="${1}" ; shift - reason="${@}" - ewarn "test '${rawtestname}' disabled: '${reason}'" - echo ${rawtestname} : ${reason} >> "${T}/disabled.def" - } - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - if ! use server ; then - einfo "Skipping server tests due to minimal build." - return 0 - fi - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ $UID -eq 0 ]]; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - - # Run CTest (test-units) - cmake-utils_src_test - retstatus_unit=$? - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - # Enable parallel testing, auto will try to detect number of cores - # You may set this by hand. - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased - export MTR_PARALLEL="${MTR_PARALLEL:-auto}" - - # create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - # Run mysql tests - pushd "${TESTDIR}" > /dev/null || die - - touch "${T}/disabled.def" - # These are failing in MariaDB 10.0 for now and are believed to be - # false positives: - # - # main.mysql_client_test, main.mysql_client_test_nonblock - # main.mysql_client_test_comp: - # segfaults at random under Portage only, suspect resource limits. - - local t - for t in plugins.cracklib_password_check plugins.two_password_validations ; do - _disable_test "$t" "False positive due to varying policies" - done - - for t in main.mysql_client_test main.mysql_client_test_nonblock \ - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do - _disable_test "$t" "False positives in Gentoo" - done - - if ! use client-libs ; then - _disable_test main.plugin_auth "Needs client libraries built" - fi - - # run mysql-test tests - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" - retstatus_tests=$? - - popd > /dev/null || die - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - local failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" -} - -mysql_init_vars() { - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="" - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1` - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ - | sed -e 's/.*=\s*//' \ - | tail -n1` - fi - fi - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="${MY_LOCALSTATEDIR}" - einfo "Using default MY_DATADIR" - fi - elog "MySQL MY_DATADIR is ${MY_DATADIR}" - - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then - if [[ -e "${MY_DATADIR}" ]] ; then - # If you get this and you're wondering about it, see bug #207636 - elog "MySQL datadir found in ${MY_DATADIR}" - elog "A new one will not be created." - PREVIOUS_DATADIR="yes" - else - PREVIOUS_DATADIR="no" - fi - export PREVIOUS_DATADIR - fi - else - if [[ ${EBUILD_PHASE} == "config" ]]; then - local new_MY_DATADIR - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1` - - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then - ewarn "MySQL MY_DATADIR has changed" - ewarn "from ${MY_DATADIR}" - ewarn "to ${new_MY_DATADIR}" - MY_DATADIR="${new_MY_DATADIR}" - fi - fi - fi - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_config() { - _getoptval() { - local mypd="${EROOT}"/usr/bin/my_print_defaults - local section="$1" - local flag="--${2}=" - local extra_options="${3}" - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" - } - local old_MY_DATADIR="${MY_DATADIR}" - local old_HOME="${HOME}" - # my_print_defaults needs to read stuff in $HOME/.my.cnf - export HOME=${EPREFIX}/root - - # Make sure the vars are correctly initialized - mysql_init_vars - - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then - die "Minimal builds do NOT include the MySQL server" - fi - - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" - MY_DATADIR_s="${MY_DATADIR_s%%/}" - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" - - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then - if [[ -d "${MY_DATADIR_s}" ]]; then - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" - else - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ - || die "Moving MY_DATADIR failed" - fi - else - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" - if [[ -d "${MY_DATADIR_s}" ]]; then - ewarn "Attempting to use ${MY_DATADIR_s}" - else - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" - fi - fi - fi - - local pwd1="a" - local pwd2="b" - local maxtry=15 - - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then - local tmp_mysqld_password_source= - - for tmp_mysqld_password_source in mysql client; do - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" - MYSQL_ROOT_PASSWORD= - continue - fi - - einfo "Found password in '${tmp_mysqld_password_source}' section!" - break - fi - done - - # Sometimes --show is required to display passwords in some implementations of my_print_defaults - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" - fi - - unset tmp_mysqld_password_source - fi - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" - # These are dir+prefix - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" - fi - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" - fi - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" - fi - - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then - ewarn "You have already a MySQL database in place." - ewarn "(${ROOT}/${MY_DATADIR}/*)" - ewarn "Please rename or delete it if you wish to replace it." - die "MySQL database already exists!" - fi - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then - - einfo "Please provide a password for the mysql 'root' user now" - einfo "or through the ${HOME}/.my.cnf file." - ewarn "Avoid [\"'\\_%] characters in the password" - read -rsp " >" pwd1 ; echo - - einfo "Retype the password" - read -rsp " >" pwd2 ; echo - - if [[ "x$pwd1" != "x$pwd2" ]] ; then - die "Passwords are not the same" - fi - MYSQL_ROOT_PASSWORD="${pwd1}" - unset pwd1 pwd2 - fi - - local options - local sqltmp="$(emktemp)" - - # Fix bug 446200. Don't reference host my.cnf, needs to come first, - # see https://bugs.mysql.com/bug.php?id=31312 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" - - # Figure out which options we need to disable to do the setup - local helpfile="${TMPDIR}/mysqld-help" - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null - for opt in grant-tables host-cache name-resolve networking slave-start \ - federated ssl log-bin relay-log slow-query-log external-locking \ - log-slave-updates \ - ; do - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" - done - - einfo "Creating the mysql database and setting proper permissions on it ..." - - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it - PID_DIR="${EROOT}/var/run/mysqld" - if [[ ! -d "${PID_DIR}" ]]; then - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" - fi - - if [[ ! -d "${MY_DATADIR}" ]]; then - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" - fi - - pushd "${TMPDIR}" &>/dev/null || die - - # Filling timezones, see - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null - - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) - einfo "Command: ${cmd[*]}" - su -s /bin/sh -c "${cmd[*]}" mysql \ - >"${TMPDIR}"/mysql_install_db.log 2>&1 - if [ $? -ne 0 ]; then - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" - fi - popd &>/dev/null || die - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ - || die "MySQL databases not installed" - - use prefix || options="${options} --user=mysql" - - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" - local mysqld="${EROOT}/usr/sbin/mysqld \ - ${options} \ - --log-warnings=0 \ - --basedir=${EROOT}/usr \ - --datadir=${ROOT}/${MY_DATADIR} \ - --max_allowed_packet=8M \ - --net_buffer_length=16K \ - --socket=${socket} \ - --pid-file=${pidfile} - --tmpdir=${ROOT}/${MYSQL_TMPDIR}" - #einfo "About to start mysqld: ${mysqld}" - ebegin "Starting mysqld" - einfo "Command ${mysqld}" - ${mysqld} & - rc=$? - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - eend $rc - - if ! [[ -S "${socket}" ]]; then - die "Completely failed to start up mysqld with: ${mysqld}" - fi - - ebegin "Setting root password" - # Do this from memory, as we don't want clear text passwords in temp files - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" - "${EROOT}/usr/bin/mysql" \ - "--socket=${socket}" \ - -hlocalhost \ - -e "${sql}" - eend $? - - if [[ -n "${sqltmp}" ]] ; then - ebegin "Loading \"zoneinfo\", this step may require a few seconds" - "${EROOT}/usr/bin/mysql" \ - "--socket=${socket}" \ - -hlocalhost \ - -uroot \ - --password="${MYSQL_ROOT_PASSWORD}" \ - mysql < "${sqltmp}" - rc=$? - eend $? - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" - fi - - # Stop the server and cleanup - einfo "Stopping the server ..." - kill $(< "${pidfile}" ) - rm -f "${sqltmp}" - wait %1 - einfo "Done" -} diff --git a/dev-db/mariadb/mariadb-10.3.8.ebuild b/dev-db/mariadb/mariadb-10.3.8.ebuild index 2f13d5760854..f54bef478b0e 100644 --- a/dev-db/mariadb/mariadb-10.3.8.ebuild +++ b/dev-db/mariadb/mariadb-10.3.8.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 EAPI="6" -MY_EXTRAS_VER="20180529-0042Z" +MY_EXTRAS_VER="20180809-1700Z" SUBSLOT="18" JAVA_PKG_OPT_USE="jdbc" @@ -262,7 +262,6 @@ src_prepare() { echo > "${S%/}/storage/${1}/CMakeLists.txt" || die } - java-pkg-opt-2_src_prepare if use tcmalloc; then echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" fi @@ -305,6 +304,7 @@ src_prepare() { fi cmake-utils_src_prepare + java-pkg-opt-2_src_prepare } src_configure(){ @@ -573,6 +573,10 @@ src_install() { for script in "${S}"/scripts/mysql* ; do [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" fi #Remove mytop if perl is not selected diff --git a/dev-db/mariadb/mariadb-5.5.60.ebuild b/dev-db/mariadb/mariadb-5.5.60.ebuild deleted file mode 100644 index 84fdbafdf4a2..000000000000 --- a/dev-db/mariadb/mariadb-5.5.60.ebuild +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI="5" -MY_EXTRAS_VER="20160721-1526Z" - -# Build system -BUILD="cmake" - -inherit toolchain-funcs mysql-v2 -# only to make repoman happy. it is really set in the eclass -IUSE="$IUSE" - -# REMEMBER: also update eclass/mysql*.eclass before committing! -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" - -# When MY_EXTRAS is bumped, the index should be revised to exclude these. -EPATCH_EXCLUDE='' - -DEPEND="|| ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) - ssl? ( !>=dev-libs/openssl-1.1 )" -RDEPEND="${RDEPEND}" -SLOT="0/18" - -# Please do not add a naive src_unpack to this ebuild -# If you want to add a single patch, copy the ebuild to an overlay -# and create your own mysql-extras tarball, looking at 000_index.txt - -# Official test instructions: -# USE='extraengine perl ssl static-libs community' \ -# FEATURES='test userpriv -usersandbox' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -src_test() { - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if ! use "minimal" ; then - - if [[ $UID -eq 0 ]]; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox" - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - addpredict /this-dir-does-not-exist/t9.MYI - - # Run CTest (test-units) - cmake-utils_src_test - retstatus_unit=$? - [[ $retstatus_unit -eq 0 ]] || eerror "test-unit failed" - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - # Enable parallel testing, auto will try to detect number of cores - # You may set this by hand. - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased - export MTR_PARALLEL="${MTR_PARALLEL:-auto}" - - # create directories because mysqladmin might right out of order - mkdir -p "${T}"/var-tests{,/log} - - # create symlink for the tests to find the replace util - ln -s "${BUILD_DIR}/extra/replace" "${BUILD_DIR}/client/" - - # These are failing in MariaDB 5.5 for now and are believed to be - # false positives: - # - # main.information_schema, binlog.binlog_statement_insert_delayed, - # main.mysqld--help, funcs_1.is_triggers, funcs_1.is_tables_mysql, - # funcs_1.is_columns_mysql - # fails due to USE=-latin1 / utf8 default - # - # main.mysql_client_test, main.mysql_client_test_nonblock: - # segfaults at random under Portage only, suspect resource limits. - # - # archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam - # fails due to bad cleanup of previous tests when run in parallel - # The tool is deprecated anyway - # Bug 532288 - - for t in main.mysql_client_test main.mysql_client_test_nonblock \ - binlog.binlog_statement_insert_delayed main.information_schema \ - main.mysqld--help \ - archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam \ - funcs_1.is_triggers funcs_1.is_tables_mysql funcs_1.is_columns_mysql ; do - mysql-v2_disable_test "$t" "False positives in Gentoo" - done - - # Run mysql tests - pushd "${TESTDIR}" - - # run mysql-test tests - perl mysql-test-run.pl --force --vardir="${T}/var-tests" \ - --testcase-timeout=30 - retstatus_tests=$? - [[ $retstatus_tests -eq 0 ]] || eerror "tests failed" - has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox" - - popd - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" - - else - - einfo "Skipping server tests due to minimal build." - fi -} diff --git a/dev-db/mariadb/mariadb-5.5.61.ebuild b/dev-db/mariadb/mariadb-5.5.61.ebuild new file mode 100644 index 000000000000..f12dcc5d57c9 --- /dev/null +++ b/dev-db/mariadb/mariadb-5.5.61.ebuild @@ -0,0 +1,831 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" +MY_EXTRAS_VER="20180809-1700Z" +SUBSLOT="18" + +# Keeping eutils in EAPI=6 for emktemp in pkg_config + +inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build + +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " + +# Gentoo patches to MySQL +if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then + SRC_URI="${SRC_URI} + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" +fi + +HOMEPAGE="https://mariadb.org/" +DESCRIPTION="An enhanced, drop-in replacement for MySQL" +LICENSE="GPL-2" +SLOT="0/${SUBSLOT:-0}" +IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl + oqgraph pam +perl profiling selinux +server sphinx + static static-libs systemtap tcmalloc + test tokudb yassl" + +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests +RESTRICT="!bindist? ( bindist ) libressl? ( test )" + +REQUIRED_USE="server? ( tokudb? ( jemalloc !tcmalloc ) ) + ?? ( tcmalloc jemalloc ) + static? ( yassl !pam )" + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" + inherit git-r3 + EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" + EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" + EGIT_CLONE_TYPE=shallow +else + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" +fi + +PATCHES=( + "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch" + "${MY_PATCH_DIR}/20004_all_mariadb-filter-tokudb-flags.patch" + "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-5.5.50.patch" + "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch" + "${MY_PATCH_DIR}/20018_all_mariadb-5.5.60-without-clientlibs-tools.patch" +) + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +COMMON_DEPEND=" + kernel_linux? ( + sys-process/procps:0= + dev-libs/libaio:0= + ) + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + jemalloc? ( dev-libs/jemalloc:0= ) + tcmalloc? ( dev-util/google-perftools:0= ) + systemtap? ( >=dev-util/systemtap-1.3:0= ) + !yassl? ( + !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 ) + libressl? ( dev-libs/libressl:0= ) + ) + >=sys-libs/zlib-1.2.3:0= + sys-libs/ncurses:0= + !bindist? ( + >=sys-libs/readline-4.1:0= + ) + server? ( + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) + pam? ( virtual/pam:0= ) + ) + !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) +" +DEPEND="virtual/yacc + static? ( sys-libs/ncurses[static-libs] ) + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) + ${COMMON_DEPEND}" +RDEPEND="selinux? ( sec-policy/selinux-mysql ) + client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster + server? ( !prefix? ( dev-db/mysql-init-scripts ) ) + ${COMMON_DEPEND} + perl? ( !dev-db/mytop + virtual/perl-Getopt-Long + dev-perl/TermReadKey + virtual/perl-Term-ANSIColor + virtual/perl-Time-HiRes ) +" +# For other stuff to bring us in +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + local GCC_MAJOR_SET=$(gcc-major-version) + local GCC_MINOR_SET=$(gcc-minor-version) + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on + # non x86{,_64} arches + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + fi + if has test ${FEATURES} && \ + use server && ! has userpriv ${FEATURES} ; then + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + + # This should come after all of the die statements + enewgroup mysql 60 || die "problem adding 'mysql' group" + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" + + if use server ; then + if use pam; then + einfo + elog "This install includes the PAM authentication plugin." + elog "To activate and configure the PAM plugin, please read:" + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" + einfo + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + elog + elog "If you are switching server implentations, you should run the" + elog "mysql_upgrade tool." + einfo + else + einfo + elog "If you are upgrading major versions, you should run the" + elog "mysql_upgrade tool." + einfo + fi + + einfo + elog "Be sure to edit the my.cnf file to activate your cluster settings." + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" + elog "The first time the cluster is activated, you should add" + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." + elog "This option should then be removed for subsequent starts." + einfo + fi +} + +src_unpack() { + unpack ${A} + # Grab the patches + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack + + mv -f "${WORKDIR%/}/${P}" "${S}" || die +} + +src_prepare() { + _disable_engine() { + echo > "${S%/}/storage/${1}/CMakeLists.txt" || die + } + + _disable_plugin() { + echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die + } + + if use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die + fi + + # Don't build bundled xz-utils for tokudb + echo > "${S%/}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die + sed -i -e 's/ build_lzma//' "${S%/}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/ft-index/portability/CMakeLists.txt" || die + + local plugin + local server_plugins=( handler_socket auth_socket feedback qc_info server_audit semisync sql_errlog ) + local test_plugins=( audit_null auth_examples daemon_example fulltext ) + if ! use server; then # These plugins are for the server + for plugin in "${server_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + if ! use test; then # These plugins are only used during testing + for plugin in "${test_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + # Collides with mariadb-connector-c bug 655980 + _disable_plugin auth_dialog + + # Don't build example + _disable_engine example + + if ! use oqgraph ; then # avoids extra library checks + _disable_engine oqgraph + fi + + cmake-utils_src_prepare +} + +src_configure(){ + # bug 508724 mariadb cannot use ld.gold + tc-ld-disable-gold + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + append-cxxflags -felide-constructors + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + CMAKE_BUILD_TYPE="RelWithDebInfo" + + # debug hack wrt #497532 + mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" + -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql" + -DINSTALL_BINDIR=bin + -DINSTALL_DOCDIR=share/doc/${PF} + -DINSTALL_DOCREADMEDIR=share/doc/${PF} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_LIBDIR=$(get_libdir) + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mariadb + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin + -DINSTALL_SCRIPTDIR=share/mariadb/scripts + -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb" + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + -DWITH_ZLIB=system + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" + -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" + # The build forces this to be defined when cross-compiling. We pass it + # all the time for simplicity and to make sure it is actually correct. + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) + -DWITHOUT_CLIENTLIBS=YES + -DWITH_READLINE=$(usex bindist 1 0) + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) + -DENABLE_DTRACE=$(usex systemtap) + ) + if use test ; then + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) + else + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) + fi + + if ! use yassl ; then + mycmakeargs+=( -DWITH_SSL=system ) + else + mycmakeargs+=( -DWITH_SSL=bundled ) + fi + + if use server ; then + + # Federated{,X} must be treated special otherwise they will not be built as plugins + if ! use extraengine ; then + mycmakeargs+=( + -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 + -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 ) + fi + + mycmakeargs+=( + -DWITH_JEMALLOC=$(usex jemalloc system) + -D$(usex sphinx WITH WITHOUT)_SPHINX_STORAGE_ENGINE=1 + -D$(usex tokudb WITH WITHOUT)_TOKUDB_STORAGE_ENGINE=1 + -D$(usex oqgraph WITH WITHOUT)_AUTH_PAM=1 + -DINSTALL_SQLBENCHDIR=share/mariadb + ) + + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + + elif ! use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + fi + mycmakeargs+=( + -DEXTRA_CHARSETS=all + -DDISABLE_SHARED=$(usex static YES NO) + -DWITH_EMBEDDED_SERVER=OFF + -DENABLED_PROFILING=$(usex profiling) + ) + + if use static; then + mycmakeargs+=( -DWITH_PIC=1 ) + fi + + if use jemalloc || use tcmalloc ; then + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + -DWITH_PARTITION_STORAGE_ENGINE=1 + ) + + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DEXTRA_CHARSETS=none + -DINSTALL_SQLBENCHDIR= + ) + fi + + cmake-utils_src_configure +} + +src_compile() { + cmake-utils_src_compile +} + +src_install() { + cmake-utils_src_install + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then + rm "${ED%/}/usr/include/mysql/server/private/config.h" || die + fi + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "mysqlcheck" "/usr/bin/mysqlrepair" + dosym "mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED%/}/usr/data" ]] ; then + rm -Rf "${ED%/}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf + local mycnf_src="my.cnf-5.5" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR%/}/${mycnf_src}" \ + > "${TMPDIR%/}/my.cnf.ok" || die + use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok" + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR%/}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR%/}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" my.cnf + + if use server ; then + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S%/}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S%/}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" + fi + + #Remove mytop if perl is not selected + [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop" +} + +# Official test instructions: +# USE='extraengine perl server' \ +# FEATURES='test userpriv -usersandbox' \ +# ebuild mariadb-X.X.XX.ebuild \ +# digest clean package +src_test() { + + _disable_test() { + local rawtestname reason + rawtestname="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}'" + echo ${rawtestname} : ${reason} >> "${T}/disabled.def" + } + + local TESTDIR="${BUILD_DIR}/mysql-test" + local retstatus_unit + local retstatus_tests + + if ! use server ; then + einfo "Skipping server tests due to minimal build." + return 0 + fi + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ $UID -eq 0 ]]; then + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" + + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + # Run CTest (test-units) + cmake-utils_src_test + retstatus_unit=$? + + # Ensure that parallel runs don't die + export MTR_BUILD_THREAD="$((${RANDOM} % 100))" + # Enable parallel testing, auto will try to detect number of cores + # You may set this by hand. + # The default maximum is 8 unless MTR_MAX_PARALLEL is increased + export MTR_PARALLEL="${MTR_PARALLEL:-auto}" + + # create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + # Run mysql tests + pushd "${TESTDIR}" > /dev/null || die + + touch "${T}/disabled.def" + # These are failing in MariaDB 5.5 for now and are believed to be + # false positives: + # + # main.information_schema, binlog.binlog_statement_insert_delayed, + # main.mysqld--help, funcs_1.is_triggers, funcs_1.is_tables_mysql, + # funcs_1.is_columns_mysql + # fails due to USE=-latin1 / utf8 default + # + # main.mysql_client_test, main.mysql_client_test_nonblock: + # segfaults at random under Portage only, suspect resource limits. + # + # archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam + # fails due to bad cleanup of previous tests when run in parallel + # The tool is deprecated anyway + # Bug 532288 + + local t + for t in main.mysql_client_test main.mysql_client_test_nonblock \ + binlog.binlog_statement_insert_delayed main.information_schema \ + main.mysqld--help \ + archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam \ + funcs_1.is_triggers funcs_1.is_tables_mysql funcs_1.is_columns_mysql ; do + _disable_test "$t" "False positives in Gentoo" + done + + if ! use client-libs ; then + _disable_test main.plugin_auth "Needs client libraries built" + fi + + # run mysql-test tests + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" + retstatus_tests=$? + + popd > /dev/null || die + + # Cleanup is important for these testcases. + pkill -9 -f "${S}/ndb" 2>/dev/null + pkill -9 -f "${S}/sql" 2>/dev/null + + local failures="" + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" + + [[ -z "$failures" ]] || die "Test failures: $failures" + einfo "Tests successfully completed" +} + +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1` + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_config() { + _getoptval() { + local mypd="${EROOT}"/usr/bin/my_print_defaults + local section="$1" + local flag="--${2}=" + local extra_options="${3}" + "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" + } + local old_MY_DATADIR="${MY_DATADIR}" + local old_HOME="${HOME}" + # my_print_defaults needs to read stuff in $HOME/.my.cnf + export HOME=${EPREFIX}/root + + # Make sure the vars are correctly initialized + mysql_init_vars + + [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" + if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then + die "Minimal builds do NOT include the MySQL server" + fi + + if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then + local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" + MY_DATADIR_s="${MY_DATADIR_s%%/}" + local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" + old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" + + if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" + ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" + else + elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" + mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ + || die "Moving MY_DATADIR failed" + fi + else + ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Attempting to use ${MY_DATADIR_s}" + else + eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" + die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" + fi + fi + fi + + local pwd1="a" + local pwd2="b" + local maxtry=15 + + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then + local tmp_mysqld_password_source= + + for tmp_mysqld_password_source in mysql client; do + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" + MYSQL_ROOT_PASSWORD= + continue + fi + + einfo "Found password in '${tmp_mysqld_password_source}' section!" + break + fi + done + + # Sometimes --show is required to display passwords in some implementations of my_print_defaults + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" + fi + + unset tmp_mysqld_password_source + fi + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" + # These are dir+prefix + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + + if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then + einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" + fi + if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then + einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" + fi + if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then + einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" + fi + + if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then + ewarn "You have already a MySQL database in place." + ewarn "(${ROOT}/${MY_DATADIR}/*)" + ewarn "Please rename or delete it if you wish to replace it." + die "MySQL database already exists!" + fi + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then + + einfo "Please provide a password for the mysql 'root' user now" + einfo "or through the ${HOME}/.my.cnf file." + ewarn "Avoid [\"'\\_%] characters in the password" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x$pwd1" != "x$pwd2" ]] ; then + die "Passwords are not the same" + fi + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 + fi + + local options + local sqltmp="$(emktemp)" + + # Fix bug 446200. Don't reference host my.cnf, needs to come first, + # see https://bugs.mysql.com/bug.php?id=31312 + use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" + + # Figure out which options we need to disable to do the setup + local helpfile="${TMPDIR}/mysqld-help" + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null + for opt in grant-tables host-cache name-resolve networking slave-start \ + federated ssl log-bin relay-log slow-query-log external-locking \ + log-slave-updates \ + ; do + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" + done + + einfo "Creating the mysql database and setting proper permissions on it ..." + + # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it + PID_DIR="${EROOT}/var/run/mysqld" + if [[ ! -d "${PID_DIR}" ]]; then + install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" + fi + + if [[ ! -d "${MY_DATADIR}" ]]; then + install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" + fi + + pushd "${TMPDIR}" &>/dev/null || die + + # Filling timezones, see + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null + + local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) + [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) + cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) + einfo "Command: ${cmd[*]}" + su -s /bin/sh -c "${cmd[*]}" mysql \ + >"${TMPDIR}"/mysql_install_db.log 2>&1 + if [ $? -ne 0 ]; then + grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 + die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" + fi + popd &>/dev/null || die + [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ + || die "MySQL databases not installed" + + use prefix || options="${options} --user=mysql" + + local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" + local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" + local mysqld="${EROOT}/usr/sbin/mysqld \ + ${options} \ + --log-warnings=0 \ + --basedir=${EROOT}/usr \ + --datadir=${ROOT}/${MY_DATADIR} \ + --max_allowed_packet=8M \ + --net_buffer_length=16K \ + --socket=${socket} \ + --pid-file=${pidfile} + --tmpdir=${ROOT}/${MYSQL_TMPDIR}" + #einfo "About to start mysqld: ${mysqld}" + ebegin "Starting mysqld" + einfo "Command ${mysqld}" + ${mysqld} & + rc=$? + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + eend $rc + + if ! [[ -S "${socket}" ]]; then + die "Completely failed to start up mysqld with: ${mysqld}" + fi + + ebegin "Setting root password" + # Do this from memory, as we don't want clear text passwords in temp files + local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" + "${EROOT}/usr/bin/mysql" \ + "--socket=${socket}" \ + -hlocalhost \ + -e "${sql}" + eend $? + + if [[ -n "${sqltmp}" ]] ; then + ebegin "Loading \"zoneinfo\", this step may require a few seconds" + "${EROOT}/usr/bin/mysql" \ + "--socket=${socket}" \ + -hlocalhost \ + -uroot \ + --password="${MYSQL_ROOT_PASSWORD}" \ + mysql < "${sqltmp}" + rc=$? + eend $? + [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" + fi + + # Stop the server and cleanup + einfo "Stopping the server ..." + kill $(< "${pidfile}" ) + rm -f "${sqltmp}" + wait %1 + einfo "Done" +} diff --git a/dev-db/mariadb/metadata.xml b/dev-db/mariadb/metadata.xml index dc1b8fcb633a..d17a7410d924 100644 --- a/dev-db/mariadb/metadata.xml +++ b/dev-db/mariadb/metadata.xml @@ -8,8 +8,6 @@ Build mariadb-backup which supports SST and hot backup of InnoDB, Aria and MyISAM including compression and encryption Build the client libraries from the server package instead of the C Connector packages - Add support for NDB clustering (deprecated) - Enables the community features from upstream. Build embedded server (libmysqld) Add support for alternative storage engines (Archive, CSV, Blackhole, Federated(X), Partition) Enables galera replication @@ -20,8 +18,6 @@ Use dev-libs/jemalloc for allocations. Use LATIN1 encoding instead of UTF8 Enable SSL connections and crypto functions using dev-libs/libressl - Raise the max index per table limit from 64 to 128 - Install client programs only, no server Add support for the Mroonga engine for interfacing with the Groonga text search Enable NUMA support using sys-process/numactl (NUMA kernel support is also required) Enable SSL connections and crypto functions using dev-libs/openssl diff --git a/dev-db/mongodb/Manifest b/dev-db/mongodb/Manifest index 7c164a92afc2..78535d502a3e 100644 --- a/dev-db/mongodb/Manifest +++ b/dev-db/mongodb/Manifest @@ -36,6 +36,7 @@ DIST mongodb-src-r3.6.4.tar.gz 40159916 BLAKE2B d3878d4e6bbf331de672768b2c92a4d7 DIST mongodb-src-r3.6.5.tar.gz 40310152 BLAKE2B 72110ae47b17ec8b1f60636a5ef8491b076e1cc019513fd872ea38b3bb8393efff4bddc7b795b3da711f258d21be9fa23e24d396a9429349c51ce05fff180a53 SHA512 6ecb3140ee4a7929fabe62d698f23e87cb5030cf31abefe7f82374f407fb87dc05f712089998f96bc40e23698836a86e7f3590892bde9d2d6f2c4bcc15cc3ebf DIST mongodb-src-r3.6.6.tar.gz 40391572 BLAKE2B 1cee1ad5431d2941cf2f0ee31290b2b5bc1c628f2cb5041d4d5a1427d342ecc3bbfb123e540581d81a1c5b018464abb9dcd1ead8df0de6a01a1462ca0c258e83 SHA512 cd91979ba29538c9e1645fe81e03ac56101b0fa8980ea2bdf89a4987ee8f7f6ddc97e2b27495500548a4424f155a1847471c7a5715beabf75ff894edf05c546b DIST mongodb-src-r4.0.0.tar.gz 49138467 BLAKE2B 616e267c737729103de544d82db60489e7a32c5f9847ffd2d643a9025c18aa867718216f5de9f18a93fb2a7930c3dbe9ec3850eef09dbec084570328a99f2865 SHA512 11d00cdde606cfea268471cffccedb6d003e421aeffda2303aff4d4126c386aaec50a1de733d7a1d5fb6605403cf9f2218dae50374c7b5e8625fa80317804589 +DIST mongodb-src-r4.0.1.tar.gz 49175057 BLAKE2B 69cd8268964200534d61493018044372f2991cedb027454c02023f5f54a0616b31c421d611ff2e67dfca87b99727cef5266a4279445a8693f8c676d0803553b3 SHA512 cfb0ec3227d976999f366ca15ddaa9379f90433dbd02bd16d001f0a7f986e84df697cbbd43674988b5d41a0b85445dcd0c4717cb406e05c1fbcd544088c859ea EBUILD mongodb-3.0.14.ebuild 4559 BLAKE2B e72ff73baaa3b6a5bb4bbb33f3153d2aeaa9458b6e7f48419f5fd0f9b7fe43dfbcd93bf0824555e688faa461839a8c3cb5e4d1a24219a395f1a245828d639777 SHA512 747424cae955229f6affd867961171d9ad3fe9c34553ddb94e034db76d4e389ba0c6dc47db23c291212b893b7377d1bfac52e79ae4ab1b9dfd8f4c89743e1a19 EBUILD mongodb-3.0.15.ebuild 4561 BLAKE2B 85e994c18b57a0278059eb0e2e141842b551a96e1a030b5d84e0bb4c1524bacff7ed1a1576093b0336ed042f8bcbf01d37ba725392c077a400fdefc2705ec2ab SHA512 d5b77ede0ab5d9fa814542e831ec93d5854f0aaa55930c5e445410d347787be96294a741f30089764ea23cdab52413d1d82c6796b3d7133796d28de95726e294 EBUILD mongodb-3.2.17.ebuild 5338 BLAKE2B fd327b1c5bb85e833782839e07b3379a103f0545fb9852cb06d7f6f0b3548b921dfce227d1882a1e448a533c043718c778e9141ec5715805a24c9e2fbf199fa1 SHA512 a439c32b20a81d1c8e199c8a6928aa75479562e6b33c0d7b50797181226a093f571a1caaab102569a9a308db18a73c51558657ccd4bcb1d7e137eb22fb363c4e @@ -50,4 +51,5 @@ EBUILD mongodb-3.6.4-r1.ebuild 4446 BLAKE2B 23e7edab8f84fac52f1dd5289017f6a27a61 EBUILD mongodb-3.6.5-r1.ebuild 4446 BLAKE2B 23e7edab8f84fac52f1dd5289017f6a27a6151deafd53cb8f0eccb229653704c780eda604bf3c08291d6cc7d20962d733c6b44e5ea659e0b5fb7e44ef8e0ed30 SHA512 70e7443ad7de93688bb58382f6a311500f580354111ce60f8bc0848862963e86be1d742fce95918f2fccce7583dc22e12940b1ca004e5f148fa0a72d512fe99a EBUILD mongodb-3.6.6.ebuild 4242 BLAKE2B 5310eccf90fe32fcd15ab0ec9b9b5aa07db79d61c9cd65ce38d082f7ece684dffd4a75cdabec383514036d6de507a3f653292b537a3acf1b3b9dc0a551e7d18d SHA512 7897c881140a41851da4453e039875d6ae43190f14b18bf2e262197888d5ccebdcb66df1f194677f34acee1239643fdc428b6e027e714c4840ead8f3d0325bfa EBUILD mongodb-4.0.0-r1.ebuild 4445 BLAKE2B b6e7e01a6fd89ac0db97172a6c8257232089b1bd2c22ef8c1e5d689827d8b9c4b4ba384b68b63e8bb3038a25d2592b3cd13e38bdf3930bfd962d57a7262fef4c SHA512 961fcccb68ae8364172471f985c46b8e4d04c57a9620661810587f7e069cf521c6c0f0a5c50e7d015cbef1ded0cdcb983890d0564c7f8a8706fe7c6e6cc44750 -MISC metadata.xml 1053 BLAKE2B f2104654da3600c3d10882bb600d9002c015c7fb5dcfc8bdb98ab1fcb06d384ead4af990d55d6596d4bd602e5c4e9978a11cc66382ee01bab006f817ba44bdc2 SHA512 9ab708e294e25487ceeeeac7500a64684c914e95aa593c3a1f06d845b6b629766a5b98d972bf0802f3713b89bd6c81e293fc45205604980164542442438b13a2 +EBUILD mongodb-4.0.1.ebuild 4243 BLAKE2B 6e04cbddaca9f1b8d43ff4976d3cec31f3508741cca67da8754d4b26c11f53d42d6ea67e614a6563ff237b48f39866375d6f93278247a86bb0cf814ca8b26e3d SHA512 b074cf554e7fcaaaebab2888e196189e25be230497e60a3964df863211cc5f1ea70c6d0510e0bbd8ce27d5743aa15f6c08c9ecacf9690f42435aceb9c7e36358 +MISC metadata.xml 835 BLAKE2B 6aaa10090846882c813db2fcbec27e9bb8d8ab5b34bbb0f5ac7b0de922606a6382be60f30a19502694022a38dc7c67f03b986d5cd1473e530ab4d05f5ee233a0 SHA512 8d190ebb08b6951c9c9ce39872c0c76b6236a0687980577eae7b2181c0bccacc60ccc67cccc4edc05aa21f4d9d65621eb57f803aab91c7ace6ab794559c9d08a diff --git a/dev-db/mongodb/metadata.xml b/dev-db/mongodb/metadata.xml index 9a81e6986392..32785d23917f 100644 --- a/dev-db/mongodb/metadata.xml +++ b/dev-db/mongodb/metadata.xml @@ -1,18 +1,10 @@ - - julien@thebault.co - Lujeni - ultrabug@gentoo.org Alexys Jacob - - proxy-maint@gentoo.org - Proxy Maintainers - MongoDB (from "humongous") is a scalable, high-performance, open source, schema-free, document-oriented database. Written in C++, MongoDB features: diff --git a/dev-db/mongodb/mongodb-4.0.1.ebuild b/dev-db/mongodb/mongodb-4.0.1.ebuild new file mode 100644 index 000000000000..142533eb1cfe --- /dev/null +++ b/dev-db/mongodb/mongodb-4.0.1.ebuild @@ -0,0 +1,164 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 ) + +SCONS_MIN_VERSION="2.5.0" +CHECKREQS_DISK_BUILD="2400M" +CHECKREQS_DISK_USR="512M" +CHECKREQS_MEMORY="1024M" + +inherit check-reqs eapi7-ver eutils flag-o-matic multilib multiprocessing pax-utils python-single-r1 scons-utils systemd toolchain-funcs user + +MY_P=${PN}-src-r${PV/_rc/-rc} + +DESCRIPTION="A high-performance, open source, schema-free document-oriented database" +HOMEPAGE="https://www.mongodb.com" +SRC_URI="https://fastdl.mongodb.org/src/${MY_P}.tar.gz" + +LICENSE="AGPL-3 Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" +IUSE="debug kerberos libressl mms-agent ssl test +tools" + +RDEPEND=">=app-arch/snappy-1.1.3 + >=dev-cpp/yaml-cpp-0.5.3 + >=dev-libs/boost-1.60:=[threads(+)] + >=dev-libs/libpcre-8.41[cxx] + dev-libs/snowball-stemmer + net-libs/libpcap + >=sys-libs/zlib-1.2.11:= + kerberos? ( dev-libs/cyrus-sasl[kerberos] ) + mms-agent? ( app-admin/mms-agent ) + ssl? ( + !libressl? ( >=dev-libs/openssl-1.0.1g:0= ) + libressl? ( dev-libs/libressl:0= ) + )" +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + dev-python/cheetah[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + virtual/python-typing[${PYTHON_USEDEP}] + dev-util/scons + sys-libs/ncurses:0= + sys-libs/readline:0= + debug? ( dev-util/valgrind ) + test? ( + dev-python/pymongo[${PYTHON_USEDEP}] + )" +PDEPEND="tools? ( >=app-admin/mongo-tools-${PV} )" + +PATCHES=( + "${FILESDIR}/${PN}-3.4.7-no-boost-check.patch" + "${FILESDIR}/${PN}-3.6.1-fix-scons.patch" + "${FILESDIR}/${PN}-4.0.0-no-compass.patch" +) + +S=${WORKDIR}/${MY_P} + +pkg_pretend() { + if [[ -n ${REPLACING_VERSIONS} ]]; then + if ver_test "$REPLACING_VERSIONS" -lt 3.6; then + ewarn "To upgrade from a version earlier than the 3.6-series, you must" + ewarn "successively upgrade major releases until you have upgraded" + ewarn "to 3.6-series. Then upgrade to 4.0 series." + else + ewarn "Be sure to set featureCompatibilityVersion to 3.6 before upgrading." + fi + fi +} + +pkg_setup() { + enewgroup mongodb + enewuser mongodb -1 -1 /var/lib/${PN} mongodb + + python-single-r1_pkg_setup +} + +src_prepare() { + default + + # remove bundled libs + rm -r src/third_party/{boost-*,pcre-*,scons-*,snappy-*,yaml-cpp-*,zlib-*} || die + + # remove compass + rm -r src/mongo/installer/compass || 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: + scons_opts=( + CC="$(tc-getCC)" + CXX="$(tc-getCXX)" + + --disable-warnings-as-errors + --use-system-boost + --use-system-pcre + --use-system-snappy + --use-system-stemmer + --use-system-yaml + --use-system-zlib + ) + + use debug && scons_opts+=( --dbg=on ) + use kerberos && scons_opts+=( --use-sasl-client ) + use ssl && scons_opts+=( --ssl ) + + # 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() { + "${EPYTHON}" ./buildscripts/resmoke.py --dbpathPrefix=test --suites core --jobs=$(makeopts_jobs) || die "Tests failed" +} + +src_install() { + escons "${scons_opts[@]}" --nostrip install --prefix="${ED}"/usr + + doman debian/mongo*.1 + dodoc README docs/building.md + + newinitd "${FILESDIR}/${PN}.initd-r3" ${PN} + newconfd "${FILESDIR}/${PN}.confd-r3" ${PN} + newinitd "${FILESDIR}/mongos.initd-r3" ${PN/db/s} + newconfd "${FILESDIR}/mongos.confd-r3" ${PN/db/s} + + insinto /etc + newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf + newins "${FILESDIR}/mongos.conf-r2" ${PN/db/s}.conf + + systemd_dounit "${FILESDIR}/${PN}.service" + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/${PN}.logrotate" ${PN} + + # see bug #526114 + pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos} + + local x + for x in /var/{lib,log}/${PN}; do + diropts -m0750 -o mongodb -g mongodb + keepdir "${x}" + done +} + +pkg_postinst() { + ewarn "Make sure to read the release notes and follow the upgrade process:" + ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/" + ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures" +} diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest index e7be0d3aae0f..d48004e9f2ef 100644 --- a/dev-db/postgresql/Manifest +++ b/dev-db/postgresql/Manifest @@ -12,27 +12,39 @@ AUX postgresql.service-9.6-r1 1477 BLAKE2B 2a652d5b2892f3a52f484fcc0b4f4dad09cf4 AUX postgresql.tmpfiles 39 BLAKE2B 25a5725af53c8e4e4009887e998172dd863ce218a5438351194548c4fc8ea15308dfba3602d5a922cf49b46015198268a4a4528119d8a74dcef4cc4c1767c052 SHA512 498060f2a597cf374f4fb31deaa2d6c5b00edef68efc0e71b82bfc20b717ae12518ba18fcb455a0c518ebba1a0868f38321470616151d02fa79b889a66dcb9f8 DIST postgresql-10.3.tar.bz2 19959653 BLAKE2B ba3b05f53b0f879b18d6d0649bf819697c77a066b49d941a96d13a4741854b01aeb0c8b868d6550a08ad52572c9463c968660aa83c16cbaa5b4bf7a89387a524 SHA512 05cf82d3483bdf38734e6ff0fef6b80e7f8fd3cb5ea6792ffe222a599d97d1a29638970bf28ebf5bd1f877e8dcd9986d88f5c5e5379e74fe79ce83e20d2babba DIST postgresql-10.4.tar.bz2 20201838 BLAKE2B 6d1cdc44547740c8f9fbc2e989364640409c6d2a365568b75731277dd0fba473ce07e2ee27e8ebfad507a6ce0ab3d3a44156c0e3a069d96d320771d8a97ba82f SHA512 b7c0d2fdc724e2eb1cda9fc1eb01b47352bbe6ba6357b3e898b7f5990fd78499c8c68dcb3aa9bde7821d71b5882d8856131384e899f8055d89d51cdfdbc9e663 +DIST postgresql-10.5.tar.bz2 20284578 BLAKE2B af2bc5bdc7e69682dac38785ce4a10c2c5c04202f2c3cd4acbb9200dbae7eec75d83813ac4df84b5a8064e77167f22a4dd54c6e84a68e564642cb5d75effd0ac SHA512 1bad30ae88beca66f7e8b99b82e7f02aac1e9230b328e6e5a762a704cdd9dc767d924f5a66c68c93586badfef91b7ff336120a567ce970eaa58bb44c662ad48c DIST postgresql-11beta1.tar.bz2 20945387 BLAKE2B a99aff17a656da2250309f2652237c8df3a3aeed088250be6114964c103dec40d0c4cc60b048b2ffa1e9733aed8e9df2597d57cab58482512c42f25139dc3499 SHA512 fa4e9cf8293fecf384d98d3a5bbed208eda2e4dd8bf05a9922a74355daba74dde4dbe0cd42bea1de155f4fea3cdcd0d7621d7e315c1d5f49ce5ee794b01b9f6d DIST postgresql-11beta2.tar.bz2 21086270 BLAKE2B ecea671334cc8dcc59ef46e1e9dfc16c1f0c44623d5355a42ef07797c6794109f10532fb6bfd6b4165e92a83d42514547e402cbe1a3618a6e6894432b3e2945d SHA512 3f9120af5f39d10937d92344c45e19f6d4de097dc24a081cd1984b27df4ecb8b0c15c638c8b1f8830b0003f01808159bd91305f9744eb6ae6c3425b3bf677937 +DIST postgresql-11beta3.tar.bz2 21375988 BLAKE2B cd83fcfc55504a028bf42f2c31de4d9e12ead1ad0f238a1f36397b9405ddf8f6d371062a25e2660f8c6754447a09ddc3a122f178101b8ab80237b16422c8cf4c SHA512 6ac6ecf2fff014b3673b11f6f106fdc93e6692a4a67a4669c4a7557f2b3229e41ddf5365c1e9328d88b6fde9141c15bd1a4640356559e727ee7f9f11641d4bf6 DIST postgresql-9.3.22.tar.bz2 17022938 BLAKE2B 198705e438717d0d9e12c73e0c0e3eff0ba89ea50a1b183de70f065e13c153c164890fe56bc6ec13b0cb9617df4f66894c122eeddaf9303b9a02b8e08b19b085 SHA512 667ff496172626d2fe35c6795935fb07f4f7967a3b0631dd3b96278f8dc00b3d08794f091a5ab060a45d6f2a861e0f10f0e9660f9e343ab34eeabd693104c47f DIST postgresql-9.3.23.tar.bz2 17033683 BLAKE2B f02ad25f6b8755a9a57c3a6dcb63b78672e29473b061ad1616be2fb97fbfd83fe0dc9fc9fda66ac0231fb30fb13f9ef8975ba5a9701d83f33495bcf2c2651b4a SHA512 bb2d54312de728aa0379ea5bc6385036bbe69d3b7f85bbd78c210840eed19ace29840849caf38d0689e21130a0c94818a362b3927805d8eded53b68e240a52b0 +DIST postgresql-9.3.24.tar.bz2 17042985 BLAKE2B 976debbc2a072cc307e22beac1d59352ecc214b9879284e635f30295d1f46ad2e0542ffc5f62639527be870afe46ea5daf5b8b2d3da9a069adf1701218def968 SHA512 3d457b6218eeb8da2d8dd134dabc7ec8000cad5863870079b85ce00d94218fa049146290a8389fec15e57d586b0edee9810cdad85f36cbabce49b6b4378ce1ee DIST postgresql-9.4.17.tar.bz2 17807762 BLAKE2B 7640c29a71c6aeff47d9b43dd1e4f52edac4295b646b34da3a0ed9c26a8a826061bfd892e9907b62f31b7f01ee3aaf437c88d79b84d1d786d608dcd088309ecf SHA512 9ac03d460e521dcd142ac463dd5bb0f3e3f47333367bf8d61499ec7e8d0129d338c6f111667d0006df0c8ced9ae8a337d4c1b40eb5f55e6bc8dd5a24dfd376f0 DIST postgresql-9.4.18.tar.bz2 17828085 BLAKE2B 346584e7d74264a7d58b3793cfd6247ae3cad3bb946bedec8df8d97278ffe6f8e881d31ad50e9f5d622aa4ae9b9711b36258bb60d520bb9a1d458af63c343e9e SHA512 2e64c3130c3dfc5183a77d72f61714bea34bfe549f55720eee25046e00b913a7effec3d7e43a021766ac957c1fa3c8c5e6c26ccbd8be1b434ae618e1fe9daab6 +DIST postgresql-9.4.19.tar.bz2 17879273 BLAKE2B 775a8748218c40440df91307107d46a35bcb3b2baf1c383014684c15d06c0026548770f88dccb1c26c3247813761e4a43003c50fe930041afc5701cddabfbde3 SHA512 38e2f1f25bd80fdfdec728cd4a3fee6696ca051e496f0629a0a554ea013bfb9bb83ef5659b00130666462a45036a648cf880a2f49693a8ef2edbde938e4dd830 DIST postgresql-9.5.12.tar.bz2 18589538 BLAKE2B 4246eb2bf5fe2e3bb48bdc411ebd3c87015570f0be4d8b1ed2a0f2ed20a8374e3244fa0aa17f9145f4f951c88f5b0717a4dd2186bf1621ce3334789f5f8dd50f SHA512 ab81bc95fd587f76a1986db5616b63d861b84da0eb9e54478f5298248a81d7a608d1bb1a9e30662c8190d05630106ddb3bb6413c34b003de948417214d342654 DIST postgresql-9.5.13.tar.bz2 18600185 BLAKE2B 7560f08648ec1417d304aa8c53c3220d7a4b2fdaf2cb4920a0196273466d1dbab4c12dbceb3dc9a136458c0089dd5f5dc595c95353584d49da0d2ab6e7903bba SHA512 807b22aabee38326934213de04b782a6b22cd8fe5c5bfd8b6cfa44281924527a715dcd78adbee276746446a7b05036b4714b00a16c650027543dcbafe1888082 +DIST postgresql-9.5.14.tar.bz2 18687959 BLAKE2B ac377b5e279d9e8179a94eb91d0cf1a7e3f6443c860d68a4540357d80128fbc54ac1ffec198725b2a783a80448f8a625556f2e6018162304d65659982890d46f SHA512 9b5ebc8dc13bbdbd5b5bc02552e2b9b5029d899a80e82b653542c735868590ebe57d586951bf036c5abd28aae325c71cc69536f88321d50dd3d254f8ee0cfe35 +DIST postgresql-9.6.10.tar.bz2 19991204 BLAKE2B 3d99296b5045a0b56b89257b2aa3f0c8be1108428acd77469b8db94200ad6b0b8d2fa84c73f652f79db56620c46928524d2f3a1a265ac332eb36c0625b800f76 SHA512 960a32c86466f9d5f5491ef163f5c4a99cb5de7312d13371e2223b1d156e31eb2a23ed478e6654bcbb7bd19db9470aaf63473ff661c11c60971b92af5e9daf82 DIST postgresql-9.6.8.tar.bz2 19528927 BLAKE2B 6aab5dbe4b13e1624befc33c2fa5241804dff71879e2d60c166db19c2fe015cd19cfc35054e6aede82bfe6b83a7146b6d2eedaabb94111c163da732526ff1723 SHA512 6b7595c0046308c725d77360b156e979d6bc469b78ac6500f631112f19b2607ca2d816781f8c5fd3bd835c48e079e79ada7af687fbd306a8fec5e160f20dd211 DIST postgresql-9.6.9.tar.bz2 19566222 BLAKE2B e92a5ffaa8f4400364a174fc21ab11bb18c96dce9be721e6073ff7ad21b828859c2ac5fe8da81cad6a3d2a63a62d8fcb067d4bb02a9d23903525ad1f78955470 SHA512 3ce2a8f3a017d9c0bd0f1b475a9ee02bcb6a4119b0d436757911f444f49f5024bb1a1be07ce16a79e71af77799de1bf952b32279b4566bae075f23a50b8545c6 EBUILD postgresql-10.3.ebuild 13694 BLAKE2B cbc3b1250d2b50dd7a9c318a9c610506db4b2593b013b2d89a573276ab8604cff741a1a3ca03a97e3c9a6bd7392762f821caf90d642c9a05cc9ca0b411340bbf SHA512 4b6fb894e8d5196139a56b897d3a06169c35def0d7e472ac8332987445f7c7ce72568b3b7a45bd7e8dac651108731761c413296864b0c9be4a617217d49ef3ec EBUILD postgresql-10.4.ebuild 13702 BLAKE2B 3b49b819926f1270075bcfac90497ffec28133761f1bec0d1dbca1e8cb3474567948183bb47d4c17fff93dcb0d12815a288e1b40e0cf8df34455374118748969 SHA512 135b2f0a4e2c5302961d3dba64fb2072568204a0205de91d20b14a6a2fc8ad7a14d90e96bc82708c2d8b63148d6e3220ac6b1971279ec52da40da4bad88969e8 +EBUILD postgresql-10.5.ebuild 13702 BLAKE2B 3b49b819926f1270075bcfac90497ffec28133761f1bec0d1dbca1e8cb3474567948183bb47d4c17fff93dcb0d12815a288e1b40e0cf8df34455374118748969 SHA512 135b2f0a4e2c5302961d3dba64fb2072568204a0205de91d20b14a6a2fc8ad7a14d90e96bc82708c2d8b63148d6e3220ac6b1971279ec52da40da4bad88969e8 EBUILD postgresql-11_beta1.ebuild 13373 BLAKE2B 96c2d9781eecc682323b5875cda00eaaa1e81729ffacf818c72078f2ba930d33ebcfc6a8dbba770a5857b85ed0633adfdf0a291ea6e34b50147338db99714278 SHA512 5f6d5f8579bed501e654ee6c7d0698f2367cfe855688750759470df96ed9cb1dd9070c66533bc7f771cd857cdba50d2d05c667a7968af1835047df7e29ade173 EBUILD postgresql-11_beta2.ebuild 13373 BLAKE2B 96c2d9781eecc682323b5875cda00eaaa1e81729ffacf818c72078f2ba930d33ebcfc6a8dbba770a5857b85ed0633adfdf0a291ea6e34b50147338db99714278 SHA512 5f6d5f8579bed501e654ee6c7d0698f2367cfe855688750759470df96ed9cb1dd9070c66533bc7f771cd857cdba50d2d05c667a7968af1835047df7e29ade173 +EBUILD postgresql-11_beta3.ebuild 13440 BLAKE2B 7c2cd1050b4e1bf5041fc551bf7e8c93aa309fd6e8e4ca30664214c2b21cd347b9d4473e1ff7d7f2a7697bfcf648173c30770dbc329aabb3229d2d49b38b4c34 SHA512 49d310d814d6d945c5a55f59e5e2b17935d7c3684295fafb27c4b8326146d49b06341c3844fde80ba80bda9fc81408d08a705293e3f1195bc342d953dcfd5ebf EBUILD postgresql-9.3.22.ebuild 13747 BLAKE2B 12e74f2f7bc2b18507b5c4e07d093cebd96406c6d981fbcaa6c2851004183acfac3e3fb882e1eea662e8cf1d35c10a1bcd6ad2820a5770874f04ad9cf508c387 SHA512 c89150f9b09e18b196d267dbec2c6539d3eb1ed6326193681249770c5d1ad42e48cffcad160121497dc8dbdd692994bd2704f581d52d029ba4dff5178a773746 EBUILD postgresql-9.3.23.ebuild 13755 BLAKE2B 32748b48a489b9a51a19365e1159638e6de06e487db1eda5932c13e469766664bbb4ae924188b4e054a1d00048c18e7944a114bb15a172be55474dd11deb5a62 SHA512 0971a967aee606d52778ed168217c7d28ddffca984fd7821db8b4271add46868ab1f1dab6ffb1d5801c1a661f4f3a1637e9c99afa487383089cee2df90565129 +EBUILD postgresql-9.3.24.ebuild 13755 BLAKE2B 32748b48a489b9a51a19365e1159638e6de06e487db1eda5932c13e469766664bbb4ae924188b4e054a1d00048c18e7944a114bb15a172be55474dd11deb5a62 SHA512 0971a967aee606d52778ed168217c7d28ddffca984fd7821db8b4271add46868ab1f1dab6ffb1d5801c1a661f4f3a1637e9c99afa487383089cee2df90565129 EBUILD postgresql-9.4.17.ebuild 14557 BLAKE2B 57446276df8b11ebe12ef5a4b3e95dfc2892cdf93cb1a40117f0e7ae5774e0ba1a4a08b2306d971625636d4f0bddb4d0395bc6671397ef291c0251a31bc37256 SHA512 05b6604f17b63442a1eda4673a702eab7bb0ac4af87dce7c9f56085573768aec408aa441873317cf610e379972221f68d49c19f47f7be48b1e6a74809d13c407 EBUILD postgresql-9.4.18.ebuild 14565 BLAKE2B 954d05aff7332bd53be29cb163b71deae09040a7ce602c28230e5dd4c9a4239e6fbc75245e10c8d4bd842db011e31303e0e924829c71a5cd5bee13ab62b03c47 SHA512 b95abd882026c4d66132d5c0ded7657f8275e22376122410962f70d382d128362480a65d9ae9e2dfa303df94bda884b919b599301395a68fd3b29ae7d71a1efe +EBUILD postgresql-9.4.19.ebuild 14565 BLAKE2B 954d05aff7332bd53be29cb163b71deae09040a7ce602c28230e5dd4c9a4239e6fbc75245e10c8d4bd842db011e31303e0e924829c71a5cd5bee13ab62b03c47 SHA512 b95abd882026c4d66132d5c0ded7657f8275e22376122410962f70d382d128362480a65d9ae9e2dfa303df94bda884b919b599301395a68fd3b29ae7d71a1efe EBUILD postgresql-9.5.12.ebuild 14785 BLAKE2B bbd02c18eb7e6b6c9bb2f3e4b4010bc1aadc0aaabe158accac75b1f692c8905d565647bac95c46b69003f70ce6608017a877e74e37e915a2827f5a6f35a732a5 SHA512 2ae77b20602445192062ab5930cc518c3524aa8c57c4aaa4923ec15b924f3b166dcd51dca32a19618d3055214bfed7977c4630dd40b6967aaf491f1688aaf717 EBUILD postgresql-9.5.13.ebuild 14793 BLAKE2B 5dac00696cdcdb3801ed7cfaeee54ec0a728938aecfe590ae82a86c70b3a5e476df6fcb247b0ccfd0b1f08409638caa473449b8600a346c089a70b27c24ce46f SHA512 778a3e5b71f06edbb92b9e46591a775136df671be23c8f4404a037e3757e45382202854d74a32223926f88f315f8af8902d8ff00a404858cedb6546649903338 +EBUILD postgresql-9.5.14.ebuild 14793 BLAKE2B 5dac00696cdcdb3801ed7cfaeee54ec0a728938aecfe590ae82a86c70b3a5e476df6fcb247b0ccfd0b1f08409638caa473449b8600a346c089a70b27c24ce46f SHA512 778a3e5b71f06edbb92b9e46591a775136df671be23c8f4404a037e3757e45382202854d74a32223926f88f315f8af8902d8ff00a404858cedb6546649903338 +EBUILD postgresql-9.6.10.ebuild 14935 BLAKE2B 72aae9d0851e921ebc3f4245cb145966db204ec7f2aa1ac6e7a5da64035d2582b5f9fbf25fa48a3de970c52afb16891f05e3ddbc40b7cb6dba1d423197446541 SHA512 336a96594bc5feb9fee37b8bde109013f48c5ac84d5cf0b17565ebe19e5418bf6069df52ceff87e9a586bef56fbfa186b898d9de64bd9d6633a6ecf510265aa0 EBUILD postgresql-9.6.8.ebuild 14927 BLAKE2B 36ba33cfc700526cd716243a838a9b52a3823feabf53fe7045aca86e54c048a0c1e5c7c4950e33d131e29a96e7f00eebe2a366e46912a942c871b799c5df8a29 SHA512 0e547e8a39b0c96ff4d100d42ba1113aa87f537f14ccd242436270a6972db3c09690a9925d869c0256342e89687421b26e18fd210313dce3b23dd4062c1ad1c6 EBUILD postgresql-9.6.9.ebuild 14935 BLAKE2B 72aae9d0851e921ebc3f4245cb145966db204ec7f2aa1ac6e7a5da64035d2582b5f9fbf25fa48a3de970c52afb16891f05e3ddbc40b7cb6dba1d423197446541 SHA512 336a96594bc5feb9fee37b8bde109013f48c5ac84d5cf0b17565ebe19e5418bf6069df52ceff87e9a586bef56fbfa186b898d9de64bd9d6633a6ecf510265aa0 -EBUILD postgresql-9999.ebuild 13408 BLAKE2B abc86c0f27c1b4699f6716e3a206ee552e08ac6d1df2456550b543ee17693b144e7dae3f138d1009e9b02c5563bed7a545e006f33903013c5946dcbf285edb51 SHA512 06adf94442e76c0e5b46d448d1c49c78bae83a9a0f347694fd181c3b413724bc6b6069b7d2a19bae5430818cfcc15dc98ad6ac0f3eeb1d7cb0b7f747da53704f -MISC metadata.xml 751 BLAKE2B 4628a6d379a41b4646be34dfcfca2be58bc93b883ccd6f4d21a426aacb34dd7d5347c5f9d61f9211f4f91bff67d2d5935b203959ab0790c74031944a9ab799f6 SHA512 726f30ec991194427b2dbcdf650778dbe0f169cb305d569918404d403deef397aef7ec3f1a5269c15f7ec7fc5506dc534203323379f1d0acc475eeb8d75d0cf1 +EBUILD postgresql-9999.ebuild 14262 BLAKE2B 43b6b2ab7b5137e8a0ca2edf28781d30f7a27afbf01ab718f4742c4ec981071797074f6dcad9995796d30bbd0b1e39d4ee7a63a404e7246a9bafbb5298a12c47 SHA512 29e5bcb9463c6cb8a43e8ba04840aacda074ddbfdcccd1dafcbd66e13d5c20a765c53f637e1c8993fe6647c286f7ef40254f3211f3341054c96bec1f327393fa +MISC metadata.xml 831 BLAKE2B 71ea5c9af98f7176bac835c7f1bfcd0e7e41055e83fccfab9ecc6476b2160040e26aeb857ed889a6a6dffe57f4e7367b944f3fbfda2e905efa0e63360fabfb73 SHA512 1dd852da0db83f6623745f0f320fb8ce93498be27b13c59a352683f2cb25afa3e8d7fca907e73ace2c9ae40e33fbd5ee68a84d803db225a5ff7fc707d435d0bf diff --git a/dev-db/postgresql/metadata.xml b/dev-db/postgresql/metadata.xml index c02f7774e30a..0235533938f8 100644 --- a/dev-db/postgresql/metadata.xml +++ b/dev-db/postgresql/metadata.xml @@ -6,6 +6,9 @@ PostgreSQL and Related Package Development + + Add support for llvm JIT engine + Use double precision floating-point numbers instead of 64-bit integers for timestamp storage. diff --git a/dev-db/postgresql/postgresql-10.5.ebuild b/dev-db/postgresql/postgresql-10.5.ebuild new file mode 100644 index 000000000000..50f0472a5668 --- /dev/null +++ b/dev-db/postgresql/postgresql-10.5.ebuild @@ -0,0 +1,460 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ + systemd user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT=$(get_major_version) + +MY_PV=${PV/_/} +S="${WORKDIR}/${PN}-${MY_PV}" + +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" + +LICENSE="POSTGRESQL GPL-2" +DESCRIPTION="PostgreSQL RDBMS" +HOMEPAGE="https://www.postgresql.org/" + +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl python +readline + selinux +server systemd ssl static-libs tcl threads uuid xml zlib" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +wanted_languages() { + local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru + sk sl sv tr zh_CN zh_TW" + local enable_langs lingua + + for lingua in ${linguas} ; do + has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +CDEPEND=" +>=app-eselect/eselect-postgresql-2.0 +sys-apps/less +virtual/libintl +kerberos? ( virtual/krb5 ) +ldap? ( net-nds/openldap ) +pam? ( virtual/pam ) +perl? ( >=dev-lang/perl-5.8:= ) +python? ( ${PYTHON_DEPS} ) +readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) +ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) + libressl? ( dev-libs/libressl:= ) +) +tcl? ( >=dev-lang/tcl-8:0= ) +xml? ( dev-libs/libxml2 dev-libs/libxslt ) +zlib? ( sys-libs/zlib ) +" + +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, +# the libc includes UUID functions. +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) +BSD_LIBC=( elibc_{Free,Net,Open}BSD ) + +nest_usedep() { + local front back + while [[ ${#} -gt 1 ]]; do + front+="${1}? ( " + back+=" )" + shift + done + echo "${front}${1}${back}" +} + +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" +CDEPEND+=" +uuid? ( + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) +)" + +DEPEND="${CDEPEND} +!! /dev/null || die "pushd failed" + + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do + bn=$(basename "${f}") + slotted_name=${bn%.${mansec}}${SLOT}.${mansec} + case ${bn} in + TABLE.7|WITH.7) + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} + ;; + *) + echo ".so ${rel_manpath}/${bn}" > ${slotted_name} + ;; + esac + done + + popd > /dev/null + done + + insinto /etc/postgresql-${SLOT} + newins src/bin/psql/psqlrc.sample psqlrc + + use static-libs || find "${ED}" -name '*.a' -delete + + local f bn + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ + -mindepth 1 -maxdepth 1) + do + bn=$(basename "${f}") + # Temporarily tack on tmp to workaround a file collision + # issue. This is only necessary for 9.7 and earlier. 10 never + # had this issue. + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ + "/usr/bin/${bn}${SLOT/.}" + done + + if use doc ; then + docinto html + dodoc doc/src/sgml/html/* + fi + + if use server; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} + + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} + + if use systemd; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.service-9.6-r1" | \ + systemd_newunit - ${PN}-${SLOT}.service + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf + fi + + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session + + if use prefix ; then + keepdir /run/postgresql + fperms 1775 /run/postgresql + fi + fi +} + +pkg_postinst() { + use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf + postgresql-config update + + elog "If you need a global psqlrc-file, you can place it in:" + elog " ${EROOT%/}/etc/postgresql-${SLOT}/" + + if use server ; then + elog + elog "Gentoo specific documentation:" + elog "https://wiki.gentoo.org/wiki/PostgreSQL" + elog + elog "Official documentation:" + elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}/run/postgresql/" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" + fi +} + +pkg_prerm() { + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" + + ebegin "Resuming removal in 10 seconds (Control-C to cancel)" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + use server || die "USE flag 'server' not enabled. Nothing to configure." + + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] \ + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" + sleep 5 + eend 0 + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" + fi + + # unix_socket_directory has no effect in postgresql.conf as it's + # overridden in the initscript + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf + + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 + # On the off-chance that you might need to work with UTF-8 encoded + # characters in PL/Perl + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' + EOF + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + if ! use systemd; then + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + fi + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + elif use systemd; then + einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" + einfo "instead of 'pg_ctl'." + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + if use server && [[ ${UID} -ne 0 ]] ; then + emake check + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + use server || \ + ewarn 'Tests cannot be run without the "server" use flag enabled.' + [[ ${UID} -eq 0 ]] || \ + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' + + ewarn 'Skipping.' + fi +} diff --git a/dev-db/postgresql/postgresql-11_beta3.ebuild b/dev-db/postgresql/postgresql-11_beta3.ebuild new file mode 100644 index 000000000000..27adb918d12f --- /dev/null +++ b/dev-db/postgresql/postgresql-11_beta3.ebuild @@ -0,0 +1,452 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN + zh_TW" + +inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ + systemd user versionator + +KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT=$(get_major_version) + +MY_PV=${PV/_/} +S="${WORKDIR}/${PN}-${MY_PV}" + +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" + +LICENSE="POSTGRESQL GPL-2" +DESCRIPTION="PostgreSQL RDBMS" +HOMEPAGE="http://www.postgresql.org/" + +IUSE="doc kerberos kernel_linux ldap libressl llvm nls pam perl python +readline + selinux +server systemd ssl static-libs tcl threads uuid xml zlib" + +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +CDEPEND=" +>=app-eselect/eselect-postgresql-2.0 +sys-apps/less +virtual/libintl +kerberos? ( virtual/krb5 ) +ldap? ( net-nds/openldap ) +llvm? ( sys-devel/llvm:= + sys-devel/clang:= ) +pam? ( virtual/pam ) +perl? ( >=dev-lang/perl-5.8:= ) +python? ( ${PYTHON_DEPS} ) +readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) +ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) + libressl? ( dev-libs/libressl:= ) +) +tcl? ( >=dev-lang/tcl-8:0= ) +xml? ( dev-libs/libxml2 dev-libs/libxslt ) +zlib? ( sys-libs/zlib ) +" + +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, +# the libc includes UUID functions. +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) +BSD_LIBC=( elibc_{Free,Net,Open}BSD ) + +nest_usedep() { + local front back + while [[ ${#} -gt 1 ]]; do + front+="${1}? ( " + back+=" )" + shift + done + echo "${front}${1}${back}" +} + +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" +CDEPEND+=" +uuid? ( + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) +)" + +DEPEND="${CDEPEND} +!! /dev/null || die "pushd failed" + + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do + bn=$(basename "${f}") + slotted_name=${bn%.${mansec}}${SLOT}.${mansec} + case ${bn} in + TABLE.7|WITH.7) + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} + ;; + *) + echo ".so ${rel_manpath}/${bn}" > ${slotted_name} + ;; + esac + done + + popd > /dev/null + done + + insinto /etc/postgresql-${SLOT} + newins src/bin/psql/psqlrc.sample psqlrc + + use static-libs || find "${ED}" -name '*.a' -delete + + local f bn + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ + -mindepth 1 -maxdepth 1) + do + bn=$(basename "${f}") + # Temporarily tack on tmp to workaround a file collision + # issue. This is only necessary for 9.7 and earlier. 10 never + # had this issue. + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ + "/usr/bin/${bn}${SLOT/.}" + done + + if use doc ; then + docinto html + dodoc doc/src/sgml/html/* + fi + + if use server; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} + + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} + + if use systemd; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.service-9.6-r1" | \ + systemd_newunit - ${PN}-${SLOT}.service + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf + fi + + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session + + if use prefix ; then + keepdir /run/postgresql + fperms 1775 /run/postgresql + fi + fi +} + +pkg_postinst() { + use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf + postgresql-config update + + elog "If you need a global psqlrc-file, you can place it in:" + elog " ${EROOT%/}/etc/postgresql-${SLOT}/" + + if use server ; then + elog + elog "Gentoo specific documentation:" + elog "https://wiki.gentoo.org/wiki/PostgreSQL" + elog + elog "Official documentation:" + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}/run/postgresql/" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" + fi +} + +pkg_prerm() { + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" + + ebegin "Resuming removal in 10 seconds (Control-C to cancel)" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + use server || die "USE flag 'server' not enabled. Nothing to configure." + + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] \ + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" + sleep 5 + eend 0 + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" + fi + + # unix_socket_directory has no effect in postgresql.conf as it's + # overridden in the initscript + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf + + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 + # On the off-chance that you might need to work with UTF-8 encoded + # characters in PL/Perl + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' + EOF + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + if ! use systemd; then + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + fi + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + elif use systemd; then + einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" + einfo "instead of 'pg_ctl'." + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + if use server && [[ ${UID} -ne 0 ]] ; then + emake check + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + use server || \ + ewarn 'Tests cannot be run without the "server" use flag enabled.' + [[ ${UID} -eq 0 ]] || \ + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' + + ewarn 'Skipping.' + fi +} diff --git a/dev-db/postgresql/postgresql-9.3.24.ebuild b/dev-db/postgresql/postgresql-9.3.24.ebuild new file mode 100644 index 000000000000..b102a6c5fabb --- /dev/null +++ b/dev-db/postgresql/postgresql-9.3.24.ebuild @@ -0,0 +1,450 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ + systemd user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT="$(get_version_component_range 1-2)" + +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" + +LICENSE="POSTGRESQL GPL-2" +DESCRIPTION="PostgreSQL RDBMS" +HOMEPAGE="https://www.postgresql.org/" + +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python + +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +wanted_languages() { + local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru + sk sl sv tr zh_CN zh_TW" + local enable_langs lingua + + for lingua in ${linguas} ; do + has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +CDEPEND=" +>=app-eselect/eselect-postgresql-2.0 +sys-apps/less +virtual/libintl +kerberos? ( virtual/krb5 ) +ldap? ( net-nds/openldap ) +pam? ( virtual/pam ) +perl? ( >=dev-lang/perl-5.8:= ) +python? ( ${PYTHON_DEPS} ) +readline? ( sys-libs/readline:0= ) +ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) + libressl? ( dev-libs/libressl:= ) +) +tcl? ( >=dev-lang/tcl-8:0= ) +uuid? ( dev-libs/ossp-uuid ) +xml? ( dev-libs/libxml2 dev-libs/libxslt ) +zlib? ( sys-libs/zlib ) +" + +DEPEND="${CDEPEND} +!! /dev/null || die "pushd failed" + + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do + bn=$(basename "${f}") + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec} + case ${bn} in + TABLE.7|WITH.7) + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} + ;; + *) + echo ".so ${rel_manpath}/${bn}" > ${slotted_name} + ;; + esac + done + + popd > /dev/null + done + + insinto /etc/postgresql-${SLOT} + newins src/bin/psql/psqlrc.sample psqlrc + + use static-libs || find "${ED}" -name '*.a' -delete + + local f bn + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ + -mindepth 1 -maxdepth 1) + do + bn=$(basename "${f}") + # Temporarily tack on tmp to workaround a file collision + # issue. This is only necessary for 9.7 and earlier. 10 never + # had this issue. + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ + "/usr/bin/${bn}${SLOT/.}tmp" + done + + if use doc ; then + docinto html + dodoc doc/src/sgml/html/* + + docinto sgml + dodoc doc/src/sgml/*.{sgml,dsl} + fi + + if use server; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} + + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} + + if use systemd; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.service-9.2" | \ + systemd_newunit - ${PN}-${SLOT}.service + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf + fi + + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir + + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session + + if use prefix ; then + keepdir /run/postgresql + fperms 1775 /run/postgresql + fi + fi +} + +pkg_preinst() { + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., + # /usr/bin/psql96). They may have been created by the + # postgresql.eselect module, but they're handled within this ebuild + # now. It's alright if we momentarily delete /usr/bin/psql as it + # will be recreated by the eselect module in pkg_ppostinst(). This + # is only necessary for 9.7 and earlier. 10 and later were never + # handled in this manner. + local canonicalise + if type -p realpath > /dev/null; then + canonicalise=realpath + elif type -p readlink > /dev/null; then + canonicalise='readlink -f' + else + # can't die, subshell + die "No readlink nor realpath found, cannot canonicalise" + fi + + local l + # First remove any symlinks in /usr/bin that may have been created + # by the old eselect + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then + rm "${l}" || ewarn "Couldn't remove ${l}" + fi + done + + # Then move the symlinks created by the ebuild to their proper place. + for l in "${ED}"/usr/bin/*tmp ; do + mv "${l}" "${l%tmp}" \ + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" + done +} + +pkg_postinst() { + use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf + postgresql-config update + + elog "If you need a global psqlrc-file, you can place it in:" + elog " ${EROOT%/}/etc/postgresql-${SLOT}/" + + if use server ; then + elog + elog "Gentoo specific documentation:" + elog "https://wiki.gentoo.org/wiki/PostgreSQL" + elog + elog "Official documentation:" + elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}/run/postgresql/" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" + fi +} + +pkg_prerm() { + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" + + ebegin "Resuming removal in 10 seconds (Control-C to cancel)" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + use server || die "USE flag 'server' not enabled. Nothing to configure." + + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] \ + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" + sleep 5 + eend 0 + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" + fi + + # unix_socket_directory has no effect in postgresql.conf as it's + # overridden in the initscript + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf + + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 + # On the off-chance that you might need to work with UTF-8 encoded + # characters in PL/Perl + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' + EOF + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + if use server && [[ ${UID} -ne 0 ]] ; then + emake check + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + use server || \ + ewarn 'Tests cannot be run without the "server" use flag enabled.' + [[ ${UID} -eq 0 ]] || \ + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' + + ewarn 'Skipping.' + fi +} diff --git a/dev-db/postgresql/postgresql-9.4.19.ebuild b/dev-db/postgresql/postgresql-9.4.19.ebuild new file mode 100644 index 000000000000..7243cdb0dd49 --- /dev/null +++ b/dev-db/postgresql/postgresql-9.4.19.ebuild @@ -0,0 +1,482 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ + systemd user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT="$(get_version_component_range 1-2)" + +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" + +LICENSE="POSTGRESQL GPL-2" +DESCRIPTION="PostgreSQL RDBMS" +HOMEPAGE="https://www.postgresql.org/" + +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python + +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +wanted_languages() { + local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru + sk sl sv tr zh_CN zh_TW" + local enable_langs lingua + + for lingua in ${linguas} ; do + has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +CDEPEND=" +>=app-eselect/eselect-postgresql-2.0 +sys-apps/less +virtual/libintl +kerberos? ( virtual/krb5 ) +ldap? ( net-nds/openldap ) +pam? ( virtual/pam ) +perl? ( >=dev-lang/perl-5.8:= ) +python? ( ${PYTHON_DEPS} ) +readline? ( sys-libs/readline:0= ) +ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) + libressl? ( dev-libs/libressl:= ) +) +tcl? ( >=dev-lang/tcl-8:0= ) +xml? ( dev-libs/libxml2 dev-libs/libxslt ) +zlib? ( sys-libs/zlib ) +" + +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, +# the libc includes UUID functions. +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) +BSD_LIBC=( elibc_{Free,Net,Open}BSD ) + +nest_usedep() { + local front back + while [[ ${#} -gt 1 ]]; do + front+="${1}? ( " + back+=" )" + shift + done + echo "${front}${1}${back}" +} + +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" +CDEPEND+=" +uuid? ( + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) +)" + +DEPEND="${CDEPEND} +!! /dev/null || die "pushd failed" + + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do + bn=$(basename "${f}") + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec} + case ${bn} in + TABLE.7|WITH.7) + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} + ;; + *) + echo ".so ${rel_manpath}/${bn}" > ${slotted_name} + ;; + esac + done + + popd > /dev/null + done + + insinto /etc/postgresql-${SLOT} + newins src/bin/psql/psqlrc.sample psqlrc + + use static-libs || find "${ED}" -name '*.a' -delete + + local f bn + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ + -mindepth 1 -maxdepth 1) + do + bn=$(basename "${f}") + # Temporarily tack on tmp to workaround a file collision + # issue. This is only necessary for 9.7 and earlier. 10 never + # had this issue. + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ + "/usr/bin/${bn}${SLOT/.}tmp" + done + + if use doc ; then + docinto html + dodoc doc/src/sgml/html/* + + docinto sgml + dodoc doc/src/sgml/*.{sgml,dsl} + fi + + if use server; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} + + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} + + if use systemd; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.service-9.2" | \ + systemd_newunit - ${PN}-${SLOT}.service + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf + fi + + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir + + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session + + if use prefix ; then + keepdir /run/postgresql + fperms 1775 /run/postgresql + fi + fi +} + +pkg_preinst() { + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., + # /usr/bin/psql96). They may have been created by the + # postgresql.eselect module, but they're handled within this ebuild + # now. It's alright if we momentarily delete /usr/bin/psql as it + # will be recreated by the eselect module in pkg_ppostinst(). This + # is only necessary for 9.7 and earlier. 10 and later were never + # handled in this manner. + local canonicalise + if type -p realpath > /dev/null; then + canonicalise=realpath + elif type -p readlink > /dev/null; then + canonicalise='readlink -f' + else + # can't die, subshell + die "No readlink nor realpath found, cannot canonicalise" + fi + + local l + # First remove any symlinks in /usr/bin that may have been created + # by the old eselect + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then + rm "${l}" || ewarn "Couldn't remove ${l}" + fi + done + + # Then move the symlinks created by the ebuild to their proper place. + for l in "${ED}"/usr/bin/*tmp ; do + mv "${l}" "${l%tmp}" \ + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" + done +} + +pkg_postinst() { + use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf + postgresql-config update + + elog "If you need a global psqlrc-file, you can place it in:" + elog " ${EROOT%/}/etc/postgresql-${SLOT}/" + + if use server ; then + elog + elog "Gentoo specific documentation:" + elog "https://wiki.gentoo.org/wiki/PostgreSQL" + elog + elog "Official documentation:" + elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}/run/postgresql/" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" + fi +} + +pkg_prerm() { + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" + + ebegin "Resuming removal in 10 seconds (Control-C to cancel)" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + use server || die "USE flag 'server' not enabled. Nothing to configure." + + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] \ + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" + sleep 5 + eend 0 + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" + fi + + # unix_socket_directory has no effect in postgresql.conf as it's + # overridden in the initscript + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf + + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 + # On the off-chance that you might need to work with UTF-8 encoded + # characters in PL/Perl + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' + EOF + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + if use server && [[ ${UID} -ne 0 ]] ; then + emake check + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + use server || \ + ewarn 'Tests cannot be run without the "server" use flag enabled.' + [[ ${UID} -eq 0 ]] || \ + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' + + ewarn 'Skipping.' + fi +} diff --git a/dev-db/postgresql/postgresql-9.5.14.ebuild b/dev-db/postgresql/postgresql-9.5.14.ebuild new file mode 100644 index 000000000000..fd41b7ff3302 --- /dev/null +++ b/dev-db/postgresql/postgresql-9.5.14.ebuild @@ -0,0 +1,488 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ + systemd user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT="$(get_version_component_range 1-2)" + +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" + +LICENSE="POSTGRESQL GPL-2" +DESCRIPTION="PostgreSQL RDBMS" +HOMEPAGE="https://www.postgresql.org/" + +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python + +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +wanted_languages() { + local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru + sk sl sv tr zh_CN zh_TW" + local enable_langs lingua + + for lingua in ${linguas} ; do + has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +CDEPEND=" +>=app-eselect/eselect-postgresql-2.0 +sys-apps/less +virtual/libintl +kerberos? ( virtual/krb5 ) +ldap? ( net-nds/openldap ) +pam? ( virtual/pam ) +perl? ( >=dev-lang/perl-5.8:= ) +python? ( ${PYTHON_DEPS} ) +readline? ( sys-libs/readline:0= ) +ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) + libressl? ( dev-libs/libressl:= ) +) +tcl? ( >=dev-lang/tcl-8:0= ) +xml? ( dev-libs/libxml2 dev-libs/libxslt ) +zlib? ( sys-libs/zlib ) +" + +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, +# the libc includes UUID functions. +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) +BSD_LIBC=( elibc_{Free,Net,Open}BSD ) + +nest_usedep() { + local front back + while [[ ${#} -gt 1 ]]; do + front+="${1}? ( " + back+=" )" + shift + done + echo "${front}${1}${back}" +} + +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" +CDEPEND+=" +uuid? ( + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) +)" + +DEPEND="${CDEPEND} +!! /dev/null || die "pushd failed" + + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do + bn=$(basename "${f}") + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec} + case ${bn} in + TABLE.7|WITH.7) + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} + ;; + *) + echo ".so ${rel_manpath}/${bn}" > ${slotted_name} + ;; + esac + done + + popd > /dev/null + done + + insinto /etc/postgresql-${SLOT} + newins src/bin/psql/psqlrc.sample psqlrc + + use static-libs || find "${ED}" -name '*.a' -delete + + local f bn + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ + -mindepth 1 -maxdepth 1) + do + bn=$(basename "${f}") + # Temporarily tack on tmp to workaround a file collision + # issue. This is only necessary for 9.7 and earlier. 10 never + # had this issue. + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ + "/usr/bin/${bn}${SLOT/.}tmp" + done + + if use doc ; then + docinto html + dodoc doc/src/sgml/html/* + + docinto sgml + dodoc doc/src/sgml/*.{sgml,dsl} + fi + + if use server; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} + + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} + + if use systemd; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.service-9.2" | \ + systemd_newunit - ${PN}-${SLOT}.service + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf + fi + + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir + + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session + + if use prefix ; then + keepdir /run/postgresql + fperms 1775 /run/postgresql + fi + fi +} + +pkg_preinst() { + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., + # /usr/bin/psql96). They may have been created by the + # postgresql.eselect module, but they're handled within this ebuild + # now. It's alright if we momentarily delete /usr/bin/psql as it + # will be recreated by the eselect module in pkg_ppostinst(). This + # is only necessary for 9.7 and earlier. 10 and later were never + # handled in this manner. + local canonicalise + if type -p realpath > /dev/null; then + canonicalise=realpath + elif type -p readlink > /dev/null; then + canonicalise='readlink -f' + else + # can't die, subshell + die "No readlink nor realpath found, cannot canonicalise" + fi + + local l + # First remove any symlinks in /usr/bin that may have been created + # by the old eselect + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then + rm "${l}" || ewarn "Couldn't remove ${l}" + fi + done + + # Then move the symlinks created by the ebuild to their proper place. + for l in "${ED}"/usr/bin/*tmp ; do + mv "${l}" "${l%tmp}" \ + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" + done +} + +pkg_postinst() { + use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf + postgresql-config update + + if use alpha && use server ; then + ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms." + ewarn "As a result, performance will be extremely degraded." + fi + + elog "If you need a global psqlrc-file, you can place it in:" + elog " ${EROOT%/}/etc/postgresql-${SLOT}/" + + if use server ; then + elog + elog "Gentoo specific documentation:" + elog "https://wiki.gentoo.org/wiki/PostgreSQL" + elog + elog "Official documentation:" + elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}/run/postgresql/" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" + fi +} + +pkg_prerm() { + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" + + ebegin "Resuming removal in 10 seconds (Control-C to cancel)" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + use server || die "USE flag 'server' not enabled. Nothing to configure." + + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] \ + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" + sleep 5 + eend 0 + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" + fi + + # unix_socket_directory has no effect in postgresql.conf as it's + # overridden in the initscript + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf + + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 + # On the off-chance that you might need to work with UTF-8 encoded + # characters in PL/Perl + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' + EOF + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + if use server && [[ ${UID} -ne 0 ]] ; then + emake check + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + use server || \ + ewarn 'Tests cannot be run without the "server" use flag enabled.' + [[ ${UID} -eq 0 ]] || \ + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' + + ewarn 'Skipping.' + fi +} diff --git a/dev-db/postgresql/postgresql-9.6.10.ebuild b/dev-db/postgresql/postgresql-9.6.10.ebuild new file mode 100644 index 000000000000..1297819d3de9 --- /dev/null +++ b/dev-db/postgresql/postgresql-9.6.10.ebuild @@ -0,0 +1,493 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ + systemd user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT="$(get_version_component_range 1-2)" + +MY_PV=${PV/_/} +S="${WORKDIR}/${PN}-${MY_PV}" + +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" + +LICENSE="POSTGRESQL GPL-2" +DESCRIPTION="PostgreSQL RDBMS" +HOMEPAGE="https://www.postgresql.org/" + +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python + +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +wanted_languages() { + local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru + sk sl sv tr zh_CN zh_TW" + local enable_langs lingua + + for lingua in ${linguas} ; do + has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +CDEPEND=" +>=app-eselect/eselect-postgresql-2.0 +sys-apps/less +virtual/libintl +kerberos? ( virtual/krb5 ) +ldap? ( net-nds/openldap ) +pam? ( virtual/pam ) +perl? ( >=dev-lang/perl-5.8:= ) +python? ( ${PYTHON_DEPS} ) +readline? ( sys-libs/readline:0= ) +ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) + libressl? ( dev-libs/libressl:= ) +) +server? ( systemd? ( sys-apps/systemd ) ) +tcl? ( >=dev-lang/tcl-8:0= ) +xml? ( dev-libs/libxml2 dev-libs/libxslt ) +zlib? ( sys-libs/zlib ) +" + +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, +# the libc includes UUID functions. +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) +BSD_LIBC=( elibc_{Free,Net,Open}BSD ) + +nest_usedep() { + local front back + while [[ ${#} -gt 1 ]]; do + front+="${1}? ( " + back+=" )" + shift + done + echo "${front}${1}${back}" +} + +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" +CDEPEND+=" +uuid? ( + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) +)" + +DEPEND="${CDEPEND} +!! /dev/null || die "pushd failed" + + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do + bn=$(basename "${f}") + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec} + case ${bn} in + TABLE.7|WITH.7) + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} + ;; + *) + echo ".so ${rel_manpath}/${bn}" > ${slotted_name} + ;; + esac + done + + popd > /dev/null + done + + insinto /etc/postgresql-${SLOT} + newins src/bin/psql/psqlrc.sample psqlrc + + use static-libs || find "${ED}" -name '*.a' -delete + + local f bn + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ + -mindepth 1 -maxdepth 1) + do + bn=$(basename "${f}") + # Temporarily tack on tmp to workaround a file collision + # issue. This is only necessary for 9.7 and earlier. 10 never + # had this issue. + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ + "/usr/bin/${bn}${SLOT/.}tmp" + done + + if use doc ; then + docinto html + dodoc doc/src/sgml/html/* + + docinto sgml + dodoc doc/src/sgml/*.{sgml,dsl} + fi + + if use server; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} + + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} + + if use systemd; then + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + "${FILESDIR}/${PN}.service-9.6-r1" | \ + systemd_newunit - ${PN}-${SLOT}.service + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf + fi + + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir + + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session + + if use prefix ; then + keepdir /run/postgresql + fperms 1775 /run/postgresql + fi + fi +} + +pkg_preinst() { + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., + # /usr/bin/psql96). They may have been created by the + # postgresql.eselect module, but they're handled within this ebuild + # now. It's alright if we momentarily delete /usr/bin/psql as it + # will be recreated by the eselect module in pkg_ppostinst(). This + # is only necessary for 9.7 and earlier. 10 and later were never + # handled in this manner. + local canonicalise + if type -p realpath > /dev/null; then + canonicalise=realpath + elif type -p readlink > /dev/null; then + canonicalise='readlink -f' + else + # can't die, subshell + die "No readlink nor realpath found, cannot canonicalise" + fi + + local l + # First remove any symlinks in /usr/bin that may have been created + # by the old eselect + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then + rm "${l}" || ewarn "Couldn't remove ${l}" + fi + done + + # Then move the symlinks created by the ebuild to their proper place. + for l in "${ED}"/usr/bin/*tmp ; do + mv "${l}" "${l%tmp}" \ + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" + done +} + +pkg_postinst() { + use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf + postgresql-config update + + elog "If you need a global psqlrc-file, you can place it in:" + elog " ${EROOT%/}/etc/postgresql-${SLOT}/" + + if use server ; then + elog + elog "Gentoo specific documentation:" + elog "https://wiki.gentoo.org/wiki/PostgreSQL" + elog + elog "Official documentation:" + elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}/run/postgresql/" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" + fi +} + +pkg_prerm() { + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" + + ebegin "Resuming removal in 10 seconds (Control-C to cancel)" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + use server || die "USE flag 'server' not enabled. Nothing to configure." + + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] \ + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" + sleep 5 + eend 0 + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" + fi + + # unix_socket_directory has no effect in postgresql.conf as it's + # overridden in the initscript + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf + + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 + # On the off-chance that you might need to work with UTF-8 encoded + # characters in PL/Perl + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' + EOF + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + if ! use systemd; then + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + fi + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + elif use systemd; then + einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" + einfo "instead of 'pg_ctl'." + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + if use server && [[ ${UID} -ne 0 ]] ; then + emake check + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + use server || \ + ewarn 'Tests cannot be run without the "server" use flag enabled.' + [[ ${UID} -eq 0 ]] || \ + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' + + ewarn 'Skipping.' + fi +} diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild index 65ea48f8b86c..922c31f8f09c 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-9999.ebuild @@ -5,8 +5,12 @@ EAPI="6" PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) -inherit eutils flag-o-matic git-r3 linux-info multilib pam prefix \ - python-single-r1 systemd user versionator +PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN + zh_TW" +PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt-BR ro ru sk sl sv tr zh-CN + zh-TW" +inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ + systemd user versionator KEYWORDS="" @@ -19,21 +23,13 @@ LICENSE="POSTGRESQL GPL-2" DESCRIPTION="PostgreSQL RDBMS" HOMEPAGE="https://www.postgresql.org/" -IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib" -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" - -wanted_languages() { - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru - sk sl sv tr zh_CN zh_TW" - local enable_langs lingua +IUSE="kerberos kernel_linux ldap libressl llvm nls pam perl python +readline + selinux systemd ssl static-libs tcl threads uuid xml zlib" +for my_locale in ${PLOCALES}; do + IUSE+=" l10n_${my_locale}" +done - for lingua in ${linguas} ; do - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} " - done - - echo -n ${enable_langs} -} +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" CDEPEND=" >=app-eselect/eselect-postgresql-2.0 @@ -41,6 +37,10 @@ sys-apps/less virtual/libintl kerberos? ( virtual/krb5 ) ldap? ( net-nds/openldap ) +llvm? ( + sys-devel/llvm:= + sys-devel/clang:= +) pam? ( virtual/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) @@ -49,13 +49,36 @@ ssl? ( !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) libressl? ( dev-libs/libressl:= ) ) -server? ( systemd? ( sys-apps/systemd ) ) +systemd? ( sys-apps/systemd ) tcl? ( >=dev-lang/tcl-8:0= ) uuid? ( dev-libs/ossp-uuid ) xml? ( dev-libs/libxml2 dev-libs/libxslt ) zlib? ( sys-libs/zlib ) " +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, +# the libc includes UUID functions. +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) +BSD_LIBC=( elibc_{Free,Net,Open}BSD ) + +nest_usedep() { + local front back + while [[ ${#} -gt 1 ]]; do + front+="${1}? ( " + back+=" )" + shift + done + echo "${front}${1}${back}" +} + +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" +CDEPEND+=" +uuid? ( + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) +)" + DEPEND="${CDEPEND} !!=dev-lang/perl-5.8 @@ -78,6 +101,14 @@ RDEPEND="${CDEPEND} selinux? ( sec-policy/selinux-postgresql ) " +my_get_locales() { + local my_locale locale_list + for my_locale in ${PLOCALES[@]}; do + use l10n_${my_locale} && locale_list+=( ${my_locale} ) + done + echo -n ${locale_list[@]} +} + pkg_pretend() { ewarn "You are using a live ebuild that uses the current source code as it is" ewarn "available from PostgreSQL's Git repository at emerge time. Given such," @@ -127,6 +158,17 @@ src_configure() { local PO="${EPREFIX%/}" + local i uuid_config="" + if use uuid; then + for i in ${UTIL_LINUX_LIBC[@]}; do + use ${i} && uuid_config="--with-uuid=e2fs" + done + for i in ${BSD_LIBC[@]}; do + use ${i} && uuid_config="--with-uuid=bsd" + done + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" + fi + econf \ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ @@ -136,22 +178,22 @@ src_configure() { --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ $(use_enable !alpha spinlocks) \ - $(use_enable !pg_legacytimestamp integer-datetimes) \ + $(use_enable nls nls "'$(my_get_locales)'") \ $(use_enable threads thread-safety) \ $(use_with kerberos gssapi) \ $(use_with ldap) \ + $(use_with llvm) \ $(use_with pam) \ $(use_with perl) \ $(use_with python) \ $(use_with readline) \ $(use_with ssl openssl) \ - $(usex server "$(use_with systemd)" '--without-systemd') \ $(use_with tcl) \ - $(use_with uuid ossp-uuid) \ $(use_with xml libxml) \ $(use_with xml libxslt) \ $(use_with zlib) \ - "$(use_enable nls nls "$(wanted_languages)")" + $(use_with systemd) \ + ${uuid_config} } src_compile() { @@ -262,7 +304,7 @@ pkg_preinst() { } pkg_postinst() { - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf + use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf postgresql-config update elog "If you need a global psqlrc-file, you can place it in:" @@ -423,17 +465,13 @@ pkg_config() { } src_test() { - einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" - if [[ ${UID} -ne 0 ]] ; then emake check einfo "If you think other tests besides the regression tests are necessary, please" einfo "submit a bug including a patch for this ebuild to enable them." else - [[ ${UID} -eq 0 ]] || \ - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES." - - ewarn "Skipping." + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' + ewarn 'Skipping.' fi } diff --git a/dev-db/pspg/Manifest b/dev-db/pspg/Manifest index 4e4a1ac8b3e8..c20fbf4382aa 100644 --- a/dev-db/pspg/Manifest +++ b/dev-db/pspg/Manifest @@ -2,8 +2,10 @@ DIST pspg-0.8.0.tar.gz 850508 BLAKE2B 2f2fb7f094f72f0b5d1c959ab73a355ea2ced155fd DIST pspg-0.9.2.tar.gz 855891 BLAKE2B 0e0a992e5885ca4b2e058d19df2d9c7eac862e1a45e8d80f31df33ab2f3c02616c67cc528af6a52225db938a0c1f27352e13c7dfd01b15bda908bbf3ee9ef128 SHA512 8ad31a5e744db96bec7cfea7d128aa4ac3b44ab51c3dd1d0661178c1d139571a955143a3ccfe6556ce2a215ec193a45224720794da5d2af1e93beb2fa713aea4 DIST pspg-0.9.3.tar.gz 856766 BLAKE2B 3e1b41f786abd8e964adb87411ba9dca7bdc0ed07a02e51a869dfaca491497478818d85de32846d675ee90f32f01f693ea33ce0166bb939457c55799aabf900a SHA512 79c019ef30a1a06c15793e7b51f7e1cabd79711d3a2a4360933c219b01e9c8d8390a82b87bb1be5316cabbcad3705adca8dd09714e6e994d7aca0b94ddcf06c0 DIST pspg-1.1.0.tar.gz 861442 BLAKE2B b62fa7e92cf4baae31da08b8f14eb18a54dd0912c08c73764f4571b5bcc22ff21e0ceb3809c4f0fb33c490241b2135594b1d2fb9fcb9006287ced9a031b75ffe SHA512 84db26b5fce668938f76a6250caca8a394b439d6496de411305605da1ec35cfe79e444a56e73423e56bede21f5da3208b140be0d995e9cf575ba76a5bd0d49b1 +DIST pspg-1.3.0.tar.gz 885210 BLAKE2B 4a6f41b915603a96eef8cd5de9a76322bf0cfec94afe5c54707ab290e657159d7e8f6d29f5c4c1de07770047e45d3566d3a4f09c53d80461a50be48afade289b SHA512 6c6e4b12008ca36ea4ecf6c60d474f897622427590d8326db73f7d5a6d2134c479db17b0765cd8861ccf422e5fab292e10fc7f7e7a548c5d3773c64c5e11d1dd EBUILD pspg-0.8.0.ebuild 387 BLAKE2B b2f49b9e1bc7a032b064e2d65cb832c1177a51fabfaaf2b466d024346635bb9af319f0c656328d0084519ba12697f4a385627194f34330cdcc28b7644298acd2 SHA512 27636211a65612ed5424d4984e737e751677048f41c91cfab69f5de351f875622a8edc68c26e69ad9a2cf13b0e294dff07742c037f57262f1149966ca53717b8 EBUILD pspg-0.9.2.ebuild 389 BLAKE2B 30ebc1a109cc694a1bcb8f612d36a51570d7df89cd5c55e6142581783e6afb958512c5de4c1bc446828c36acc3c6788da001c98ee0d60a1153ff454b693bf381 SHA512 3c62b0fbaacd4be5248cd7101cc91511f9bb321a0437b65e17848d1ab30338d1de64d674d43feb4c8c33513c8b4215545b3548994167eba20e9860955a2d3e6d EBUILD pspg-0.9.3.ebuild 389 BLAKE2B 30ebc1a109cc694a1bcb8f612d36a51570d7df89cd5c55e6142581783e6afb958512c5de4c1bc446828c36acc3c6788da001c98ee0d60a1153ff454b693bf381 SHA512 3c62b0fbaacd4be5248cd7101cc91511f9bb321a0437b65e17848d1ab30338d1de64d674d43feb4c8c33513c8b4215545b3548994167eba20e9860955a2d3e6d EBUILD pspg-1.1.0.ebuild 389 BLAKE2B 30ebc1a109cc694a1bcb8f612d36a51570d7df89cd5c55e6142581783e6afb958512c5de4c1bc446828c36acc3c6788da001c98ee0d60a1153ff454b693bf381 SHA512 3c62b0fbaacd4be5248cd7101cc91511f9bb321a0437b65e17848d1ab30338d1de64d674d43feb4c8c33513c8b4215545b3548994167eba20e9860955a2d3e6d +EBUILD pspg-1.3.0.ebuild 389 BLAKE2B 30ebc1a109cc694a1bcb8f612d36a51570d7df89cd5c55e6142581783e6afb958512c5de4c1bc446828c36acc3c6788da001c98ee0d60a1153ff454b693bf381 SHA512 3c62b0fbaacd4be5248cd7101cc91511f9bb321a0437b65e17848d1ab30338d1de64d674d43feb4c8c33513c8b4215545b3548994167eba20e9860955a2d3e6d MISC metadata.xml 298 BLAKE2B 40abb765b052aa2cbbf749c54c686f1c98968cb1af2e93c149bfbfe6244d3c17e827189d7a1da90a566016758bfbed63b16ad0a0328725349748d1b18b2437b1 SHA512 167896d1d92ccb4b171cce16d63405369a9e28b0d01c12b2ed94fcec1f982892e179c007287fc3386e1c00393d6570a2ae9e8efe9420e53a82308426075d5c89 diff --git a/dev-db/pspg/pspg-1.3.0.ebuild b/dev-db/pspg/pspg-1.3.0.ebuild new file mode 100644 index 000000000000..9b1b64baa6d0 --- /dev/null +++ b/dev-db/pspg/pspg-1.3.0.ebuild @@ -0,0 +1,16 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +DESCRIPTION="A better pager for psql and mysql" +HOMEPAGE="https://github.com/okbob/${PN}" +SRC_URI="https://github.com/okbob/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="sys-libs/ncurses:*" +RDEPEND="${DEPEND}" -- cgit v1.2.3