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