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

Diff of /eclass/mysql.eclass

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

Revision 1.3 Revision 1.4
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.3 2006/01/04 20:37:38 vivo Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.4 2006/01/07 16:43:39 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
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-20051220.tar.bz2"
22
23LICENSE="GPL-2" 22LICENSE="GPL-2"
24KEYWORDS="-*"
25IUSE="big-tables berkdb debug minimal perl selinux ssl static" 23IUSE="big-tables berkdb debug minimal perl selinux ssl static"
26RESTRICT="primaryuri" 24RESTRICT="primaryuri"
25DEPEND="app-admin/eselect-mysql"
27 26
28mysql_version_is_at_least "4.01.03.00" \ 27mysql_version_is_at_least "4.01.03.00" \
29&& IUSE="${IUSE} cluster utf8 extraengine" 28&& IUSE="${IUSE} cluster utf8 extraengine"
30 29
31mysql_version_is_at_least "5.00.18.00" \ 30mysql_version_is_at_least "5.00.18.00" \
60 die "USEs cluster, extraengine conflicts with \"minimal\"" 59 die "USEs cluster, extraengine conflicts with \"minimal\""
61 fi 60 fi
62 61
63 unpack ${A} || die 62 unpack ${A} || die
64 63
65 mv "${WORKDIR}/${NEWP}" "${S}" 64 mv -f "${WORKDIR}/${NEWP}" "${S}"
66 cd "${S}" 65 cd "${S}"
67 66
68 EPATCH_SUFFIX="patch" 67 EPATCH_SUFFIX="patch"
69 mkdir -p "${EPATCH_SOURCE}" || die "unable to create epatch directory" 68 mkdir -p "${EPATCH_SOURCE}" || die "unable to create epatch directory"
70 mysql_mv_patches 69 mysql_mv_patches
104 bdbdir='bdb/dist' 103 bdbdir='bdb/dist'
105 fi 104 fi
106 105
107 for d in ${rebuilddirlist}; do 106 for d in ${rebuilddirlist}; do
108 einfo "reconfiguring dir \"${d}\"" 107 einfo "reconfiguring dir \"${d}\""
109 pushd "${d}" 108 pushd "${d}" &>/dev/null
110 for buildstep in \ 109 for buildstep in \
111 'libtoolize --copy --force' \ 110 'libtoolize --copy --force' \
112 'aclocal --force' \ 111 'aclocal --force' \
113 'autoheader --force -Wnone' \ 112 'autoheader --force -Wnone' \
114 'autoconf --force -Wnone' \ 113 'autoconf --force -Wnone' \
116 'gnuconfig_update' 115 'gnuconfig_update'
117 do 116 do
118 einfo "performing ${buildstep}" 117 einfo "performing ${buildstep}"
119 ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\"" 118 ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\""
120 done 119 done
121 popd 120 popd &>/dev/null
122 done 121 done
123 122
124 if ! mysql_check_version_range "5.01.00.00 to 5.01.06.99" ; then 123 if ! mysql_check_version_range "5.01.00.00 to 5.01.06.99" ; then
125 [[ -w "${bdbdir}/ltmain.sh" ]] && cp ltmain.sh "${bdbdir}/ltmain.sh" 124 [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh"
126 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" 125 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null
127 popd 126 popd &>/dev/null
128 fi 127 fi
129 128
130} 129}
131 130
132src_compile() { 131src_compile() {
331 binary-configure* my-*.cnf mi_test_all* 330 binary-configure* my-*.cnf mi_test_all*
332 do 331 do
333 rm -f ${D}/usr/share/mysql/${removeme} 332 rm -f ${D}/usr/share/mysql/${removeme}
334 done 333 done
335 334
336 # oops
337 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
338 && cp \
339 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0.15" \
340 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
341
342 # TODO change at Makefile-am level 335 # TODO change at Makefile-am level
343 for moveme in "mysql_fix_privilege_tables.sql" \ 336 for moveme in "mysql_fix_privilege_tables.sql" \
344 "fill_help_tables.sql" "ndb-config-2-node.ini" 337 "fill_help_tables.sql" "ndb-config-2-node.ini"
345 do 338 do
346 mv "${D}/usr/share/mysql/${moveme}" "${D}/usr/share/mysql${MY_SUFFIX}/" 2>/dev/null 339 mv -f "${D}/usr/share/mysql/${moveme}" "${D}/usr/share/mysql${MY_SUFFIX}/" 2>/dev/null
347 done 340 done
348 341
349 if [[ -n "${MY_SUFFIX}" ]] ; then 342 if [[ -n "${MY_SUFFIX}" ]] ; then
350 local notcatched=$(ls "${D}/usr/share/mysql"/*) 343 local notcatched=$(ls "${D}/usr/share/mysql"/*)
351 if [[ -n "${notcatched}" ]] ; then 344 if [[ -n "${notcatched}" ]] ; then
419 do 412 do
420 dodoc "${script}" 413 dodoc "${script}"
421 done 414 done
422 415
423 docinto "scripts" 416 docinto "scripts"
424 for script in \ 417 for script in scripts/mysql* ; do
425 $(ls scripts/mysql* | grep -v '.sh$') 418 [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}"
426 do
427 dodoc "${script}"
428 done 419 done
429 fi 420 fi
421
422 # oops, temporary fix
423 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
424 && cp -f \
425 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0.15" \
426 "${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
430} 441}
431 442
432mysql_pkg_preinst() { 443mysql_pkg_preinst() {
433 444
434 enewgroup mysql 60 || die "problem adding group mysql" 445 enewgroup mysql 60 || die "problem adding group mysql"
458 einfo "if this is a new install." 469 einfo "if this is a new install."
459 einfo 470 einfo
460 fi 471 fi
461 472
462 einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream." 473 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
463} 481}
464 482
465mysql_pkg_config() { 483mysql_pkg_config() {
466 mysql_init_vars 484 mysql_init_vars
467 [[ -z "${DATADIR}" ]] && die "sorry, unable to find DATADIR" 485 [[ -z "${DATADIR}" ]] && die "sorry, unable to find DATADIR"
502 [[ -r "${help_tables}" ]] \ 520 [[ -r "${help_tables}" ]] \
503 && zcat "${help_tables}" > "${TMPDIR}/fill_help_tables.sql" \ 521 && zcat "${help_tables}" > "${TMPDIR}/fill_help_tables.sql" \
504 || touch "${TMPDIR}/fill_help_tables.sql" 522 || touch "${TMPDIR}/fill_help_tables.sql"
505 help_tables="${TMPDIR}/fill_help_tables.sql" 523 help_tables="${TMPDIR}/fill_help_tables.sql"
506 524
507 pushd "${TMPDIR}" 525 pushd "${TMPDIR}" &>/dev/null
508 ${ROOT}/usr/bin/mysql_install_db${MY_SUFFIX} | grep -B5 -A999 -i "ERROR" 526 ${ROOT}/usr/bin/mysql_install_db${MY_SUFFIX} | grep -B5 -A999 -i "ERROR"
509 popd 527 popd &>/dev/null
510 [[ -f ${ROOT}/${DATADIR}/mysql/user.frm ]] || die "MySQL databases not installed" 528 [[ -f ${ROOT}/${DATADIR}/mysql/user.frm ]] || die "MySQL databases not installed"
511 chown -R mysql:mysql ${ROOT}/${DATADIR} 2> /dev/null 529 chown -R mysql:mysql ${ROOT}/${DATADIR} 2> /dev/null
512 chmod 0750 ${ROOT}/${DATADIR} 2> /dev/null 530 chmod 0750 ${ROOT}/${DATADIR} 2> /dev/null
513 531
514 if mysql_version_is_at_least "4.01.03.00" ; then 532 if mysql_version_is_at_least "4.01.03.00" ; then
570 einfo "done" 588 einfo "done"
571} 589}
572 590
573mysql_pkg_postrm() { 591mysql_pkg_postrm() {
574 mysql_lib_symlinks 592 mysql_lib_symlinks
593 if [[ ${SLOT} -gt 0 ]] ; then
594 einfo "you may want to run \"eselect myqsl list\" followed by a "
595 einfo "\"eselect myqsl list\" to chose the default mysql server"
596 fi
575} 597}

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

  ViewVC Help
Powered by ViewVC 1.1.20