-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.68 2007/01/12 17:00:39 chtekk Exp $
-# kate: encoding utf-8; eol unix;
-# kate: indent-width 4; mixedindent off; remove-trailing-space on; space-indent off;
-# kate: word-wrap-column 80; word-wrap off;
+# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.69 2007/01/12 20:51:28 chtekk Exp $
# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
# Maintainer: Luca Longinotti <chtekk@gentoo.org>
-# Note that MYSQL_VERSION_ID must be empty !!!
+# Both MYSQL_VERSION_ID and MYSQL_PATCHSET_REV must be set in the ebuild too!
+# Note that MYSQL_VERSION_ID must be empty!
-ECLASS="mysql"
-INHERITED="$INHERITED $ECLASS"
WANT_AUTOCONF="latest"
WANT_AUTOMAKE="latest"
+
inherit eutils flag-o-matic gnuconfig autotools mysql_fx
# Shorten the path because the socket path length must be shorter than 107 chars
# This is an important part, because many of the choices the MySQL ebuild will do
# depend on this variable.
# In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803"
+
MYSQL_VERSION_ID=""
tpv=( ${PV//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}"
for vatom in 0 1 2 3 ; do
>=sys-apps/sed-4
>=sys-apps/texinfo-4.7-r1
>=sys-libs/readline-4.1
- >=sys-libs/zlib-1.2.3
- "
+ >=sys-libs/zlib-1.2.3"
-# having different flavours at the same time is not a good idea
-for i in "" "-community" "-slotted" ; do
+# 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}"
done
mysql_version_is_at_least "5.1" \
|| DEPEND="${DEPEND} berkdb? ( sys-apps/ed )"
+mysql_version_is_at_least "5.1.12" \
+&& DEPEND="${DEPEND} innodb? ( >=dev-util/cmake-2.4.3 )"
+
# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
-if mysql_version_is_at_least "5.1.12" ; then
- DEPEND="${DEPEND} innodb? ( >=dev-util/cmake-2.4.3 )"
-fi
-
# BitKeeper dependency, compile-time only
[[ ${IS_BITKEEPER} -eq 90 ]] && DEPEND="${DEPEND} dev-util/bk_client"
-if [[ ${PN} == "mysql-slotted" ]] ; then
- DEPEND="${DEPEND} app-admin/eselect-mysql"
-fi
-
-if [[ ${PN} == "mysql-slotted" ]] ; then
- SLOT=""
- tpv=( ${PV//[-._]/ } )
- for vatom in 0 1 2 ; do
- SLOT="${SLOT}${tpv[${vatom}]}_"
- done
- #finally SLOT=5_0_24
- SLOT=${SLOT:0:${#SLOT}-1}
-else
- SLOT="0"
-fi
-
# Define correct SRC_URIs
-SRC_URI="
-${SERVER_URI}
-http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
-"
+SRC_URI="${SERVER_URI}
+ http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
mysql_version_is_at_least "5.1.12" \
&& [[ -n "${PBXT_VERSION}" ]] \
&& SRC_URI="${SRC_URI} pbxt? ( mirror://sourceforge/pbxt/pbxt-${PBXT_VERSION}.tar.gz )"
DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
HOMEPAGE="http://www.mysql.com/"
LICENSE="GPL-2"
+SLOT="0"
IUSE="big-tables debug embedded minimal perl selinux ssl static"
RESTRICT="confcache"
#
bitkeeper_fetch() {
-
local reposuf
if [[ -z "${1}" ]] ; then
local tpv
else
reposuf="${1}"
fi
- einfo "using \"${reposuf}\" repository."
+ einfo "Using '${reposuf}' repository."
local repo_uri="bk://mysql.bkbits.net/${reposuf}"
- ## -- ebk_store_dir: bitkeeper sources store directory
+ ## -- ebk_store_dir: bitkeeper sources store directory
local ebk_store_dir="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/bk-src"
- ## -- ebk_fetch_cmd: bitkeeper fetch command
+ ## -- ebk_fetch_cmd: bitkeeper fetch command
# always fetch the latest revision, use -r<revision> if a specified revision is wanted
# hint: does not work
local ebk_fetch_cmd="sfioball"
- ## -- ebk_update_cmd: bitkeeper update command
+ ## -- ebk_update_cmd: bitkeeper update command
local ebk_update_cmd="update"
- #addread "/etc/bitkeeper"
+ # addread "/etc/bitkeeper"
addwrite "${ebk_store_dir}"
- if [[ ! -d "${ebk_store_dir}" ]]; then
- debug-print "${FUNCNAME}: initial checkout. creating bitkeeper directory"
- mkdir -p "${ebk_store_dir}" || die "${EBK}: can't mkdir ${ebk_store_dir}."
+ if [[ ! -d "${ebk_store_dir}" ]] ; then
+ debug-print "${FUNCNAME}: initial checkout, creating bitkeeper directory ..."
+ mkdir -p "${ebk_store_dir}" || die "BK: couldn't mkdir ${ebk_store_dir}"
fi
- pushd "${ebk_store_dir}" || die "${EBK}: can't chdir to ${ebk_store_dir}"
+ pushd "${ebk_store_dir}" || die "BK: couldn't chdir to ${ebk_store_dir}"
local wc_path=${reposuf}
- if [[ ! -d "${wc_path}" ]]; then
+ if [[ ! -d "${wc_path}" ]] ; then
local options="-r+"
- # first check out
- einfo "bitkeeper check out start -->"
- elog " repository: ${repo_uri}"
- ${ebk_fetch_cmd} ${options} "${repo_uri}" ${wc_path} \
- || die "${EBK}: can't fetch from ${repo_uri}."
+
+ # first checkout
+ einfo "bitkeeper checkout start -->"
+ einfo " repository: ${repo_uri}"
+
+ ${ebk_fetch_cmd} ${options} "${repo_uri}" "${wc_path}" \
+ || die "BK: couldn't fetch from ${repo_uri}"
else
- if [[ ! -d "${wc_path}/BK" ]]; then
+ if [[ ! -d "${wc_path}/BK" ]] ; then
popd
- die "Look like ${wc_path} is not a bitkeeper path."
+ die "Looks like ${wc_path} is not a bitkeeper path"
fi
# update working copy
einfo "bitkeeper update start -->"
- elog " repository: ${repo_uri}"
+ einfo " repository: ${repo_uri}"
${ebk_update_cmd} "${repo_uri}" "${wc_path}" \
- || die "BK: can't update from ${repo_uri} to ${wc_path}."
+ || die "BK: couldn't update from ${repo_uri} to ${wc_path}"
fi
- einfo " working copy: ${wc_path}"
+ einfo " working copy: ${wc_path}"
cd "${wc_path}"
- rsync -rlpgo --exclude="BK/" . "${S}" || die "BK: can't export to ${S}."
+ rsync -rlpgo --exclude="BK/" . "${S}" || die "BK: couldn't export to ${S}"
echo
popd
-
}
mysql_disable_test() {
local reason="${@}"
local mysql_disable_file="${S}/mysql-test/t/disabled.def"
echo ${testname} : ${reason} >> "${mysql_disable_file}"
- ewarn "test \"${testname}\" disabled because: \"${reason}\""
+ ewarn "test '${testname}' disabled: '${reason}'"
}
# void mysql_init_vars()
# 2005-11-19 <vivo@gentoo.org>
mysql_init_vars() {
- if [[ ${SLOT} == "0" ]] ; then
- MY_SUFFIX=""
- else
- MY_SUFFIX=${MY_SUFFIX:-"-${SLOT}"}
- fi
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR:-"/usr/share/mysql${MY_SUFFIX}"}
- MY_SYSCONFDIR=${MY_SYSCONFDIR="/etc/mysql${MY_SUFFIX}"}
- MY_LIBDIR=${MY_LIBDIR="/usr/$(get_libdir)/mysql${MY_SUFFIX}"}
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="/var/lib/mysql${MY_SUFFIX}"}
- MY_LOGDIR=${MY_LOGDIR="/var/log/mysql${MY_SUFFIX}"}
- MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql${MY_SUFFIX}"}
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="/usr/share/mysql"}
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="/etc/mysql"}
+ MY_LIBDIR=${MY_LIBDIR="/usr/$(get_libdir)/mysql"}
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="/var/lib/mysql"}
+ MY_LOGDIR=${MY_LOGDIR="/var/log/mysql"}
+ MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql"}
if [[ -z "${DATADIR}" ]] ; then
DATADIR=""
if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
- DATADIR=`"my_print_defaults${MY_SUFFIX}" mysqld 2>/dev/null \
+ DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
| sed -ne '/datadir/s|^--datadir=||p' \
| tail -n1`
if [[ -z "${DATADIR}" ]] ; then
MY_SOURCEDIR=${SERVER_URI##*/}
MY_SOURCEDIR=${MY_SOURCEDIR%.tar*}
- export MY_SUFFIX MY_SHAREDSTATEDIR MY_SYSCONFDIR
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR
export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
export MY_INCLUDEDIR DATADIR MY_SOURCEDIR
}
myconf="${myconf} --enable-shared --enable-static"
fi
- if mysql_version_is_at_least "4.01.00.00" && ! use latin1 ; then
+ if mysql_version_is_at_least "4.1" && ! use latin1 ; then
myconf="${myconf} --with-charset=utf8"
myconf="${myconf} --with-collation=utf8_general_ci"
else
myconf="${myconf} --without-readline"
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
if use ssl ; then
- # --with-vio is not needed anymore, it's on by default and
- # has been removed from configure
- mysql_version_is_at_least "5.0.4" || myconf="${myconf} --with-vio"
+ mysql_version_is_at_least "5.0.4" || myconf="${myconf} --with-vio"
fi
if mysql_version_is_at_least "5.1.11" ; then
# The following fix is due to a bug with bdb on SPARC's. See:
# http://www.geocrawler.com/mail/msg.php3?msg_id=4754814&list=8
# It comes down to non-64-bit safety problems.
- if use sparc || use alpha || use hppa || use mips || use amd64 ; then
+ if use alpha || use amd64 || use hppa || use mips || use sparc ; then
elog "Berkeley DB support was disabled due to incompatible arch"
myconf="${myconf} --without-berkeley-db"
else
einfo "Reconfiguring dir '${PWD}'"
AT_GNUCONF_UPDATE="yes" eautoreconf
- local myconf
- myconf="${myconf} --with-mysql=${S}"
- mkdir -p ${T}/lib
- myconf="${myconf} --libdir=${D}/${MY_LIBDIR}"
+ local myconf=""
+ myconf="${myconf} --with-mysql=${S} --libdir=${D}/${MY_LIBDIR}"
use debug && myconf="${myconf} --with-debug=full"
- # TODO is safe/needed to use econf here ?
- ./configure ${myconf} || die "problem configuring pbxt storage engine"
- # TODO is safe/needed to use emake here ?
- make || die "problem making pbxt storage engine (${myconf})"
+ # TODO: is it safe/needed to use econf here ?
+ ./configure ${myconf} || die "Problem configuring PBXT storage engine"
+ # TODO: is it safe/needed to use emake here ?
+ make || die "Problem making PBXT storage engine (${myconf})"
popd
- # TODO: modify test suite
+ # TODO: modify test suite for PBXT
}
pbxt_src_install() {
pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
- make install || die "failed pbxt install"
+ make install || die "Failed to install PBXT"
popd
}
if [[ ${IS_BITKEEPER} -eq 90 ]] ; then
if mysql_check_version_range "5.1 to 5.1.99" ; then
bitkeeper_fetch "mysql-5.1-ndb"
- elif mysql_check_version_range "5.2.0 to 5.2.99" ; then
+ elif mysql_check_version_range "5.2 to 5.2.99" ; then
bitkeeper_fetch "mysql-5.2-falcon"
else
bitkeeper_fetch
fi
cd "${S}"
- einfo "running upstream autorun on bk sources"
+ einfo "Running upstream autorun over BK sources ..."
BUILD/autorun.sh
else
mv -f "${WORKDIR}/${MY_SOURCEDIR}" "${S}"
# Apply the patches for this MySQL version
EPATCH_SUFFIX="patch"
- mkdir -p "${EPATCH_SOURCE}" || die "unable to create epatch directory"
+ mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory"
mysql_mv_patches
- epatch || die "failed to apply all patches"
+ epatch
# Additional checks, remove bundled zlib
rm -f "${S}/zlib/"*.[ch]
if mysql_version_is_at_least "5.1.12" ; then
rebuilddirlist="."
- # TODO IMPO! Check this with a cmake expert
+ # TODO: check this with a cmake expert
use innodb \
&& cmake \
-DCMAKE_C_COMPILER=$(which $(tc-getCC)) \
export CXXFLAGS
econf \
- --program-suffix="${MY_SUFFIX}" \
--libexecdir="/usr/sbin" \
--sysconfdir="${MY_SYSCONFDIR}" \
--localstatedir="${MY_LOCALSTATEDIR}" \
# Make sure the vars are correctly initialized
mysql_init_vars
- emake install DESTDIR="${D}" benchdir_root="${MY_SHAREDSTATEDIR}" || die
+ 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
doins "${MY_INCLUDEDIR}"/my_{config,dir}.h
# Convenience links
- dosym "/usr/bin/mysqlcheck${MY_SUFFIX}" "/usr/bin/mysqlanalyze${MY_SUFFIX}"
- dosym "/usr/bin/mysqlcheck${MY_SUFFIX}" "/usr/bin/mysqlrepair${MY_SUFFIX}"
- dosym "/usr/bin/mysqlcheck${MY_SUFFIX}" "/usr/bin/mysqloptimize${MY_SUFFIX}"
+ dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
+ dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
+ dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
# Various junk (my-*.cnf moved elsewhere)
rm -Rf "${D}/usr/share/info"
rm -f "${D}"/usr/share/mysql/${removeme}
done
- # TODO change at Makefile-am level
- if [[ ${PN} == "mysql-slotted" ]] ; then
- for moveme in "mysql_fix_privilege_tables.sql" \
- "fill_help_tables.sql" "ndb-config-2-node.ini"
- do
- mv -f "${D}/usr/share/mysql/${moveme}" "${D}/usr/share/mysql${MY_SUFFIX}/" 2>/dev/null
- done
- fi
-
- # clean up stuff for a minimal build
+ # Clean up stuff for a minimal build
if use minimal ; then
rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench}
rm -f "${D}"/usr/bin/{mysql{_install_db,manager*,_secure_installation,_fix_privilege_tables,hotcopy,_convert_table_format,d_multi,_fix_extensions,_zap,_explain_log,_tableinfo,d_safe,_install,_waitpid,binlog,test},myisam*,isam*,pack_isam}
rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a
fi
- if [[ ${PN} == "mysql-slotted" ]] ; then
- local notcatched=$(ls "${D}/usr/share/mysql"/*)
- if [[ -n "${notcatched}" ]] ; then
- ewarn "QA notice"
- ewarn "${notcatched} files in /usr/share/mysql"
- ewarn "bug mysql-herd to manage them"
- fi
- rm -Rf "${D}/usr/share/mysql"
- fi
-
# Configuration stuff
if mysql_version_is_at_least "4.1" ; then
mysql_mycnf_version="4.1"
fi
insinto "${MY_SYSCONFDIR}"
doins scripts/mysqlaccess.conf
- sed -e "s!@MY_SUFFIX@!${MY_SUFFIX}!g" \
- -e "s!@DATADIR@!${DATADIR}!g" \
+ sed -e "s!@DATADIR@!${DATADIR}!g" \
"${FILESDIR}/my.cnf-${mysql_mycnf_version}" \
> "${TMPDIR}/my.cnf.ok"
if mysql_version_is_at_least "4.1" && use latin1 ; then
done
fi
- if [[ ${PN} == "mysql-slotted" ]] ; then
- # MOVED HERE DUE TO BUG #121445
- # create a list of files, to be used
- # by external utilities
- mkdir -p "${D}/var/lib/eselect/mysql/"
- local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
- pushd "${D}/" &>/dev/null
- find usr/bin/ usr/sbin/ \
- -type f -name "*${MY_SUFFIX}*" \
- -and -not -name "mysql_config${MY_SUFFIX}" \
- > "${filelist}"
- find usr/share/man \
- -type f -name "*${MY_SUFFIX}*" \
- | sed -e 's/$/.gz/' \
- >> "${filelist}"
- echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
- echo "${MY_LIBDIR#"/"}" >> "${filelist}"
- echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
- popd &>/dev/null
- fi
-
mysql_lib_symlinks "${D}"
}
mysql_init_vars
# Check FEATURES="collision-protect" before removing this
- [[ -d "${ROOT}/var/log/mysql" ]] \
- || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
+ [[ -d "${ROOT}/var/log/mysql" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
# Secure the logfiles
touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
for script in scripts/mysql* ; do
[[ "${script%.sh}" == "${script}" ]] && dodoc "${script}"
done
+
+ einfo
+ elog "You might want to run:"
+ elog "\"emerge --config =${CATEGORY}/${PF}\""
+ elog "if this is a new install."
+ einfo
fi
- #einfo "you may want to read slotting upgrade documents in the overlay"
if mysql_version_is_at_least "5.1.12" && use pbxt ; then
- # TODO tell it better ;-)
- elog "mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';"
- elog "CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;"
- elog "if, after that you cannot start the mysql server"
+ # 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 "
- 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;"
+ 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!"
}
mysql_pkg_postrm() {
- if [[ ${PN} == "mysql-slotted" ]] ; then
- mysql_lib_symlinks
- mysql_clients_link_to_best_version
- fi
+ # mysql_lib_symlinks "${D}"
}
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.17 2007/01/04 20:38:16 vivo Exp $
-# kate: encoding utf-8; eol unix;
-# kate: indent-width 4; mixedindent off; remove-trailing-space on; space-indent off;
-# kate: word-wrap-column 80; word-wrap off;
+# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.18 2007/01/12 20:51:28 chtekk Exp $
# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
-# Maintainer: Francesco Riosa <vivo@gentoo.org>
+# Maintainer: Luca Longinotti <chtekk@gentoo.org>
-ECLASS="mysql_fx"
-INHERITED="$INHERITED $ECLASS"
inherit multilib
+#
# Helper function, version (integer) may have sections separated by dots
-# for readability
+# for readability.
#
stripdots() {
local dotver=${1:-"0"}
for i in 1000000 10000 100 1 ; do
v=${dotver%%\.*}
# remove leading zeroes
- while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]]; do v=${v#0}; done
+ while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done
# increment integer version number
ret=$(( ${v} * ${i} + ${ret} ))
if [[ "${dotver}" == "${dotver/\.}" ]] ; then
dotver=${dotver#*\.}
fi
done
- echo ${ret}
+ echo "${ret}"
else
# already an integer
v=${dotver}
- while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]]; do v=${v#0}; done
- echo ${v}
+ while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done
+ echo "${v}"
fi
}
#
# Check if a version number falls inside a given range.
# The range includes the extremes and must be specified as
-# "low_version to high_version" i.e. "4.00.00.00 to 5.01.99.99"
-# Return true if inside the range
-# 2005-11-19 <vivo@gentoo.org>
+# "low_version to high_version" i.e. "4.1.2 to 5.1.99.99".
+# Returns true if inside the range.
#
mysql_check_version_range() {
local lbound="${1%% to *}" ; lbound=$(stripdots "${lbound}")
return 1
}
-# true if found at least one appliable range
-# 2005-11-19 <vivo at gentoo.org>
+#
+# True if at least one applicable range is found for the patch.
+#
_mysql_test_patch_ver_pn() {
local filesdir="${WORKDIR}/mysql-extras"
local allelements=", version, package name"
- [[ -d "${filesdir}" ]] || die "sourcedir must be a directory"
+ [[ -d "${filesdir}" ]] || die "Source dir must be a directory"
local flags=$1 pname=$2
if [[ $(( $flags & $(( 1 + 4 + 16 )) )) -eq 21 ]] ; then
- einfo "using \"${pname}\""
- mv "${filesdir}/${pname}" "${EPATCH_SOURCE}" || die "cannot move ${pname}"
+ einfo "using '${pname}'"
+ mv -f "${filesdir}/${pname}" "${EPATCH_SOURCE}" || die "Couldn't move ${pname}"
return 0
fi
&& allelements="${allelements//", package name"}"
[[ -n "${allelements}" ]] && [[ "${flags}" -gt 0 ]] \
- && ewarn "QA notice ${allelements} missing in ${pname} patch"
+ && ewarn "QA notice: ${allelements} missing in ${pname} patch"
return 1
}
-# void mysql_mv_patches(char * index_file, char * filesdir, int my_ver)
#
-# parse a "index_file" looking for patches to apply to current
-# version.
-# If the patch apply then print it's description
-# 2005-11-19 <vivo at gentoo.org>
+# Parse a "index_file" looking for patches to apply to the
+# current MySQL version.
+# If the patch applies, print its description.
+#
mysql_mv_patches() {
local index_file="${1:-"${WORKDIR}/mysql-extras/000_index.txt"}"
local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
local dsc ndsc=0 i
dsc=( )
- # values for flags are (2^x):
+ # Values for flags are (2^x):
# 1 - one patch found
- # 2 - at least one version range is wrong
- # 4 - at least one version range is _good_
- # 8 - at least one ${PN} did not match
- # 16 - at least one ${PN} has been matched
- local flags=0 pname=''
- while read row; do
+ # 2 - at least one version range is wrong
+ # 4 - at least one version range is ok
+ # 8 - at least one ${PN} did not match
+ # 16 - at least one ${PN} has been matched
+ local flags=0 pname=""
+ while read row ; do
case "${row}" in
@patch\ *)
[[ -n "${pname}" ]] \
- && ${my_test_fx} $flags "${pname}" \
+ && ${my_test_fx} ${flags} "${pname}" \
&& for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
flags=1 ; ndsc=0 ; dsc=( )
pname=${row#"@patch "}
;;
@ver\ *)
if mysql_check_version_range "${row#"@ver "}" "${my_ver}" ; then
- flags=$(( $flags | 4 ))
+ flags=$(( ${flags} | 4 ))
else
- flags=$(( $flags | 2 ))
+ flags=$(( ${flags} | 2 ))
fi
;;
@pn\ *)
if [[ ${row#"@pn "} == "${PN}" ]] ; then
- flags=$(( $flags | 16 ))
+ flags=$(( ${flags} | 16 ))
else
- flags=$(( $flags | 8 ))
+ flags=$(( ${flags} | 8 ))
fi
;;
# @use\ *) ;;
;;
esac
done < "${index_file}"
- ${my_test_fx} $flags "${pname}" \
- && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
+
+ ${my_test_fx} ${flags} "${pname}" \
+ && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
}
+#
# Is $2 (defaults to $MYSQL_VERSION_ID) at least version $1?
# (nice) idea from versionator.eclass
#
[[ ${want_s} -le ${have_s} ]] && return 0 || return 1
}
-# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
-# crappy sorting file list per version
-mysql_make_file_list() {
- local base="${1}-"
- local n=( )
- echo $( for i in $( ls -d ${1}-[[:digit:]]_[[:digit:]]{,[[:digit:]]}_[[:digit:]]{,[[:digit:]]} 2>/dev/null )
- do
- n=${i#${base}}
- n=( ${n//_/ } )
- # prepend the file name with its numeric version number to make
- # it sortable
- echo "$(( 100000 + ${n[0]} * 10000 + ${n[1]} * 100 + ${n[2]} ))$i"
- # sort and cut the numeric version we added in the previous line
- done | sort | cut -c 7- )
-}
-
-# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
-mysql_choose_better_version() {
- local better=$(mysql_make_file_list ${1})
- echo ${better##* }
-}
-
-# void mysql_lib_symlinks()
#
-# To be called on the live filesystem, reassign symlinks to each mysql
-# library to the best version available
-# 2005-12-30 <vivo at gentoo.org>
-# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
+# To be called on the live filesystem, reassigning symlinks of each MySQL
+# library to the best version available.
+#
mysql_lib_symlinks() {
local d dirlist maxdots soname sonameln reldir
- reldir=${1}
- pushd "${ROOT}${reldir}/usr/$(get_libdir)" &> /dev/null
+ reldir="${1}"
+ pushd "${reldir}/usr/$(get_libdir)" &> /dev/null
# dirlist must contain the less significative directory left
- dirlist="mysql $( mysql_make_file_list mysql )"
+ dirlist="mysql"
# waste some time in removing and recreating symlinks
for d in $dirlist ; do
- for soname in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null )
- do
+ for soname in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null ) ; do
# maxdot is a limit versus infinite loop
maxdots=0
sonameln=${soname##*/}
- # loop in version of the library to link it, similar to the
- # libtool work
- while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]]
- do
+ # loop in version of the library to link it, similar to how
+ # libtool works
+ while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]] ; do
rm -f "${sonameln}"
ln -s "${soname}" "${sonameln}"
(( ++maxdots ))
done
popd &> /dev/null
}
-
-mysql_clients_link_to_best_version() {
- local other better
- # "include"s and "mysql_config", needed to compile other sw
- for other in "/usr/$(get_libdir)/mysql" "/usr/include/mysql" "/usr/bin/mysql_config" ; do
- pushd "${ROOT}${other%/*}" &> /dev/null
- better=$( mysql_choose_better_version "${other##*/}" )
- if ! [[ -d "${other##*/}" ]] ; then
- [[ -L "${other##*/}" ]] && rm -f "${other##*/}"
- ! [[ -f "${other##*/}" ]] && ln -sf "${better}" "${other##*/}"
- else
- [[ -L "${other##*/}" ]] && rm -f "${other##*/}"
- ! [[ -d "${other##*/}" ]] && ln -s "${better}" "${other##*/}"
- fi
- popd &> /dev/null
- done
-}
\ No newline at end of file