diff --git a/eclass/mysql.eclass b/eclass/mysql.eclass index 41ad567..b76d5f8 100644 --- a/eclass/mysql.eclass +++ b/eclass/mysql.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.126 2010/01/31 05:47:21 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.144 2010/04/01 20:36:39 robbat2 Exp $ # @ECLASS: mysql.eclass # @MAINTAINER: @@ -40,6 +40,7 @@ case "${EAPI:-0}" in pkg_preinst pkg_postinst \ pkg_config pkg_postrm IUSE_DEFAULT_ON='+' + IUSE_DEFAULT_OFF='-' ;; 0 | 1) EXPORT_FUNCTIONS pkg_setup \ @@ -53,6 +54,14 @@ case "${EAPI:-0}" in die "Unsupported EAPI: ${EAPI}" ;; esac + +# @ECLASS-VARIABLE: MYSQL_PV_MAJOR +# @DESCRIPTION: +# Upstream MySQL considers the first two parts of the version number to be the +# major version. Upgrades that change major version should always run +# mysql_upgrade. +MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})" + # @ECLASS-VARIABLE: MYSQL_VERSION_ID # @DESCRIPTION: # MYSQL_VERSION_ID will be: @@ -63,7 +72,6 @@ esac # 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 @@ -80,30 +88,22 @@ MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} # and 0 (no). # Community features are available in mysql-community # AND in the re-merged mysql-5.0.82 and newer -if [ "${PN}" == "mysql-community" ]; then +if [ "${PN}" == "mysql-community" -o "${PN}" == "mariadb" ]; then MYSQL_COMMUNITY_FEATURES=1 elif [ "${PV#5.0}" != "${PV}" ] && mysql_version_is_at_least "5.0.82"; then MYSQL_COMMUNITY_FEATURES=1 elif [ "${PV#5.1}" != "${PV}" ] && mysql_version_is_at_least "5.1.28"; then MYSQL_COMMUNITY_FEATURES=1 -elif [ "${PV#5.4}" != "${PV}" ]; then +elif [ "${PV#5.4}" != "${PV}" ] ; then MYSQL_COMMUNITY_FEATURES=1 -elif [ "${PV#5.5}" != "${PV}" ]; then +elif [ "${PV#5.5}" != "${PV}" ] ; then + MYSQL_COMMUNITY_FEATURES=1 +elif [ "${PV#6.0}" != "${PV}" ] ; then MYSQL_COMMUNITY_FEATURES=1 else MYSQL_COMMUNITY_FEATURES=0 fi -# @ECLASS-VARIABLE: XTRADB_VER -# @DESCRIPTION: -# Version of the XTRADB storage engine -XTRADB_VER="${XTRADB_VER}" - -# @ECLASS-VARIABLE: PERCONA_VER -# @DESCRIPTION: -# Designation by PERCONA for a MySQL version to apply an XTRADB release -PERCONA_VER="${PERCONA_VER}" - # Be warned, *DEPEND are version-dependant # These are used for both runtime and compiletime DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) @@ -113,10 +113,13 @@ DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) >=sys-libs/readline-4.1 >=sys-libs/zlib-1.2.3" +[[ "${PN}" == "mariadb" ]] \ +&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )" + # Having different flavours at the same time is not a good idea -for i in "" "-community" ; do - [[ "${i}" == ${PN#mysql} ]] || - DEPEND="${DEPEND} !dev-db/mysql${i}" +for i in "mysql" "mysql-community" "mariadb" ; do + [[ "${i}" == ${PN} ]] || + DEPEND="${DEPEND} !dev-db/${i}" done RDEPEND="${DEPEND} @@ -135,21 +138,30 @@ mysql_version_is_at_least "5.1.12" \ PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" # For other stuff to bring us in -PDEPEND="${PDEPEND} =virtual/mysql-$(get_version_component_range 1-2 ${PV})" +PDEPEND="${PDEPEND} =virtual/mysql-${MYSQL_PV_MAJOR}" # 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 '-' ${PV})" + MARIA_FULL_P="${PN}-${MARIA_FULL_PV}" + SERVER_URI=" + http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz + http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz + http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz + " # The community build is on the mirrors - if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then - SERVER_URI="mirror://mysql/Downloads/MySQL-${MY_PV%.*}/mysql-${MY_PV//_/-}.tar.gz" + elif [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then + SERVER_URI="mirror://mysql/Downloads/MySQL-${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-${MY_PV//_/-}.tar.gz" + SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV}.tar.gz" fi fi # Define correct SRC_URIs -SRC_URI="${SERVER_URI}" +SRC_URI="${SERVER_URI} ${GO_MYSQL_PATCHES}" # Gentoo patches to MySQL [[ ${MY_EXTRAS_VER} != live ]] \ @@ -160,15 +172,23 @@ SRC_URI="${SERVER_URI}" for str in ${MYSQL_STORAGE} ; do STORAGE_USE="${str/-*/}" - SRC_URI="${SRC_URI} ${STORAGE_USE}? ( http://ftp.disconnected-by-peer.at/mysql/mysql-storage-${str}.tar.gz )" + SRC_URI="${SRC_URI} http://ftp.disconnected-by-peer.at/mysql/mysql-storage-${str}.tar.gz" STORAGE_IUSE="${STORAGE_IUSE} ${STORAGE_USE}" +# IUSE="{IUSE} ${IUSE_DEFAULT_OFF}${STORAGE_USE}" done DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." HOMEPAGE="http://www.mysql.com/" +if [[ "${PN}" == "mariadb" ]]; then + HOMEPAGE="http://askmonty.org/" + DESCRIPTION="MariaDB is a MySQL fork with 3rd-party patches and additional storage engines merged." +fi +if [[ "${PN}" == "mysql-community" ]]; then + DESCRIPTION="${DESCRIPTION} (obsolete, move to dev-db/mysql)" +fi LICENSE="GPL-2" SLOT="0" -IUSE="big-tables debug embedded minimal ${IUSE_DEFAULT_ON}perl selinux ssl static" +IUSE="big-tables debug embedded minimal ${IUSE_DEFAULT_ON}perl selinux ssl static test" mysql_version_is_at_least "4.1" \ && IUSE="${IUSE} latin1" @@ -185,12 +205,12 @@ mysql_version_is_at_least "5.0.18" \ mysql_version_is_at_least "5.1" \ || IUSE="${IUSE} berkdb" -mysql_version_is_at_least "5.1.26" \ -&& IUSE="${IUSE} innodb xtradb dynamicplugins" - [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \ && IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling" +[[ "${PN}" == "mariadb" ]] \ +&& IUSE="${IUSE} libevent pbxt xtradb" + IUSE="${IUSE} ${STORAGE_IUSE}" # @@ -209,7 +229,7 @@ mysql_disable_test() { testsuite="${rawtestname/.*}" testname="${rawtestname/*.}" mysql_disable_file="${S}/mysql-test/t/disabled.def" - einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" + #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" echo ${testname} : ${reason} >> "${mysql_disable_file}" # ${S}/mysql-tests/t/disabled.def @@ -389,20 +409,16 @@ configure_40_41_50() { myconf="${myconf} --with-extra-tools" myconf="${myconf} --with-innodb" myconf="${myconf} --without-readline" + myconf="${myconf} $(use_with ssl openssl)" mysql_version_is_at_least "5.0" || myconf="${myconf} $(use_with raid)" # --with-vio is not needed anymore, it's on by default and # has been removed from configure + # Apply to 4.x and 5.0.[0-3] if use ssl ; then mysql_version_is_at_least "5.0.4" || myconf="${myconf} --with-vio" fi - if mysql_version_is_at_least "5.1.11" ; then - myconf="${myconf} $(use_with ssl)" - else - myconf="${myconf} $(use_with ssl openssl)" - fi - if mysql_version_is_at_least "5.0.60" ; then if use berkdb ; then elog "Berkeley DB support was disabled due to build failures" @@ -467,57 +483,140 @@ configure_51() { # TODO: !!!! readd --without-readline # the failure depend upon config/ac-macros/readline.m4 checking into # readline.h instead of history.h - myconf="${myconf} $(use_with ssl)" + myconf="${myconf} $(use_with ssl ssl /usr)" myconf="${myconf} --enable-assembler" myconf="${myconf} --with-geometry" myconf="${myconf} --with-readline" - myconf="${myconf} --with-zlib-dir=/usr" + myconf="${myconf} --with-zlib-dir=/usr/" myconf="${myconf} --without-pstack" + myconf="${myconf} --with-plugindir=/usr/$(get_libdir)/mysql/plugin" + use max-idx-128 && myconf="${myconf} --with-max-indexes=128" + if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then + myconf="${myconf} $(use_enable community community-features)" + if use community; then + myconf="${myconf} $(use_enable profiling)" + else + myconf="${myconf} --disable-profiling" + fi + fi + + # Scan for all available plugins + local plugins_avail="$( + LANG=C \ + find "${S}" \ + \( \ + -name 'plug.in' \ + -o -iname 'configure.in' \ + -o -iname 'configure.ac' \ + \) \ + -print0 \ + | xargs -0 sed -r -n \ + -e '/^MYSQL_STORAGE_ENGINE/{ + s~MYSQL_STORAGE_ENGINE\([[:space:]]*\[?([-_a-z0-9]+)\]?.*,~\1 ~g ; + s~^([^ ]+).*~\1~gp; + }' \ + | tr -s '\n' ' ' + )" # 5.1 introduces a new way to manage storage engines (plugins) # like configuration=none - local plugins="csv,myisam,myisammrg,heap" - 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" + # This base set are required, and will always be statically built. + local plugins_sta="csv myisam myisammrg heap" + local plugins_dyn="" + local plugins_dis="example ibmdb2i" - elog "Before using the Federated storage engine, please be sure to read" - elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" + # These aren't actually required by the base set, but are really useful: + plugins_sta="${plugins_sta} archive blackhole" + + # default in 5.5.4 + if mysql_version_is_at_least "5.5.4" ; then + plugins_sta="${plugins_sta} partition" + fi + # Now the extras + if use extraengine ; then + # like configuration=max-no-ndb, archive and example removed in 5.1.11 + # not added yet: ibmdb2i + # Not supporting as examples: example,daemon_example,ftexample + plugins_sta="${plugins_sta} partition" + plugins_dyn="${plugins_dyn} federated" + + if [[ "${PN}" != "mariadb" ]] ; then + elog "Before using the Federated storage engine, please be sure to read" + elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" + else + elog "MariaDB includes the FederatedX engine. Be sure to read" + elog "http://askmonty.org/wiki/index.php/Manual:FederatedX_storage_engine" + fi + else + plugins_dis="${plugins_dis} partition federated" fi - # Upstream specifically requests that InnoDB always be built. - plugins="${plugins},innobase" + # Upstream specifically requests that InnoDB always be built: + # - innobase, innodb_plugin + # Build falcon if available for 6.x series. + for i in innobase falcon ; do + [ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}" + done + for i in innodb_plugin ; do + [ -e "${S}"/storage/${i} ] && plugins_dyn="${plugins_dyn} ${i}" + done # like configuration=max-no-ndb if use cluster ; then - plugins="${plugins},ndbcluster" + plugins_sta="${plugins_sta} ndbcluster" myconf="${myconf} --with-ndb-binlog" + else + plugins_dis="${plugins_dis} ndbcluster" fi - if mysql_version_is_at_least "6.0" ; then - plugins="${plugins},falcon" + if [[ "${PN}" == "mariadb" ]] ; then + # In MariaDB, InnoDB is packaged in the xtradb directory, so it's not + # caught above. + plugins_sta="${plugins_sta} maria innobase" + myconf="${myconf} $(use_with libevent)" + # This is not optional, without it several upstream testcases fail. + # Also strongly recommended by upstream. + myconf="${myconf} --with-maria-tmp-tables" fi - + 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 + # don't confuse autoconf by specifying the plugins two or more times + [[ -e "${S}"/storage/${str} ]] && plugins_dyn="${plugins_dyn} ${str}" + elif ! use ${str} ; then + # don't confuse autoconf by specifying the plugins two or more times + [[ -e "${S}"/storage/${str} ]] && plugins_dis="${plugins_dis} ${str}" + else + # don't confuse autoconf by specifying the plugins two or more times + [[ -e "${S}"/storage/${str} ]] && plugins_sta="${plugins_sta} ${str}" + fi + # suppress error message + [[ ${str} = "innodb" ]] && str="innobase" + [[ ${str} = "xtradb" ]] && str="innobase" + [[ ! -e "${S}"/storage/${str} ]] && eerror "use ${str} but no ${str} plugin" + if [ -e "${S}"/storage/${str}/setup.sh ]; then + pushd storage/${str} + sh setup.sh + popd fi done - myconf="${myconf} --with-plugins=${plugins}" + use static && \ + plugins_sta="${plugins_sta} ${plugins_dyn}" && \ + plugins_dyn="" + + einfo "Available plugins: ${plugins_avail}" + einfo "Dynamic plugins: ${plugins_dyn}" + einfo "Static plugins: ${plugins_sta}" + einfo "Disabled plugins: ${plugins_dis}" + + # These are the static plugins + myconf="${myconf} --with-plugins=${plugins_sta// /,}" + # And the disabled ones + for i in ${plugins_dis} ; do + myconf="${myconf} --without-plugin-${i}" + done } # @@ -541,8 +640,9 @@ mysql_pkg_setup() { # Check for USE flag problems in pkg_setup if use static && use ssl ; then - eerror "MySQL does not support being built statically with SSL support enabled!" - die "MySQL does not support being built statically with SSL support enabled!" + M="MySQL does not support being built statically with SSL support enabled!" + eerror "${M}" + die "${M}" fi if ! mysql_version_is_at_least "5.0" \ @@ -554,17 +654,24 @@ mysql_pkg_setup() { fi if mysql_version_is_at_least "4.1.3" \ - && ( use cluster || use extraengine ) \ + && ( use cluster || use extraengine || use embedded ) \ && use minimal ; then - eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" - die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" + M="USE flags 'cluster', 'extraengine', 'embedded' conflict with 'minimal' USE flag!" + eerror "${M}" + die "${M}" fi - # Bug #290570 fun. Upstream made us need a fairly new GCC4. - if mysql_version_is_at_least "5.0.83" ; then + # Bug #290570, 284946, 307251 + # Upstream changes made us need a fairly new GCC4. + # But only for 5.0.8[3-6]! + if mysql_version_is_at_least "5.0.83" && ! mysql_version_is_at_least 5.0.87 ; 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" ;; + 2*|3*|4.0|4.1|4.2) + eerror "Some releases of MySQL required a very new GCC, and then" + eerror "later release relaxed that requirement again. Either pick a" + eerror "MySQL >=5.0.87, or use a newer GCC." + die "Active GCC too old!" ;; esac fi @@ -575,6 +682,16 @@ mysql_pkg_setup() { 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!" + + if [ "${PN}" != "mysql-cluster" ] && use cluster; then + ewarn "Upstream has noted that the NDB cluster support in the 5.0 and" + ewarn "5.1 series should NOT be put into production. In the near" + ewarn "future, it will be disabled from building." + ewarn "" + ewarn "If you need NDB support, you should instead move to the new" + ewarn "mysql-cluster package that represents that upstream NDB" + ewarn "development." + fi } # @FUNCTION: mysql_src_unpack @@ -588,17 +705,15 @@ mysql_src_unpack() { 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 + 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 done # Grab the patches @@ -623,12 +738,16 @@ mysql_src_prepare() { EPATCH_SUFFIX="patch" mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" # Clean out old items - rm -f "${EPATCH_SOURCE}"/* + #rm -f "${EPATCH_SOURCE}"/* # Now link in right patches mysql_mv_patches # And apply epatch + # last -fPIC fixup, per bug #305873 + i="${S}"/storage/innodb_plugin/plug.in + [ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" + # Additional checks, remove bundled zlib rm -f "${S}/zlib/"*.[ch] sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" @@ -651,8 +770,6 @@ mysql_src_prepare() { local rebuilddirlist d - - 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 @@ -673,6 +790,7 @@ mysql_src_prepare() { # Or maybe we haven't [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" mv -f "xtradb" "${i}" + rm -rf "innodb" popd elif mysql_version_is_at_least "5.1.26" && use innodb && ! use xtradb ; then einfo "Replacing InnoDB with Innobase innoDB" @@ -692,17 +810,19 @@ mysql_src_prepare() { # Or maybe we haven't [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" mv -f "innodb" "${i}" + rm -rf "xtradb" popd fi if mysql_version_is_at_least "5.1.12" ; then - einfo "Updating innobase cmake" 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" + # This does not seem to be needed presently. robbat2 2010/02/23 + #einfo "Updating innobase cmake" + ## 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 rebuilddirlist=". innobase" fi @@ -801,10 +921,10 @@ mysql_src_configure() { # Compile the mysql code. mysql_src_compile() { # Be backwards compatible for now - case ${EAPI:-0} in - 2) : ;; - 0 | 1) mysql_src_configure ;; - esac + case ${EAPI:-0} in + 2) : ;; + 0 | 1) mysql_src_configure ;; + esac emake || die "emake failed" } @@ -816,7 +936,11 @@ mysql_src_install() { # Make sure the vars are correctly initialized mysql_init_vars - emake install DESTDIR="${D}" benchdir_root="${MY_SHAREDSTATEDIR}" || die "emake install failed" + emake install \ + DESTDIR="${D}" \ + benchdir_root="${MY_SHAREDSTATEDIR}" \ + testroot="${MY_SHAREDSTATEDIR}" \ + || die "emake install failed" # Convenience links einfo "Making Convenience links for mysqlcheck multi-call binary" @@ -830,7 +954,7 @@ mysql_src_install() { for removeme in "mysql-log-rotate" mysql.server* \ binary-configure* my-*.cnf mi_test_all* do - rm -f "${D}"/usr/share/mysql/${removeme} + rm -f "${D}"/${MY_SHAREDSTATEDIR}/${removeme} done # Clean up stuff for a minimal build @@ -842,8 +966,17 @@ mysql_src_install() { rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a 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 - if mysql_version_is_at_least "4.1" ; then + if mysql_version_is_at_least "5.1" ; then + mysql_mycnf_version="5.1" + elif mysql_version_is_at_least "4.1" ; then mysql_mycnf_version="4.1" else mysql_mycnf_version="4.0" @@ -855,7 +988,9 @@ mysql_src_install() { "${FILESDIR}/my.cnf-${mysql_mycnf_version}" \ > "${TMPDIR}/my.cnf.ok" if mysql_version_is_at_least "4.1" && use latin1 ; then - sed -e "s|utf8|latin1|g" -i "${TMPDIR}/my.cnf.ok" + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR}/my.cnf.ok" fi newins "${TMPDIR}/my.cnf.ok" my.cnf @@ -880,7 +1015,7 @@ mysql_src_install() { # Docs einfo "Installing docs" - dodoc README COPYING ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE + dodoc README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE doinfo "${S}"/Docs/mysql.info # Minimal builds don't have the MySQL server @@ -892,12 +1027,12 @@ mysql_src_install() { "${S}"/support-files/magic \ "${S}"/support-files/ndb-config-2-node.ini do - dodoc "${script}" + [[ -f "$script" ]] && dodoc "${script}" done docinto "scripts" for script in "${S}"/scripts/mysql* ; do - [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" + [[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" done fi @@ -941,12 +1076,15 @@ mysql_pkg_postinst() { support-files/magic \ support-files/ndb-config-2-node.ini do - dodoc "${script}" + [[ -f "${script}" ]] \ + && dodoc "${script}" done docinto "scripts" for script in scripts/mysql* ; do - [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" + [[ -f "${script}" ]] \ + && [[ "${script%.sh}" == "${script}" ]] \ + && dodoc "${script}" done einfo @@ -956,6 +1094,21 @@ mysql_pkg_postinst() { einfo fi + if 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!" @@ -1002,7 +1155,12 @@ mysql_pkg_config() { local pwd1="a" local pwd2="b" - local maxtry=5 + local MYSQL_ROOT_PASSWORD='' + local maxtry=15 + + if [ -z "${MYSQL_ROOT_PASSWORD}" -a -f "${ROOT}/root/.my.cnf" ]; then + MYSQL_ROOT_PASSWORD="$(sed -n -e '/^password=/s,^password=,,gp' "${ROOT}/root/.my.cnf")" + fi if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then ewarn "You have already a MySQL database in place." @@ -1015,18 +1173,21 @@ mysql_pkg_config() { # localhost. Also causes weird failures. [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - einfo "Creating the mysql database and setting proper" - einfo "permissions on it ..." + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then - einfo "Insert a password for the mysql 'root' user" - ewarn "Avoid [\"'\\_%] characters in the password" - read -rsp " >" pwd1 ; echo + einfo "Please provide a password for the mysql 'root' user now," + einfo "or in the MYSQL_ROOT_PASSWORD env var." + ewarn "Avoid [\"'\\_%] characters in the password" + read -rsp " >" pwd1 ; echo - einfo "Retype the password" - read -rsp " >" pwd2 ; echo + einfo "Retype the password" + read -rsp " >" pwd2 ; echo - if [[ "x$pwd1" != "x$pwd2" ]] ; then - die "Passwords are not the same" + if [[ "x$pwd1" != "x$pwd2" ]] ; then + die "Passwords are not the same" + fi + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 fi local options="" @@ -1050,9 +1211,20 @@ mysql_pkg_config() { chown -R mysql:mysql "${ROOT}/${MY_DATADIR}" 2>/dev/null chmod 0750 "${ROOT}/${MY_DATADIR}" 2>/dev/null - if mysql_version_is_at_least "4.1.3" ; then - options="--skip-ndbcluster" + # Figure out which options we need to disable to do the setup + helpfile="${TMPDIR}/mysqld-help" + ${ROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null + for opt in grant-tables host-cache name-resolve networking slave-start bdb \ + federated innodb ssl log-bin relay-log slow-query-log external-locking \ + ; do + optexp="--(skip-)?${opt}" optfull="--skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" + done + # But some options changed names + egrep -sq external-locking "${helpfile}" && \ + options="${options/skip-locking/skip-external-locking}" + if mysql_version_is_at_least "4.1.3" ; then # Filling timezones, see # http://dev.mysql.com/doc/mysql/en/time-zone-support.html "${ROOT}/usr/bin/mysql_tzinfo_to_sql" "${ROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null @@ -1061,49 +1233,61 @@ mysql_pkg_config() { cat "${help_tables}" >> "${sqltmp}" fi fi + + einfo "Creating the mysql database and setting proper" + einfo "permissions on it ..." local socket="${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock" local pidfile="${ROOT}/var/run/mysqld/mysqld${RANDOM}.pid" local mysqld="${ROOT}/usr/sbin/mysqld \ ${options} \ --user=mysql \ - --skip-grant-tables \ --basedir=${ROOT}/usr \ --datadir=${ROOT}/${MY_DATADIR} \ - --skip-innodb \ - --skip-bdb \ - --skip-networking \ --max_allowed_packet=8M \ --net_buffer_length=16K \ + --default-storage-engine=MyISAM \ --socket=${socket} \ --pid-file=${pidfile}" + #einfo "About to start mysqld: ${mysqld}" + ebegin "Starting 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('${pwd1}') WHERE USER='root'" + local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'" "${ROOT}/usr/bin/mysql" \ --socket=${socket} \ -hlocalhost \ -e "${sql}" + eend $? - einfo "Loading \"zoneinfo\", this step may require a few seconds ..." - + ebegin "Loading \"zoneinfo\", this step may require a few seconds ..." "${ROOT}/usr/bin/mysql" \ --socket=${socket} \ -hlocalhost \ -uroot \ - -p"${pwd1}" \ + -p"${MYSQL_ROOT_PASSWORD}" \ mysql < "${sqltmp}" + rc=$? + eend $? + [ $rc -ne 0 ] && ewarn "Failed to load zoneinfo!" # Stop the server and cleanup + einfo "Stopping the server ..." kill $(< "${pidfile}" ) rm -f "${sqltmp}" - einfo "Stopping the server ..." wait %1 einfo "Done" } diff --git a/eclass/mysql.eclass.diff b/eclass/mysql.eclass.diff index 6e23d52..8dcd86d 100644 --- a/eclass/mysql.eclass.diff +++ b/eclass/mysql.eclass.diff @@ -1,112 +1,167 @@ ---- /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 +--- /var/lib/layman/mysql-overlay/eclass/mysql.eclass 2010-04-29 20:11:37.345620519 +0200 ++++ mysql.eclass 2010-05-30 02:06:43.216440310 +0200 +@@ -40,6 +40,7 @@ + pkg_preinst pkg_postinst \ + pkg_config pkg_postrm + IUSE_DEFAULT_ON='+' ++ IUSE_DEFAULT_OFF='-' + ;; + 0 | 1) + EXPORT_FUNCTIONS pkg_setup \ +@@ -103,16 +104,6 @@ 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 + +-# @ECLASS-VARIABLE: XTRADB_VER +-# @DESCRIPTION: +-# Version of the XTRADB storage engine +-XTRADB_VER="${XTRADB_VER}" +- +-# @ECLASS-VARIABLE: PERCONA_VER +-# @DESCRIPTION: +-# Designation by PERCONA for a MySQL version to apply an XTRADB release +-PERCONA_VER="${PERCONA_VER}" +- + # Be warned, *DEPEND are version-dependant + # These are used for both runtime and compiletime + DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) +@@ -170,7 +161,7 @@ fi -@@ -155,19 +158,11 @@ + # Define correct SRC_URIs +-SRC_URI="${SERVER_URI}" ++SRC_URI="${SERVER_URI} ${GO_MYSQL_PATCHES}" + + # Gentoo patches to MySQL + [[ ${MY_EXTRAS_VER} != live ]] \ +@@ -179,6 +170,13 @@ 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.disconnected-by-peer.at/mysql/mysql-storage-${str}.tar.gz )" ++ SRC_URI="${SRC_URI} http://ftp.disconnected-by-peer.at/mysql/mysql-storage-${str}.tar.gz" + STORAGE_IUSE="${STORAGE_IUSE} ${STORAGE_USE}" ++# IUSE="{IUSE} ${IUSE_DEFAULT_OFF}${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" ] \ + if [[ "${PN}" == "mariadb" ]]; then +@@ -211,57 +209,9 @@ && 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}" + [[ "${PN}" == "mariadb" ]] \ +-&& IUSE="${IUSE} libevent" +- +-# MariaDB has integrated PBXT +-# 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" ]] \ +- && mysql_version_is_at_least "5.1.12" \ +- && [[ -n "${PBXT_VERSION}" ]] +- return $? -} - +-pbxt_available() { +- pbxt_patch_available || [[ "${PN}" == "mariadb" ]] +- return $? +-} +- +-# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set +-# MariaDB has integrated XtraDB +-# 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" ]] \ +- && mysql_version_is_at_least "5.1.26" \ +- && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] +- return $? +-} ++&& IUSE="${IUSE} libevent pbxt xtradb" + +- +-pbxt_patch_available \ +-&& 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} )" \ +- +-# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins +-# vs. built outside the dir +-pbxt_available \ +-&& IUSE="${IUSE} pbxt" \ +-&& mysql_version_is_at_least "5.1.40" \ +-&& PBXT_NEWSTYLE=1 +- +-xtradb_patch_available \ +-&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \ +-&& XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \ +-&& XTRADB_SRC_B1="http://www.percona.com/" \ +-&& XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/" \ +-&& XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}" \ +-&& XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}" \ +-&& XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \ +-&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )" \ +-&& IUSE="${IUSE} xtradb" ++IUSE="${IUSE} ${STORAGE_IUSE}" + + # + # HELPER FUNCTIONS: +@@ -589,7 +539,7 @@ + # not added yet: ibmdb2i + # Not supporting as examples: example,daemon_example,ftexample + plugins_sta="${plugins_sta} partition" +- plugins_dyn="${plugins_sta} federated" ++ plugins_dyn="${plugins_dyn} federated" + + if [[ "${PN}" != "mariadb" ]] ; then + elog "Before using the Federated storage engine, please be sure to read" +@@ -623,18 +573,34 @@ + if [[ "${PN}" == "mariadb" ]] ; then + # In MariaDB, InnoDB is packaged in the xtradb directory, so it's not + # caught above. +- plugins_sta="${plugins_sta},maria,innobase" ++ plugins_sta="${plugins_sta} maria innobase" + myconf="${myconf} $(use_with libevent)" + # This is not optional, without it several upstream testcases fail. + # Also strongly recommended by upstream. + myconf="${myconf} --with-maria-tmp-tables" + fi + +- if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then +- use pbxt \ +- && plugins_dyn="${plugins_dyn} pbxt" \ +- || plugins_dis="${plugins_dis} pbxt" +- fi ++ for str in ${STORAGE_IUSE} ; do ++ if use ${str} ; then ++ # don't confuse autoconf by specifying the plugins two or more times ++ [[ -e "${S}"/storage/${str} ]] && plugins_dyn="${plugins_dyn} ${str}" ++ elif ! use ${str} ; then ++ # don't confuse autoconf by specifying the plugins two or more times ++ [[ -e "${S}"/storage/${str} ]] && plugins_dis="${plugins_dis} ${str}" ++ else ++ # don't confuse autoconf by specifying the plugins two or more times ++ [[ -e "${S}"/storage/${str} ]] && plugins_sta="${plugins_sta} ${str}" ++ fi ++ # suppress error message ++ [[ ${str} = "innodb" ]] && str="innobase" ++ [[ ${str} = "xtradb" ]] && str="innobase" ++ [[ ! -e "${S}"/storage/${str} ]] && eerror "use ${str} but no ${str} plugin" ++ if [ -e "${S}"/storage/${str}/setup.sh ]; then ++ pushd storage/${str} ++ sh setup.sh ++ popd ++ fi ++ done + + use static && \ + plugins_sta="${plugins_sta} ${plugins_dyn}" && \ +@@ -653,39 +619,6 @@ + done + } + -pbxt_src_configure() { - mysql_init_vars - @@ -116,13 +171,13 @@ - AT_GNUCONF_UPDATE="yes" eautoreconf - - local myconf="" -- myconf="${myconf} --with-mysql=${S} --libdir=${D}/${MY_LIBDIR}" +- myconf="${myconf} --with-mysql=${S} --libdir=/usr/$(get_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" +- econf ${myconf} || die "Problem configuring PBXT storage engine" -} - -pbxt_src_compile() { +- - # Be backwards compatible for now - if [[ $EAPI != 2 ]]; then - pbxt_src_configure @@ -133,66 +188,105 @@ - 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" +- emake install DESTDIR="${D}" || die "Failed to install PBXT" - popd -+ myconf="${myconf} --with-plugins=${plugins}" - } - +-} +- # -@@ -609,6 +585,22 @@ + # EBUILD FUNCTIONS + # +@@ -727,15 +660,6 @@ + eerror "${M}" + die "${M}" + fi +- +- if mysql_version_is_at_least "5.1" \ +- && xtradb_patch_available \ +- && use xtradb \ +- && use embedded ; then +- M="USE flags 'xtradb' and 'embedded' conflict and cause build failures" +- eerror "${M}" +- die "${M}" +- fi + + # Bug #290570, 284946, 307251 + # Upstream changes made us need a fairly new GCC4. +@@ -778,6 +702,20 @@ 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 ++ 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 + done + # Grab the patches [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git_src_unpack -@@ -659,16 +651,47 @@ +@@ -800,7 +738,7 @@ + EPATCH_SUFFIX="patch" + mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" + # Clean out old items +- rm -f "${EPATCH_SOURCE}"/* ++ #rm -f "${EPATCH_SOURCE}"/* + # Now link in right patches + mysql_mv_patches + # And apply +@@ -832,26 +770,48 @@ local rebuilddirlist d -- if mysql_version_is_at_least "5.1.26" && use xtradb ; then -+ -+ +- if xtradb_patch_available && use xtradb ; then +- einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)" +- pushd "${S}"/storage >/dev/null + 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 "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? +- [ -d "${o}" ] && rm -f "${i}" ++ [ -h "${i}" ] && rm -f "${i}" + # Or maybe we haven't + [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" +- cp -ral "${WORKDIR}/${XTRADB_P}" "${i}" +- popd >/dev/null +- fi +- +- if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then +- einfo "Adding storage engine: PBXT" +- pushd "${S}"/storage >/dev/null +- i='pbxt' +- [ -d "${i}" ] && rm -rf "${i}" +- cp -ral "${WORKDIR}/${PBXT_P}" "${i}" +- popd >/dev/null ++ mv -f "xtradb" "${i}" ++ rm -rf "innodb" ++ 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 @@ -208,78 +302,51 @@ + [ -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 ++ rm -rf "xtradb" ++ popd fi -@@ -771,10 +794,6 @@ + if mysql_version_is_at_least "5.1.12" ; then +@@ -954,10 +914,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 +- if [[ $EAPI == 2 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then +- pbxt_patch_available && use pbxt && pbxt_src_configure - fi } # @FUNCTION: mysql_src_compile -@@ -788,8 +807,6 @@ - esac +@@ -971,10 +927,6 @@ + esac emake || die "emake failed" - -- mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_compile +- if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then +- pbxt_patch_available && use pbxt && pbxt_src_compile +- fi } # @FUNCTION: mysql_src_install -@@ -801,8 +818,6 @@ +@@ -990,10 +942,6 @@ + testroot="${MY_SHAREDSTATEDIR}" \ + || die "emake install failed" - 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 +- if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then +- pbxt_patch_available && use pbxt && pbxt_src_install +- fi - # Convenience links einfo "Making Convenience links for mysqlcheck multi-call binary" dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" -@@ -941,21 +956,6 @@ +@@ -1146,7 +1094,7 @@ 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!" +- if pbxt_available && use pbxt ; then ++ if 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;"