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

Contents of /eclass/mysql-v2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.39 - (hide annotations) (download)
Sun May 24 04:35:49 2015 UTC (3 months ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.38: +3 -4 lines
pkg_config: tweak user messages

1 ulm 1.37 # Copyright 1999-2015 Gentoo Foundation
2 robbat2 1.1 # Distributed under the terms of the GNU General Public License v2
3 vapier 1.39 # $Header: /var/cvsroot/gentoo-x86/eclass/mysql-v2.eclass,v 1.38 2015/05/01 12:34:31 grknight Exp $
4 robbat2 1.1
5     # @ECLASS: mysql-v2.eclass
6     # @MAINTAINER:
7     # Maintainers:
8     # - MySQL Team <mysql-bugs@gentoo.org>
9     # - Robin H. Johnson <robbat2@gentoo.org>
10     # - Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
11 grknight 1.29 # - Brian Evans <grknight@gentoo.org>
12 robbat2 1.1 # @BLURB: This eclass provides most of the functions for mysql ebuilds
13     # @DESCRIPTION:
14     # The mysql-v2.eclass is the base eclass to build the mysql and
15 jmbsvicetto 1.25 # alternative projects (mariadb and percona) ebuilds.
16 robbat2 1.1 # This eclass uses the mysql-autotools and mysql-cmake eclasses for the
17     # specific bits related to the build system.
18     # It provides the src_unpack, src_prepare, src_configure, src_compile,
19 heroxbd 1.16 # src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm
20 robbat2 1.1 # phase hooks.
21    
22     # @ECLASS-VARIABLE: BUILD
23 vapier 1.7 # @DESCRIPTION:
24     # Build type of the mysql version
25 robbat2 1.1 : ${BUILD:=autotools}
26    
27     case ${BUILD} in
28     "cmake")
29     BUILD_INHERIT="mysql-cmake"
30     ;;
31     "autotools")
32     BUILD_INHERIT="mysql-autotools"
33    
34     WANT_AUTOCONF="latest"
35     WANT_AUTOMAKE="latest"
36     ;;
37     *)
38     die "${BUILD} is not a valid build system for mysql"
39     ;;
40     esac
41    
42     MYSQL_EXTRAS=""
43    
44     # @ECLASS-VARIABLE: MYSQL_EXTRAS_VER
45 vapier 1.7 # @DESCRIPTION:
46     # The version of the MYSQL_EXTRAS repo to use to build mysql
47 jmbsvicetto 1.9 # Use "none" to disable it's use
48 robbat2 1.34 [[ ${MY_EXTRAS_VER} == "live" ]] && MYSQL_EXTRAS="git-r3"
49 robbat2 1.1
50 vapier 1.26 inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs user
51 robbat2 1.1
52     #
53     # Supported EAPI versions and export functions
54     #
55    
56     case "${EAPI:-0}" in
57 jmbsvicetto 1.25 4|5) ;;
58 robbat2 1.1 *) die "Unsupported EAPI: ${EAPI}" ;;
59     esac
60    
61 jmbsvicetto 1.3 EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm
62 robbat2 1.1
63     #
64     # VARIABLES:
65     #
66    
67     # Shorten the path because the socket path length must be shorter than 107 chars
68     # and we will run a mysql server during test phase
69     S="${WORKDIR}/mysql"
70    
71 jmbsvicetto 1.25 [[ ${MY_EXTRAS_VER} == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z"
72     if [[ ${MY_EXTRAS_VER} == "live" ]]; then
73 grknight 1.38 EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
74 robbat2 1.34 EGIT_CHECKOUT_DIR=${WORKDIR}/mysql-extras
75     EGIT_CLONE_TYPE=shallow
76 robbat2 1.1 fi
77    
78     # @ECLASS-VARIABLE: MYSQL_PV_MAJOR
79     # @DESCRIPTION:
80     # Upstream MySQL considers the first two parts of the version number to be the
81     # major version. Upgrades that change major version should always run
82     # mysql_upgrade.
83     MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})"
84    
85 jmbsvicetto 1.27 # Cluster is a special case...
86 robbat2 1.33 if [[ ${PN} == "mysql-cluster" ]]; then
87     case ${PV} in
88 jmbsvicetto 1.27 6.1*|7.0*|7.1*) MYSQL_PV_MAJOR=5.1 ;;
89 robbat2 1.33 7.2*) MYSQL_PV_MAJOR=5.5 ;;
90     7.3*) MYSQL_PV_MAJOR=5.6 ;;
91     esac
92     fi
93    
94     # MariaDB has left the numbering schema but keeping compatibility
95     if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
96     case ${PV} in
97     10.0*|10.1*) MYSQL_PV_MAJOR="5.6" ;;
98 jmbsvicetto 1.27 esac
99     fi
100    
101 robbat2 1.1 # @ECLASS-VARIABLE: MYSQL_VERSION_ID
102     # @DESCRIPTION:
103     # MYSQL_VERSION_ID will be:
104     # major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99]
105     # This is an important part, because many of the choices the MySQL ebuild will do
106     # depend on this variable.
107     # In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803"
108     # We also strip off upstream's trailing letter that they use to respin tarballs
109     MYSQL_VERSION_ID=""
110     tpv="${PV%[a-z]}"
111     tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}"
112     for vatom in 0 1 2 3 ; do
113     # pad to length 2
114     tpv[${vatom}]="00${tpv[${vatom}]}"
115     MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}"
116     done
117     # strip leading "0" (otherwise it's considered an octal number by BASH)
118     MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"}
119    
120     # This eclass should only be used with at least mysql-5.1.50
121     mysql_version_is_at_least "5.1.50" || die "This eclass should only be used with >=mysql-5.1.50"
122    
123     # @ECLASS-VARIABLE: XTRADB_VER
124     # @DEFAULT_UNSET
125     # @DESCRIPTION:
126     # Version of the XTRADB storage engine
127    
128     # @ECLASS-VARIABLE: PERCONA_VER
129     # @DEFAULT_UNSET
130     # @DESCRIPTION:
131     # Designation by PERCONA for a MySQL version to apply an XTRADB release
132    
133     # Work out the default SERVER_URI correctly
134 jmbsvicetto 1.25 if [[ -z ${SERVER_URI} ]]; then
135     [[ -z ${MY_PV} ]] && MY_PV="${PV//_/-}"
136     if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
137 jmbsvicetto 1.27 # Beginning with 5.5, MariaDB stopped putting beta, alpha or rc on their tarball names
138     mysql_version_is_at_least "5.5" && MARIA_FULL_PV=$(get_version_component_range 1-3) || \
139     MARIA_FULL_PV=$(replace_version_separator 3 '-' ${MY_PV})
140 robbat2 1.1 MARIA_FULL_P="${PN}-${MARIA_FULL_PV}"
141     SERVER_URI="
142     http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
143 jmbsvicetto 1.28 http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz
144 jmbsvicetto 1.27 http://mirror.jmu.edu/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
145     http://mirrors.coreix.net/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
146     http://mirrors.syringanetworks.net/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
147     http://mirrors.fe.up.pt/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
148     http://mirror2.hs-esslingen.de/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
149 robbat2 1.1 "
150 jmbsvicetto 1.25 if [[ ${PN} == "mariadb-galera" ]]; then
151     MY_SOURCEDIR="${PN%%-galera}-${MARIA_FULL_PV}"
152     fi
153     elif [[ ${PN} == "percona-server" ]]; then
154     PERCONA_PN="Percona-Server"
155     MIRROR_PV=$(get_version_component_range 1-2 ${PV})
156     MY_PV=$(get_version_component_range 1-3 ${PV})
157 jmbsvicetto 1.27 PERCONA_RELEASE=$(get_version_component_range 4-5 ${PV})
158     PERCONA_RC=$(get_version_component_range 6 ${PV})
159     SERVER_URI="http://www.percona.com/redir/downloads/${PERCONA_PN}-${MIRROR_PV}/${PERCONA_PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}/source/tarball/${PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}.tar.gz"
160     # http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/Percona-Server-5.5.30-30.2.tar.gz
161     # http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.13-rc60.5/source/tarball/Percona-Server-5.6.13-rc60.5.tar.gz
162 robbat2 1.15 else
163 jmbsvicetto 1.27 if [[ "${PN}" == "mysql-cluster" ]] ; then
164     URI_DIR="MySQL-Cluster"
165     URI_FILE="mysql-cluster-gpl"
166     else
167     URI_DIR="MySQL"
168     URI_FILE="mysql"
169     fi
170 robbat2 1.1 URI_A="${URI_FILE}-${MY_PV}.tar.gz"
171     MIRROR_PV=$(get_version_component_range 1-2 ${PV})
172     # Recently upstream switched to an archive site, and not on mirrors
173     SERVER_URI="http://downloads.mysql.com/archives/${URI_FILE}-${MIRROR_PV}/${URI_A}
174 robbat2 1.35 https://downloads.skysql.com/files/${URI_FILE}-${MIRROR_PV}/${URI_A}
175 robbat2 1.1 mirror://mysql/Downloads/${URI_DIR}-${PV%.*}/${URI_A}"
176     fi
177     fi
178    
179     # Define correct SRC_URIs
180     SRC_URI="${SERVER_URI}"
181    
182     # Gentoo patches to MySQL
183 jmbsvicetto 1.25 if [[ ${MY_EXTRAS_VER} != "live" && ${MY_EXTRAS_VER} != "none" ]]; then
184     SRC_URI="${SRC_URI}
185 robbat2 1.1 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
186     http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
187 jmbsvicetto 1.4 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
188 grknight 1.29 http://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
189     http://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
190 jmbsvicetto 1.25 fi
191 robbat2 1.1
192 grknight 1.29 DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
193 robbat2 1.1 HOMEPAGE="http://www.mysql.com/"
194 jmbsvicetto 1.25 if [[ ${PN} == "mariadb" ]]; then
195 robbat2 1.1 HOMEPAGE="http://mariadb.org/"
196 robbat2 1.23 DESCRIPTION="An enhanced, drop-in replacement for MySQL"
197 robbat2 1.1 fi
198 jmbsvicetto 1.25 if [[ ${PN} == "mariadb-galera" ]]; then
199     HOMEPAGE="http://mariadb.org/"
200     DESCRIPTION="An enhanced, drop-in replacement for MySQL with Galera Replication"
201     fi
202     if [[ ${PN} == "percona-server" ]]; then
203     HOMEPAGE="http://www.percona.com/software/percona-server"
204 grknight 1.29 DESCRIPTION="An enhanced, drop-in replacement for MySQL from the Percona team"
205 jmbsvicetto 1.25 fi
206 robbat2 1.1 LICENSE="GPL-2"
207     SLOT="0"
208    
209     case "${BUILD}" in
210     "autotools")
211     IUSE="big-tables debug embedded minimal +perl selinux ssl static test"
212     ;;
213     "cmake")
214 jmbsvicetto 1.27 IUSE="debug embedded minimal +perl selinux ssl static static-libs test"
215 robbat2 1.1 ;;
216     esac
217    
218 jmbsvicetto 1.27 # Common IUSE
219     IUSE="${IUSE} latin1 extraengine cluster max-idx-128 +community profiling"
220 robbat2 1.1
221 robbat2 1.33 # This probably could be simplified, but the syntax would have to be just right
222 grknight 1.31 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && \
223 robbat2 1.33 mysql_version_is_at_least "5.5" ; then
224     IUSE="bindist ${IUSE}"
225 ulm 1.37 RESTRICT="${RESTRICT} !bindist? ( bindist )"
226 robbat2 1.33 elif [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] && \
227     mysql_check_version_range "5.5.37 to 5.6.11.99" ; then
228     IUSE="bindist ${IUSE}"
229 ulm 1.37 RESTRICT="${RESTRICT} !bindist? ( bindist )"
230 robbat2 1.33 elif [[ ${PN} == "mysql-cluster" ]] && \
231     mysql_check_version_range "7.2 to 7.2.99.99" ; then
232 grknight 1.31 IUSE="bindist ${IUSE}"
233 ulm 1.37 RESTRICT="${RESTRICT} !bindist? ( bindist )"
234 grknight 1.31 fi
235    
236 jmbsvicetto 1.25 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
237     mysql_check_version_range "5.1.38 to 5.3.99" && IUSE="${IUSE} libevent"
238 jmbsvicetto 1.27 mysql_version_is_at_least "5.2" && IUSE="${IUSE} oqgraph" && \
239     REQUIRED_USE="${REQUIRED_USE} minimal? ( !oqgraph )"
240     mysql_version_is_at_least "5.2.5" && IUSE="${IUSE} sphinx" && \
241     REQUIRED_USE="${REQUIRED_USE} minimal? ( !sphinx )"
242 jmbsvicetto 1.25 mysql_version_is_at_least "5.2.10" && IUSE="${IUSE} pam"
243 jmbsvicetto 1.27 # 5.5.33 and 10.0.5 add TokuDB. Authors strongly recommend jemalloc or perfomance suffers
244     mysql_version_is_at_least "10.0.5" && IUSE="${IUSE} tokudb odbc xml" && \
245     REQUIRED_USE="${REQUIRED_USE} odbc? ( extraengine ) xml? ( extraengine ) tokudb? ( jemalloc )"
246     mysql_check_version_range "5.5.33 to 5.5.99" && IUSE="${IUSE} tokudb" && \
247     REQUIRED_USE="${REQUIRED_USE} tokudb? ( jemalloc )"
248 jmbsvicetto 1.25 fi
249 robbat2 1.24
250 robbat2 1.21 if mysql_version_is_at_least "5.5"; then
251 jmbsvicetto 1.27 REQUIRED_USE="${REQUIRED_USE} tcmalloc? ( !jemalloc ) jemalloc? ( !tcmalloc )"
252 robbat2 1.21 IUSE="${IUSE} jemalloc tcmalloc"
253     fi
254    
255 jmbsvicetto 1.25 if mysql_version_is_at_least "5.5.7"; then
256     IUSE="${IUSE} systemtap"
257     fi
258    
259     if [[ ${PN} == "percona-server" ]]; then
260     mysql_version_is_at_least "5.5.10" && IUSE="${IUSE} pam"
261     fi
262    
263 robbat2 1.23 REQUIRED_USE="${REQUIRED_USE} minimal? ( !cluster !extraengine !embedded ) static? ( !ssl )"
264    
265 robbat2 1.1 #
266     # DEPENDENCIES:
267     #
268    
269     # Be warned, *DEPEND are version-dependant
270     # These are used for both runtime and compiletime
271     DEPEND="
272 grknight 1.36 ssl? ( >=dev-libs/openssl-0.9.6d:0 )
273 jmbsvicetto 1.9 kernel_linux? ( sys-process/procps )
274 robbat2 1.1 >=sys-apps/sed-4
275     >=sys-apps/texinfo-4.7-r1
276     >=sys-libs/zlib-1.2.3
277     "
278 jmbsvicetto 1.27 # TODO: add this as a dep if it is moved from the overlay
279     # !dev-db/mariadb-native-client[mysqlcompat]
280    
281     # dev-db/mysql-5.6.12+ only works with dev-libs/libedit
282 robbat2 1.33 # This probably could be simplified
283     if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] && \
284     mysql_version_is_at_least "5.6.12" ; then
285     DEPEND="${DEPEND} dev-libs/libedit"
286     elif [[ ${PN} == "mysql-cluster" ]] && mysql_version_is_at_least "7.3"; then
287 jmbsvicetto 1.27 DEPEND="${DEPEND} dev-libs/libedit"
288     else
289 grknight 1.31 if mysql_version_is_at_least "5.5" ; then
290 grknight 1.36 DEPEND="${DEPEND} !bindist? ( >=sys-libs/readline-4.1:0 )"
291 grknight 1.31 else
292 grknight 1.36 DEPEND="${DEPEND} >=sys-libs/readline-4.1:0"
293 grknight 1.31 fi
294 jmbsvicetto 1.27 fi
295 robbat2 1.1
296 jmbsvicetto 1.25 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
297     mysql_check_version_range "5.1.38 to 5.3.99" && DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )"
298     mysql_version_is_at_least "5.2" && DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )"
299     mysql_version_is_at_least "5.2.10" && DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam ) )"
300     # Bug 441700 MariaDB >=5.3 include custom mytop
301     mysql_version_is_at_least "5.3" && DEPEND="${DEPEND} perl? ( !dev-db/mytop )"
302 jmbsvicetto 1.27 if mysql_version_is_at_least "10.0.5" ; then
303     DEPEND="${DEPEND}
304     odbc? ( dev-db/unixODBC )
305     xml? ( dev-libs/libxml2 )
306     "
307     fi
308     mysql_version_is_at_least "10.0.7" && DEPEND="${DEPEND} oqgraph? ( dev-libs/judy )"
309     if mysql_version_is_at_least "10.0.9" ; then
310 grknight 1.29 DEPEND="${DEPEND} >=dev-libs/libpcre-8.35"
311 jmbsvicetto 1.27 fi
312 jmbsvicetto 1.25 fi
313 robbat2 1.1
314     # Having different flavours at the same time is not a good idea
315 jmbsvicetto 1.27 for i in "mysql" "mariadb" "mariadb-galera" "percona-server" "mysql-cluster" ; do
316 robbat2 1.1 [[ ${i} == ${PN} ]] ||
317     DEPEND="${DEPEND} !dev-db/${i}"
318     done
319    
320 jmbsvicetto 1.27 if mysql_version_is_at_least "5.5.7" ; then
321     DEPEND="${DEPEND}
322     jemalloc? ( dev-libs/jemalloc[static-libs?] )
323     tcmalloc? ( dev-util/google-perftools )
324     >=sys-libs/zlib-1.2.3[static-libs?]
325     ssl? ( >=dev-libs/openssl-0.9.6d[static-libs?] )
326     systemtap? ( >=dev-util/systemtap-1.3 )
327     kernel_linux? ( dev-libs/libaio )
328     "
329 jmbsvicetto 1.25 fi
330 robbat2 1.22
331 jmbsvicetto 1.27 if [[ ${PN} == "mysql-cluster" ]] ; then
332     # TODO: This really should include net-misc/memcached
333     # but the package does not install the files it seeks.
334     mysql_version_is_at_least "7.2.3" && \
335     DEPEND="${DEPEND} dev-libs/libevent"
336 jmbsvicetto 1.25 fi
337 robbat2 1.22
338 grobian 1.8 # prefix: first need to implement something for #196294
339 robbat2 1.1 RDEPEND="${DEPEND}
340 grobian 1.8 !minimal? ( !prefix? ( dev-db/mysql-init-scripts ) )
341 robbat2 1.1 selinux? ( sec-policy/selinux-mysql )
342     "
343    
344 jmbsvicetto 1.25 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
345     # Bug 455016 Add dependencies of mytop
346     if mysql_version_is_at_least "5.3" ; then
347 jmbsvicetto 1.27 RDEPEND="${RDEPEND}
348     perl? (
349     virtual/perl-Getopt-Long
350     dev-perl/TermReadKey
351     virtual/perl-Term-ANSIColor
352     virtual/perl-Time-HiRes
353     )
354     "
355 jmbsvicetto 1.25 fi
356     fi
357 robbat2 1.24
358 jmbsvicetto 1.27 if [[ ${PN} == "mariadb-galera" ]] ; then
359     # The wsrep API version must match between the ebuild and sys-cluster/galera.
360     # This will be indicated by WSREP_REVISION in the ebuild and the first number
361     # in the version of sys-cluster/galera
362     RDEPEND="${RDEPEND}
363     =sys-cluster/galera-${WSREP_REVISION}*
364     "
365     fi
366    
367     if [[ ${PN} == "mysql-cluster" ]] ; then
368     mysql_version_is_at_least "7.2.9" && RDEPEND="${RDEPEND} java? ( >=virtual/jre-1.6 )" && \
369     DEPEND="${DEPEND} java? ( >=virtual/jdk-1.6 )"
370     fi
371    
372 jmbsvicetto 1.6 DEPEND="${DEPEND}
373     virtual/yacc
374     "
375    
376 jmbsvicetto 1.17 DEPEND="${DEPEND} static? ( sys-libs/ncurses[static-libs] )"
377 robbat2 1.1
378     # compile-time-only
379     DEPEND="${DEPEND} >=dev-util/cmake-2.4.3"
380    
381     # compile-time-only
382 jmbsvicetto 1.25 if mysql_version_is_at_least "5.5.8" ; then
383     DEPEND="${DEPEND} >=dev-util/cmake-2.6.3"
384     fi
385 robbat2 1.1
386     # dev-perl/DBD-mysql is needed by some scripts installed by MySQL
387     PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
388    
389     # For other stuff to bring us in
390 jmbsvicetto 1.27 PDEPEND="${PDEPEND} ~virtual/mysql-${MYSQL_PV_MAJOR}"
391 robbat2 1.1
392     #
393     # External patches
394     #
395    
396 jmbsvicetto 1.27 # MariaDB has integrated PBXT until it was dropped in version 5.5.33
397 robbat2 1.1 # PBXT_VERSION means that we have a PBXT patch for this PV
398     # PBXT was only introduced after 5.1.12
399     pbxt_patch_available() {
400 jmbsvicetto 1.25 [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera" && ( -n "${PBXT_VERSION}" ) ]]
401 robbat2 1.1 return $?
402     }
403    
404     pbxt_available() {
405 jmbsvicetto 1.27 pbxt_patch_available || [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && mysql_check_version_range "5.1 to 5.5.32"
406 robbat2 1.1 return $?
407     }
408    
409     # Get the percona tarball if XTRADB_VER and PERCONA_VER are both set
410     # MariaDB has integrated XtraDB
411     # XTRADB_VERS means that we have a XTRADB patch for this PV
412     # XTRADB was only introduced after 5.1.26
413     xtradb_patch_available() {
414 jmbsvicetto 1.25 [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera"
415     && ( -n "${XTRADB_VER}" ) && ( -n "${PERCONA_VER}" ) ]]
416 robbat2 1.1 return $?
417     }
418    
419     if pbxt_patch_available; then
420    
421     PBXT_P="pbxt-${PBXT_VERSION}"
422     PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz"
423     SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )"
424 robbat2 1.15 fi
425    
426     # PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins
427     # vs. built outside the dir
428     if pbxt_available; then
429 robbat2 1.1
430 robbat2 1.15 IUSE="${IUSE} pbxt"
431     PBXT_NEWSTYLE=1
432 robbat2 1.23 REQUIRED_USE="${REQUIRED_USE} pbxt? ( !embedded ) "
433 robbat2 1.1 fi
434    
435     if xtradb_patch_available; then
436     XTRADB_P="percona-xtradb-${XTRADB_VER}"
437     XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz"
438     XTRADB_SRC_B1="http://www.percona.com/"
439     XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/"
440     XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}"
441     XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}"
442     XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}"
443     SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )"
444     IUSE="${IUSE} xtradb"
445 robbat2 1.23 REQUIRED_USE="${REQUIRED_USE} xtradb? ( !embedded ) "
446 robbat2 1.1 fi
447    
448     #
449     # HELPER FUNCTIONS:
450     #
451    
452     # @FUNCTION: mysql-v2_disable_test
453     # @DESCRIPTION:
454     # Helper function to disable specific tests.
455     mysql-v2_disable_test() {
456     ${BUILD_INHERIT}_disable_test "$@"
457     }
458    
459     # @FUNCTION: mysql-v2_configure_minimal
460     # @DESCRIPTION:
461     # Helper function to configure minimal build
462     configure_minimal() {
463     ${BUILD_INHERIT}_configure_minimal "$@"
464     }
465    
466     # @FUNCTION: mysql-v2_configure_common
467     # @DESCRIPTION:
468     # Helper function to configure common builds
469     configure_common() {
470     ${BUILD_INHERIT}_configure_common "$@"
471     }
472    
473     #
474     # EBUILD FUNCTIONS
475     #
476    
477     # @FUNCTION: mysql-v2_pkg_setup
478     # @DESCRIPTION:
479     # Perform some basic tests and tasks during pkg_setup phase:
480 jmbsvicetto 1.27 # die if FEATURES="test", USE="-minimal" and not using FEATURES="userpriv"
481     # check for conflicting use flags
482     # create new user and group for mysql
483     # warn about deprecated features
484 robbat2 1.1 mysql-v2_pkg_setup() {
485    
486     if has test ${FEATURES} ; then
487     if ! use minimal ; then
488 jmbsvicetto 1.12 if ! has userpriv ${FEATURES} ; then
489 robbat2 1.1 eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
490     fi
491     fi
492     fi
493    
494     # Check for USE flag problems in pkg_setup
495 jmbsvicetto 1.25 if ! mysql_version_is_at_least "5.2" && use debug ; then
496 robbat2 1.1 # Also in package.use.mask
497     die "Bug #344885: Upstream has broken USE=debug for 5.1 series >=5.1.51"
498     fi
499    
500     # This should come after all of the die statements
501     enewgroup mysql 60 || die "problem adding 'mysql' group"
502     enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
503    
504 jmbsvicetto 1.27 if use cluster && [[ "${PN}" != "mysql-cluster" ]]; then
505 robbat2 1.1 ewarn "Upstream has noted that the NDB cluster support in the 5.0 and"
506     ewarn "5.1 series should NOT be put into production. In the near"
507     ewarn "future, it will be disabled from building."
508     fi
509 jmbsvicetto 1.27
510     if [[ ${PN} == "mysql-cluster" ]] ; then
511     mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_pkg_setup
512     fi
513    
514 jmbsvicetto 1.28 if use_if_iuse tokudb && [[ $(gcc-major-version) -lt 4 || $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 7 ]] ; then
515 jmbsvicetto 1.27 eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
516     eerror "Please use gcc-config to switch to gcc-4.7 or later version."
517     die
518     fi
519    
520 robbat2 1.1 }
521    
522     # @FUNCTION: mysql-v2_src_unpack
523     # @DESCRIPTION:
524     # Unpack the source code
525     mysql-v2_src_unpack() {
526    
527     # Initialize the proper variables first
528     mysql_init_vars
529    
530     unpack ${A}
531     # Grab the patches
532 robbat2 1.34 [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
533 robbat2 1.1
534     mv -f "${WORKDIR}/${MY_SOURCEDIR}" "${S}"
535     }
536    
537     # @FUNCTION: mysql-v2_src_prepare
538     # @DESCRIPTION:
539     # Apply patches to the source code and remove unneeded bundled libs.
540     mysql-v2_src_prepare() {
541     ${BUILD_INHERIT}_src_prepare "$@"
542 jmbsvicetto 1.27 if [[ ${PN} == "mysql-cluster" ]] ; then
543     mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_src_prepare
544     fi
545 robbat2 1.1 }
546    
547     # @FUNCTION: mysql-v2_src_configure
548     # @DESCRIPTION:
549     # Configure mysql to build the code for Gentoo respecting the use flags.
550     mysql-v2_src_configure() {
551     ${BUILD_INHERIT}_src_configure "$@"
552     }
553    
554     # @FUNCTION: mysql-v2_src_compile
555     # @DESCRIPTION:
556     # Compile the mysql code.
557     mysql-v2_src_compile() {
558     ${BUILD_INHERIT}_src_compile "$@"
559     }
560    
561     # @FUNCTION: mysql-v2_src_install
562     # @DESCRIPTION:
563     # Install mysql.
564     mysql-v2_src_install() {
565     ${BUILD_INHERIT}_src_install "$@"
566     }
567    
568     # @FUNCTION: mysql-v2_pkg_preinst
569     # @DESCRIPTION:
570     # Create the user and groups for mysql - die if that fails.
571     mysql-v2_pkg_preinst() {
572 jmbsvicetto 1.27 if [[ ${PN} == "mysql-cluster" ]] ; then
573     mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_pkg_preinst
574     fi
575 robbat2 1.1 enewgroup mysql 60 || die "problem adding 'mysql' group"
576     enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
577     }
578    
579     # @FUNCTION: mysql-v2_pkg_postinst
580     # @DESCRIPTION:
581     # Run post-installation tasks:
582 jmbsvicetto 1.27 # create the dir for logfiles if non-existant
583     # touch the logfiles and secure them
584     # install scripts
585     # issue required steps for optional features
586     # issue deprecation warnings
587 robbat2 1.1 mysql-v2_pkg_postinst() {
588    
589     # Make sure the vars are correctly initialized
590     mysql_init_vars
591    
592     # Check FEATURES="collision-protect" before removing this
593 jmbsvicetto 1.12 [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
594 robbat2 1.1
595     # Secure the logfiles
596     touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
597     chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
598     chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
599    
600     # Minimal builds don't have the MySQL server
601     if ! use minimal ; then
602     docinto "support-files"
603     for script in \
604     support-files/my-*.cnf \
605     support-files/magic \
606     support-files/ndb-config-2-node.ini
607     do
608     [[ -f "${script}" ]] \
609     && dodoc "${script}"
610     done
611    
612     docinto "scripts"
613     for script in scripts/mysql* ; do
614 jmbsvicetto 1.25 if [[ -f "${script}" && "${script%.sh}" == "${script}" ]]; then
615     dodoc "${script}"
616     fi
617 robbat2 1.1 done
618    
619 jmbsvicetto 1.27 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
620     if use_if_iuse pam ; then
621     einfo
622     elog "This install includes the PAM authentication plugin."
623     elog "To activate and configure the PAM plugin, please read:"
624     elog "https://kb.askmonty.org/en/pam-authentication-plugin/"
625     einfo
626     fi
627 robbat2 1.24 fi
628    
629 robbat2 1.1 einfo
630     elog "You might want to run:"
631     elog "\"emerge --config =${CATEGORY}/${PF}\""
632     elog "if this is a new install."
633     einfo
634    
635     einfo
636     elog "If you are upgrading major versions, you should run the"
637     elog "mysql_upgrade tool."
638     einfo
639 jmbsvicetto 1.27
640     if [[ ${PN} == "mariadb-galera" ]] ; then
641     einfo
642     elog "Be sure to edit the my.cnf file to activate your cluster settings."
643     elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
644     elog "The first time the cluster is activated, you should add"
645     elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
646     elog "This option should then be removed for subsequent starts."
647     einfo
648     fi
649 robbat2 1.1 fi
650    
651 jmbsvicetto 1.27 if use_if_iuse pbxt ; then
652 robbat2 1.21 elog "Note: PBXT is now statically built when enabled."
653     elog ""
654     elog "If, you previously installed as a plugin and "
655     elog "you cannot start the MySQL server,"
656 robbat2 1.1 elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then"
657     elog "use the MySQL upgrade script to restore the table"
658     elog "or execute the following SQL command:"
659 jmbsvicetto 1.27 elog " CREATE TABLE IF NOT EXISTS plugin ("
660     elog " name char(64) binary DEFAULT '' NOT NULL,"
661     elog " dl char(128) DEFAULT '' NOT NULL,"
662     elog " PRIMARY KEY (name)"
663     elog " ) CHARACTER SET utf8 COLLATE utf8_bin;"
664 robbat2 1.1 fi
665     }
666    
667 robbat2 1.20 # @FUNCTION: mysql-v2_getopt
668     # @DESCRIPTION:
669     # Use my_print_defaults to extract specific config options
670     mysql-v2_getopt() {
671     local mypd="${EROOT}"/usr/bin/my_print_defaults
672     section="$1"
673     flag="--${2}="
674     "${mypd}" $section | sed -n "/^${flag}/p"
675     }
676    
677     # @FUNCTION: mysql-v2_getoptval
678     # @DESCRIPTION:
679     # Use my_print_defaults to extract specific config options
680     mysql-v2_getoptval() {
681     local mypd="${EROOT}"/usr/bin/my_print_defaults
682     section="$1"
683     flag="--${2}="
684     "${mypd}" $section | sed -n "/^${flag}/s,${flag},,gp"
685     }
686    
687 robbat2 1.1 # @FUNCTION: mysql-v2_pkg_config
688     # @DESCRIPTION:
689     # Configure mysql environment.
690     mysql-v2_pkg_config() {
691    
692     local old_MY_DATADIR="${MY_DATADIR}"
693 robbat2 1.20 local old_HOME="${HOME}"
694     # my_print_defaults needs to read stuff in $HOME/.my.cnf
695 grobian 1.32 export HOME=${EPREFIX}/root
696 robbat2 1.1
697     # Make sure the vars are correctly initialized
698     mysql_init_vars
699    
700     [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
701    
702     if built_with_use ${CATEGORY}/${PN} minimal ; then
703     die "Minimal builds do NOT include the MySQL server"
704     fi
705    
706     if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
707 ferringb 1.18 local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
708     MY_DATADIR_s="${MY_DATADIR_s%%/}"
709 robbat2 1.20 local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
710 ferringb 1.18 old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
711 robbat2 1.1
712 jmbsvicetto 1.25 if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
713 robbat2 1.1 if [[ -d "${MY_DATADIR_s}" ]]; then
714     ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
715     ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
716     else
717     elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
718     mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
719     || die "Moving MY_DATADIR failed"
720     fi
721     else
722     ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
723     if [[ -d "${MY_DATADIR_s}" ]]; then
724     ewarn "Attempting to use ${MY_DATADIR_s}"
725     else
726     eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
727 jmbsvicetto 1.27 die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
728 robbat2 1.1 fi
729     fi
730     fi
731    
732     local pwd1="a"
733     local pwd2="b"
734     local maxtry=15
735    
736 robbat2 1.20 if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
737     MYSQL_ROOT_PASSWORD="$(mysql-v2_getoptval 'client mysql' password)"
738     fi
739     MYSQL_TMPDIR="$(mysql-v2_getoptval mysqld tmpdir)"
740     # These are dir+prefix
741     MYSQL_RELAY_LOG="$(mysql-v2_getoptval mysqld relay-log)"
742     MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
743     MYSQL_LOG_BIN="$(mysql-v2_getoptval mysqld log-bin)"
744     MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
745    
746 grobian 1.32 if [[ ! -d "${ROOT}"/$MYSQL_TMPDIR ]]; then
747 robbat2 1.20 einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
748 grobian 1.32 install -d -m 770 -o mysql -g mysql "${ROOT}"/$MYSQL_TMPDIR
749 robbat2 1.20 fi
750 grobian 1.32 if [[ ! -d "${ROOT}"/$MYSQL_LOG_BIN ]]; then
751 robbat2 1.20 einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
752 grobian 1.32 install -d -m 770 -o mysql -g mysql "${ROOT}"/$MYSQL_LOG_BIN
753 robbat2 1.20 fi
754     if [[ ! -d "${EROOT}"/$MYSQL_RELAY_LOG ]]; then
755     einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
756     install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_RELAY_LOG
757 robbat2 1.1 fi
758    
759     if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
760     ewarn "You have already a MySQL database in place."
761     ewarn "(${ROOT}/${MY_DATADIR}/*)"
762     ewarn "Please rename or delete it if you wish to replace it."
763     die "MySQL database already exists!"
764     fi
765    
766     # Bug #213475 - MySQL _will_ object strenously if your machine is named
767     # localhost. Also causes weird failures.
768     [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
769    
770     if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
771    
772     einfo "Please provide a password for the mysql 'root' user now, in the"
773 grobian 1.32 einfo "MYSQL_ROOT_PASSWORD env var or through the ${HOME}/.my.cnf file."
774 robbat2 1.1 ewarn "Avoid [\"'\\_%] characters in the password"
775     read -rsp " >" pwd1 ; echo
776    
777     einfo "Retype the password"
778     read -rsp " >" pwd2 ; echo
779    
780     if [[ "x$pwd1" != "x$pwd2" ]] ; then
781     die "Passwords are not the same"
782     fi
783     MYSQL_ROOT_PASSWORD="${pwd1}"
784     unset pwd1 pwd2
785     fi
786    
787 grobian 1.32 local options
788 robbat2 1.1 local sqltmp="$(emktemp)"
789    
790 grobian 1.32 # Fix bug 446200. Don't reference host my.cnf, needs to come first,
791     # see http://bugs.mysql.com/bug.php?id=31312
792     use prefix && options="${options} --defaults-file=${MY_SYSCONFDIR}/my.cnf"
793    
794 robbat2 1.1 local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql"
795     [[ -r "${help_tables}" ]] \
796     && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
797     || touch "${TMPDIR}/fill_help_tables.sql"
798     help_tables="${TMPDIR}/fill_help_tables.sql"
799 jmbsvicetto 1.25
800 robbat2 1.20 # Figure out which options we need to disable to do the setup
801     helpfile="${TMPDIR}/mysqld-help"
802     ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
803 jmbsvicetto 1.25 for opt in grant-tables host-cache name-resolve networking slave-start \
804 grknight 1.29 federated ssl log-bin relay-log slow-query-log external-locking \
805 robbat2 1.20 ndbcluster log-slave-updates \
806     ; do
807     optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
808     egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
809     done
810     # But some options changed names
811     egrep -sq external-locking "${helpfile}" && \
812     options="${options/skip-locking/skip-external-locking}"
813    
814     use prefix || options="${options} --user=mysql"
815 robbat2 1.1
816 grknight 1.29 # MySQL 5.6+ needs InnoDB
817     if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] ; then
818     mysql_version_is_at_least "5.6" || options="${options} --loose-skip-innodb"
819     fi
820    
821 vapier 1.39 einfo "Creating the mysql database and setting proper permissions on it ..."
822 grknight 1.29
823     # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
824     PID_DIR="${EROOT}/var/run/mysqld"
825     if [[ ! -d "${PID_DIR}" ]]; then
826     mkdir -p "${PID_DIR}" || die "Could not create pid directory"
827     chown mysql:mysql "${PID_DIR}" || die "Could not set ownership on pid directory"
828     chmod 755 "${PID_DIR}" || die "Could not set permissions on pid directory"
829     fi
830    
831 robbat2 1.1 pushd "${TMPDIR}" &>/dev/null
832 robbat2 1.20 #cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}"
833     cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db
834 jmbsvicetto 1.25 [[ -f ${cmd} ]] || cmd=${EROOT}usr/bin/mysql_install_db
835 grobian 1.32 cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options} '--datadir=${ROOT}/${MY_DATADIR}' '--tmpdir=${ROOT}/${MYSQL_TMPDIR}'"
836 robbat2 1.20 einfo "Command: $cmd"
837     eval $cmd \
838     >"${TMPDIR}"/mysql_install_db.log 2>&1
839 robbat2 1.1 if [ $? -ne 0 ]; then
840     grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
841 jmbsvicetto 1.12 die "Failed to run mysql_install_db. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
842 robbat2 1.1 fi
843     popd &>/dev/null
844     [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
845     || die "MySQL databases not installed"
846     chown -R mysql:mysql "${ROOT}/${MY_DATADIR}" 2>/dev/null
847     chmod 0750 "${ROOT}/${MY_DATADIR}" 2>/dev/null
848    
849     # Filling timezones, see
850     # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
851 jmbsvicetto 1.12 "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
852 robbat2 1.1
853     if [[ -r "${help_tables}" ]] ; then
854     cat "${help_tables}" >> "${sqltmp}"
855     fi
856    
857 jmbsvicetto 1.12 local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
858     local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
859     local mysqld="${EROOT}/usr/sbin/mysqld \
860 robbat2 1.1 ${options} \
861 grobian 1.32 $(use prefix || echo --user=mysql) \
862 robbat2 1.20 --log-warnings=0 \
863 jmbsvicetto 1.12 --basedir=${EROOT}/usr \
864 grobian 1.32 --datadir=${ROOT}/${MY_DATADIR} \
865 robbat2 1.1 --max_allowed_packet=8M \
866     --net_buffer_length=16K \
867     --default-storage-engine=MyISAM \
868     --socket=${socket} \
869 grknight 1.30 --pid-file=${pidfile}
870 grobian 1.32 --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
871 robbat2 1.1 #einfo "About to start mysqld: ${mysqld}"
872     ebegin "Starting mysqld"
873 robbat2 1.20 einfo "Command ${mysqld}"
874 robbat2 1.1 ${mysqld} &
875     rc=$?
876     while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
877     maxtry=$((${maxtry}-1))
878     echo -n "."
879     sleep 1
880     done
881     eend $rc
882    
883     if ! [[ -S "${socket}" ]]; then
884     die "Completely failed to start up mysqld with: ${mysqld}"
885     fi
886    
887     ebegin "Setting root password"
888     # Do this from memory, as we don't want clear text passwords in temp files
889     local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'"
890 jmbsvicetto 1.12 "${EROOT}/usr/bin/mysql" \
891 robbat2 1.1 --socket=${socket} \
892     -hlocalhost \
893     -e "${sql}"
894     eend $?
895    
896 vapier 1.39 ebegin "Loading \"zoneinfo\", this step may require a few seconds"
897 jmbsvicetto 1.12 "${EROOT}/usr/bin/mysql" \
898 robbat2 1.1 --socket=${socket} \
899     -hlocalhost \
900     -uroot \
901 robbat2 1.20 --password="${MYSQL_ROOT_PASSWORD}" \
902 robbat2 1.1 mysql < "${sqltmp}"
903     rc=$?
904     eend $?
905 jmbsvicetto 1.25 [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
906 robbat2 1.1
907     # Stop the server and cleanup
908     einfo "Stopping the server ..."
909     kill $(< "${pidfile}" )
910     rm -f "${sqltmp}"
911     wait %1
912     einfo "Done"
913     }
914    
915     # @FUNCTION: mysql-v2_pkg_postrm
916     # @DESCRIPTION:
917     # Remove mysql symlinks.
918     mysql-v2_pkg_postrm() {
919    
920 jmbsvicetto 1.12 : # mysql_lib_symlinks "${ED}"
921 robbat2 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20