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