diff options
author | Francesco Riosa <vivo@gentoo.org> | 2006-01-08 23:51:13 +0000 |
---|---|---|
committer | Francesco Riosa <vivo@gentoo.org> | 2006-01-08 23:51:13 +0000 |
commit | 670e9bcffa844f272ee3ecdcd019e35fc783876a (patch) | |
tree | e04c83849f202eb84bf6fdbb46c3293e8eb6f5ee /dev-db | |
parent | 2.0.6 version bump. (diff) | |
download | gentoo-2-670e9bcffa844f272ee3ecdcd019e35fc783876a.tar.gz gentoo-2-670e9bcffa844f272ee3ecdcd019e35fc783876a.tar.bz2 gentoo-2-670e9bcffa844f272ee3ecdcd019e35fc783876a.zip |
Slotted mysql versions only (considered ready for testing from now):
- Modified rc scripts to be more similar to the net.* ones, many script to
start the servers, one central config file in /etc/conf.d
- modified and moved the creation of the filelist to be used by the
mysql-eselect module.
- other, forgotten
(Portage version: 2.0.53)
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/mysql/ChangeLog | 13 | ||||
-rw-r--r-- | dev-db/mysql/files/mysql-slot.conf.d-r2 | 87 | ||||
-rwxr-xr-x | dev-db/mysql/files/mysql-slot.rc6-r2 | 260 | ||||
-rw-r--r-- | dev-db/mysql/mysql-4.1.16-r30.ebuild | 12 | ||||
-rw-r--r-- | dev-db/mysql/mysql-5.0.18-r30.ebuild | 12 | ||||
-rw-r--r-- | dev-db/mysql/mysql-5.1.4_alpha-r30.ebuild | 12 |
6 files changed, 380 insertions, 16 deletions
diff --git a/dev-db/mysql/ChangeLog b/dev-db/mysql/ChangeLog index 1ea99ed92b4b..b84d970b3726 100644 --- a/dev-db/mysql/ChangeLog +++ b/dev-db/mysql/ChangeLog @@ -1,6 +1,17 @@ # ChangeLog for dev-db/mysql # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/ChangeLog,v 1.290 2006/01/01 19:00:29 vivo Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/ChangeLog,v 1.291 2006/01/08 23:51:13 vivo Exp $ + + 08 Jan 2006; Francesco Riosa <vivo@gentoo.org> + +files/mysql-slot.conf.d-r2, +files/mysql-slot.rc6-r2, + mysql-4.1.16-r30.ebuild, mysql-5.0.18-r30.ebuild, + mysql-5.1.4_alpha-r30.ebuild: + Slotted mysql versions only (considered ready for testing from now): + - Modified rc scripts to be more similar to the net.* ones, many script to + start the servers, one central config file in /etc/conf.d + - modified and moved the creation of the filelist to be used by the + mysql-eselect module. + - other, forgotten 01 Jan 2006; Francesco Riosa <vivo@gentoo.org> mysql-4.1.16-r30.ebuild, mysql-5.0.18-r30.ebuild, mysql-5.1.4_alpha-r30.ebuild: diff --git a/dev-db/mysql/files/mysql-slot.conf.d-r2 b/dev-db/mysql/files/mysql-slot.conf.d-r2 new file mode 100644 index 000000000000..c775375bb83d --- /dev/null +++ b/dev-db/mysql/files/mysql-slot.conf.d-r2 @@ -0,0 +1,87 @@ +# here is where to define which server start. +#> Additional parameters to be passed to mysqld at startup may be added here, +#> these one will override the ones in "my.cnf". +# +# Each /etc/init.d/mysql-* script read it's own here, see at the end for +#> a deeper explanation +# +# Below are described some suggested parameters to use +# The parameters not recognized will be passed through to the mysqld daemon +# To avoid starting a server just comment it's definition +# Last but not least, spaces are NOT allowed inside the parameters +# +# Parameter : description +# ----------------+----------------------------------------------------------- +# nice : integer [-20 .. 19 ] default 0 +# : change the priority of the server -20 (high) to 19 (low) +# : see "man nice 1" for description +# ----------------+----------------------------------------------------------- +# mycnf : string [full path to my.cnf] +# : specify the path to my.cnf file to be used +# ----------------+----------------------------------------------------------- +# startup_timeout : integer [seconds] default 5 +# : time to wait for mysqld up and running, after this it's +# : marked as failed +# ----------------+----------------------------------------------------------- +# stop_timeout : integer [seconds] default 120 +# : time to wait for a clean mysql shutdown +# ----------------+----------------------------------------------------------- +# +# Additional parameters +# Parameter : description +# ----------------+----------------------------------------------------------- +# server-id : integer [1 .. 255] +# : Uniquely identifies the server instance in the community +# : of replication partners. +# ----------------+----------------------------------------------------------- +# port : integer [1025 .. 65535] default 3306 +# : Port number to use for connection. +# : loose any meaning if skip-networking is set. +# ----------------+----------------------------------------------------------- +# skip-networking : NULL, Don't allow connection with TCP/IP. +# log-bin : string [name of the binlog files] +# : Log update queries in binary format. Optional (but +# : strongly recommended to avoid replication problems if +# : server's hostname changes) argument should be the chosen +# : location for the binary log files. +# ----------------+----------------------------------------------------------- +# Additionally the following variables are recognized: +# +# Be more verbose accept values from 1 to 4 +#DEBUG=4 +# + +## The parameters are passed in a bash array variable, +# the variable name is mysql_slot_[server-ver]_[server-num] +# Where "server-ver" and "server-num" are optional. +# in case are defined "server-num" MUST be of three digits. +# The first digit is the mayor version, the following two the minor +# i.e. having installed mysql-5.1.x "server-num" will be "501" +# "server-num" it's an optional number used mainly to start more servers +# of the same version. +# +# The /etc/init.d/mysql-* script will choose the parameters analyzing it's own name +# i.e. /etc/init.d/mysql-501 will look for mysql_slot_501 +# side note the script could be called "mysql-501_1" or "mysql.501.1" with the same result +# +# Examples: +# +# start a default server with default options: +#mysql_slot=( ) +# or +#mysql_slot_0=( ) +# +# start MySQL 7.5.x reniced, overriding some start parameters +#mysql_slot_705=( +# "nice=-5" +# "server-id=123" +# "log-bin="myhost" +# "port=3307" +#) +# +# start another server, same version, different my.cnf +#mysql_slot_705_1=( +# "mycnf=/home/test/my.cnf" +# "server-id=124" +#) +# diff --git a/dev-db/mysql/files/mysql-slot.rc6-r2 b/dev-db/mysql/files/mysql-slot.rc6-r2 new file mode 100755 index 000000000000..0aa8d8b65649 --- /dev/null +++ b/dev-db/mysql/files/mysql-slot.rc6-r2 @@ -0,0 +1,260 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-slot.rc6-r2,v 1.1 2006/01/08 23:51:13 vivo Exp $ + +# external binaryes used: which, sed, tac + +depend() { + use dns net localmount netmount nfsmount +} + +function wdebug() { + if [[ "${DEBUG}" -ge "${1}" ]] ; then + shift + echo "dbg: ${@}" + fi +} + +do_escape() { + # Ihatethisreallyverymuch + #echo "$1" | sed -e "s|'| |" -e "s|=|='|" -e "s|$|'|" + echo "$1" +} + +# int get_slot_config() +get_slot_config() { + + wdebug 4 ">>> get_slot_config()" + + # servers options are (also) defined in /etc/conf.d/mysql + [[ -f /etc/conf.d/mysql ]] && source /etc/conf.d/mysql + + # myservice={mysql,mysql-500,mysql-500_1} => {,-500,-500_1,-500.1} + local srv="${myservice#mysql}" + # srv={,-500,-500_1,-500.1} => {,500,500_1,500.1} + srv="${srv:1}" + # srv=array(0 => [srv_slot], 1 => [srv_num] ) + srv=( ${srv//[_.-]/" "} ) + local srv_slot=${srv[0]} srv_num=${srv[1]} + # defined in /etc/conf.d/mysql mysql_slot_{0,500,500_1} + local tmp_eval="mysql_slot_${srv_slot}${srv_num:+"_"}${srv_num}[@]" + local conf_d_parameters="${!tmp_eval}" + MY_SUFFIX="-${srv_slot}" + if [[ -z "${srv_slot}" ]] ; then + srv_slot="0" + MY_SUFFIX='' + # try some other default for the default server + [[ -z "${conf_d_parameters[@]}" ]] && conf_d_parameters=${mysql_slot_0[@]} + [[ -z "${conf_d_parameters[@]}" ]] && conf_d_parameters=${mysql_slot[@]} + fi + [[ -z "${conf_d_parameters[@]}" ]] && conf_d_parameters=( ) + basedir="" datadir="" pidfile="" socket="" + CHROOT="" NICE="" STARTUPTIMEOUT=5 STOPTIMEOUT=120 + + wdebug 3 "myservice ${myservice}" + wdebug 3 "srv ${srv[@]}" + wdebug 3 "srv_slot ${srv_slot}" + wdebug 3 "srv_num ${srv_num}" + wdebug 3 "tmp_eval ${tmp_eval}" + wdebug 3 "conf_d_parameters ${conf_d_parameters[@]}" + wdebug 3 "MY_SUFFIX ${MY_SUFFIX}" + + local tmp_eval="mysql_slot_${srv_slot}${srv_num:+"_"}${srv_num}[@]" + local conf_d_parameters="${!tmp_eval}" + # collations need to be defined *after* the character sets, + #>so we will duplicate them + local collations="" + [[ ${conf_d_parameters[*]} == '()' ]] && conf_d_parameters='' + + MY_CNF="/etc/mysql${MY_SUFFIX}/my.cnf" + # summa of unmanaged parameters + #>some parameters may be present multiple times + unmanagedparams="" + + # grab the parameters from conf.d/mysql definition + for my_default in ${conf_d_parameters[*]}; do + case "${my_default}" in + nice=*) + NICE="${my_default#nice=}" + nice -n $NICE ls /tmp &>/dev/null || NICE="" + ;; + mycnf=*) MY_CNF="${my_default#mycnf=}" ;; + startup_timeout=*) + STARTUPTIMEOUT="${my_default#startup_timeout=}" ;; + stop_timeout=*) + STOPTIMEOUT="${my_default#stop_timeout=}" ;; + basedir=*) basedir="${my_default#basedir=}" ;; + datadir=*) datadir="${my_default#datadir=}" ;; + pid-file=*) pidfile="${my_default#pid-file=}" ;; + socket=*) socket="${my_default#socket=}" ;; + *collation*=) + collations="${collations} --$( do_escape "${my_default}" )" + ;; + *=*) + # list of parameters we already have + # prepend "--" because my_print_defaults do it + unmanagedparams="${unmanagedparams} --$( do_escape "${my_default}" )" + ;; + *) + unmanagedparams="${unmanagedparams} --${my_default}" + ;; + esac + done + + if [[ ! -r "${MY_CNF}" ]]; then + ewarn "Cannot access ${MY_CNF} !" + MY_CNF="" + my_defaults="" + else + local my_print_defaults="$(which my_print_defaults${MY_SUFFIX} 2>/dev/null)" + if [[ ! -x "${my_print_defaults}" ]]; then + eerror "my_print_defaults NOT found or not executable" + my_defaults="" + else + my_defaults=$( ${my_print_defaults} \ + --loose-verbose \ + --config-file="${MY_CNF}" \ + mysqld server ) + fi + fi + + # grab needed parameters from my.cnf, don't override the ones from + # conf.d mysql + for my_default in ${my_defaults}; do + case "${my_default}" in + --basedir=*) + [[ -z "${basedir}" ]] && basedir="${my_default#--basedir=}" ;; + --datadir=*) + [[ -z "${datadir}" ]] && datadir="${my_default#--datadir=}" ;; + --pid-file=*) + [[ -z "${pidfile}" ]] && pidfile="${my_default#--pid-file=}" ;; + --socket=*) + [[ -z "${socket}" ]] && socket="${my_default#--socket=}" ;; + --*collation*=) + # the order is inversed because we want the conf.d ones override + collations="$( do_escape "${my_default}" ) ${collations}" + ;; + esac + done + + # still empty, I'm in doubt if assign a default or break, will see + basedir="${basedir:-"/usr"}" + datadir="${datadir:-"/var/lib/mysql${MY_SUFFIX}"}" + pidfile="${pidfile:-"/var/run/mysqld/mysqld${MY_SUFFIX}.pid"}" + socket="${socket:-"/var/run/mysqld/mysqld${MY_SUFFIX}.sock"}" + unmanagedparams="${unmanagedparams} ${collations}" + + wdebug 3 "chroot dir => ${CHROOT}" + wdebug 3 "niceness => ${NICE}" + wdebug 3 "basedir => ${basedir}" + wdebug 3 "datadir => ${datadir}" + wdebug 3 "pidfile => ${pidfile}" + wdebug 3 "socket => ${socket}" + wdebug 3 "Unamanged => ${unmanagedparams}" + + # extension for sleep tenth of seconds, not very portable so check it before + if sleep 0.01 ; then + STARTUPTIMEOUT=$(( STARTUPTIMEOUT * 10 )) + STOPTIMEOUT=$(( STOPTIMEOUT * 10 )) + TIMEUNIT=0.1 + else + TIMEUNIT=1 + fi + + # push these out to the script + export MY_SUFFIX NICE MY_CNF pidfile datadir basedir socket CHROOT + export unmanagedparams STARTUPTIMEOUT STOPTIMEOUT TIMEUNIT + wdebug 4 "<<< get_slot_config() ok" + return 0 +} + +checkconfig() { + wdebug 4 ">>> checkconfig(\"${1}\")" + local datadir="$1" + if [ ! -d "${datadir}" ]; then + eerror "MySQL datadir is empty or invalid" + eerror "Please check your my.cnf : ${MY_CNF}" + wdebug 4 "<<< checkconfig() KO" + return 1 + fi + + if [ ! -d "$datadir/mysql" ]; then + eerror "You don't appear to have the mysql database installed yet." + eerror "Please run /usr/bin/mysql_install_db to have this done..." + wdebug 4 "<<< checkconfig() KO" + return 1 + fi + wdebug 4 "<<< checkconfig() ok" + return 0 +} + +start() { + wdebug 4 ">>> start()" + + local retstatus=0 + + ebegin + get_slot_config || return 1 + + if [[ -f ${pidfile} ]] || [[ -S ${socket} ]] ; then + echo "\"${pidfile}\" and/or \"${socket}\" are still present." + echo "Please check that no server is running and remove them." + return 1 + fi + + checkconfig "${datadir}" || return 2 + + einfo "Starting ${myservice} (${MY_CNF})" + + wdebug 2 "starting mysqld with: "${basedir}/sbin/mysqld${MY_SUFFIX} ${unmanagedparams} --basedir=${basedir} --datadir=${datadir} --pid-file=${pidfile} --socket=${socket} + + start-stop-daemon --quiet --start --background \ + ${NICE:+"--nicelevel "}${NICE} \ + --pidfile "${pidfile}" \ + --exec ${basedir}/sbin/mysqld${MY_SUFFIX} \ + -- \ + ${MY_CNF:+"--defaults-file="}${MY_CNF} \ + ${unmanagedparams} \ + --basedir=${basedir} \ + --datadir=${datadir} \ + --pid-file=${pidfile} \ + --socket=${socket} + + retstatus=$? + + # wait for socket creation + wdebug 1 + while ! [[ -S "${socket}" || "${STARTUPTIMEOUT}" -lt 1 || "${retstatus}" -ne 0 ]] ; do + STARTUPTIMEOUT=$(( STARTUPTIMEOUT - 1 )) + [[ ${DEBUG} -ge 1 ]] && echo -n "${STARTUPTIMEOUT}," + sleep ${TIMEUNIT} + done + wdebug 1 "" + if [[ ! -S "${socket}" ]] ; then + eerror "MySQL${MY_SUFFIX} NOT started (${retstatus})" + retstatus=1 + fi + + wdebug 4 "<<< start()" + eend $retstatus +} + +stop() { + get_slot_config + local retstatus PID + local timeout=${STOPTIMEOUT:-"120"} + + ebegin "Stopping ${myservice}" + PID=$(cat "${pidfile}" 2>/dev/null) + start-stop-daemon --stop --quiet --pidfile "${pidfile}" + #retstatus=$? + wdebug 1 "" + while ! [[ -n "$PID" || $( kill -0 $PID 2>/dev/null ) || "${timeout}" -lt 1 ]] ; do + timeout=$(($timeout - 1)) + [[ ${DEBUG} -ge 1 ]] && echo -n $(( $STOPTIMEOUT - $timeout )) + sleep ${TIMEUNIT} + done + [[ "${timeout}" -lt 1 ]] && retstatus=1 + eend ${retstatus} +} diff --git a/dev-db/mysql/mysql-4.1.16-r30.ebuild b/dev-db/mysql/mysql-4.1.16-r30.ebuild index eaa603b6842d..7df49e62d60d 100644 --- a/dev-db/mysql/mysql-4.1.16-r30.ebuild +++ b/dev-db/mysql/mysql-4.1.16-r30.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-4.1.16-r30.ebuild,v 1.4 2006/01/01 19:00:30 vivo Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-4.1.16-r30.ebuild,v 1.5 2006/01/08 23:51:13 vivo Exp $ # MYSQL_VERSION_ID will be # major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo magic number, all [0..99] @@ -22,8 +22,10 @@ MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} NDB_VERSION_ID=$(( ${MYSQL_VERSION_ID} / 100 )) inherit mysql +KEYWORDS="-*" -DEPEND=">=sys-libs/readline-4.1 +DEPEND="${DEPEND} + >=sys-libs/readline-4.1 bdb? ( sys-apps/ed ) ssl? ( >=dev-libs/openssl-0.9.6d ) userland_GNU? ( sys-process/procps ) @@ -43,9 +45,9 @@ src_test() { local retstatus addpredict /this-dir-does-not-exist/t9.MYI - mysql_version_is_at_least "5.00.15.00" \ - && make test-force-pl \ - || make test + cd mysql-test + sed -i -e "s|MYSQL_TCP_PORT=3306|MYSQL_TCP_PORT=3307|" mysql-test-run + ./mysql-test-run retstatus=$? # to be sure ;) diff --git a/dev-db/mysql/mysql-5.0.18-r30.ebuild b/dev-db/mysql/mysql-5.0.18-r30.ebuild index f02f9d9e1f21..6c6197838968 100644 --- a/dev-db/mysql/mysql-5.0.18-r30.ebuild +++ b/dev-db/mysql/mysql-5.0.18-r30.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-5.0.18-r30.ebuild,v 1.2 2006/01/01 19:00:30 vivo Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-5.0.18-r30.ebuild,v 1.3 2006/01/08 23:51:13 vivo Exp $ # MYSQL_VERSION_ID will be # major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo magic number, all [0..99] @@ -22,8 +22,10 @@ MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} NDB_VERSION_ID=$(( ${MYSQL_VERSION_ID} / 100 )) inherit mysql +KEYWORDS="-*" -DEPEND=">=sys-libs/readline-4.1 +DEPEND="${DEPEND} + >=sys-libs/readline-4.1 bdb? ( sys-apps/ed ) ssl? ( >=dev-libs/openssl-0.9.6d ) userland_GNU? ( sys-process/procps ) @@ -43,9 +45,9 @@ src_test() { local retstatus addpredict /this-dir-does-not-exist/t9.MYI - mysql_version_is_at_least "5.00.15.00" \ - && make test-force-pl \ - || make test-pl + cd mysql-test + sed -i -e "s|MYSQL_TCP_PORT=3306|MYSQL_TCP_PORT=3307|" mysql-test-run + ./mysql-test-run retstatus=$? # to be sure ;) diff --git a/dev-db/mysql/mysql-5.1.4_alpha-r30.ebuild b/dev-db/mysql/mysql-5.1.4_alpha-r30.ebuild index 18e5cdd0581b..f3f5dd253f1d 100644 --- a/dev-db/mysql/mysql-5.1.4_alpha-r30.ebuild +++ b/dev-db/mysql/mysql-5.1.4_alpha-r30.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-5.1.4_alpha-r30.ebuild,v 1.4 2006/01/01 19:00:30 vivo Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-5.1.4_alpha-r30.ebuild,v 1.5 2006/01/08 23:51:13 vivo Exp $ # MYSQL_VERSION_ID will be # major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo magic number, all [0..99] @@ -22,8 +22,10 @@ MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} NDB_VERSION_ID=$(( ${MYSQL_VERSION_ID} / 100 )) inherit mysql +KEYWORDS="-*" -DEPEND=">=sys-libs/readline-4.1 +DEPEND="${DEPEND} + >=sys-libs/readline-4.1 bdb? ( sys-apps/ed ) ssl? ( >=dev-libs/openssl-0.9.6d ) userland_GNU? ( sys-process/procps ) @@ -43,9 +45,9 @@ src_test() { local retstatus addpredict /this-dir-does-not-exist/t9.MYI - mysql_version_is_at_least "5.00.15.00" \ - && make test-force-pl \ - || make test-pl + cd mysql-test + sed -i -e "s|MYSQL_TCP_PORT=3306|MYSQL_TCP_PORT=3307|" mysql-test-run + ./mysql-test-run retstatus=$? # to be sure ;) |