diff options
author | 2013-06-26 19:31:49 +0000 | |
---|---|---|
committer | 2013-06-26 19:31:49 +0000 | |
commit | 18ca2e1e2592391c922a365888901b8224c8f2fa (patch) | |
tree | b38b4a354387750a28c77373cd6c6d0744ef3034 /eclass/mysql-v2.eclass | |
parent | create texmf-var/web2c before trying to build the formats if it does not exis... (diff) | |
download | historical-18ca2e1e2592391c922a365888901b8224c8f2fa.tar.gz historical-18ca2e1e2592391c922a365888901b8224c8f2fa.tar.bz2 historical-18ca2e1e2592391c922a365888901b8224c8f2fa.zip |
[eclass] Copy mysql eclasses from the mysql overlay.
Diffstat (limited to 'eclass/mysql-v2.eclass')
-rw-r--r-- | eclass/mysql-v2.eclass | 193 |
1 files changed, 99 insertions, 94 deletions
diff --git a/eclass/mysql-v2.eclass b/eclass/mysql-v2.eclass index b13d22667f88..76dae6d5ce66 100644 --- a/eclass/mysql-v2.eclass +++ b/eclass/mysql-v2.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-v2.eclass,v 1.24 2013/02/13 00:40:57 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-v2.eclass,v 1.25 2013/06/26 19:31:49 jmbsvicetto Exp $ # @ECLASS: mysql-v2.eclass # @MAINTAINER: @@ -11,7 +11,7 @@ # @BLURB: This eclass provides most of the functions for mysql ebuilds # @DESCRIPTION: # The mysql-v2.eclass is the base eclass to build the mysql and -# alternative projects (mariadb) ebuilds. +# alternative projects (mariadb and percona) ebuilds. # This eclass uses the mysql-autotools and mysql-cmake eclasses for the # specific bits related to the build system. # It provides the src_unpack, src_prepare, src_configure, src_compile, @@ -44,7 +44,7 @@ MYSQL_EXTRAS="" # @DESCRIPTION: # The version of the MYSQL_EXTRAS repo to use to build mysql # Use "none" to disable it's use -[[ "${MY_EXTRAS_VER}" == "live" ]] && MYSQL_EXTRAS="git-2" +[[ ${MY_EXTRAS_VER} == "live" ]] && MYSQL_EXTRAS="git-2" inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs @@ -53,7 +53,7 @@ inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx # case "${EAPI:-0}" in - 3|4|5) ;; + 4|5) ;; *) die "Unsupported EAPI: ${EAPI}" ;; esac @@ -67,8 +67,8 @@ EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_ # and we will run a mysql server during test phase S="${WORKDIR}/mysql" -[[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" -if [[ "${MY_EXTRAS_VER}" == "live" ]]; then +[[ ${MY_EXTRAS_VER} == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" +if [[ ${MY_EXTRAS_VER} == "live" ]]; then EGIT_PROJECT=mysql-extras EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/mysql-extras.git" fi @@ -113,10 +113,10 @@ mysql_version_is_at_least "5.1.50" || die "This eclass should only be used with # Designation by PERCONA for a MySQL version to apply an XTRADB release # Work out the default SERVER_URI correctly -if [ -z "${SERVER_URI}" ]; then - [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}" - if [ "${PN}" == "mariadb" ]; then - MARIA_FULL_PV="$(replace_version_separator 3 '-' ${MY_PV})" +if [[ -z ${SERVER_URI} ]]; then + [[ -z ${MY_PV} ]] && MY_PV="${PV//_/-}" + if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then + MARIA_FULL_PV=$(replace_version_separator 3 '-' ${MY_PV}) MARIA_FULL_P="${PN}-${MARIA_FULL_PV}" SERVER_URI=" http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz @@ -126,6 +126,16 @@ if [ -z "${SERVER_URI}" ]; then http://mirrors.fe.up.pt/pub/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz http://ftp-stud.hs-esslingen.de/pub/Mirrors/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz " + if [[ ${PN} == "mariadb-galera" ]]; then + MY_SOURCEDIR="${PN%%-galera}-${MARIA_FULL_PV}" + fi + elif [[ ${PN} == "percona-server" ]]; then + PERCONA_PN="Percona-Server" + MIRROR_PV=$(get_version_component_range 1-2 ${PV}) + MY_PV=$(get_version_component_range 1-3 ${PV}) + MY_PATCH=$(get_version_component_range 4 ${PV}) + SERVER_URI="http://www.percona.com/redir/downloads/${PERCONA_PN}-${MIRROR_PV}/LATEST/source/${PERCONA_PN}-${MY_PV}-rel30.${MY_PATCH}.tar.gz" +# http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/Percona-Server-5.5.30-rel30.2.tar.gz else URI_DIR="MySQL" URI_FILE="mysql" @@ -141,19 +151,28 @@ fi SRC_URI="${SERVER_URI}" # Gentoo patches to MySQL -[[ ${MY_EXTRAS_VER} != live ]] && [[ ${MY_EXTRAS_VER} != none ]] \ -&& SRC_URI="${SRC_URI} +if [[ ${MY_EXTRAS_VER} != "live" && ${MY_EXTRAS_VER} != "none" ]]; then + SRC_URI="${SRC_URI} mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 http://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" +fi DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." HOMEPAGE="http://www.mysql.com/" -if [[ "${PN}" == "mariadb" ]]; then +if [[ ${PN} == "mariadb" ]]; then HOMEPAGE="http://mariadb.org/" DESCRIPTION="An enhanced, drop-in replacement for MySQL" fi +if [[ ${PN} == "mariadb-galera" ]]; then + HOMEPAGE="http://mariadb.org/" + DESCRIPTION="An enhanced, drop-in replacement for MySQL with Galera Replication" +fi +if [[ ${PN} == "percona-server" ]]; then + HOMEPAGE="http://www.percona.com/software/percona-server" + DESCRIPTION="An enhanced, drop-in replacement fro MySQL from the Percona team" +fi LICENSE="GPL-2" SLOT="0" @@ -172,34 +191,29 @@ IUSE="${IUSE} extraengine" IUSE="${IUSE} cluster" IUSE="${IUSE} max-idx-128" -IUSE="${IUSE} berkdb" IUSE="${IUSE} +community profiling" -[[ ${PN} == "mariadb" ]] \ -&& mysql_check_version_range "5.1.38 to 5.3.99" \ -&& IUSE="${IUSE} libevent" - -[[ ${PN} == "mariadb" ]] \ -&& mysql_version_is_at_least "5.2" \ -&& IUSE="${IUSE} oqgraph" - -[[ ${PN} == "mariadb" ]] \ -&& mysql_version_is_at_least "5.2.5" \ -&& IUSE="${IUSE} sphinx" - -[[ ${PN} == "mariadb" ]] \ -&& mysql_version_is_at_least "5.2.10" \ -&& IUSE="${IUSE} pam" +if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then + mysql_check_version_range "5.1.38 to 5.3.99" && IUSE="${IUSE} libevent" + mysql_version_is_at_least "5.2" && IUSE="${IUSE} oqgraph" + mysql_version_is_at_least "5.2.5" && IUSE="${IUSE} sphinx" + mysql_version_is_at_least "5.2.10" && IUSE="${IUSE} pam" +fi if mysql_version_is_at_least "5.5"; then REQUIRED_USE="tcmalloc? ( !jemalloc ) jemalloc? ( !tcmalloc )" IUSE="${IUSE} jemalloc tcmalloc" fi -REQUIRED_USE="${REQUIRED_USE} minimal? ( !cluster !extraengine !embedded ) static? ( !ssl )" +if mysql_version_is_at_least "5.5.7"; then + IUSE="${IUSE} systemtap" +fi -mysql_version_is_at_least "5.5.7" \ -&& IUSE="${IUSE} systemtap" +if [[ ${PN} == "percona-server" ]]; then + mysql_version_is_at_least "5.5.10" && IUSE="${IUSE} pam" +fi + +REQUIRED_USE="${REQUIRED_USE} minimal? ( !cluster !extraengine !embedded ) static? ( !ssl )" # # DEPENDENCIES: @@ -216,42 +230,30 @@ DEPEND=" >=sys-libs/zlib-1.2.3 " -[[ ${PN} == mariadb ]] \ -&& mysql_check_version_range "5.1.38 to 5.3.99" \ -&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )" +if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then + mysql_check_version_range "5.1.38 to 5.3.99" && DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )" + mysql_version_is_at_least "5.2" && DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )" + mysql_version_is_at_least "5.2.5" && DEPEND="${DEPEND} sphinx? ( app-misc/sphinx )" + mysql_version_is_at_least "5.2.10" && DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam ) )" + # Bug 441700 MariaDB >=5.3 include custom mytop + mysql_version_is_at_least "5.3" && DEPEND="${DEPEND} perl? ( !dev-db/mytop )" +fi # Having different flavours at the same time is not a good idea -for i in "mysql" "mariadb" ; do +for i in "mysql" "mariadb" "mariadb-galera" "percona-server"; do [[ ${i} == ${PN} ]] || DEPEND="${DEPEND} !dev-db/${i}" done -[[ "${PN}" == "mariadb" ]] \ -&& mysql_version_is_at_least "5.2" \ -&& DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )" - -[[ "${PN}" == "mariadb" ]] \ -&& mysql_version_is_at_least "5.2.5" \ -&& DEPEND="${DEPEND} sphinx? ( app-misc/sphinx )" - -[[ "${PN}" == "mariadb" ]] \ -&& mysql_version_is_at_least "5.2.10" \ -&& DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam ) )" - -# Bug 441700 MariaDB >=5.3 include custom mytop -[[ "${PN}" == "mariadb" ]] \ -&& mysql_version_is_at_least "5.3" \ -&& DEPEND="${DEPEND} perl? ( !dev-db/mytop )" - -mysql_version_is_at_least "5.5.7" \ -&& DEPEND="${DEPEND} systemtap? ( >=dev-util/systemtap-1.3 )" \ -&& DEPEND="${DEPEND} kernel_linux? ( dev-libs/libaio )" - -mysql_version_is_at_least "5.5" \ -&& DEPEND="${DEPEND} jemalloc? ( dev-libs/jemalloc )" +if mysql_version_is_at_least "5.5" ; then + DEPEND="${DEPEND} jemalloc? ( dev-libs/jemalloc )" + DEPEND="${DEPEND} tcmalloc? ( dev-util/google-perftools )" +fi -mysql_version_is_at_least "5.5" \ -&& DEPEND="${DEPEND} tcmalloc? ( dev-util/google-perftools )" +if mysql_version_is_at_least "5.5.7" ; then + DEPEND="${DEPEND} systemtap? ( >=dev-util/systemtap-1.3 )" + DEPEND="${DEPEND} kernel_linux? ( dev-libs/libaio )" +fi # prefix: first need to implement something for #196294 RDEPEND="${DEPEND} @@ -259,14 +261,16 @@ RDEPEND="${DEPEND} selinux? ( sec-policy/selinux-mysql ) " -# Bug 455016 Add dependancies of mytop -[[ "${PN}" == "mariadb" ]] \ -&& mysql_version_is_at_least "5.3" \ -&& RDEPEND="${RDEPEND} perl? ( - virtual/perl-Getopt-Long - dev-perl/TermReadKey - virtual/perl-Term-ANSIColor - virtual/perl-Time-HiRes ) " +if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then + # Bug 455016 Add dependencies of mytop + if mysql_version_is_at_least "5.3" ; then + RDEPEND="${RDEPEND} perl? ( + virtual/perl-Getopt-Long + dev-perl/TermReadKey + virtual/perl-Term-ANSIColor + virtual/perl-Time-HiRes ) " + fi +fi DEPEND="${DEPEND} virtual/yacc @@ -278,8 +282,9 @@ DEPEND="${DEPEND} static? ( sys-libs/ncurses[static-libs] )" DEPEND="${DEPEND} >=dev-util/cmake-2.4.3" # compile-time-only -mysql_version_is_at_least "5.5.8" \ -&& DEPEND="${DEPEND} >=dev-util/cmake-2.6.3" +if mysql_version_is_at_least "5.5.8" ; then + DEPEND="${DEPEND} >=dev-util/cmake-2.6.3" +fi # dev-perl/DBD-mysql is needed by some scripts installed by MySQL PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" @@ -295,13 +300,12 @@ PDEPEND="${PDEPEND} =virtual/mysql-${MYSQL_PV_MAJOR}" # PBXT_VERSION means that we have a PBXT patch for this PV # PBXT was only introduced after 5.1.12 pbxt_patch_available() { - [[ ${PN} != "mariadb" ]] \ - && [[ -n "${PBXT_VERSION}" ]] + [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera" && ( -n "${PBXT_VERSION}" ) ]] return $? } pbxt_available() { - pbxt_patch_available || [[ ${PN} == "mariadb" ]] + pbxt_patch_available || [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] return $? } @@ -310,18 +314,16 @@ pbxt_available() { # XTRADB_VERS means that we have a XTRADB patch for this PV # XTRADB was only introduced after 5.1.26 xtradb_patch_available() { - [[ ${PN} != "mariadb" ]] \ - && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] + [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera" + && ( -n "${XTRADB_VER}" ) && ( -n "${PERCONA_VER}" ) ]] return $? } - if pbxt_patch_available; then PBXT_P="pbxt-${PBXT_VERSION}" PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" - fi # PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins @@ -393,8 +395,7 @@ mysql-v2_pkg_setup() { fi # Check for USE flag problems in pkg_setup - if ! mysql_version_is_at_least "5.2" \ - && use debug ; then + if ! mysql_version_is_at_least "5.2" && use debug ; then # Also in package.use.mask die "Bug #344885: Upstream has broken USE=debug for 5.1 series >=5.1.51" fi @@ -496,13 +497,13 @@ mysql-v2_pkg_postinst() { docinto "scripts" for script in scripts/mysql* ; do - [[ -f "${script}" ]] \ - && [[ "${script%.sh}" == "${script}" ]] \ - && dodoc "${script}" + if [[ -f "${script}" && "${script%.sh}" == "${script}" ]]; then + dodoc "${script}" + fi done - if [ ${PN} == "mariadb" ] \ - && mysql_version_is_at_least "5.2.10" && use pam ; then + if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] \ + && mysql_version_is_at_least "5.2.10" && use pam ; then einfo elog "This install includes the PAM authentication plugin." elog "To activate and configure the PAM plugin, please read:" @@ -536,10 +537,6 @@ mysql-v2_pkg_postinst() { elog " PRIMARY KEY (name)" elog " ) CHARACTER SET utf8 COLLATE utf8_bin;" fi - - mysql_check_version_range "4.0 to 5.0.99.99" \ - && use berkdb \ - && elog "Berkeley DB support is deprecated and will be removed in future versions!" } # @FUNCTION: mysql-v2_getopt @@ -587,7 +584,7 @@ mysql-v2_pkg_config() { 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 "${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}" @@ -670,11 +667,11 @@ mysql-v2_pkg_config() { && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ || touch "${TMPDIR}/fill_help_tables.sql" help_tables="${TMPDIR}/fill_help_tables.sql" - + # Figure out which options we need to disable to do the setup 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 bdb \ + for opt in grant-tables host-cache name-resolve networking slave-start \ federated innodb ssl log-bin relay-log slow-query-log external-locking \ ndbcluster log-slave-updates \ ; do @@ -690,7 +687,7 @@ mysql-v2_pkg_config() { pushd "${TMPDIR}" &>/dev/null #cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}" cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db - [ -f ${cmd} ] || cmd=${EROOT}usr/bin/mysql_install_db + [[ -f ${cmd} ]] || cmd=${EROOT}usr/bin/mysql_install_db cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options}" einfo "Command: $cmd" eval $cmd \ @@ -716,6 +713,14 @@ mysql-v2_pkg_config() { einfo "Creating the mysql database and setting proper" einfo "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 + mkdir "${PID_DIR}" + chown mysql:mysql "${PID_DIR}" + chmod 755 "${PID_DIR}" + fi + local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" local mysqld="${EROOT}/usr/sbin/mysqld \ @@ -763,7 +768,7 @@ mysql-v2_pkg_config() { mysql < "${sqltmp}" rc=$? eend $? - [ $rc -ne 0 ] && ewarn "Failed to load zoneinfo!" + [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" # Stop the server and cleanup einfo "Stopping the server ..." |