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