/[gentoo-x86]/eclass/mysql.eclass
Gentoo

Diff of /eclass/mysql.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.4 Revision 1.6
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.4 2006/01/07 16:43:39 vivo Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.6 2006/01/14 19:00:32 vivo Exp $
4 4
5# Author: Francesco Riosa <vivo at gentoo.org> 5# Author: Francesco Riosa <vivo at gentoo.org>
6# Maintainer: Francesco Riosa <vivo at gentoo.org> 6# Maintainer: Francesco Riosa <vivo at gentoo.org>
7 7
8inherit eutils flag-o-matic gnuconfig mysql_fx 8inherit eutils flag-o-matic gnuconfig mysql_fx
16 16
17DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" 17DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
18HOMEPAGE="http://www.mysql.com/" 18HOMEPAGE="http://www.mysql.com/"
19NEWP="${PN}-${PV/_/-}" 19NEWP="${PN}-${PV/_/-}"
20SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${NEWP}.tar.gz 20SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${NEWP}.tar.gz
21 mirror://gentoo/mysql-extras-20051220.tar.bz2" 21 mirror://gentoo/mysql-extras-20060114.tar.bz2"
22LICENSE="GPL-2" 22LICENSE="GPL-2"
23IUSE="big-tables berkdb debug minimal perl selinux ssl static" 23IUSE="big-tables berkdb debug minimal perl selinux ssl static"
24RESTRICT="primaryuri" 24RESTRICT="primaryuri"
25DEPEND="app-admin/eselect-mysql" 25DEPEND="app-admin/eselect-mysql"
26 26
118 ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\"" 118 ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\""
119 done 119 done
120 popd &>/dev/null 120 popd &>/dev/null
121 done 121 done
122 122
123 if ! mysql_check_version_range "5.01.00.00 to 5.01.06.99" ; then 123 if ! useq bdbdir && ! mysql_check_version_range "5.01.00.00 to 5.01.06.99"
124 then
124 [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh" 125 [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh"
125 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null 126 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null
126 popd &>/dev/null 127 popd &>/dev/null
127 fi 128 fi
128 129
129} 130}
130 131
131src_compile() { 132mysql_src_compile() {
132 133
133 mysql_init_vars 134 mysql_init_vars
134 local myconf 135 local myconf
135 136
136 if useq static ; then 137 if useq static ; then
361 # config stuff 362 # config stuff
362 insinto "${MY_SYSCONFDIR}" 363 insinto "${MY_SYSCONFDIR}"
363 doins scripts/mysqlaccess.conf 364 doins scripts/mysqlaccess.conf
364 newins "${FILESDIR}/my.cnf-4.1" my.cnf 365 newins "${FILESDIR}/my.cnf-4.1" my.cnf
365 insinto "/etc/conf.d" 366 insinto "/etc/conf.d"
366 newins "${FILESDIR}/mysql-slot.conf.d-r1" "mysql" 367 newins "${FILESDIR}/mysql-slot.conf.d-r2" "mysql"
367 mysql_version_is_at_least "5.00.11.00" \ 368 mysql_version_is_at_least "5.00.11.00" \
368 && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager" 369 && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager"
369 370
370 local charset='utf8' 371 local charset='utf8'
371 ! useq utf8 && local charset='latin1' 372 ! useq utf8 && local charset='latin1'
375 "${D}/etc/mysql${MY_SUFFIX}/my.cnf" 376 "${D}/etc/mysql${MY_SUFFIX}/my.cnf"
376 377
377 # minimal builds don't have the server 378 # minimal builds don't have the server
378 if ! useq minimal; then 379 if ! useq minimal; then
379 exeinto /etc/init.d 380 exeinto /etc/init.d
380 newexe "${FILESDIR}/mysql-slot.rc6-r1" "mysql" 381 newexe "${FILESDIR}/mysql-slot.rc6-r2" "mysql"
382 [[ ${SLOT} -gt 0 ]] && dosym "/etc/init.d/mysql" "/etc/init.d/mysql${MY_SUFFIX}"
383
381 mysql_version_is_at_least "5.00.11.00" \ 384 mysql_version_is_at_least "5.00.11.00" \
382 && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager" 385 && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager"
383 insinto /etc/logrotate.d 386 insinto /etc/logrotate.d
384 # TODO 387 # TODO
385 newins "${FILESDIR}/logrotate.mysql" "mysql${MY_SUFFIX}" 388 newins "${FILESDIR}/logrotate.mysql" "mysql${MY_SUFFIX}"
420 fi 423 fi
421 424
422 # oops, temporary fix 425 # oops, temporary fix
423 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ 426 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
424 && cp -f \ 427 && cp -f \
425 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0.15" \ 428 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \
426 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" 429 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
427
428 # create a list of executable files, to be used
429 # by external utilities
430 # uncompressed because of the small size
431 local exelist="usr/share/mysql${MY_SUFFIX}/.exe-list"
432 pushd "${D}/" &>/dev/null
433 env -i find usr/bin/ usr/sbin/ usr/share/man \
434 -type f -name "*${MY_SUFFIX}*" \
435 > "${exelist}"
436 echo "${MY_SYSCONFDIR##"/"}" >> "${exelist}"
437 echo "${MY_INCLUDEDIR##"/"}" >> "${exelist}"
438 echo "${MY_LIBDIR##"/"}" >> "${exelist}"
439 echo "${MY_SHAREDSTATEDIR##"/"}" >> "${exelist}"
440 popd &>/dev/null
441} 430}
442 431
443mysql_pkg_preinst() { 432mysql_pkg_preinst() {
444 433
445 enewgroup mysql 60 || die "problem adding group mysql" 434 enewgroup mysql 60 || die "problem adding group mysql"
459 #secure the logfiles... does this bother anybody? 448 #secure the logfiles... does this bother anybody?
460 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 449 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
461 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 450 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
462 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 451 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
463 452
453 # create a list of files, to be used
454 # by external utilities
455 # uncompressed because of the small size
456 local filelist="${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}"
457 pushd "${D}/" &>/dev/null
458 mkdir -p "${ROOT}/var/lib/eselect/mysql/"
459 env -i find usr/bin/ usr/sbin/ usr/share/man \
460 -type f -name "*${MY_SUFFIX}*" \
461 -and -not -name "mysql_config${MY_SUFFIX}" \
462 > "${filelist}.filelist"
463 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}.filelist"
464 echo "${MY_LIBDIR#"/"}" >> "${filelist}.filelist"
465 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}.filelist"
466 popd &>/dev/null
467
464 if ! useq minimal; then 468 if ! useq minimal; then
469 if [[ ${SLOT} -gt 0 ]] ; then
470 if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then
471 einfo "you may want to run unmerge any unslotted MySQL versions with "
472 einfo "emerge -C --pretend dev-db/mysql"
473 einfo "emerge -C =dev-db/mysql-X.Y.Z"
474 einfo "After the unmerge run \"eselect myqsl list\" followed by a "
475 einfo "\"eselect myqsl set 1\" to chose the default mysql server"
476 else
477 local tmpres="$( eselect mysql show )"
478 # "like grep -q unset"
479 if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then
480 eselect mysql set 1
481 else
482 einfo "The version of mysql emerged now stils is _NOT_ the default"
483 einfo "you may want to run \"eselect myqsl list\" followed by a "
484 einfo "\"eselect myqsl set 1\" to chose the default mysql server"
485 fi
486 fi
487 fi
488
465 # your friendly public service announcement... 489 # your friendly public service announcement...
466 einfo 490 einfo
467 einfo "You might want to run:" 491 einfo "You might want to run:"
468 einfo "\"emerge --config =${CATEGORY}/${PF}\"" 492 einfo "\"emerge --config =${CATEGORY}/${PF}\""
469 einfo "if this is a new install." 493 einfo "if this is a new install."
470 einfo 494 einfo
471 fi
472
473 einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream." 495 einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream."
474 if [[ ${SLOT} -gt 0 ]] ; then
475 einfo "you may want to run \"eselect myqsl list\" followed by a "
476 einfo "\"eselect myqsl list\" to chose the default mysql server"
477 einfo "Prior to do this unmerge any unslotted MySQL versions with "
478 einfo "emerge -C -p dev-db/mysql <<< NOTICE the \"-p\""
479 einfo "emerge -C =dev-db/mysql-X.Y.Z"
480 fi 496 fi
481} 497}
482 498
483mysql_pkg_config() { 499mysql_pkg_config() {
484 mysql_init_vars 500 mysql_init_vars

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20