Gentoo Archives: gentoo-commits

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