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

Diff of /eclass/mysql.eclass

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

Revision 1.2 Revision 1.25
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.2 2006/01/04 20:25:14 vivo Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.25 2006/03/16 20:39:00 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 autotools mysql_fx
9 9
10#major, minor only in the slot 10#major, minor only in the slot
11SLOT=$(( ${MYSQL_VERSION_ID} / 10000 )) 11SLOT=$(( ${MYSQL_VERSION_ID} / 10000 ))
12 12
13# shorten the path because the socket path length must be shorter than 107 chars 13# shorten the path because the socket path length must be shorter than 107 chars
14# and we will run a mysql server during test phase 14# and we will run a mysql server during test phase
15S="${WORKDIR}/${PN}" 15S="${WORKDIR}/${PN}"
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="${P/_/-}"
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-${MY_EXTRAS_VER}.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 embedded minimal perl selinux srvdir ssl static"
26RESTRICT="primaryuri" 24RESTRICT="primaryuri confcache"
27 25
28mysql_version_is_at_least "4.01.03.00" \ 26mysql_version_is_at_least "4.01.03.00" \
29&& IUSE="${IUSE} cluster utf8 extraengine" 27&& IUSE="${IUSE} cluster extraengine"
28
29mysql_version_is_at_least "5.00.00.00" \
30|| IUSE="${IUSE} raid"
30 31
31mysql_version_is_at_least "5.00.18.00" \ 32mysql_version_is_at_least "5.00.18.00" \
32&& IUSE="${IUSE} max-idx-128" 33&& IUSE="${IUSE} max-idx-128"
33 34
34mysql_version_is_at_least "5.01.00.00" \ 35mysql_version_is_at_least "5.01.00.00" \
35&& IUSE="${IUSE} innodb" 36&& IUSE="${IUSE} innodb"
36 37
37EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm 38EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_prerm pkg_postrm
39
40# void mysql_init_vars()
41#
42# initialize global variables
43# 2005-11-19 <vivo at gentoo.org>
44mysql_init_vars() {
45
46 if [[ ${SLOT} -eq 0 ]] ; then
47 MY_SUFFIX=""
48 else
49 MY_SUFFIX=${MY_SUFFIX:-"-${SLOT}"}
50 fi
51 MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR:-"/usr/share/mysql${MY_SUFFIX}"}
52 MY_SYSCONFDIR=${MY_SYSCONFDIR="/etc/mysql${MY_SUFFIX}"}
53 MY_LIBDIR=${MY_LIBDIR="/usr/$(get_libdir)/mysql${MY_SUFFIX}"}
54 MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="/var/lib/mysql${MY_SUFFIX}"}
55 MY_LOGDIR=${MY_LOGDIR="/var/log/mysql${MY_SUFFIX}"}
56 MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql${MY_SUFFIX}"}
57
58 if [ -z "${DATADIR}" ]; then
59 DATADIR=""
60 if [ -f "${MY_SYSCONFDIR}/my.cnf" ] ; then
61 DATADIR=`"my_print_defaults${MY_SUFFIX}" mysqld 2>/dev/null | sed -ne '/datadir/s|^--datadir=||p' | tail -n1`
62 if [ -z "${DATADIR}" ]; then
63 if useq "srvdir" ; then
64 DATADIR="${ROOT}/srv/localhost/mysql${MY_SUFFIX}/datadir"
65 else
66 DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" | sed -e 's/.*=\s*//'`
67 fi
68 fi
69 fi
70 if [ -z "${DATADIR}" ]; then
71 if useq "srvdir" ; then
72 DATADIR="${ROOT}/srv/localhost/mysql${MY_SUFFIX}/datadir"
73 else
74 DATADIR="${MY_LOCALSTATEDIR}"
75 fi
76 einfo "Using default DATADIR"
77 fi
78 einfo "MySQL DATADIR is ${DATADIR}"
79
80 if [ -z "${PREVIOUS_DATADIR}" ] ; then
81 if [ -a "${DATADIR}" ] ; then
82 ewarn "Previous datadir found, it's YOUR job to change"
83 ewarn "ownership and have care of it"
84 PREVIOUS_DATADIR="yes"
85 export PREVIOUS_DATADIR
86 else
87 PREVIOUS_DATADIR="no"
88 export PREVIOUS_DATADIR
89 fi
90 fi
91 fi
92
93 export MY_SUFFIX MY_SHAREDSTATEDIR MY_SYSCONFDIR
94 export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
95 export MY_INCLUDEDIR
96 export DATADIR
97}
38 98
39mysql_pkg_setup() { 99mysql_pkg_setup() {
40 100
41 enewgroup mysql 60 || die "problem adding group mysql" 101 enewgroup mysql 60 || die "problem adding group mysql"
42 enewuser mysql 60 -1 /dev/null mysql \ 102 enewuser mysql 60 -1 /dev/null mysql \
60 die "USEs cluster, extraengine conflicts with \"minimal\"" 120 die "USEs cluster, extraengine conflicts with \"minimal\""
61 fi 121 fi
62 122
63 unpack ${A} || die 123 unpack ${A} || die
64 124
65 mv "${WORKDIR}/${NEWP}" "${S}" 125 mv -f "${WORKDIR}/${NEWP}" "${S}"
66 cd "${S}" 126 cd "${S}"
67 127
68 EPATCH_SUFFIX="patch" 128 EPATCH_SUFFIX="patch"
69 mkdir -p "${EPATCH_SOURCE}" || die "unable to create epatch directory" 129 mkdir -p "${EPATCH_SOURCE}" || die "unable to create epatch directory"
70 mysql_mv_patches 130 mysql_mv_patches
72 132
73 # additional check, remove bundled zlib 133 # additional check, remove bundled zlib
74 rm -f "${S}/zlib/"*.[ch] 134 rm -f "${S}/zlib/"*.[ch]
75 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" 135 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in"
76 rm -f scripts/mysqlbug 136 rm -f scripts/mysqlbug
77
78 # Multilib issue with zlib detection
79 mysql_version_is_at_least "5.00.15.00" \
80 && sed -i -e "s:zlib_dir/lib:zlib_dir/$(get_libdir):g" \
81 "${S}/config/ac-macros/zlib.m4"
82 137
83 # Make charsets install in the right place 138 # Make charsets install in the right place
84 find . -name 'Makefile.am' \ 139 find . -name 'Makefile.am' \
85 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; 140 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \;
86 141
104 bdbdir='bdb/dist' 159 bdbdir='bdb/dist'
105 fi 160 fi
106 161
107 for d in ${rebuilddirlist}; do 162 for d in ${rebuilddirlist}; do
108 einfo "reconfiguring dir \"${d}\"" 163 einfo "reconfiguring dir \"${d}\""
109 pushd "${d}" 164 pushd "${d}" &>/dev/null
110 for buildstep in \ 165 AT_GNUCONF_UPDATE="yes" eautoreconf
111 'libtoolize --copy --force' \ 166 popd &>/dev/null
112 'aclocal --force' \
113 'autoheader --force -Wnone' \
114 'autoconf --force -Wnone' \
115 'automake --force --force-missing -Wnone' \
116 'gnuconfig_update'
117 do
118 einfo "performing ${buildstep}"
119 ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\""
120 done
121 popd
122 done 167 done
123 168
169 #TODO berkdb in 5.1 need to be worked on
124 if ! mysql_check_version_range "5.01.00.00 to 5.01.06.99" ; then 170 if useq berkdb && ! mysql_check_version_range "5.01.00.00 to 5.01.08.99"
171 then
125 [[ -w "${bdbdir}/ltmain.sh" ]] && cp ltmain.sh "${bdbdir}/ltmain.sh" 172 [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh"
126 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" 173 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null
127 popd 174 popd &>/dev/null
128 fi 175 fi
129 176
130} 177}
131 178
132src_compile() { 179mysql_src_compile() {
133 180
134 mysql_init_vars 181 mysql_init_vars
135 local myconf 182 local myconf
136 183
137 if useq static ; then 184 if useq static ; then
186 233
187 if useq static ; then 234 if useq static ; then
188 myconf="${myconf} --without-raid" 235 myconf="${myconf} --without-raid"
189 ewarn "disabling raid support, has problem with static" 236 ewarn "disabling raid support, has problem with static"
190 else 237 else
238 if mysql_version_is_at_least "5.00.00.00" ; then
191 myconf="${myconf} --with-raid" 239 myconf="${myconf} --without-raid"
240 else
241 myconf="${myconf} `use_with raid`"
242 fi
192 fi 243 fi
193 244
194 if ! mysql_version_is_at_least "5.00.00.00" ; then 245 if ! mysql_version_is_at_least "5.00.00.00" ; then
195 if mysql_version_is_at_least "4.01.00.00" && useq utf8; then 246 if mysql_version_is_at_least "4.01.00.00" ; then
196 myconf="${myconf} --with-charset=utf8" 247 myconf="${myconf} --with-charset=utf8"
197 myconf="${myconf} --with-collation=utf8_general_ci" 248 myconf="${myconf} --with-collation=utf8_general_ci"
198 else 249 else
199 myconf="${myconf} --with-charset=latin1" 250 myconf="${myconf} --with-charset=latin1"
200 myconf="${myconf} --with-collation=latin1_swedish_ci" 251 myconf="${myconf} --with-collation=latin1_swedish_ci"
218 || mysql_check_version_range "5.01.00.00 to 5.01.06.99" 269 || mysql_check_version_range "5.01.00.00 to 5.01.06.99"
219 then 270 then
220 ewarn "bdb berkeley-db disabled due to arch or version" 271 ewarn "bdb berkeley-db disabled due to arch or version"
221 myconf="${myconf} --without-berkeley-db" 272 myconf="${myconf} --without-berkeley-db"
222 else 273 else
274 #TODO berkdb in 5.1 need to be worked on
223 useq berkdb \ 275 useq berkdb && \
276 ! mysql_check_version_range "5.01.00.00 to 5.01.08.99" \
224 && myconf="${myconf} --with-berkeley-db=./bdb" \ 277 && myconf="${myconf} --with-berkeley-db=./bdb" \
225 || myconf="${myconf} --without-berkeley-db" 278 || myconf="${myconf} --without-berkeley-db"
226 fi 279 fi
227 280
228 if mysql_version_is_at_least "4.01.03.00" ; then 281 if mysql_version_is_at_least "4.01.03.00" ; then
230 myconf="${myconf} --with-geometry" 283 myconf="${myconf} --with-geometry"
231 myconf="${myconf} $(use_with cluster ndbcluster)" 284 myconf="${myconf} $(use_with cluster ndbcluster)"
232 fi 285 fi
233 286
234 mysql_version_is_at_least "4.01.11.00" && myconf="${myconf} `use_with big-tables`" 287 mysql_version_is_at_least "4.01.11.00" && myconf="${myconf} `use_with big-tables`"
288
289 mysql_version_is_at_least "5.01.06.00" && myconf="${myconf} --with-ndb-binlog"
290
291 if useq embedded ; then
292 #REMIND, need the privilege control enabled ?
293 myconf="${myconf} --without-embedded-privilege-control"
294 myconf="${myconf} --with-embedded-server"
295 else
296 myconf="${myconf} --without-embedded-privilege-control"
297 myconf="${myconf} --without-embedded-server"
298 fi
235 else 299 else
236 for i in ${minimal_exclude_list}; do 300 for i in ${minimal_exclude_list}; do
237 myconf="${myconf} --without-${i}" 301 myconf="${myconf} --without-${i}"
238 done 302 done
239 myconf="${myconf} --without-berkeley-db" 303 myconf="${myconf} --without-berkeley-db"
262 if mysql_version_is_at_least "5.01.00.00" ; then 326 if mysql_version_is_at_least "5.01.00.00" ; then
263 myconf="${myconf} --with-partition" 327 myconf="${myconf} --with-partition"
264 fi 328 fi
265 fi 329 fi
266 330
331 fi
332
267 mysql_version_is_at_least "5.00.18.00" \ 333 mysql_version_is_at_least "5.00.18.00" \
268 && useq "max-idx-128" \ 334 && useq "max-idx-128" \
269 && myconf="${myconf} --with-max-indexes=128" 335 && myconf="${myconf} --with-max-indexes=128"
336
337 if mysql_version_is_at_least "5.01.05.00" ; then
338 myconf="${myconf} --with-row-based-replication"
339 fi
340
341 #TODO rechek again later, had problem with assembler enabled
342 # and some combination of use-flags with 5.1
343 if mysql_check_version_range "5.01.00.00 to 5.01.08.99" ; then
344 myconf="${myconf} --disable-assembler"
345 else
346 myconf="${myconf} --enable-assembler"
270 fi 347 fi
271 348
272 #Bug #114895,Bug #110149 349 #Bug #114895,Bug #110149
273 filter-flags "-O" "-O[01]" 350 filter-flags "-O" "-O[01]"
274 #glibc-2.3.2_pre fix; bug #16496 351 #glibc-2.3.2_pre fix; bug #16496
287 --localstatedir="${MY_LOCALSTATEDIR}" \ 364 --localstatedir="${MY_LOCALSTATEDIR}" \
288 --sharedstatedir="${MY_SHAREDSTATEDIR}" \ 365 --sharedstatedir="${MY_SHAREDSTATEDIR}" \
289 --libdir="${MY_LIBDIR}" \ 366 --libdir="${MY_LIBDIR}" \
290 --includedir="${MY_INCLUDEDIR}" \ 367 --includedir="${MY_INCLUDEDIR}" \
291 --with-low-memory \ 368 --with-low-memory \
292 --enable-assembler \
293 --enable-local-infile \ 369 --enable-local-infile \
294 --with-mysqld-user=mysql \ 370 --with-mysqld-user=mysql \
295 --with-client-ldflags=-lstdc++ \ 371 --with-client-ldflags=-lstdc++ \
296 --enable-thread-safe-client \ 372 --enable-thread-safe-client \
297 --with-comment="Gentoo Linux ${PF}" \ 373 --with-comment="Gentoo Linux ${PF}" \
298 --with-unix-socket-path="/var/run/mysqld/mysqld${MY_SUFFIX}.sock" \ 374 --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \
299 --with-zlib-dir=/usr \
300 --with-lib-ccflags="-fPIC" \ 375 --with-lib-ccflags="-fPIC" \
301 --without-readline \ 376 --without-readline \
302 --without-docs \ 377 --without-docs \
303 ${myconf} || die "bad ./configure" 378 ${myconf} || die "bad ./configure"
304 379
305 # TODO Move this before autoreconf !!! 380 # TODO Move this before autoreconf !!!
306 find . -name 'Makefile' \ 381 find . -type f -name Makefile -print0 \
307 -exec sed --in-place \ 382 | xargs -0 -n100 sed -i \
308 -e 's|^pkglibdir\s*=\s*$(libdir)/mysql|pkglibdir = $(libdir)|' \ 383 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
309 -e 's|^pkgincludedir\s*=\s*$(includedir)/mysql|pkgincludedir = $(includedir)|' \
310 {} \;
311 384
312 emake || die "compile problem" 385 emake || die "compile problem"
313} 386}
314 387
315mysql_src_install() { 388mysql_src_install() {
331 binary-configure* my-*.cnf mi_test_all* 404 binary-configure* my-*.cnf mi_test_all*
332 do 405 do
333 rm -f ${D}/usr/share/mysql/${removeme} 406 rm -f ${D}/usr/share/mysql/${removeme}
334 done 407 done
335 408
336 # oops
337 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
338 && cp "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0.15" "${D}/usr/share/mysql${MY_SUFFIX}/"
339
340 # TODO change at Makefile-am level 409 # TODO change at Makefile-am level
341 for moveme in "mysql_fix_privilege_tables.sql" \ 410 for moveme in "mysql_fix_privilege_tables.sql" \
342 "fill_help_tables.sql" "ndb-config-2-node.ini" 411 "fill_help_tables.sql" "ndb-config-2-node.ini"
343 do 412 do
344 mv "${D}/usr/share/mysql/${moveme}" "${D}/usr/share/mysql${MY_SUFFIX}/" 2>/dev/null 413 mv -f "${D}/usr/share/mysql/${moveme}" "${D}/usr/share/mysql${MY_SUFFIX}/" 2>/dev/null
345 done 414 done
346 415
347 if [[ -n "${MY_SUFFIX}" ]] ; then 416 if [[ -n "${MY_SUFFIX}" ]] ; then
348 local notcatched=$(ls "${D}/usr/share/mysql"/*) 417 local notcatched=$(ls "${D}/usr/share/mysql"/*)
349 if [[ -n "${notcatched}" ]] ; then 418 if [[ -n "${notcatched}" ]] ; then
364 fi 433 fi
365 434
366 # config stuff 435 # config stuff
367 insinto "${MY_SYSCONFDIR}" 436 insinto "${MY_SYSCONFDIR}"
368 doins scripts/mysqlaccess.conf 437 doins scripts/mysqlaccess.conf
438 sed -e "s!@MY_SUFFIX@!${MY_SUFFIX}!g" \
439 -e "s!@DATADIR@!${DATADIR}!g" \
440 "${FILESDIR}/my.cnf-4.1-r1" \
441 > "${TMPDIR}/my.cnf.ok"
369 newins "${FILESDIR}/my.cnf-4.1" my.cnf 442 newins "${TMPDIR}/my.cnf.ok" my.cnf
443
370 insinto "/etc/conf.d" 444 insinto "/etc/conf.d"
371 newins "${FILESDIR}/mysql-slot.conf.d-r1" "mysql" 445 newins "${FILESDIR}/mysql.conf.d-r1" "mysql"
372 mysql_version_is_at_least "5.00.11.00" \ 446 mysql_version_is_at_least "5.00.11.00" \
373 && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager" 447 && newins "${FILESDIR}/mysqlmanager.conf.d" "mysqlmanager"
374
375 local charset='utf8'
376 ! useq utf8 && local charset='latin1'
377 sed --in-place \
378 -e "s/@MY_SUFFIX@/${MY_SUFFIX}/" \
379 -e "s/@CHARSET@/${charset}/" \
380 "${D}/etc/mysql${MY_SUFFIX}/my.cnf"
381 448
382 # minimal builds don't have the server 449 # minimal builds don't have the server
383 if ! useq minimal; then 450 if ! useq minimal; then
384 exeinto /etc/init.d 451 exeinto /etc/init.d
385 newexe "${FILESDIR}/mysql-slot.rc6-r1" "mysql" 452 newexe "${FILESDIR}/mysql.rc6-r3" "mysql"
453
386 mysql_version_is_at_least "5.00.11.00" \ 454 mysql_version_is_at_least "5.00.11.00" \
387 && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager" 455 && newexe "${FILESDIR}/mysqlmanager.rc6" "mysqlmanager"
388 insinto /etc/logrotate.d 456 insinto /etc/logrotate.d
389 # TODO 457 sed -e "s!___MY_SUFFIX___!${MY_SUFFIX}!g" \
458 "${FILESDIR}/logrotate-slot.mysql" \
459 > "${TMPDIR}/logrotate.mysql"
390 newins "${FILESDIR}/logrotate.mysql" "mysql${MY_SUFFIX}" 460 newins "${TMPDIR}/logrotate.mysql" "mysql${MY_SUFFIX}"
391 461
392 #empty dirs... 462 #empty dirs...
393 diropts "-m0750" 463 diropts "-m0750"
394 if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then 464 if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then
395 dodir "${DATADIR}" 465 dodir "${DATADIR}"
417 do 487 do
418 dodoc "${script}" 488 dodoc "${script}"
419 done 489 done
420 490
421 docinto "scripts" 491 docinto "scripts"
422 for script in \ 492 for script in scripts/mysql* ; do
423 $(ls scripts/mysql* | grep -v '.sh$') 493 [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}"
424 do
425 dodoc "${script}"
426 done 494 done
427 fi 495 fi
496
497 # oops, temporary fix
498 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
499 && cp -f \
500 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \
501 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
502
503 if [[ ${SLOT} -gt 0 ]] ; then
504 # MOVED HERE DUE TO BUG #121445
505 # create a list of files, to be used
506 # by external utilities
507 mkdir -p "${D}/var/lib/eselect/mysql/"
508 local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
509 pushd "${D}/" &>/dev/null
510 find usr/bin/ usr/sbin/ \
511 -type f -name "*${MY_SUFFIX}*" \
512 -and -not -name "mysql_config${MY_SUFFIX}" \
513 > "${filelist}"
514 find usr/share/man \
515 -type f -name "*${MY_SUFFIX}*" \
516 | sed -e 's/$/.gz/' \
517 >> "${filelist}"
518 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
519 echo "${MY_LIBDIR#"/"}" >> "${filelist}"
520 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
521 popd &>/dev/null
522 fi
523
524 # It's safer portage wis doing this in instal, but we can't
525 # if it's a slotted install
526 [[ ${SLOT} -eq 0 ]] && ROOT="${D}" mysql_lib_symlinks
428} 527}
429 528
430mysql_pkg_preinst() { 529mysql_pkg_preinst() {
431 530
432 enewgroup mysql 60 || die "problem adding group mysql" 531 enewgroup mysql 60 || die "problem adding group mysql"
435} 534}
436 535
437mysql_pkg_postinst() { 536mysql_pkg_postinst() {
438 537
439 mysql_init_vars 538 mysql_init_vars
440 mysql_lib_symlinks 539 # slotted, manage lib symlinks on the real file-system
540 # to cope with other version installed
541 [[ ${SLOT} -ne 0 ]] && mysql_lib_symlinks
441 542
442 # mind at FEATURES=collision-protect before to remove this 543 # mind at FEATURES=collision-protect before to remove this
443 [ -d "${ROOT}/var/log/mysql" ] \ 544 [ -d "${ROOT}/var/log/mysql" ] \
444 || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" 545 || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
445 546
447 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 548 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
448 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 549 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
449 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 550 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
450 551
451 if ! useq minimal; then 552 if ! useq minimal; then
553 if [[ ${SLOT} -gt 0 ]] ; then
554 einfo "you may want to read:"
555 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml"
556 einfo "you may want to run \"eselect mysql list\" followed by a "
557 einfo "\"eselect mysql set 1\" to choose the default mysql server"
558 fi
559
452 # your friendly public service announcement... 560 # your friendly public service announcement...
453 einfo 561 einfo
454 einfo "You might want to run:" 562 einfo "You might want to run:"
455 einfo "\"emerge --config =${CATEGORY}/${PF}\"" 563 einfo "\"emerge --config =${CATEGORY}/${PF}\""
456 einfo "if this is a new install." 564 einfo "if this is a new install."
457 einfo 565 einfo
458 fi 566 mysql_version_is_at_least "5.01.00.00" \
459
460 einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream." 567 || einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream."
568 fi
461} 569}
462 570
463mysql_pkg_config() { 571mysql_pkg_config() {
464 mysql_init_vars 572 mysql_init_vars
465 [[ -z "${DATADIR}" ]] && die "sorry, unable to find DATADIR" 573 [[ -z "${DATADIR}" ]] && die "sorry, unable to find DATADIR"
494 fi 602 fi
495 603
496 local options="" 604 local options=""
497 local sqltmp="$(emktemp)" 605 local sqltmp="$(emktemp)"
498 606
499 local help_tables="${ROOT}/usr/share/doc/mysql-${PVR}/scripts/fill_help_tables.sql.gz" 607 local help_tables="${MY_SHAREDSTATEDIR}/fill_help_tables.sql"
500 [[ -r "${help_tables}" ]] \ 608 [[ -r "${help_tables}" ]] \
501 && zcat "${help_tables}" > "${TMPDIR}/fill_help_tables.sql" \ 609 && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
502 || touch "${TMPDIR}/fill_help_tables.sql" 610 || touch "${TMPDIR}/fill_help_tables.sql"
503 help_tables="${TMPDIR}/fill_help_tables.sql" 611 help_tables="${TMPDIR}/fill_help_tables.sql"
504 612
505 pushd "${TMPDIR}" 613 pushd "${TMPDIR}" &>/dev/null
506 ${ROOT}/usr/bin/mysql_install_db${MY_SUFFIX} | grep -B5 -A999 -i "ERROR" 614 ${ROOT}/usr/bin/mysql_install_db${MY_SUFFIX} | grep -B5 -A999 -i "ERROR"
507 popd 615 popd &>/dev/null
508 [[ -f ${ROOT}/${DATADIR}/mysql/user.frm ]] || die "MySQL databases not installed" 616 [[ -f ${ROOT}/${DATADIR}/mysql/user.frm ]] || die "MySQL databases not installed"
509 chown -R mysql:mysql ${ROOT}/${DATADIR} 2> /dev/null 617 chown -R mysql:mysql ${ROOT}/${DATADIR} 2> /dev/null
510 chmod 0750 ${ROOT}/${DATADIR} 2> /dev/null 618 chmod 0750 ${ROOT}/${DATADIR} 2> /dev/null
511 619
512 if mysql_version_is_at_least "4.01.03.00" ; then 620 if mysql_version_is_at_least "4.01.03.00" ; then
520 if [[ -r "${help_tables}" ]] ; then 628 if [[ -r "${help_tables}" ]] ; then
521 cat "${help_tables}" >> "${sqltmp}" 629 cat "${help_tables}" >> "${sqltmp}"
522 fi 630 fi
523 fi 631 fi
524 632
525 local socket=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 633 local socket=${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock
526 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 634 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.pid
527 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \ 635 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \
528 ${options} \ 636 ${options} \
529 --user=mysql \ 637 --user=mysql \
530 --skip-grant-tables \ 638 --skip-grant-tables \
531 --basedir=${ROOT}/usr \ 639 --basedir=${ROOT}/usr \
566 einfo "stopping the server," 674 einfo "stopping the server,"
567 wait %1 675 wait %1
568 einfo "done" 676 einfo "done"
569} 677}
570 678
679mysql_pkg_prerm() {
680 if [[ ${SLOT} -gt 0 ]] ; then
681 # external program
682 eselect mysql slot_remove "${SLOT}"
683 fi
684}
685
571mysql_pkg_postrm() { 686mysql_pkg_postrm() {
572 mysql_lib_symlinks 687 mysql_lib_symlinks
688 if [[ ${SLOT} -gt 0 ]] ; then
689 einfo "you may want to run \"eselect mysql list\" followed by a "
690 einfo "\"eselect mysql list\" to choose the default mysql server"
691 fi
573} 692}

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20