Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mariadb/
Date: Mon, 24 Sep 2018 23:34:38
Message-Id: 1537832050.861a8528a544d5f99c0bcfa4db22d0de8c70de11.grknight@gentoo
1 commit: 861a8528a544d5f99c0bcfa4db22d0de8c70de11
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 24 23:34:10 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 24 23:34:10 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=861a8528
7
8 dev-db/mariadb: Version bump for 10.1.36
9
10 Package-Manager: Portage-2.3.49, Repoman-2.3.11
11
12 dev-db/mariadb/Manifest | 1 +
13 dev-db/mariadb/mariadb-10.1.36.ebuild | 887 ++++++++++++++++++++++++++++++++++
14 2 files changed, 888 insertions(+)
15
16 diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
17 index 2a9a72ce10e..2c84bda019b 100644
18 --- a/dev-db/mariadb/Manifest
19 +++ b/dev-db/mariadb/Manifest
20 @@ -2,6 +2,7 @@ DIST mariadb-10.0.35.tar.gz 66551252 BLAKE2B 69cc9c78f7c47a4b1760940cb0f395b4053
21 DIST mariadb-10.0.36.tar.gz 66577105 BLAKE2B 6165c641cf4a8d13e53aa8391fe146edb476d6fe80aebd0c0698543595f2060a3f7c834cbfd8d7e7c50697e7be1010ae833310f2756da84b11c87224c940df50 SHA512 aa26e43775f4f76754c79c960b5e96d8ae3e28ab922d7abbb5c23867a2705085fe57830addc79eed3c810329eca344eaf1c09dcdb8b73d9d73c85090386984c0
22 DIST mariadb-10.1.34.tar.gz 65298561 BLAKE2B 3f3af7b8bad68a08f69befd3f3e7bd88b8cf058feb20309dc2cdbd16bf5d015c2cb0d1d9d2fdf831f6183c0b9bb25405124c24b2940467489e05d42c57f7b0a6 SHA512 3c18359006b340dcf724d1fce36dcc19916c42492269a7545e0726172b8f7b84860e10725c74e4458dae34572395f1650bf17838e9058544e0a6cfcbffd54f6d
23 DIST mariadb-10.1.35.tar.gz 65324620 BLAKE2B 659ad232a1f2f1cfd74ba8aa9b9f67adc6f4a5dc82e5d8b16011dba83155b1223138df273c935c71021f05068cd8fd14538e935847a36640fc4218b86155698c SHA512 88e6049f3bbc3aa047e108f91a2c4f335758e80f25bfa2974b5f8c2e13f5758824d7835dece021b515c531e5641b9998e4de92256ad4b47b7f694da99bd471aa
24 +DIST mariadb-10.1.36.tar.gz 63366949 BLAKE2B ef2831832eff5283fbb62500639921c7680c987ca7627bd75125b8f32e798b70ce5ac551979bf5b60bdabc6fededf38befae9939720c88cc4305084eeb32281a SHA512 44eb8565f068292511c8109c8b265472ba0884377644a7ef8a4a19793c8c5e75faee0b3de7a3c276589a074ddd64c9658e27807d68b0002e2354c1583b9bbf76
25 DIST mariadb-10.2.17.tar.gz 73409162 BLAKE2B f13d359a4a061ae2ef2fb4dde53ed07dac1735f9577ef67e396a51ac74acec71acf7a0ab07b4e0f84d70c8f7bcacbdc61933957c4936c99d5038f433296af8a3 SHA512 9714f786abde43b418d8b5accbbd485de213b90db18c879625ce30777526d28fdafd3bdb43922ab6872b300cfa06895b5b3fad5eb0c0e804ad66a1fd1793a141
26 DIST mariadb-10.3.8.tar.gz 72152953 BLAKE2B 4742be1d533c7958b61efd430411a1e7390faffc25ceccc09c736647fb263dc3797064725335abf17f9362c7a92293ea5fc72bc2ddd70636f83c25e35c4c83aa SHA512 e1b61900a06fa57992a2f8516771f5fb98799ed5a4bbe74f858c0fe87b907cc6b600942d6fe97b6064cb39b610a7213cb3bc9634a336f9ebffe11dfe67746422
27 DIST mariadb-5.5.61.tar.gz 45839038 BLAKE2B 2755963d51aee3b9b560531e00b9df6f5637c90a44ad181cf826234d27c15e9fd1b61ae4faf4d9a4ff06779e605c6a5757192407e6e402ad68dfb3ae45a94088 SHA512 a2bebb47ec62eb6cd15e003dea7708948cd96fd7f0fc631a85cfc4691b55e220ed78f3e3b16542b5152ad5bcc61e50a831c71cf8f29481f7de86816ec0bae594
28
29 diff --git a/dev-db/mariadb/mariadb-10.1.36.ebuild b/dev-db/mariadb/mariadb-10.1.36.ebuild
30 new file mode 100644
31 index 00000000000..51e39e6958e
32 --- /dev/null
33 +++ b/dev-db/mariadb/mariadb-10.1.36.ebuild
34 @@ -0,0 +1,887 @@
35 +# Copyright 1999-2018 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI="6"
39 +MY_EXTRAS_VER="20180809-1700Z"
40 +SUBSLOT="18"
41 +
42 +JAVA_PKG_OPT_USE="jdbc"
43 +
44 +# Keeping eutils in EAPI=6 for emktemp in pkg_config
45 +
46 +inherit eutils systemd flag-o-matic prefix toolchain-funcs java-pkg-opt-2 user cmake-utils multilib-build
47 +
48 +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
49 +
50 +# Gentoo patches to MySQL
51 +if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
52 + SRC_URI="${SRC_URI}
53 + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
54 + https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
55 + https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
56 + https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
57 + https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
58 +fi
59 +
60 +HOMEPAGE="https://mariadb.org/"
61 +DESCRIPTION="An enhanced, drop-in replacement for MySQL"
62 +LICENSE="GPL-2"
63 +SLOT="0/${SUBSLOT:-0}"
64 +IUSE="+backup bindist client-libs cracklib debug extraengine galera jdbc jemalloc kerberos
65 + innodb-lz4 innodb-lzo innodb-snappy latin1 libressl mroonga numa odbc oqgraph pam
66 + +perl profiling selinux +server sphinx sst-rsync sst-mariabackup sst-xtrabackup
67 + systemd systemtap static static-libs tcmalloc test tokudb xml yassl"
68 +
69 +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
70 +RESTRICT="!bindist? ( bindist ) libressl? ( test )"
71 +
72 +REQUIRED_USE="jdbc? ( extraengine server !static )
73 + server? ( tokudb? ( jemalloc !tcmalloc ) )
74 + ?? ( tcmalloc jemalloc )
75 + static? ( yassl !pam )"
76 +
77 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
78 +
79 +# Shorten the path because the socket path length must be shorter than 107 chars
80 +# and we will run a mysql server during test phase
81 +S="${WORKDIR}/mysql"
82 +
83 +if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
84 + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
85 + inherit git-r3
86 + EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
87 + EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
88 + EGIT_CLONE_TYPE=shallow
89 +else
90 + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
91 +fi
92 +
93 +PATCHES=(
94 + "${MY_PATCH_DIR}"/20006_all_cmake_elib-mariadb-10.1.27.patch
95 + "${MY_PATCH_DIR}"/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch
96 + "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
97 + "${MY_PATCH_DIR}"/20018_all_mariadb-10.1.16-without-clientlibs-tools.patch
98 + "${MY_PATCH_DIR}"/20025_all_mariadb-10.1.26-gssapi-detect.patch
99 + "${MY_PATCH_DIR}"/20029_all_mariadb-10.1.31-enable-numa.patch
100 + "${MY_PATCH_DIR}"/20035_all_mariadb-10.1-atomic-detection.patch
101 +)
102 +
103 +# Be warned, *DEPEND are version-dependant
104 +# These are used for both runtime and compiletime
105 +COMMON_DEPEND="
106 + kernel_linux? (
107 + sys-process/procps:0=
108 + dev-libs/libaio:0=
109 + )
110 + >=sys-apps/sed-4
111 + >=sys-apps/texinfo-4.7-r1
112 + jemalloc? ( dev-libs/jemalloc:0= )
113 + tcmalloc? ( dev-util/google-perftools:0= )
114 + systemtap? ( >=dev-util/systemtap-1.3:0= )
115 + !yassl? (
116 + !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
117 + libressl? ( dev-libs/libressl:0= )
118 + )
119 + >=sys-libs/zlib-1.2.3:0=
120 + sys-libs/ncurses:0=
121 + !bindist? (
122 + sys-libs/binutils-libs:0=
123 + >=sys-libs/readline-4.1:0=
124 + )
125 + server? (
126 + backup? ( app-arch/libarchive:0= )
127 + cracklib? ( sys-libs/cracklib:0= )
128 + extraengine? (
129 + odbc? ( dev-db/unixODBC:0= )
130 + xml? ( dev-libs/libxml2:2= )
131 + sys-libs/zlib[minizip]
132 + )
133 + innodb-lz4? ( app-arch/lz4 )
134 + innodb-lzo? ( dev-libs/lzo )
135 + innodb-snappy? ( app-arch/snappy )
136 + kerberos? ( virtual/krb5 )
137 + mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
138 + numa? ( sys-process/numactl )
139 + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
140 + pam? ( virtual/pam:0= )
141 + systemd? ( sys-apps/systemd:= )
142 + tokudb? ( app-arch/snappy )
143 + )
144 + !yassl? ( !libressl? ( !>=dev-libs/openssl-1.1.0 ) )
145 + >=dev-libs/libpcre-8.41-r1:3=
146 + !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
147 +"
148 +DEPEND="virtual/yacc
149 + static? ( sys-libs/ncurses[static-libs] )
150 + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
151 + server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
152 + ${COMMON_DEPEND}"
153 +RDEPEND="selinux? ( sec-policy/selinux-mysql )
154 + client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
155 + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
156 + server? ( !prefix? ( dev-db/mysql-init-scripts ) )
157 + ${COMMON_DEPEND}
158 + server? ( galera? (
159 + sys-apps/iproute2
160 + =sys-cluster/galera-25*
161 + sst-rsync? ( sys-process/lsof )
162 + sst-mariabackup? ( net-misc/socat[ssl] )
163 + sst-xtrabackup? ( net-misc/socat[ssl] )
164 + ) )
165 + perl? ( !dev-db/mytop
166 + virtual/perl-Getopt-Long
167 + dev-perl/TermReadKey
168 + virtual/perl-Term-ANSIColor
169 + virtual/perl-Time-HiRes )
170 + server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
171 +"
172 +# For other stuff to bring us in
173 +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
174 +# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
175 +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
176 + server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
177 +
178 +pkg_setup() {
179 + if [[ ${MERGE_TYPE} != binary ]] ; then
180 + local GCC_MAJOR_SET=$(gcc-major-version)
181 + local GCC_MINOR_SET=$(gcc-minor-version)
182 + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
183 + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
184 + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
185 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
186 + die
187 + fi
188 + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
189 + # non x86{,_64} arches
190 + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
191 + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
192 + eerror "${PN} needs to be built with gcc-4.7 or later."
193 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
194 + die
195 + fi
196 + fi
197 + java-pkg-opt-2_pkg_setup
198 + if has test ${FEATURES} && \
199 + use server && ! has userpriv ${FEATURES} ; then
200 + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
201 + fi
202 +
203 + # This should come after all of the die statements
204 + enewgroup mysql 60 || die "problem adding 'mysql' group"
205 + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
206 +}
207 +
208 +pkg_preinst() {
209 + java-pkg-opt-2_pkg_preinst
210 +}
211 +
212 +pkg_postinst() {
213 + # Make sure the vars are correctly initialized
214 + mysql_init_vars
215 +
216 + # Create log directory securely if it does not exist
217 + [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
218 +
219 + if use server ; then
220 + if use pam; then
221 + einfo
222 + elog "This install includes the PAM authentication plugin."
223 + elog "To activate and configure the PAM plugin, please read:"
224 + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
225 + einfo
226 + fi
227 +
228 + if [[ -z "${REPLACING_VERSIONS}" ]] ; then
229 + einfo
230 + elog "You might want to run:"
231 + elog "\"emerge --config =${CATEGORY}/${PF}\""
232 + elog "if this is a new install."
233 + elog
234 + elog "If you are switching server implentations, you should run the"
235 + elog "mysql_upgrade tool."
236 + einfo
237 + else
238 + einfo
239 + elog "If you are upgrading major versions, you should run the"
240 + elog "mysql_upgrade tool."
241 + einfo
242 + fi
243 +
244 + einfo
245 + elog "Be sure to edit the my.cnf file to activate your cluster settings."
246 + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
247 + elog "The first time the cluster is activated, you should add"
248 + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
249 + elog "This option should then be removed for subsequent starts."
250 + einfo
251 + fi
252 +}
253 +
254 +src_unpack() {
255 + unpack ${A}
256 + # Grab the patches
257 + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
258 +
259 + mv -f "${WORKDIR%/}/${PN%%-galera}-${PV}" "${S}" || die
260 +}
261 +
262 +src_prepare() {
263 + _disable_engine() {
264 + echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
265 + }
266 +
267 + _disable_plugin() {
268 + echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
269 + }
270 +
271 + if use tcmalloc; then
272 + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
273 + fi
274 +
275 + # Don't build bundled xz-utils for tokudb
276 + echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
277 + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
278 + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
279 +
280 + local plugin
281 + local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
282 + locale_info qc_info server_audit semisync sql_errlog )
283 + local test_plugins=( audit_null auth_examples daemon_example fulltext )
284 + if ! use server; then # These plugins are for the server
285 + for plugin in "${server_plugins[@]}" ; do
286 + _disable_plugin "${plugin}"
287 + done
288 + fi
289 +
290 + if ! use test; then # These plugins are only used during testing
291 + for plugin in "${test_plugins[@]}" ; do
292 + _disable_plugin "${plugin}"
293 + done
294 + fi
295 +
296 + # Collides with mariadb-connector-c bug 655980
297 + _disable_plugin auth_dialog
298 +
299 + # Avoid useless library checks
300 + use mroonga || _disable_engine mroonga
301 + use oqgraph || _disable_engine oqgraph
302 + _disable_engine example
303 +
304 + cmake-utils_src_prepare
305 + java-pkg-opt-2_src_prepare
306 +}
307 +
308 +src_configure(){
309 + # bug 508724 mariadb cannot use ld.gold
310 + tc-ld-disable-gold
311 + # Bug #114895, bug #110149
312 + filter-flags "-O" "-O[01]"
313 +
314 + append-cxxflags -felide-constructors
315 +
316 + # bug #283926, with GCC4.4, this is required to get correct behavior.
317 + append-flags -fno-strict-aliasing
318 +
319 + CMAKE_BUILD_TYPE="RelWithDebInfo"
320 +
321 + # debug hack wrt #497532
322 + mycmakeargs=(
323 + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
324 + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
325 + -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
326 + -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql"
327 + -DINSTALL_BINDIR=bin
328 + -DINSTALL_DOCDIR=share/doc/${PF}
329 + -DINSTALL_DOCREADMEDIR=share/doc/${PF}
330 + -DINSTALL_INCLUDEDIR=include/mysql
331 + -DINSTALL_INFODIR=share/info
332 + -DINSTALL_LIBDIR=$(get_libdir)
333 + -DINSTALL_MANDIR=share/man
334 + -DINSTALL_MYSQLSHAREDIR=share/mariadb
335 + -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mariadb/mysql-test' '')
336 + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
337 + -DINSTALL_SCRIPTDIR=share/mariadb/scripts
338 + -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
339 + -DINSTALL_SBINDIR=sbin
340 + -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb"
341 + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
342 + -DWITH_UNIT_TESTS=$(usex test ON OFF)
343 + -DWITH_ZLIB=system
344 + -DENABLED_LOCAL_INFILE=1
345 + -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
346 + -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
347 + -DWITH_DEFAULT_COMPILER_OPTIONS=0
348 + -DWITH_DEFAULT_FEATURE_SET=0
349 + -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
350 + # The build forces this to be defined when cross-compiling. We pass it
351 + # all the time for simplicity and to make sure it is actually correct.
352 + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
353 + -DWITHOUT_CLIENTLIBS=YES
354 + -DWITH_READLINE=$(usex bindist 1 0)
355 + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
356 + -DENABLE_DTRACE=$(usex systemtap)
357 + -DWITH_SSL=$(usex yassl bundled system)
358 + )
359 +
360 + if use server ; then
361 +
362 + # Federated{,X} must be treated special otherwise they will not be built as plugins
363 + if ! use extraengine ; then
364 + mycmakeargs+=(
365 + -DPLUGIN_FEDERATED=NO
366 + -DPLUGIN_FEDERATEDX=NO )
367 + fi
368 +
369 + mycmakeargs+=(
370 + -DWITH_JEMALLOC=$(usex jemalloc system)
371 + -DWITH_PCRE=system
372 + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
373 + -DPLUGIN_SPHINX=$(usex sphinx YES NO)
374 + -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
375 + -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
376 + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
377 + -DPLUGIN_CASSANDRA=NO
378 + -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
379 + -DPLUGIN_SPIDER=$(usex extraengine YES NO)
380 + -DPLUGIN_CONNECT=$(usex extraengine YES NO)
381 + -DCONNECT_WITH_MYSQL=1
382 + -DCONNECT_WITH_LIBXML2=$(usex xml)
383 + -DCONNECT_WITH_ODBC=$(usex odbc)
384 + -DCONNECT_WITH_JDBC=$(usex jdbc)
385 + # Build failure and autodep wrt bug 639144
386 + -DCONNECT_WITH_MONGO=OFF
387 + -DWITH_WSREP=$(usex galera)
388 + -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
389 + -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
390 + -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
391 + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
392 + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
393 + -DPLUGIN_AUTH_GSSAPI_CLIENT=NO
394 + -DWITH_MARIABACKUP=$(usex backup ON OFF)
395 + -DWITH_LIBARCHIVE=$(usex backup ON OFF)
396 + -DWITH_SYSTEMD=$(usex systemd yes no)
397 + -DWITH_NUMA=$(usex numa ON OFF)
398 + -DINSTALL_SQLBENCHDIR=''
399 + )
400 +
401 + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
402 + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
403 + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
404 + ewarn "You MUST file bugs without these variables set."
405 +
406 + mycmakeargs+=(
407 + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
408 + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
409 + )
410 +
411 + elif ! use latin1 ; then
412 + mycmakeargs+=(
413 + -DDEFAULT_CHARSET=utf8
414 + -DDEFAULT_COLLATION=utf8_general_ci
415 + )
416 + else
417 + mycmakeargs+=(
418 + -DDEFAULT_CHARSET=latin1
419 + -DDEFAULT_COLLATION=latin1_swedish_ci
420 + )
421 + fi
422 + mycmakeargs+=(
423 + -DEXTRA_CHARSETS=all
424 + -DMYSQL_USER=mysql
425 + -DDISABLE_SHARED=$(usex static YES NO)
426 + -DWITH_DEBUG=$(usex debug)
427 + -DWITH_EMBEDDED_SERVER=OFF
428 + -DENABLED_PROFILING=$(usex profiling)
429 + )
430 +
431 + if use static; then
432 + mycmakeargs+=( -DWITH_PIC=1 )
433 + fi
434 +
435 + if use jemalloc || use tcmalloc ; then
436 + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
437 + fi
438 +
439 + # Storage engines
440 + mycmakeargs+=(
441 + -DWITH_ARCHIVE_STORAGE_ENGINE=1
442 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1
443 + -DWITH_CSV_STORAGE_ENGINE=1
444 + -DWITH_HEAP_STORAGE_ENGINE=1
445 + -DWITH_INNOBASE_STORAGE_ENGINE=1
446 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1
447 + -DWITH_MYISAM_STORAGE_ENGINE=1
448 + -DWITH_PARTITION_STORAGE_ENGINE=1
449 + )
450 +
451 + else
452 + mycmakeargs+=(
453 + -DWITHOUT_SERVER=1
454 + -DWITH_EMBEDDED_SERVER=OFF
455 + -DEXTRA_CHARSETS=none
456 + -DINSTALL_SQLBENCHDIR=
457 + -DWITH_SYSTEMD=no
458 + )
459 + fi
460 +
461 + cmake-utils_src_configure
462 +}
463 +
464 +src_compile() {
465 + cmake-utils_src_compile
466 +}
467 +
468 +src_install() {
469 + cmake-utils_src_install
470 +
471 + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
472 + if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
473 + rm "${ED}/usr/include/mysql/server/private/config.h" || die
474 + fi
475 +
476 + # Make sure the vars are correctly initialized
477 + mysql_init_vars
478 +
479 + # Convenience links
480 + einfo "Making Convenience links for mysqlcheck multi-call binary"
481 + dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
482 + dosym "mysqlcheck" "/usr/bin/mysqlrepair"
483 + dosym "mysqlcheck" "/usr/bin/mysqloptimize"
484 +
485 + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
486 + if [[ -d "${ED}/usr/data" ]] ; then
487 + rm -Rf "${ED}/usr/data" || die
488 + fi
489 +
490 + # Unless they explicitly specific USE=test, then do not install the
491 + # testsuite. It DOES have a use to be installed, esp. when you want to do a
492 + # validation of your database configuration after tuning it.
493 + if ! use test ; then
494 + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
495 + fi
496 +
497 + # Configuration stuff
498 + einfo "Building default configuration ..."
499 + insinto "${MY_SYSCONFDIR#${EPREFIX}}"
500 + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
501 + local mycnf_src="my.cnf-5.6-r1"
502 + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
503 + "${FILESDIR}/${mycnf_src}" \
504 + > "${TMPDIR}/my.cnf.ok" || die
505 + use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
506 + if use latin1 ; then
507 + sed -i \
508 + -e "/character-set/s|utf8|latin1|g" \
509 + "${TMPDIR}/my.cnf.ok" || die
510 + fi
511 + eprefixify "${TMPDIR}/my.cnf.ok"
512 + newins "${TMPDIR}/my.cnf.ok" my.cnf
513 +
514 + if use server ; then
515 + einfo "Including support files and sample configurations"
516 + docinto "support-files"
517 + local script
518 + for script in \
519 + "${S}"/support-files/magic
520 + do
521 + [[ -f "$script" ]] && dodoc "${script}"
522 + done
523 +
524 + docinto "scripts"
525 + for script in "${S}"/scripts/mysql* ; do
526 + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
527 + done
528 + # Manually install supporting files that conflict with other packages
529 + # but are needed for galera and initial installation
530 + exeinto /usr/libexec/mariadb
531 + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
532 + fi
533 +
534 + #Remove mytop if perl is not selected
535 + [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
536 +}
537 +
538 +# Official test instructions:
539 +# USE='extraengine perl server' \
540 +# FEATURES='test userpriv -usersandbox' \
541 +# ebuild mariadb-X.X.XX.ebuild \
542 +# digest clean package
543 +src_test() {
544 +
545 + _disable_test() {
546 + local rawtestname reason
547 + rawtestname="${1}" ; shift
548 + reason="${@}"
549 + ewarn "test '${rawtestname}' disabled: '${reason}'"
550 + echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
551 + }
552 +
553 + local TESTDIR="${BUILD_DIR}/mysql-test"
554 + local retstatus_unit
555 + local retstatus_tests
556 +
557 + if ! use server ; then
558 + einfo "Skipping server tests due to minimal build."
559 + return 0
560 + fi
561 +
562 + # Bug #213475 - MySQL _will_ object strenously if your machine is named
563 + # localhost. Also causes weird failures.
564 + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
565 +
566 + if [[ $UID -eq 0 ]]; then
567 + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
568 + fi
569 + has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
570 +
571 + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
572 +
573 + # Run CTest (test-units)
574 +# cmake-utils_src_test
575 +# retstatus_unit=$?
576 +
577 + # Ensure that parallel runs don't die
578 + export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
579 + # Enable parallel testing, auto will try to detect number of cores
580 + # You may set this by hand.
581 + # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
582 + export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
583 +
584 + # create directories because mysqladmin might run out of order
585 + mkdir -p "${T}"/var-tests{,/log} || die
586 +
587 + # Run mysql tests
588 + pushd "${TESTDIR}" > /dev/null || die
589 +
590 + touch "${T}/disabled.def"
591 + # These are failing in MariaDB 10.0 for now and are believed to be
592 + # false positives:
593 + #
594 + # main.mysql_client_test, main.mysql_client_test_nonblock
595 + # main.mysql_client_test_comp:
596 + # segfaults at random under Portage only, suspect resource limits.
597 +
598 + local t
599 + for t in plugins.cracklib_password_check plugins.two_password_validations ; do
600 + _disable_test "$t" "False positive due to varying policies"
601 + done
602 +
603 + for t in main.mysql_client_test main.mysql_client_test_nonblock \
604 + rpl.rpl_semi_sync_uninstall_plugin \
605 + main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
606 + _disable_test "$t" "False positives in Gentoo"
607 + done
608 +
609 + if ! use client-libs ; then
610 + _disable_test main.plugin_auth "Needs client libraries built"
611 + fi
612 +
613 + _disable_test sys_vars.sysvars_server_notembedded "Broken test" # bug #661700 required profiling always on
614 +
615 + # run mysql-test tests
616 + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
617 + retstatus_tests=$?
618 +
619 + popd > /dev/null || die
620 +
621 + # Cleanup is important for these testcases.
622 + pkill -9 -f "${S}/ndb" 2>/dev/null
623 + pkill -9 -f "${S}/sql" 2>/dev/null
624 +
625 + local failures=""
626 + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
627 + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
628 +
629 + [[ -z "$failures" ]] || die "Test failures: $failures"
630 + einfo "Tests successfully completed"
631 +}
632 +
633 +mysql_init_vars() {
634 + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
635 + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
636 + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
637 + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
638 +
639 + if [[ -z "${MY_DATADIR}" ]] ; then
640 + MY_DATADIR=""
641 + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
642 + MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
643 + | sed -ne '/datadir/s|^--datadir=||p' \
644 + | tail -n1`
645 + if [[ -z "${MY_DATADIR}" ]] ; then
646 + MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
647 + | sed -e 's/.*=\s*//' \
648 + | tail -n1`
649 + fi
650 + fi
651 + if [[ -z "${MY_DATADIR}" ]] ; then
652 + MY_DATADIR="${MY_LOCALSTATEDIR}"
653 + einfo "Using default MY_DATADIR"
654 + fi
655 + elog "MySQL MY_DATADIR is ${MY_DATADIR}"
656 +
657 + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
658 + if [[ -e "${MY_DATADIR}" ]] ; then
659 + # If you get this and you're wondering about it, see bug #207636
660 + elog "MySQL datadir found in ${MY_DATADIR}"
661 + elog "A new one will not be created."
662 + PREVIOUS_DATADIR="yes"
663 + else
664 + PREVIOUS_DATADIR="no"
665 + fi
666 + export PREVIOUS_DATADIR
667 + fi
668 + else
669 + if [[ ${EBUILD_PHASE} == "config" ]]; then
670 + local new_MY_DATADIR
671 + new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
672 + | sed -ne '/datadir/s|^--datadir=||p' \
673 + | tail -n1`
674 +
675 + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
676 + ewarn "MySQL MY_DATADIR has changed"
677 + ewarn "from ${MY_DATADIR}"
678 + ewarn "to ${new_MY_DATADIR}"
679 + MY_DATADIR="${new_MY_DATADIR}"
680 + fi
681 + fi
682 + fi
683 +
684 + export MY_SHAREDSTATEDIR MY_SYSCONFDIR
685 + export MY_LOCALSTATEDIR MY_LOGDIR
686 + export MY_DATADIR
687 +}
688 +
689 +pkg_config() {
690 + _getoptval() {
691 + local mypd="${EROOT}"/usr/bin/my_print_defaults
692 + local section="$1"
693 + local flag="--${2}="
694 + local extra_options="${3}"
695 + "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
696 + }
697 + local old_MY_DATADIR="${MY_DATADIR}"
698 + local old_HOME="${HOME}"
699 + # my_print_defaults needs to read stuff in $HOME/.my.cnf
700 + export HOME=${EPREFIX}/root
701 +
702 + # Make sure the vars are correctly initialized
703 + mysql_init_vars
704 +
705 + [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
706 + if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
707 + die "Minimal builds do NOT include the MySQL server"
708 + fi
709 +
710 + if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
711 + local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
712 + MY_DATADIR_s="${MY_DATADIR_s%%/}"
713 + local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
714 + old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
715 +
716 + if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
717 + if [[ -d "${MY_DATADIR_s}" ]]; then
718 + ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
719 + ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
720 + else
721 + elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
722 + mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
723 + || die "Moving MY_DATADIR failed"
724 + fi
725 + else
726 + ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
727 + if [[ -d "${MY_DATADIR_s}" ]]; then
728 + ewarn "Attempting to use ${MY_DATADIR_s}"
729 + else
730 + eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
731 + die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
732 + fi
733 + fi
734 + fi
735 +
736 + local pwd1="a"
737 + local pwd2="b"
738 + local maxtry=15
739 +
740 + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
741 + local tmp_mysqld_password_source=
742 +
743 + for tmp_mysqld_password_source in mysql client; do
744 + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
745 + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
746 + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
747 + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
748 + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
749 + MYSQL_ROOT_PASSWORD=
750 + continue
751 + fi
752 +
753 + einfo "Found password in '${tmp_mysqld_password_source}' section!"
754 + break
755 + fi
756 + done
757 +
758 + # Sometimes --show is required to display passwords in some implementations of my_print_defaults
759 + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
760 + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
761 + fi
762 +
763 + unset tmp_mysqld_password_source
764 + fi
765 + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
766 + # These are dir+prefix
767 + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
768 + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
769 + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
770 + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
771 +
772 + if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
773 + einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
774 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
775 + fi
776 + if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
777 + einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
778 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
779 + fi
780 + if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
781 + einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
782 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
783 + fi
784 +
785 + if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
786 + ewarn "You have already a MySQL database in place."
787 + ewarn "(${ROOT}/${MY_DATADIR}/*)"
788 + ewarn "Please rename or delete it if you wish to replace it."
789 + die "MySQL database already exists!"
790 + fi
791 +
792 + # Bug #213475 - MySQL _will_ object strenously if your machine is named
793 + # localhost. Also causes weird failures.
794 + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
795 +
796 + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
797 +
798 + einfo "Please provide a password for the mysql 'root' user now"
799 + einfo "or through the ${HOME}/.my.cnf file."
800 + ewarn "Avoid [\"'\\_%] characters in the password"
801 + read -rsp " >" pwd1 ; echo
802 +
803 + einfo "Retype the password"
804 + read -rsp " >" pwd2 ; echo
805 +
806 + if [[ "x$pwd1" != "x$pwd2" ]] ; then
807 + die "Passwords are not the same"
808 + fi
809 + MYSQL_ROOT_PASSWORD="${pwd1}"
810 + unset pwd1 pwd2
811 + fi
812 +
813 + local options
814 + local sqltmp="$(emktemp)"
815 +
816 + # Fix bug 446200. Don't reference host my.cnf, needs to come first,
817 + # see https://bugs.mysql.com/bug.php?id=31312
818 + use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
819 +
820 + # Figure out which options we need to disable to do the setup
821 + local helpfile="${TMPDIR}/mysqld-help"
822 + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
823 + for opt in grant-tables host-cache name-resolve networking slave-start \
824 + federated ssl log-bin relay-log slow-query-log external-locking \
825 + log-slave-updates \
826 + ; do
827 + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
828 + egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
829 + done
830 +
831 + einfo "Creating the mysql database and setting proper permissions on it ..."
832 +
833 + # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
834 + PID_DIR="${EROOT}/var/run/mysqld"
835 + if [[ ! -d "${PID_DIR}" ]]; then
836 + install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
837 + fi
838 +
839 + if [[ ! -d "${MY_DATADIR}" ]]; then
840 + install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
841 + fi
842 +
843 + pushd "${TMPDIR}" &>/dev/null || die
844 +
845 + # Filling timezones, see
846 + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
847 + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
848 +
849 + local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
850 + [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
851 + cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
852 + einfo "Command: ${cmd[*]}"
853 + su -s /bin/sh -c "${cmd[*]}" mysql \
854 + >"${TMPDIR}"/mysql_install_db.log 2>&1
855 + if [ $? -ne 0 ]; then
856 + grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
857 + die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
858 + fi
859 + popd &>/dev/null || die
860 + [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
861 + || die "MySQL databases not installed"
862 +
863 + use prefix || options="${options} --user=mysql"
864 +
865 + local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
866 + local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
867 + local mysqld="${EROOT}/usr/sbin/mysqld \
868 + ${options} \
869 + --log-warnings=0 \
870 + --basedir=${EROOT}/usr \
871 + --datadir=${ROOT}/${MY_DATADIR} \
872 + --max_allowed_packet=8M \
873 + --net_buffer_length=16K \
874 + --socket=${socket} \
875 + --pid-file=${pidfile}
876 + --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
877 + #einfo "About to start mysqld: ${mysqld}"
878 + ebegin "Starting mysqld"
879 + einfo "Command ${mysqld}"
880 + ${mysqld} &
881 + rc=$?
882 + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
883 + maxtry=$((${maxtry}-1))
884 + echo -n "."
885 + sleep 1
886 + done
887 + eend $rc
888 +
889 + if ! [[ -S "${socket}" ]]; then
890 + die "Completely failed to start up mysqld with: ${mysqld}"
891 + fi
892 +
893 + ebegin "Setting root password"
894 + # Do this from memory, as we don't want clear text passwords in temp files
895 + local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
896 + "${EROOT}/usr/bin/mysql" \
897 + "--socket=${socket}" \
898 + -hlocalhost \
899 + -e "${sql}"
900 + eend $?
901 +
902 + if [[ -n "${sqltmp}" ]] ; then
903 + ebegin "Loading \"zoneinfo\", this step may require a few seconds"
904 + "${EROOT}/usr/bin/mysql" \
905 + "--socket=${socket}" \
906 + -hlocalhost \
907 + -uroot \
908 + --password="${MYSQL_ROOT_PASSWORD}" \
909 + mysql < "${sqltmp}"
910 + rc=$?
911 + eend $?
912 + [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
913 + fi
914 +
915 + # Stop the server and cleanup
916 + einfo "Stopping the server ..."
917 + kill $(< "${pidfile}" )
918 + rm -f "${sqltmp}"
919 + wait %1
920 + einfo "Done"
921 +}