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/Attic/mysql.eclass,v 1.4 2006/01/07 16:43:39 vivo Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/Attic/mysql.eclass,v 1.23 2006/03/09 12:37:01 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 | |
8 | inherit eutils flag-o-matic gnuconfig mysql_fx |
8 | inherit eutils flag-o-matic gnuconfig autotools mysql_fx |
9 | |
9 | |
10 | #major, minor only in the slot |
10 | #major, minor only in the slot |
11 | SLOT=$(( ${MYSQL_VERSION_ID} / 10000 )) |
11 | SLOT=$(( ${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 |
15 | S="${WORKDIR}/${PN}" |
15 | S="${WORKDIR}/${PN}" |
16 | |
16 | |
17 | DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
17 | DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
18 | HOMEPAGE="http://www.mysql.com/" |
18 | HOMEPAGE="http://www.mysql.com/" |
19 | NEWP="${PN}-${PV/_/-}" |
19 | NEWP="${P/_/-}" |
20 | SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${NEWP}.tar.gz |
20 | SRC_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 | LICENSE="GPL-2" |
22 | LICENSE="GPL-2" |
23 | IUSE="big-tables berkdb debug minimal perl selinux ssl static" |
23 | IUSE="big-tables berkdb debug embedded minimal perl selinux srvdir ssl static" |
24 | RESTRICT="primaryuri" |
24 | RESTRICT="primaryuri confcache" |
25 | DEPEND="app-admin/eselect-mysql" |
|
|
26 | |
25 | |
27 | mysql_version_is_at_least "4.01.03.00" \ |
26 | mysql_version_is_at_least "4.01.03.00" \ |
28 | && IUSE="${IUSE} cluster utf8 extraengine" |
27 | && IUSE="${IUSE} cluster extraengine" |
|
|
28 | |
|
|
29 | mysql_version_is_at_least "5.00.00.00" \ |
|
|
30 | || IUSE="${IUSE} raid" |
29 | |
31 | |
30 | mysql_version_is_at_least "5.00.18.00" \ |
32 | mysql_version_is_at_least "5.00.18.00" \ |
31 | && IUSE="${IUSE} max-idx-128" |
33 | && IUSE="${IUSE} max-idx-128" |
32 | |
34 | |
33 | mysql_version_is_at_least "5.01.00.00" \ |
35 | mysql_version_is_at_least "5.01.00.00" \ |
34 | && IUSE="${IUSE} innodb" |
36 | && IUSE="${IUSE} innodb" |
35 | |
37 | |
36 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm |
38 | EXPORT_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> |
|
|
44 | mysql_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 | } |
37 | |
98 | |
38 | mysql_pkg_setup() { |
99 | mysql_pkg_setup() { |
39 | |
100 | |
40 | enewgroup mysql 60 || die "problem adding group mysql" |
101 | enewgroup mysql 60 || die "problem adding group mysql" |
41 | enewuser mysql 60 -1 /dev/null mysql \ |
102 | enewuser mysql 60 -1 /dev/null mysql \ |
… | |
… | |
72 | # additional check, remove bundled zlib |
133 | # additional check, remove bundled zlib |
73 | rm -f "${S}/zlib/"*.[ch] |
134 | rm -f "${S}/zlib/"*.[ch] |
74 | 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" |
75 | rm -f scripts/mysqlbug |
136 | rm -f scripts/mysqlbug |
76 | |
137 | |
77 | # Multilib issue with zlib detection |
|
|
78 | mysql_version_is_at_least "5.00.15.00" \ |
|
|
79 | && sed -i -e "s:zlib_dir/lib:zlib_dir/$(get_libdir):g" \ |
|
|
80 | "${S}/config/ac-macros/zlib.m4" |
|
|
81 | |
|
|
82 | # Make charsets install in the right place |
138 | # Make charsets install in the right place |
83 | find . -name 'Makefile.am' \ |
139 | find . -name 'Makefile.am' \ |
84 | -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
140 | -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
85 | |
141 | |
86 | # Manage mysqlmanager |
142 | # Manage mysqlmanager |
… | |
… | |
104 | fi |
160 | fi |
105 | |
161 | |
106 | for d in ${rebuilddirlist}; do |
162 | for d in ${rebuilddirlist}; do |
107 | einfo "reconfiguring dir \"${d}\"" |
163 | einfo "reconfiguring dir \"${d}\"" |
108 | pushd "${d}" &>/dev/null |
164 | pushd "${d}" &>/dev/null |
109 | for buildstep in \ |
165 | AT_GNUCONF_UPDATE="yes" eautoreconf |
110 | 'libtoolize --copy --force' \ |
|
|
111 | 'aclocal --force' \ |
|
|
112 | 'autoheader --force -Wnone' \ |
|
|
113 | 'autoconf --force -Wnone' \ |
|
|
114 | 'automake --force --force-missing -Wnone' \ |
|
|
115 | 'gnuconfig_update' |
|
|
116 | do |
|
|
117 | einfo "performing ${buildstep}" |
|
|
118 | ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\"" |
|
|
119 | done |
|
|
120 | popd &>/dev/null |
166 | popd &>/dev/null |
121 | done |
167 | done |
122 | |
168 | |
|
|
169 | #TODO berkdb in 5.1 need to be worked on |
123 | 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 |
124 | [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh" |
172 | [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh" |
125 | pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null |
173 | pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null |
126 | popd &>/dev/null |
174 | popd &>/dev/null |
127 | fi |
175 | fi |
128 | |
176 | |
129 | } |
177 | } |
130 | |
178 | |
131 | src_compile() { |
179 | mysql_src_compile() { |
132 | |
180 | |
133 | mysql_init_vars |
181 | mysql_init_vars |
134 | local myconf |
182 | local myconf |
135 | |
183 | |
136 | if useq static ; then |
184 | if useq static ; then |
… | |
… | |
185 | |
233 | |
186 | if useq static ; then |
234 | if useq static ; then |
187 | myconf="${myconf} --without-raid" |
235 | myconf="${myconf} --without-raid" |
188 | ewarn "disabling raid support, has problem with static" |
236 | ewarn "disabling raid support, has problem with static" |
189 | else |
237 | else |
|
|
238 | if mysql_version_is_at_least "5.00.00.00" ; then |
190 | myconf="${myconf} --with-raid" |
239 | myconf="${myconf} --without-raid" |
|
|
240 | else |
|
|
241 | myconf="${myconf} `use_with raid`" |
|
|
242 | fi |
191 | fi |
243 | fi |
192 | |
244 | |
193 | if ! mysql_version_is_at_least "5.00.00.00" ; then |
245 | if ! mysql_version_is_at_least "5.00.00.00" ; then |
194 | 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 |
195 | myconf="${myconf} --with-charset=utf8" |
247 | myconf="${myconf} --with-charset=utf8" |
196 | myconf="${myconf} --with-collation=utf8_general_ci" |
248 | myconf="${myconf} --with-collation=utf8_general_ci" |
197 | else |
249 | else |
198 | myconf="${myconf} --with-charset=latin1" |
250 | myconf="${myconf} --with-charset=latin1" |
199 | myconf="${myconf} --with-collation=latin1_swedish_ci" |
251 | myconf="${myconf} --with-collation=latin1_swedish_ci" |
… | |
… | |
217 | || 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" |
218 | then |
270 | then |
219 | ewarn "bdb berkeley-db disabled due to arch or version" |
271 | ewarn "bdb berkeley-db disabled due to arch or version" |
220 | myconf="${myconf} --without-berkeley-db" |
272 | myconf="${myconf} --without-berkeley-db" |
221 | else |
273 | else |
|
|
274 | #TODO berkdb in 5.1 need to be worked on |
222 | useq berkdb \ |
275 | useq berkdb && \ |
|
|
276 | ! mysql_check_version_range "5.01.00.00 to 5.01.08.99" \ |
223 | && myconf="${myconf} --with-berkeley-db=./bdb" \ |
277 | && myconf="${myconf} --with-berkeley-db=./bdb" \ |
224 | || myconf="${myconf} --without-berkeley-db" |
278 | || myconf="${myconf} --without-berkeley-db" |
225 | fi |
279 | fi |
226 | |
280 | |
227 | if mysql_version_is_at_least "4.01.03.00" ; then |
281 | if mysql_version_is_at_least "4.01.03.00" ; then |
… | |
… | |
229 | myconf="${myconf} --with-geometry" |
283 | myconf="${myconf} --with-geometry" |
230 | myconf="${myconf} $(use_with cluster ndbcluster)" |
284 | myconf="${myconf} $(use_with cluster ndbcluster)" |
231 | fi |
285 | fi |
232 | |
286 | |
233 | 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 |
234 | else |
299 | else |
235 | for i in ${minimal_exclude_list}; do |
300 | for i in ${minimal_exclude_list}; do |
236 | myconf="${myconf} --without-${i}" |
301 | myconf="${myconf} --without-${i}" |
237 | done |
302 | done |
238 | myconf="${myconf} --without-berkeley-db" |
303 | myconf="${myconf} --without-berkeley-db" |
… | |
… | |
261 | if mysql_version_is_at_least "5.01.00.00" ; then |
326 | if mysql_version_is_at_least "5.01.00.00" ; then |
262 | myconf="${myconf} --with-partition" |
327 | myconf="${myconf} --with-partition" |
263 | fi |
328 | fi |
264 | fi |
329 | fi |
265 | |
330 | |
|
|
331 | fi |
|
|
332 | |
266 | mysql_version_is_at_least "5.00.18.00" \ |
333 | mysql_version_is_at_least "5.00.18.00" \ |
267 | && useq "max-idx-128" \ |
334 | && useq "max-idx-128" \ |
268 | && 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" |
269 | fi |
347 | fi |
270 | |
348 | |
271 | #Bug #114895,Bug #110149 |
349 | #Bug #114895,Bug #110149 |
272 | filter-flags "-O" "-O[01]" |
350 | filter-flags "-O" "-O[01]" |
273 | #glibc-2.3.2_pre fix; bug #16496 |
351 | #glibc-2.3.2_pre fix; bug #16496 |
… | |
… | |
286 | --localstatedir="${MY_LOCALSTATEDIR}" \ |
364 | --localstatedir="${MY_LOCALSTATEDIR}" \ |
287 | --sharedstatedir="${MY_SHAREDSTATEDIR}" \ |
365 | --sharedstatedir="${MY_SHAREDSTATEDIR}" \ |
288 | --libdir="${MY_LIBDIR}" \ |
366 | --libdir="${MY_LIBDIR}" \ |
289 | --includedir="${MY_INCLUDEDIR}" \ |
367 | --includedir="${MY_INCLUDEDIR}" \ |
290 | --with-low-memory \ |
368 | --with-low-memory \ |
291 | --enable-assembler \ |
|
|
292 | --enable-local-infile \ |
369 | --enable-local-infile \ |
293 | --with-mysqld-user=mysql \ |
370 | --with-mysqld-user=mysql \ |
294 | --with-client-ldflags=-lstdc++ \ |
371 | --with-client-ldflags=-lstdc++ \ |
295 | --enable-thread-safe-client \ |
372 | --enable-thread-safe-client \ |
296 | --with-comment="Gentoo Linux ${PF}" \ |
373 | --with-comment="Gentoo Linux ${PF}" \ |
297 | --with-unix-socket-path="/var/run/mysqld/mysqld${MY_SUFFIX}.sock" \ |
374 | --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \ |
298 | --with-zlib-dir=/usr \ |
|
|
299 | --with-lib-ccflags="-fPIC" \ |
375 | --with-lib-ccflags="-fPIC" \ |
300 | --without-readline \ |
376 | --without-readline \ |
301 | --without-docs \ |
377 | --without-docs \ |
302 | ${myconf} || die "bad ./configure" |
378 | ${myconf} || die "bad ./configure" |
303 | |
379 | |
304 | # TODO Move this before autoreconf !!! |
380 | # TODO Move this before autoreconf !!! |
305 | find . -name 'Makefile' \ |
381 | find . -type f -name Makefile -print0 \ |
306 | -exec sed --in-place \ |
382 | | xargs -0 -n100 sed -i \ |
307 | -e 's|^pkglibdir\s*=\s*$(libdir)/mysql|pkglibdir = $(libdir)|' \ |
383 | -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' |
308 | -e 's|^pkgincludedir\s*=\s*$(includedir)/mysql|pkgincludedir = $(includedir)|' \ |
|
|
309 | {} \; |
|
|
310 | |
384 | |
311 | emake || die "compile problem" |
385 | emake || die "compile problem" |
312 | } |
386 | } |
313 | |
387 | |
314 | mysql_src_install() { |
388 | mysql_src_install() { |
… | |
… | |
359 | fi |
433 | fi |
360 | |
434 | |
361 | # config stuff |
435 | # config stuff |
362 | insinto "${MY_SYSCONFDIR}" |
436 | insinto "${MY_SYSCONFDIR}" |
363 | 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" |
364 | newins "${FILESDIR}/my.cnf-4.1" my.cnf |
442 | newins "${TMPDIR}/my.cnf.ok" my.cnf |
|
|
443 | |
365 | insinto "/etc/conf.d" |
444 | insinto "/etc/conf.d" |
366 | newins "${FILESDIR}/mysql-slot.conf.d-r1" "mysql" |
445 | newins "${FILESDIR}/mysql-slot.conf.d-r1" "mysql" |
367 | mysql_version_is_at_least "5.00.11.00" \ |
446 | mysql_version_is_at_least "5.00.11.00" \ |
368 | && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager" |
447 | && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager" |
369 | |
448 | |
370 | local charset='utf8' |
|
|
371 | ! useq utf8 && local charset='latin1' |
|
|
372 | sed --in-place \ |
|
|
373 | -e "s/@MY_SUFFIX@/${MY_SUFFIX}/" \ |
|
|
374 | -e "s/@CHARSET@/${charset}/" \ |
|
|
375 | "${D}/etc/mysql${MY_SUFFIX}/my.cnf" |
|
|
376 | |
|
|
377 | # minimal builds don't have the server |
449 | # minimal builds don't have the server |
378 | if ! useq minimal; then |
450 | if ! useq minimal; then |
379 | exeinto /etc/init.d |
451 | exeinto /etc/init.d |
380 | newexe "${FILESDIR}/mysql-slot.rc6-r1" "mysql" |
452 | newexe "${FILESDIR}/mysql-slot.rc6-r3" "mysql" |
|
|
453 | |
381 | mysql_version_is_at_least "5.00.11.00" \ |
454 | mysql_version_is_at_least "5.00.11.00" \ |
382 | && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager" |
455 | && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager" |
383 | insinto /etc/logrotate.d |
456 | insinto /etc/logrotate.d |
384 | # TODO |
457 | sed -e "s!___MY_SUFFIX___!${MY_SUFFIX}!g" \ |
|
|
458 | "${FILESDIR}/logrotate-slot.mysql" \ |
|
|
459 | > "${TMPDIR}/logrotate.mysql" |
385 | newins "${FILESDIR}/logrotate.mysql" "mysql${MY_SUFFIX}" |
460 | newins "${TMPDIR}/logrotate.mysql" "mysql${MY_SUFFIX}" |
386 | |
461 | |
387 | #empty dirs... |
462 | #empty dirs... |
388 | diropts "-m0750" |
463 | diropts "-m0750" |
389 | if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then |
464 | if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then |
390 | dodir "${DATADIR}" |
465 | dodir "${DATADIR}" |
… | |
… | |
420 | fi |
495 | fi |
421 | |
496 | |
422 | # oops, temporary fix |
497 | # oops, temporary fix |
423 | mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ |
498 | mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ |
424 | && cp -f \ |
499 | && cp -f \ |
425 | "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0.15" \ |
500 | "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \ |
426 | "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" |
501 | "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" |
427 | |
502 | |
|
|
503 | if [[ ${SLOT} -gt 0 ]] ; then |
|
|
504 | # MOVED HERE DUE TO BUG #121445 |
428 | # create a list of executable files, to be used |
505 | # create a list of files, to be used |
429 | # by external utilities |
506 | # by external utilities |
430 | # uncompressed because of the small size |
507 | mkdir -p "${D}/var/lib/eselect/mysql/" |
431 | local exelist="usr/share/mysql${MY_SUFFIX}/.exe-list" |
508 | local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist" |
432 | pushd "${D}/" &>/dev/null |
509 | pushd "${D}/" &>/dev/null |
433 | env -i find usr/bin/ usr/sbin/ usr/share/man \ |
510 | find usr/bin/ usr/sbin/ \ |
434 | -type f -name "*${MY_SUFFIX}*" \ |
511 | -type f -name "*${MY_SUFFIX}*" \ |
|
|
512 | -and -not -name "mysql_config${MY_SUFFIX}" \ |
435 | > "${exelist}" |
513 | > "${filelist}" |
|
|
514 | find usr/share/man \ |
|
|
515 | -type f -name "*${MY_SUFFIX}*" \ |
|
|
516 | | sed -e 's/$/.gz/' \ |
|
|
517 | >> "${filelist}" |
436 | echo "${MY_SYSCONFDIR##"/"}" >> "${exelist}" |
518 | echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}" |
437 | echo "${MY_INCLUDEDIR##"/"}" >> "${exelist}" |
|
|
438 | echo "${MY_LIBDIR##"/"}" >> "${exelist}" |
519 | echo "${MY_LIBDIR#"/"}" >> "${filelist}" |
439 | echo "${MY_SHAREDSTATEDIR##"/"}" >> "${exelist}" |
520 | echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}" |
440 | popd &>/dev/null |
521 | popd &>/dev/null |
|
|
522 | fi |
441 | } |
523 | } |
442 | |
524 | |
443 | mysql_pkg_preinst() { |
525 | mysql_pkg_preinst() { |
444 | |
526 | |
445 | enewgroup mysql 60 || die "problem adding group mysql" |
527 | enewgroup mysql 60 || die "problem adding group mysql" |
… | |
… | |
460 | touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} |
542 | touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} |
461 | chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* |
543 | chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* |
462 | chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* |
544 | chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* |
463 | |
545 | |
464 | if ! useq minimal; then |
546 | if ! useq minimal; then |
|
|
547 | if [[ ${SLOT} -gt 0 ]] ; then |
|
|
548 | einfo "you may want to read:" |
|
|
549 | einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml" |
|
|
550 | einfo "you may want to run \"eselect mysql list\" followed by a " |
|
|
551 | einfo "\"eselect mysql set 1\" to choose the default mysql server" |
|
|
552 | fi |
|
|
553 | |
465 | # your friendly public service announcement... |
554 | # your friendly public service announcement... |
466 | einfo |
555 | einfo |
467 | einfo "You might want to run:" |
556 | einfo "You might want to run:" |
468 | einfo "\"emerge --config =${CATEGORY}/${PF}\"" |
557 | einfo "\"emerge --config =${CATEGORY}/${PF}\"" |
469 | einfo "if this is a new install." |
558 | einfo "if this is a new install." |
470 | einfo |
559 | einfo |
471 | fi |
560 | mysql_version_is_at_least "5.01.00.00" \ |
472 | |
|
|
473 | einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream." |
561 | || 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 |
562 | fi |
481 | } |
563 | } |
482 | |
564 | |
483 | mysql_pkg_config() { |
565 | mysql_pkg_config() { |
484 | mysql_init_vars |
566 | mysql_init_vars |
… | |
… | |
514 | fi |
596 | fi |
515 | |
597 | |
516 | local options="" |
598 | local options="" |
517 | local sqltmp="$(emktemp)" |
599 | local sqltmp="$(emktemp)" |
518 | |
600 | |
519 | local help_tables="${ROOT}/usr/share/doc/mysql-${PVR}/scripts/fill_help_tables.sql.gz" |
601 | local help_tables="${MY_SHAREDSTATEDIR}/fill_help_tables.sql" |
520 | [[ -r "${help_tables}" ]] \ |
602 | [[ -r "${help_tables}" ]] \ |
521 | && zcat "${help_tables}" > "${TMPDIR}/fill_help_tables.sql" \ |
603 | && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ |
522 | || touch "${TMPDIR}/fill_help_tables.sql" |
604 | || touch "${TMPDIR}/fill_help_tables.sql" |
523 | help_tables="${TMPDIR}/fill_help_tables.sql" |
605 | help_tables="${TMPDIR}/fill_help_tables.sql" |
524 | |
606 | |
525 | pushd "${TMPDIR}" &>/dev/null |
607 | pushd "${TMPDIR}" &>/dev/null |
526 | ${ROOT}/usr/bin/mysql_install_db${MY_SUFFIX} | grep -B5 -A999 -i "ERROR" |
608 | ${ROOT}/usr/bin/mysql_install_db${MY_SUFFIX} | grep -B5 -A999 -i "ERROR" |
… | |
… | |
540 | if [[ -r "${help_tables}" ]] ; then |
622 | if [[ -r "${help_tables}" ]] ; then |
541 | cat "${help_tables}" >> "${sqltmp}" |
623 | cat "${help_tables}" >> "${sqltmp}" |
542 | fi |
624 | fi |
543 | fi |
625 | fi |
544 | |
626 | |
545 | local socket=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock |
627 | local socket=${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock |
546 | local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock |
628 | local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.pid |
547 | local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \ |
629 | local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \ |
548 | ${options} \ |
630 | ${options} \ |
549 | --user=mysql \ |
631 | --user=mysql \ |
550 | --skip-grant-tables \ |
632 | --skip-grant-tables \ |
551 | --basedir=${ROOT}/usr \ |
633 | --basedir=${ROOT}/usr \ |
… | |
… | |
586 | einfo "stopping the server," |
668 | einfo "stopping the server," |
587 | wait %1 |
669 | wait %1 |
588 | einfo "done" |
670 | einfo "done" |
589 | } |
671 | } |
590 | |
672 | |
|
|
673 | mysql_pkg_prerm() { |
|
|
674 | if [[ ${SLOT} -gt 0 ]] ; then |
|
|
675 | # external program |
|
|
676 | eselect mysql slot_remove "${SLOT}" |
|
|
677 | fi |
|
|
678 | } |
|
|
679 | |
591 | mysql_pkg_postrm() { |
680 | mysql_pkg_postrm() { |
592 | mysql_lib_symlinks |
681 | mysql_lib_symlinks |
593 | if [[ ${SLOT} -gt 0 ]] ; then |
682 | if [[ ${SLOT} -gt 0 ]] ; then |
594 | einfo "you may want to run \"eselect myqsl list\" followed by a " |
683 | einfo "you may want to run \"eselect mysql list\" followed by a " |
595 | einfo "\"eselect myqsl list\" to chose the default mysql server" |
684 | einfo "\"eselect mysql list\" to choose the default mysql server" |
596 | fi |
685 | fi |
597 | } |
686 | } |