as requeseted rebase

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mysql@1911 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2010-02-01 06:17:26 +00:00
parent 97c1b7282f
commit 0c886627e9
2 changed files with 346 additions and 11 deletions

View File

@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation # Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.121 2009/12/09 18:54:05 robbat2 Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.127 2010/02/01 01:07:08 robbat2 Exp $
# @ECLASS: mysql.eclass # @ECLASS: mysql.eclass
# @MAINTAINER: # @MAINTAINER:
@ -18,7 +18,11 @@
WANT_AUTOCONF="latest" WANT_AUTOCONF="latest"
WANT_AUTOMAKE="latest" WANT_AUTOMAKE="latest"
inherit eutils flag-o-matic gnuconfig autotools mysql_fx versionator inherit eutils flag-o-matic gnuconfig autotools mysql_fx versionator toolchain-funcs
# 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"
[[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" [[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z"
if [[ "${MY_EXTRAS_VER}" == "live" ]]; then if [[ "${MY_EXTRAS_VER}" == "live" ]]; then
@ -49,10 +53,6 @@ case "${EAPI:-0}" in
die "Unsupported EAPI: ${EAPI}" ;; die "Unsupported EAPI: ${EAPI}" ;;
esac esac
# 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"
# @ECLASS-VARIABLE: MYSQL_VERSION_ID # @ECLASS-VARIABLE: MYSQL_VERSION_ID
# @DESCRIPTION: # @DESCRIPTION:
# MYSQL_VERSION_ID will be: # MYSQL_VERSION_ID will be:
@ -127,6 +127,10 @@ RDEPEND="${DEPEND}
mysql_version_is_at_least "5.1" \ mysql_version_is_at_least "5.1" \
|| DEPEND="${DEPEND} berkdb? ( sys-apps/ed )" || DEPEND="${DEPEND} berkdb? ( sys-apps/ed )"
# compile-time-only
mysql_version_is_at_least "5.1.12" \
&& DEPEND="${DEPEND} >=dev-util/cmake-2.4.3"
# dev-perl/DBD-mysql is needed by some scripts installed by MySQL # dev-perl/DBD-mysql is needed by some scripts installed by MySQL
PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
@ -151,7 +155,8 @@ SRC_URI="${SERVER_URI}"
[[ ${MY_EXTRAS_VER} != live ]] \ [[ ${MY_EXTRAS_VER} != live ]] \
&& SRC_URI="${SRC_URI} && SRC_URI="${SRC_URI}
mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
http://g3nt8.org/patches/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"
for str in ${MYSQL_STORAGE} ; do for str in ${MYSQL_STORAGE} ; do
STORAGE_USE="${str/-*/}" STORAGE_USE="${str/-*/}"
@ -196,11 +201,42 @@ IUSE="${IUSE} ${STORAGE_IUSE}"
# @DESCRIPTION: # @DESCRIPTION:
# Helper function to disable specific tests. # Helper function to disable specific tests.
mysql_disable_test() { mysql_disable_test() {
local testname="${1}" ; shift local rawtestname testname testsuite reason mysql_disable_file
local reason="${@}" rawtestname="${1}" ; shift
local mysql_disable_file="${S}/mysql-test/t/disabled.def" reason="${@}"
ewarn "test '${rawtestname}' disabled: '${reason}'"
testsuite="${rawtestname/.*}"
testname="${rawtestname/*.}"
mysql_disable_file="${S}/mysql-test/t/disabled.def"
einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
echo ${testname} : ${reason} >> "${mysql_disable_file}" echo ${testname} : ${reason} >> "${mysql_disable_file}"
ewarn "test '${testname}' disabled: '${reason}'"
# ${S}/mysql-tests/t/disabled.def
#
# ${S}/mysql-tests/suite/federated/disabled.def
#
# ${S}/mysql-tests/suite/jp/t/disabled.def
# ${S}/mysql-tests/suite/ndb/t/disabled.def
# ${S}/mysql-tests/suite/rpl/t/disabled.def
# ${S}/mysql-tests/suite/parts/t/disabled.def
# ${S}/mysql-tests/suite/rpl_ndb/t/disabled.def
# ${S}/mysql-tests/suite/ndb_team/t/disabled.def
# ${S}/mysql-tests/suite/binlog/t/disabled.def
# ${S}/mysql-tests/suite/innodb/t/disabled.def
if [ -n "${testsuite}" ]; then
for mysql_disable_file in \
${S}/mysql-test/suite/${testsuite}/disabled.def \
${S}/mysql-test/suite/${testsuite}/t/disabled.def \
FAILED ; do
[ -f "${mysql_disable_file}" ] && break
done
if [ "${mysql_disabled_file}" != "FAILED" ]; then
echo "${testname} : ${reason}" >> "${mysql_disable_file}"
else
ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
fi
fi
} }
# @FUNCTION: mysql_init_vars # @FUNCTION: mysql_init_vars
@ -524,6 +560,14 @@ mysql_pkg_setup() {
die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
fi fi
# Bug #290570 fun. Upstream made us need a fairly new GCC4.
if mysql_version_is_at_least "5.0.83" ; then
GCC_VER=$(gcc-version)
case ${GCC_VER} in
2*|3*|4.0|4.1|4.2) die "Active GCC too old! Must have at least GCC4.3" ;;
esac
fi
# This should come after all of the die statements # This should come after all of the die statements
enewgroup mysql 60 || die "problem adding 'mysql' group" enewgroup mysql 60 || die "problem adding 'mysql' group"
enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
@ -652,7 +696,13 @@ mysql_src_prepare() {
fi fi
if mysql_version_is_at_least "5.1.12" ; then if mysql_version_is_at_least "5.1.12" ; then
einfo "Updating innobase cmake"
rebuilddirlist="." rebuilddirlist="."
# TODO: check this with a cmake expert
cmake \
-DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \
-DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \
"storage/innobase"
else else
rebuilddirlist=". innobase" rebuilddirlist=". innobase"
fi fi

285
eclass/mysql.eclass.diff Normal file
View File

@ -0,0 +1,285 @@
--- /usr/portage/eclass/mysql.eclass 2010-02-01 02:08:45.000000000 +0100
+++ mysql.eclass 2010-02-01 07:14:49.174800340 +0100
@@ -63,6 +63,7 @@
# We also strip off upstream's trailing letter that they use to respin tarballs
MYSQL_VERSION_ID=""
+MY_PV="${PV/pre/m}"
tpv="${PV%[a-z]}"
tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}"
for vatom in 0 1 2 3 ; do
@@ -87,6 +88,8 @@
MYSQL_COMMUNITY_FEATURES=1
elif [ "${PV#5.4}" != "${PV}" ]; then
MYSQL_COMMUNITY_FEATURES=1
+elif [ "${PV#5.5}" != "${PV}" ]; then
+ MYSQL_COMMUNITY_FEATURES=1
else
MYSQL_COMMUNITY_FEATURES=0
fi
@@ -138,10 +141,10 @@
if [ -z "${SERVER_URI}" ]; then
# The community build is on the mirrors
if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then
- SERVER_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/mysql-${PV//_/-}.tar.gz"
+ SERVER_URI="mirror://mysql/Downloads/MySQL-${MY_PV%.*}/mysql-${MY_PV//_/-}.tar.gz"
# The (old) enterprise source is on the primary site only
elif [ "${PN}" == "mysql" ]; then
- SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${PV//_/-}.tar.gz"
+ SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV//_/-}.tar.gz"
fi
fi
@@ -155,19 +158,11 @@
http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
-# PBXT engine
-mysql_version_is_at_least "5.1.12" \
-&& [[ -n "${PBXT_VERSION}" ]] \
-&& PBXT_P="pbxt-${PBXT_VERSION}" \
-&& PBXT_SRC_URI="mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \
-&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )"
-
-# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set
-mysql_version_is_at_least "5.1.26" \
-&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
-&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \
-&& XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \
-&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )"
+for str in ${MYSQL_STORAGE} ; do
+ STORAGE_USE="${str/-*/}"
+ SRC_URI="${SRC_URI} ${STORAGE_USE}? ( http://ftp.mars.arge.at/mysql/mysql-storage-${str}.tar.gz )"
+ STORAGE_IUSE="${STORAGE_IUSE} ${STORAGE_USE}"
+done
DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
HOMEPAGE="http://www.mysql.com/"
@@ -190,17 +185,14 @@
mysql_version_is_at_least "5.1" \
|| IUSE="${IUSE} berkdb"
-mysql_version_is_at_least "5.1.12" \
-&& [[ -n "${PBXT_VERSION}" ]] \
-&& IUSE="${IUSE} pbxt"
-
mysql_version_is_at_least "5.1.26" \
-&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
-&& IUSE="${IUSE} xtradb"
+&& IUSE="${IUSE} innodb xtradb dynamicplugins"
[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \
&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling"
+IUSE="${IUSE} ${STORAGE_IUSE}"
+
#
# HELPER FUNCTIONS:
#
@@ -479,15 +471,14 @@
myconf="${myconf} --enable-assembler"
myconf="${myconf} --with-geometry"
myconf="${myconf} --with-readline"
- myconf="${myconf} --with-row-based-replication"
- myconf="${myconf} --with-zlib=/usr/$(get_libdir)"
+ myconf="${myconf} --with-zlib-dir=/usr"
myconf="${myconf} --without-pstack"
use max-idx-128 && myconf="${myconf} --with-max-indexes=128"
- # 5.1 introduces a new way to manage storage engines (plugins)
+ # 5.1 introduces a new way to manage storage engines (plugins)
# like configuration=none
local plugins="csv,myisam,myisammrg,heap"
- if use extraengine ; then
+ if use extraengine && ! use dynamicplugins ; then
# like configuration=max-no-ndb, archive and example removed in 5.1.11
plugins="${plugins},archive,blackhole,example,federated,partition"
@@ -504,44 +495,29 @@
myconf="${myconf} --with-ndb-binlog"
fi
- if mysql_version_is_at_least "5.2" ; then
+ if mysql_version_is_at_least "6.0" ; then
plugins="${plugins},falcon"
fi
- myconf="${myconf} --with-plugins=${plugins}"
-}
-
-pbxt_src_configure() {
- mysql_init_vars
-
- pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
-
- einfo "Reconfiguring dir '${PWD}'"
- AT_GNUCONF_UPDATE="yes" eautoreconf
-
- local myconf=""
- myconf="${myconf} --with-mysql=${S} --libdir=${D}/${MY_LIBDIR}"
- use debug && myconf="${myconf} --with-debug=full"
- # TODO: is it safe/needed to use econf here ?
- ./configure ${myconf} || die "Problem configuring PBXT storage engine"
-}
-
-pbxt_src_compile() {
- # Be backwards compatible for now
- if [[ $EAPI != 2 ]]; then
- pbxt_src_configure
- fi
- # TODO: is it safe/needed to use emake here ?
- make || die "Problem making PBXT storage engine (${myconf})"
-
- popd
- # TODO: modify test suite for PBXT
-}
+ for str in ${STORAGE_IUSE} ; do
+ if use ${str} ; then
+ # don't confuse autoconf by specifying the plugins to or more times
+ if ! use dynamicplugins ; then
+ [[ -d storage/${str} ]] && plugins="${plugins},${str}"
+ fi
+ # suppress error message
+ [[ ${str} = "innodb" ]] && str="innobase"
+ [[ ${str} = "xtradb" ]] && str="innobase"
+ [[ ! -d storage/${str} ]] && eerror "use ${str} but no ${str} plugin"
+ if [ -e storage/${str}/setup.sh ]; then
+ pushd storage/${str}
+ sh setup.sh
+ popd
+ fi
+ fi
+ done
-pbxt_src_install() {
- pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
- make install || die "Failed to install PBXT"
- popd
+ myconf="${myconf} --with-plugins=${plugins}"
}
#
@@ -609,6 +585,22 @@
mysql_init_vars
unpack ${A}
+
+ for str in ${MYSQL_STORAGE} ; do
+ storage_name="${str/-*/}"
+ if use ${storage_name} ; then
+ einfo "Moving ${str/-/ Storage Engine Version } in place"
+ pushd "${WORKDIR}/${MY_SOURCEDIR}"/storage
+ i="${WORKDIR}/mysql-storage-${str}"
+ o="${storage_name}"
+ # Have we been here already ? or are we updating the included engine !
+ [ -h "${o}" ] && rm -f "${o}"
+ # Or maybe we haven't
+ [ -d "${i}" -a ! -d "${o}" ] && cp -R "${i}"/* "${WORKDIR}/${MY_SOURCEDIR}"
+ popd
+ fi
+ done
+
# Grab the patches
[[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git_src_unpack
@@ -659,16 +651,47 @@
local rebuilddirlist d
- if mysql_version_is_at_least "5.1.26" && use xtradb ; then
+
+
+ if mysql_version_is_at_least "5.1.26" && use xtradb && use innodb ; then
+ eerror "Percona XtraDB and Innobase innoDB can not be insalled at the same time."
+ elif mysql_version_is_at_least "5.1.26" && use xtradb && ! use innodb ; then
einfo "Replacing InnoDB with Percona XtraDB"
+ einfo "Removing InnoDB Plugin Storage Engine"
+ pushd "${S}"/storage
+ # the innodb_plugin is a reason for compile errors if we replace innobase
+ i="innodb_plugin"
+ o="${WORKDIR}/storage-${i}.mysql-upstream"
+ # Have we been here already?
+ [ -h "${i}" ] && rm -f "${i}"
+ # Or maybe we haven't
+ [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
+ i="innobase"
+ o="${WORKDIR}/storage-${i}.mysql-upstream"
+ # Have we been here already?
+ [ -h "${i}" ] && rm -f "${i}"
+ # Or maybe we haven't
+ [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
+ mv -f "xtradb" "${i}"
+ popd
+ elif mysql_version_is_at_least "5.1.26" && use innodb && ! use xtradb ; then
+ einfo "Replacing InnoDB with Innobase innoDB"
+ einfo "Removing InnoDB Plugin Storage Engine"
pushd "${S}"/storage
+ # the innodb_plugin is a reason for compile errors if we replace innobase
+ i="innodb_plugin"
+ o="${WORKDIR}/storage-${i}.mysql-upstream"
+ # Have we been here already?
+ [ -h "${i}" ] && rm -f "${i}"
+ # Or maybe we haven't
+ [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
i="innobase"
o="${WORKDIR}/storage-${i}.mysql-upstream"
# Have we been here already?
[ -h "${i}" ] && rm -f "${i}"
# Or maybe we haven't
[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
- ln -s "${WORKDIR}/${XTRADB_P}" "${i}"
+ mv -f "innodb" "${i}"
popd
fi
@@ -771,10 +794,6 @@
find . -type f -name Makefile -print0 \
| xargs -0 -n100 sed -i \
-e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
-
- if [[ $EAPI == 2 ]]; then
- mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_configure
- fi
}
# @FUNCTION: mysql_src_compile
@@ -788,8 +807,6 @@
esac
emake || die "emake failed"
-
- mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_compile
}
# @FUNCTION: mysql_src_install
@@ -801,8 +818,6 @@
emake install DESTDIR="${D}" benchdir_root="${MY_SHAREDSTATEDIR}" || die "emake install failed"
- mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_install
-
# Convenience links
einfo "Making Convenience links for mysqlcheck multi-call binary"
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
@@ -941,21 +956,6 @@
einfo
fi
- if mysql_version_is_at_least "5.1.12" && use pbxt ; then
- # TODO: explain it better
- elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';"
- elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;"
- elog "if, after that, you cannot start the MySQL server,"
- elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then"
- elog "use the MySQL upgrade script to restore the table"
- elog "or execute the following SQL command:"
- elog " CREATE TABLE IF NOT EXISTS plugin ("
- elog " name char(64) binary DEFAULT '' NOT NULL,"
- elog " dl char(128) DEFAULT '' NOT NULL,"
- 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!"