Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/percona-server/
Date: Wed, 28 Apr 2021 13:20:25
Message-Id: 1619615960.4d221e21a621e20074c87fe9e619c31db8cc2a7d.whissi@gentoo
1 commit: 4d221e21a621e20074c87fe9e619c31db8cc2a7d
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 28 12:20:30 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 28 13:19:20 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d221e21
7
8 dev-db/percona-server: drop old
9
10 Package-Manager: Portage-3.0.18, Repoman-3.0.3
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-db/percona-server/Manifest | 3 -
14 .../percona-server/percona-server-8.0.21.12.ebuild | 1219 --------------------
15 2 files changed, 1222 deletions(-)
16
17 diff --git a/dev-db/percona-server/Manifest b/dev-db/percona-server/Manifest
18 index ef3eea1e4ea..b7a91b5b885 100644
19 --- a/dev-db/percona-server/Manifest
20 +++ b/dev-db/percona-server/Manifest
21 @@ -1,6 +1,3 @@
22 -DIST boost_1_72_0.tar.bz2 106907358 BLAKE2B ab270a0e3cb24da687d86785e2d2e6d7731b4dbc07bd839eadb642dfa5a428ad584acb1f3529661a8de9a986008ff3427491041059ea2b742348d02e00761cd8 SHA512 63bbd1743e7c904b2e69fdc2eafd1c2a8a30fd70d960dcd366059d0100f000cb605d56cbd9397bb18421631f1c9552a772c434d0f0caddbe56302273f51fd1f6
23 DIST boost_1_73_0.tar.bz2 109247910 BLAKE2B 5995ff6ca21f45988b187b94bf743795cca97531baa8355f488be0987b9426289dd85d6ce25b7eb03ccd690109f05ba56252a95bca50505ad9cd66f4e0e234e8 SHA512 86c296511c0766145097625a62bf099c3d155284d250ad6e528e788bc90b2945838498dfe473c6c6c78d1694b6fba8e19f7dee0d064a043841e6231603fff668
24 -DIST percona-server-8.0.21-12.tar.gz 522004727 BLAKE2B bc6bf77d862a4827839d1942f58e4124f4692abfa9298eaa7cebdaaa7a6cff036247edda51d9cbb878b0e79858e54cbe5326bc30479b1d5977a655240df438fd SHA512 66076a6774cf18af1111b83aa8977a55e1a2d634c30e190d3bd8e82ba079fb772ac2a2402356be0b79677b54ca0b24c441d87444b68d1e66cd298ca6a0108d31
25 -DIST percona-server-8.0.21.12-patches-02.tar.xz 9276 BLAKE2B 97aa38dedcd1c09e88d2b17c462da8adbf1defbe1596abbc33eeca1ef1f14e3a2acddeca82da04e7c4d3a4c0dec70c53ee39d1011ba86c836492a2f8599a6732 SHA512 e7876088778a6190c0f0dbfbc44d5794c2d0903a2303bbb913fc1d4d7f462000108e33d3e764399c9fedbaa5b642004243316505f4a6f0566e1b250a9faded14
26 DIST percona-server-8.0.22-13.tar.gz 530806570 BLAKE2B 256e5afa2e3908617c41ffcab591ccdbfd932a8ba3ce25fbf2a0be2cdfa80991b0c2d090c11ffae64e4bb3d8cf9f3011b70974ab22cbab023f6625ac422f3c73 SHA512 9b7a1d06885eb4412361bb3920adc9f050f8da95584eb910c97c8877a433ead04d02f2908e5e9648b1d79cdba677727fdb745377feac3c958339588d5f0cdf2b
27 DIST percona-server-8.0.22.13-patches-01.tar.xz 9236 BLAKE2B d75d32782902d5d095389c8f79587b196e65508223503616d92304a2cb09520959adca04eac96fd4501cccf46ca684702b55c7a0327e6c3477b68245fe96e82b SHA512 e884d8bbd31f6df7f3a585feb970f82f78484a90404c40dc3e5daf46c3836a59c6bcef34fd8a3e9191a12820ba7ae441d53a7c010256dd0296e7eeb00313d6a0
28
29 diff --git a/dev-db/percona-server/percona-server-8.0.21.12.ebuild b/dev-db/percona-server/percona-server-8.0.21.12.ebuild
30 deleted file mode 100644
31 index ae1e6e9e3ea..00000000000
32 --- a/dev-db/percona-server/percona-server-8.0.21.12.ebuild
33 +++ /dev/null
34 @@ -1,1219 +0,0 @@
35 -# Copyright 1999-2021 Gentoo Authors
36 -# Distributed under the terms of the GNU General Public License v2
37 -
38 -EAPI="7"
39 -
40 -CMAKE_MAKEFILE_GENERATOR=emake
41 -
42 -inherit check-reqs cmake flag-o-matic linux-info \
43 - multiprocessing prefix toolchain-funcs
44 -
45 -MY_BOOST_VERSION="1.72.0"
46 -MY_PV=$(ver_rs 3 '-')
47 -MY_PV="${MY_PV//_pre*}"
48 -MY_PN="Percona-Server"
49 -MY_P="${PN}-${MY_PV}"
50 -MY_MAJOR_PV=$(ver_cut 1-2)
51 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/${MY_MAJOR_PV}/"
52 -
53 -# Patch version
54 -PATCH_SET="https://dev.gentoo.org/~whissi/dist/percona-server/${PN}-8.0.21.12-patches-02.tar.xz"
55 -
56 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz
57 - https://dl.bintray.com/boostorg/release/${MY_BOOST_VERSION}/source/boost_$(ver_rs 1- _ ${MY_BOOST_VERSION}).tar.bz2
58 - ${PATCH_SET}
59 -"
60 -
61 -HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server https://github.com/percona/percona-server"
62 -DESCRIPTION="Fully compatible, enhanced and open source drop-in replacement for MySQL"
63 -LICENSE="GPL-2"
64 -SLOT="8.0"
65 -IUSE="cjk cracklib debug jemalloc latin1 ldap libressl numa pam +perl profiling
66 - rocksdb router selinux +server tcmalloc test tokudb tokudb-backup-plugin"
67 -
68 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
69 -RESTRICT="!test? ( test ) libressl? ( test )"
70 -
71 -REQUIRED_USE="?? ( tcmalloc jemalloc )
72 - cjk? ( server )
73 - jemalloc? ( server )
74 - numa? ( server )
75 - profiling? ( server )
76 - router? ( server )
77 - tcmalloc? ( server )"
78 -
79 -KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-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 -# Be warned, *DEPEND are version-dependant
86 -# These are used for both runtime and compiletime
87 -COMMON_DEPEND="
88 - >=app-arch/lz4-0_p131:=
89 - app-arch/zstd:=
90 - sys-libs/ncurses:0=
91 - >=sys-libs/zlib-1.2.3:0=
92 - libressl? ( dev-libs/libressl:0= )
93 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
94 - server? (
95 - dev-libs/icu:=
96 - dev-libs/libevent:=[ssl]
97 - >=dev-libs/protobuf-3.8:=
98 - net-libs/libtirpc:=
99 - net-misc/curl:=
100 - cjk? ( app-text/mecab:= )
101 - ldap? (
102 - dev-libs/cyrus-sasl
103 - net-nds/openldap
104 - )
105 - jemalloc? ( dev-libs/jemalloc:0= )
106 - kernel_linux? (
107 - dev-libs/libaio:0=
108 - sys-process/procps:0=
109 - )
110 - numa? ( sys-process/numactl )
111 - pam? ( sys-libs/pam:0= )
112 - tcmalloc? ( dev-util/google-perftools:0= )
113 - )
114 -"
115 -DEPEND="${COMMON_DEPEND}
116 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
117 - virtual/yacc
118 - server? ( net-libs/rpcsvc-proto )
119 - test? (
120 - acct-group/mysql acct-user/mysql
121 - dev-perl/JSON
122 - )
123 -"
124 -RDEPEND="${COMMON_DEPEND}
125 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
126 - !dev-db/percona-server:0
127 - !dev-db/percona-server:5.7
128 - selinux? ( sec-policy/selinux-mysql )
129 - !prefix? (
130 - acct-group/mysql acct-user/mysql
131 - dev-db/mysql-init-scripts
132 - )
133 -"
134 -# For other stuff to bring us in
135 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
136 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
137 -
138 -mysql_init_vars() {
139 - : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
140 - : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
141 - : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
142 - : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
143 - MY_DATADIR="${MY_LOCALSTATEDIR}"
144 -
145 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
146 - export MY_LOCALSTATEDIR MY_LOGDIR
147 - export MY_DATADIR
148 -}
149 -
150 -pkg_pretend() {
151 - if [[ ${MERGE_TYPE} != binary ]] ; then
152 - if use server ; then
153 - CHECKREQS_DISK_BUILD="3G"
154 -
155 - if has test $FEATURES ; then
156 - CHECKREQS_DISK_BUILD="9G"
157 - fi
158 -
159 - check-reqs_pkg_pretend
160 - fi
161 - fi
162 -}
163 -
164 -pkg_setup() {
165 - if [[ ${MERGE_TYPE} != binary ]] ; then
166 - CHECKREQS_DISK_BUILD="3G"
167 -
168 - if has test ${FEATURES} ; then
169 - CHECKREQS_DISK_BUILD="9G"
170 -
171 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
172 - # localhost. Also causes weird failures.
173 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
174 -
175 - if ! has userpriv ${FEATURES} ; then
176 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
177 - fi
178 -
179 - local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null)
180 - [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] \
181 - && die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!"
182 -
183 - if use latin1 ; then
184 - # Upstream only supports tests with default charset
185 - die "Testing with USE=latin1 is not supported."
186 - fi
187 - fi
188 -
189 - if use kernel_linux ; then
190 - if use numa ; then
191 - linux-info_get_any_version
192 -
193 - local CONFIG_CHECK="~NUMA"
194 -
195 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
196 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
197 -
198 - check_extra_config
199 - fi
200 - fi
201 -
202 - use server && check-reqs_pkg_setup
203 - fi
204 -}
205 -
206 -src_unpack() {
207 - unpack ${A}
208 -
209 - mv -f "${WORKDIR}/${MY_P}" "${S}" || die
210 -}
211 -
212 -src_prepare() {
213 - eapply "${WORKDIR}"/mysql-patches
214 -
215 - # Avoid rpm call which would trigger sandbox, #692368
216 - sed -i \
217 - -e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \
218 - CMakeLists.txt || die
219 -
220 - if use jemalloc ; then
221 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
222 - fi
223 -
224 - if use tcmalloc ; then
225 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
226 - fi
227 -
228 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
229 - if [[ -d "${S}/support-files/SELinux" ]] ; then
230 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
231 - fi
232 -
233 - # Remove man pages for client-lib tools we don't install
234 - rm \
235 - man/my_print_defaults.1 \
236 - man/perror.1 \
237 - man/zlib_decompress.1 \
238 - || die
239 -
240 - cmake_src_prepare
241 -}
242 -
243 -src_configure() {
244 - # Bug #114895, bug #110149
245 - filter-flags "-O" "-O[01]"
246 -
247 - append-cxxflags -felide-constructors
248 -
249 - # bug #283926, with GCC4.4, this is required to get correct behavior.
250 - append-flags -fno-strict-aliasing
251 -
252 - CMAKE_BUILD_TYPE="RelWithDebInfo"
253 -
254 - # debug hack wrt #497532
255 - mycmakeargs=(
256 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
257 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
258 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
259 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
260 - -DINSTALL_BINDIR=bin
261 - -DINSTALL_DOCDIR=share/doc/${PF}
262 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
263 - -DINSTALL_INCLUDEDIR=include/mysql
264 - -DINSTALL_INFODIR=share/info
265 - -DINSTALL_LIBDIR=$(get_libdir)
266 - -DINSTALL_MANDIR=share/man
267 - -DINSTALL_MYSQLSHAREDIR=share/mysql
268 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
269 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
270 - -DINSTALL_SBINDIR=sbin
271 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
272 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
273 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
274 - # Using bundled editline to get CTRL+C working
275 - -DWITH_EDITLINE=bundled
276 - -DWITH_ZLIB=system
277 - -DWITH_SSL=system
278 - -DWITH_LIBWRAP=0
279 - -DENABLED_LOCAL_INFILE=1
280 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
281 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
282 - -DWITH_DEFAULT_FEATURE_SET=0
283 - # The build forces this to be defined when cross-compiling. We pass it
284 - # all the time for simplicity and to make sure it is actually correct.
285 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
286 - -DCMAKE_POSITION_INDEPENDENT_CODE=ON
287 - -DWITH_CURL=system
288 - -DWITH_BOOST="${WORKDIR}/boost_$(ver_rs 1- _ ${MY_BOOST_VERSION})"
289 - -DWITH_ROUTER=$(usex router ON OFF)
290 - )
291 -
292 - if is-flagq -fno-lto ; then
293 - einfo "LTO disabled via {C,CXX,F,FC}FLAGS"
294 - mycmakeargs+=( -DWITH_LTO=OFF )
295 - elif is-flagq -flto ; then
296 - einfo "LTO forced via {C,CXX,F,FC}FLAGS"
297 - myconf+=( -DWITH_LTO=ON )
298 - else
299 - # Disable automagic
300 - myconf+=( -DWITH_LTO=OFF )
301 - fi
302 -
303 - if use test ; then
304 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
305 - else
306 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
307 - fi
308 -
309 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
310 -
311 - mycmakeargs+=(
312 - -DWITH_ICU=system
313 - -DWITH_LZ4=system
314 - # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex
315 - -DWITH_RAPIDJSON=bundled
316 - -DWITH_ZSTD=system
317 - )
318 -
319 - if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then
320 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
321 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
322 - ewarn "You MUST file bugs without these variables set."
323 - ewarn "Tests will probably fail!"
324 -
325 - mycmakeargs+=(
326 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
327 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
328 - )
329 - elif use latin1 ; then
330 - mycmakeargs+=(
331 - -DDEFAULT_CHARSET=latin1
332 - -DDEFAULT_COLLATION=latin1_swedish_ci
333 - )
334 - else
335 - mycmakeargs+=(
336 - -DDEFAULT_CHARSET=utf8mb4
337 - -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci
338 - )
339 - fi
340 -
341 - if use server ; then
342 - mycmakeargs+=(
343 - -DWITH_AUTHENTICATION_LDAP=$(usex ldap system OFF)
344 - -DWITH_EXTRA_CHARSETS=all
345 - -DWITH_DEBUG=$(usex debug)
346 - -DWITH_MECAB=$(usex cjk system OFF)
347 - -DWITH_LIBEVENT=system
348 - -DWITH_PROTOBUF=system
349 - -DWITH_NUMA=$(usex numa ON OFF)
350 - -DWITH_PAM=$(usex pam)
351 - )
352 -
353 - if use profiling ; then
354 - # Setting to OFF doesn't work: Once set, profiling options will be added
355 - # to `mysqld --help` output via sql/sys_vars.cc causing
356 - # "main.mysqld--help-notwin" test to fail
357 - mycmakeargs+=( -DENABLED_PROFILING=ON )
358 - fi
359 -
360 - # Storage engines
361 - mycmakeargs+=(
362 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
363 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
364 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
365 - -DWITH_CSV_STORAGE_ENGINE=1
366 - -DWITH_FEDERATED_STORAGE_ENGINE=1
367 - -DWITH_HEAP_STORAGE_ENGINE=1
368 - -DWITH_INNOBASE_STORAGE_ENGINE=1
369 - -DWITH_INNODB_MEMCACHED=0
370 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
371 - -DWITH_MYISAM_STORAGE_ENGINE=1
372 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
373 - -DWITH_TOKUDB=$(usex tokudb 1 0)
374 - )
375 - else
376 - mycmakeargs+=(
377 - -DWITHOUT_SERVER=1
378 - -DWITH_SYSTEMD=no
379 - )
380 - fi
381 -
382 - cmake_src_configure
383 -}
384 -
385 -# Official test instructions:
386 -# ulimit -n 16500 && \
387 -# USE='perl server' \
388 -# FEATURES='test userpriv' \
389 -# ebuild mysql-X.X.XX.ebuild \
390 -# digest clean package
391 -src_test() {
392 - _disable_test() {
393 - local rawtestname bug reason
394 - rawtestname="${1}" ; shift
395 - bug="${1}" ; shift
396 - reason="${@}"
397 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
398 - echo ${rawtestname} : BUG#${bug} ${reason} >> "${T}/disabled.def"
399 - }
400 -
401 - local TESTDIR="${BUILD_DIR}/mysql-test"
402 - local retstatus_unit
403 - local retstatus_tests
404 -
405 - # Run CTest (test-units)
406 - cmake_src_test
407 - retstatus_unit=$?
408 -
409 - # Ensure that parallel runs don't die
410 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
411 -
412 - if [[ -z "${MTR_PARALLEL}" ]] ; then
413 - local -x MTR_PARALLEL=$(makeopts_jobs)
414 -
415 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
416 - # Running multiple tests in parallel usually require higher ulimit
417 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
418 - # are known to hit timeout when system is busy.
419 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
420 - # using "auto".
421 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
422 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
423 - einfo "${info_msg}"
424 - unset info_msg
425 - MTR_PARALLEL=4
426 - fi
427 - else
428 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
429 - fi
430 -
431 - # create directories because mysqladmin might run out of order
432 - mkdir -p "${T}"/var-tests{,/log} || die
433 -
434 - # Run mysql tests
435 - pushd "${TESTDIR}" &>/dev/null || die
436 -
437 - touch "${T}/disabled.def"
438 -
439 - local -a disabled_tests
440 - disabled_tests+=( "auth_sec.keyring_file_data_qa;0;Won't work with user privileges" )
441 - disabled_tests+=( "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" )
442 - disabled_tests+=( "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" )
443 - disabled_tests+=( "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" )
444 - disabled_tests+=( "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" )
445 - disabled_tests+=( "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" )
446 - disabled_tests+=( "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" )
447 - disabled_tests+=( "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" )
448 - disabled_tests+=( "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" )
449 - disabled_tests+=( "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" )
450 - disabled_tests+=( "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" )
451 - disabled_tests+=( "group_replication.gr_ssl_options2;0;Sporadic failing test" )
452 - disabled_tests+=( "innodb.percona_changed_page_bmp_flush;6807;False positive on Gentoo (PS)" )
453 - disabled_tests+=( "innodb.percona_changed_page_bmp_log_resize;0;Sporadic failing test" )
454 - disabled_tests+=( "innodb.percona_log_encrypt_failure;0;Requires proper keyring setup" )
455 - disabled_tests+=( "innodb.percona_log_encrypt_change_mk;6039;False positive on Gentoo (PS)" )
456 - disabled_tests+=( "innodb.percona_log_encrypt_change_rk;6805;False positive on Gentoo (PS)" )
457 - disabled_tests+=( "innodb.upgrade_orphan;0;Sporadic failing test" )
458 - disabled_tests+=( "main.myisam-blob;0;Sporadic failing test" )
459 - disabled_tests+=( "main.mysql_load_data_local_dir;7416;Known test failure" )
460 - disabled_tests+=( "main.mysqlpump_basic_lz4;6042;Extra tool output causes false positive" )
461 - disabled_tests+=( "main.ssl_bug75311;5996;Known test failure" )
462 - disabled_tests+=( "main.ssl_san;6808;False positive on IPv6-enabled hosts" )
463 - disabled_tests+=( "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
464 - disabled_tests+=( "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
465 - disabled_tests+=( "main.with_recursive;6804;Known rounding error with latest AMD processors" )
466 - disabled_tests+=( "rpl_gtid.rpl_gtid_stm_drop_table;90612;Known test failure" )
467 - disabled_tests+=( "rpl_gtid.rpl_multi_source_mtr_includes;0;Know failure - no upstream bug yet" )
468 - disabled_tests+=( "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware" )
469 - disabled_tests+=( "sys_vars.innodb_sys_tablespace_encrypt_basic;7415;Known test failure" )
470 - disabled_tests+=( "x.message_compressed_payload;0;False positive caused by protobuff-3.11+" )
471 - disabled_tests+=( "x.message_protobuf_nested;6803;False positive caused by protobuff-3.11+" )
472 -
473 - # Known test failures due to expired SSL certificates -- fixed in 8.0.22
474 - disabled_tests+=( "auth_sec.admin_ssl_crl_crlpath;100055;Fixed in 8.0.22" )
475 - disabled_tests+=( "auth_sec.admin_ssl_crl;100055;Fixed in 8.0.22" )
476 - disabled_tests+=( "auth_sec.server_withssl_client_withssl;100055;Fixed in 8.0.22" )
477 - disabled_tests+=( "main.ssl_crl_clients_valid;100055;Fixed in 8.0.22" )
478 - disabled_tests+=( "main.ssl_crl;100055;Fixed in 8.0.22" )
479 - disabled_tests+=( "main.ssl_crl_crlpath;100055;Fixed in 8.0.22" )
480 - disabled_tests+=( "main.ssl_ca;100055;Fixed in 8.0.22" )
481 -
482 - if ! hash zip 1>/dev/null 2>&1 ; then
483 - # no need to force dep app-arch/zip for one test
484 - disabled_tests+=( "innodb.discarded_partition_create;0;Requires app-arch/zip" )
485 - disabled_tests+=( "innodb.partition_upgrade_create;0;Requires app-arch/zip" )
486 - fi
487 -
488 - local test_ds
489 - for test_infos_str in "${disabled_tests[@]}" ; do
490 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
491 -
492 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
493 - die "Invalid test data set, not matching format: ${test_infos_str}"
494 - fi
495 -
496 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
497 - done
498 - unset test_ds test_infos_str test_infos_arr
499 -
500 - if [[ -z "${MTR_VAULT_TOKEN}" ]] ; then
501 - local impossible_test
502 - for impossible_test in \
503 - encryption.default_table_encryption_var \
504 - keyring_vault.innodb_online_alter_encryption \
505 - keyring_vault.innodb_row_log_encryption \
506 - keyring_vault.install_keyring_vault \
507 - keyring_vault.keyring_udf \
508 - keyring_vault.keyring_vault_config \
509 - keyring_vault.keyring_vault_config_qa \
510 - keyring_vault.keyring_vault_timeout \
511 - keyring_vault.key_rotation_qa \
512 - keyring_vault.rpl_key_rotation \
513 - keyring_vault.table_encrypt_2 \
514 - keyring_vault.table_encrypt_2_directory \
515 - keyring_vault.table_encrypt_2_keyring \
516 - keyring_vault.table_encrypt_5 \
517 - keyring_vault.table_encrypt_5_directory \
518 - keyring_vault.table_encrypt_kill \
519 - keyring_vault.temp_table_encrypt_keyring_vault \
520 - main.persisted_variables \
521 - ; do
522 - _disable_test "${impossible_test}" "0" "MTR_VAULT_TOKEN is not set"
523 - done
524 - fi
525 -
526 - # Try to increase file limits to increase test coverage
527 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
528 - # Upper limit comes from parts.partition_* tests
529 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
530 -
531 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
532 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
533 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
534 -
535 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
536 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
537 - else
538 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
539 - fi
540 - else
541 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
542 - fi
543 - else
544 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
545 - fi
546 -
547 - # run mysql-test tests
548 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
549 - retstatus_tests=$?
550 -
551 - popd &>/dev/null || die
552 -
553 - # Cleanup is important for these testcases.
554 - pkill -9 -f "${S}/ndb" 2>/dev/null
555 - pkill -9 -f "${S}/sql" 2>/dev/null
556 -
557 - local failures=""
558 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
559 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
560 -
561 - [[ -z "$failures" ]] || die "Test failures: $failures"
562 - einfo "Tests successfully completed"
563 -}
564 -
565 -src_install() {
566 - cmake_src_install
567 -
568 - # Make sure the vars are correctly initialized
569 - mysql_init_vars
570 -
571 - # Convenience links
572 - einfo "Making Convenience links for mysqlcheck multi-call binary"
573 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
574 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
575 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
576 -
577 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
578 - if [[ -d "${ED}/usr/data" ]] ; then
579 - rm -Rf "${ED}/usr/data" || die
580 - fi
581 -
582 - # Unless they explicitly specific USE=test, then do not install the
583 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
584 - # validation of your database configuration after tuning it.
585 - if ! use test ; then
586 - rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test"
587 - fi
588 -
589 - # Configuration stuff
590 - einfo "Building default configuration ..."
591 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
592 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
593 - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
594 - eprefixify "${TMPDIR}/my.cnf"
595 - doins "${TMPDIR}/my.cnf"
596 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
597 - cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
598 - eprefixify "${TMPDIR}/50-distro-client.cnf"
599 - doins "${TMPDIR}/50-distro-client.cnf"
600 -
601 - mycnf_src="my.cnf-8.0.distro-server"
602 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
603 - "${FILESDIR}/${mycnf_src}" \
604 - > "${TMPDIR}/my.cnf.ok" || die
605 -
606 - if use prefix ; then
607 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
608 - "${TMPDIR}/my.cnf.ok" || die
609 - fi
610 -
611 - if use latin1 ; then
612 - sed -i \
613 - -e "/character-set/s|utf8mb4|latin1|g" \
614 - "${TMPDIR}/my.cnf.ok" || die
615 - fi
616 -
617 - eprefixify "${TMPDIR}/my.cnf.ok"
618 -
619 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
620 -
621 - #Remove mytop if perl is not selected
622 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
623 -
624 - if use router ; then
625 - rm -rf \
626 - "${ED}/usr/LICENSE.router" \
627 - "${ED}/usr/README.router" \
628 - "${ED}/usr/run" \
629 - "${ED}/usr/var" \
630 - || die
631 - fi
632 -
633 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
634 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
635 -}
636 -
637 -pkg_postinst() {
638 - # Make sure the vars are correctly initialized
639 - mysql_init_vars
640 -
641 - # Create log directory securely if it does not exist
642 - # NOTE: $MY_LOGDIR contains $EPREFIX by default
643 - [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}"
644 -
645 - # Note about configuration change
646 - einfo
647 - elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
648 - elog "to several files in /etc/mysql/mysql.d."
649 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
650 - elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
651 - elog "You may have as many files as needed and they are read alphabetically."
652 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
653 - einfo
654 -
655 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
656 - einfo
657 - elog "You might want to run:"
658 - elog " \"emerge --config =${CATEGORY}/${PF}\""
659 - elog "if this is a new install."
660 - einfo
661 - else
662 - einfo
663 - elog "Upgrade process for ${PN}-8.x has changed. Please read"
664 - elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html"
665 - einfo
666 - fi
667 -}
668 -
669 -pkg_config() {
670 - _getoptval() {
671 - local section="$1"
672 - local flag="--${2}="
673 - local extra_options="${3}"
674 - local cmd=(
675 - "${my_print_defaults_binary}"
676 - "${extra_options}"
677 - "${section}"
678 - )
679 - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
680 -
681 - if [[ ${#results[@]} -gt 0 ]] ; then
682 - # When option is set multiple times only return last value
683 - echo "${results[-1]}"
684 - fi
685 - }
686 -
687 - _mktemp_dry() {
688 - # emktemp has no --dry-run option
689 - local template="${1}"
690 -
691 - if [[ -z "${template}" ]] ; then
692 - if [[ -z "${T}" ]] ; then
693 - template="/tmp/XXXXXXX"
694 - else
695 - template="${T}/XXXXXXX"
696 - fi
697 - fi
698 -
699 - local template_wo_X=${template//X/}
700 - local n_X
701 - let n_X=${#template}-${#template_wo_X}
702 - if [[ ${n_X} -lt 3 ]] ; then
703 - echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
704 - return
705 - fi
706 -
707 - local attempts=0
708 - local character tmpfile
709 - while [[ true ]] ; do
710 - let attempts=attempts+1
711 -
712 - new_file=
713 - while read -n1 character ; do
714 - if [[ "${character}" == "X" ]] ; then
715 - tmpfile+="${RANDOM:0:1}"
716 - else
717 - tmpfile+="${character}"
718 - fi
719 - done < <(echo -n "${template}")
720 -
721 - if [[ ! -f "${tmpfile}" ]]
722 - then
723 - echo "${tmpfile}"
724 - return
725 - fi
726 -
727 - if [[ ${attempts} -ge 100 ]] ; then
728 - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
729 - return
730 - fi
731 - done
732 - }
733 -
734 - local mysqld_binary="${EROOT}/usr/sbin/mysqld"
735 - if [[ ! -x "${mysqld_binary}" ]] ; then
736 - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
737 - fi
738 -
739 - local mysql_binary="${EROOT}/usr/bin/mysql"
740 - if [[ ! -x "${mysql_binary}" ]] ; then
741 - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
742 - fi
743 -
744 - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
745 - if [[ ! -x "${my_print_defaults_binary}" ]] ; then
746 - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
747 - fi
748 -
749 - if [[ -z "${MYSQL_USER}" ]] ; then
750 - MYSQL_USER=mysql
751 - if use prefix ; then
752 - MYSQL_USER=$(id -u -n 2>/dev/null)
753 - if [[ -z "${MYSQL_USER}" ]] ; then
754 - die "Failed to determine current username!"
755 - fi
756 - fi
757 - fi
758 -
759 - if [[ -z "${MYSQL_GROUP}" ]] ; then
760 - MYSQL_GROUP=mysql
761 - if use prefix ; then
762 - MYSQL_GROUP=$(id -g -n 2>/dev/null)
763 - if [[ -z "${MYSQL_GROUP}" ]] ; then
764 - die "Failed to determine current user groupname!"
765 - fi
766 - fi
767 - fi
768 -
769 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
770 - local -x HOME="${EROOT}/root"
771 -
772 - # Make sure the vars are correctly initialized
773 - mysql_init_vars
774 -
775 - # Read currently set data directory
776 - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
777 -
778 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
779 - # localhost. Also causes weird failures.
780 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
781 -
782 - if [[ -z "${MY_DATADIR}" ]] ; then
783 - die "Sorry, unable to find MY_DATADIR!"
784 - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
785 - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
786 - ewarn "Please rename or delete its content if you wish to initialize a new data directory."
787 - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
788 - fi
789 -
790 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
791 - MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
792 - # These are dir+prefix
793 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
794 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
795 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
796 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
797 -
798 - # Create missing directories.
799 - # Always check if mysql user can write to directory even if we just
800 - # created directory because a parent directory might be not
801 - # accessible for that user.
802 - PID_DIR="${EROOT}/run/mysqld"
803 - if [[ ! -d "${PID_DIR}" ]] ; then
804 - einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
805 - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
806 - || die "Failed to create PID directory '${PID_DIR}'!"
807 - fi
808 -
809 - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
810 - [[ -z "${_pid_dir_testfile}" ]] \
811 - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
812 -
813 - if use prefix ; then
814 - touch "${_pid_dir_testfile}" &>/dev/null
815 - else
816 - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
817 - fi
818 -
819 - if [[ $? -ne 0 ]] ; then
820 - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
821 - else
822 - rm "${_pid_dir_testfile}" || die
823 - unset _pid_dir_testfile
824 - fi
825 -
826 - if [[ ! -d "${MY_DATADIR}" ]] ; then
827 - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
828 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
829 - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
830 - fi
831 -
832 - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
833 - [[ -z "${_my_datadir_testfile}" ]] \
834 - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
835 -
836 - if use prefix ; then
837 - touch "${_my_datadir_testfile}" &>/dev/null
838 - else
839 - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
840 - fi
841 -
842 - if [[ $? -ne 0 ]] ; then
843 - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
844 - else
845 - rm "${_my_datadir_testfile}" || die
846 - unset _my_datadir_testfile
847 - fi
848 -
849 - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
850 - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
851 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
852 - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
853 - fi
854 -
855 - if [[ -z "${MYSQL_TMPDIR}" ]] ; then
856 - MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
857 - [[ -z "${MYSQL_TMPDIR}" ]] \
858 - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
859 -
860 - mkdir "${MYSQL_TMPDIR}" || die
861 - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
862 - fi
863 -
864 - # Now we need to test MYSQL_TMPDIR...
865 - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
866 - [[ -z "${_my_tmpdir_testfile}" ]] \
867 - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
868 -
869 - if use prefix ; then
870 - touch "${_my_tmpdir_testfile}" &>/dev/null
871 - else
872 - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
873 - fi
874 -
875 - if [[ $? -ne 0 ]] ; then
876 - die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
877 - else
878 - rm "${_my_tmpdir_testfile}" || die
879 - unset _my_tmpdir_testfile
880 - fi
881 -
882 - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
883 - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
884 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
885 - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
886 - fi
887 -
888 - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then
889 - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
890 - [[ -z "${_my_logbin_testfile}" ]] \
891 - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
892 -
893 - if use prefix ; then
894 - touch "${_my_logbin_testfile}" &>/dev/null
895 - else
896 - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
897 - fi
898 -
899 - if [[ $? -ne 0 ]] ; then
900 - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
901 - else
902 - rm "${_my_logbin_testfile}" || die
903 - unset _my_logbin_testfile
904 - fi
905 - fi
906 -
907 - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
908 - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
909 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
910 - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
911 - fi
912 -
913 - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
914 - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
915 - [[ -z "${_my_relaylog_testfile}" ]] \
916 - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
917 -
918 - if use prefix ; then
919 - touch "${_my_relaylog_testfile}" &>/dev/null
920 - else
921 - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
922 - fi
923 -
924 - if [[ $? -ne 0 ]] ; then
925 - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
926 - else
927 - rm "${_my_relaylog_testfile}" || die
928 - unset _my_relaylog_testfile
929 - fi
930 - fi
931 -
932 - local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")"
933 - if [[ -z "${mysql_install_log}" ]] ; then
934 - die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!"
935 - else
936 - # make sure file is writable for MYSQL_USER...
937 - touch "${mysql_install_log}" || die
938 - chown ${MYSQL_USER} "${mysql_install_log}" || die
939 - fi
940 -
941 - local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")"
942 - if [[ -z "${mysqld_logfile}" ]] ; then
943 - die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!"
944 - else
945 - # make sure file is writable for MYSQL_USER...
946 - touch "${mysqld_logfile}" || die
947 - chown ${MYSQL_USER} "${mysqld_logfile}" || die
948 - fi
949 -
950 - echo ""
951 - einfo "Detected settings:"
952 - einfo "=================="
953 - einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
954 - einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
955 - einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
956 - einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
957 -
958 - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then
959 - einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
960 - fi
961 -
962 - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
963 - einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
964 - fi
965 -
966 - einfo "PID DIR:\t\t\t\t${PID_DIR}"
967 - einfo "Install db log:\t\t\t${mysql_install_log}"
968 - einfo "Install server log:\t\t\t${mysqld_logfile}"
969 -
970 - local -a config_files
971 -
972 - local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf"
973 - if [[ -f "${config_file}" ]] ; then
974 - config_files+=( "${config_file}" )
975 - else
976 - ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..."
977 - fi
978 -
979 - config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf"
980 - if [[ -f "${config_file}" ]] ; then
981 - config_files+=( "${config_file}" )
982 - else
983 - ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..."
984 - fi
985 -
986 - if [[ ${#config_files[@]} -gt 0 ]] ; then
987 - if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then
988 - local user_answer
989 -
990 - echo
991 - einfo "Please select default authentication plugin (enter number or plugin name):"
992 - einfo "1) caching_sha2_password [MySQL 8.0 default]"
993 - einfo "2) mysql_native_password [MySQL 5.7 default]"
994 - einfo
995 - einfo "For details see:"
996 - einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password"
997 - read -p " >" user_answer
998 - echo
999 -
1000 - case "${user_answer}" in
1001 - 1|caching_sha2_password)
1002 - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password
1003 - ;;
1004 - 2|mysql_native_password)
1005 - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password
1006 - ;;
1007 - '')
1008 - die "No authentication plugin selected!"
1009 - ;;
1010 - *)
1011 - die "Authentication plugin '${user_answer}' is unknown/unsupported!"
1012 - ;;
1013 - esac
1014 -
1015 - echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}"
1016 -
1017 - unset user_answer
1018 - fi
1019 -
1020 - local cfg_option cfg_option_tabs cfg_section
1021 - for config_file in "${config_files[@]}" ; do
1022 - cfg_option="default-authentication-plugin"
1023 - cfg_section="mysqld"
1024 - cfg_option_tabs="\t\t"
1025 - if [[ "${config_file}" == *client.cnf ]] ; then
1026 - cfg_option="default-auth"
1027 - cfg_section="client"
1028 - cfg_option_tabs="\t\t\t\t"
1029 - fi
1030 -
1031 - if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then
1032 - einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
1033 - sed -i \
1034 - -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \
1035 - "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!"
1036 - else
1037 - einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
1038 - sed -i \
1039 - -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \
1040 - "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!"
1041 - fi
1042 - done
1043 - unset cfg_option cfg_option_tabs cfg_section
1044 - fi
1045 - unset config_files config_file
1046 -
1047 - echo
1048 -
1049 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
1050 - local tmp_mysqld_password_source=
1051 -
1052 - for tmp_mysqld_password_source in mysql client ; do
1053 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1054 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
1055 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
1056 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
1057 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1058 - MYSQL_ROOT_PASSWORD=
1059 - continue
1060 - fi
1061 -
1062 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1063 - break
1064 - fi
1065 - done
1066 -
1067 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1068 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
1069 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
1070 - fi
1071 -
1072 - unset tmp_mysqld_password_source
1073 - fi
1074 -
1075 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
1076 - local pwd1="a"
1077 - local pwd2="b"
1078 -
1079 - echo
1080 - einfo "No password for mysql 'root' user was specified via environment"
1081 - einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
1082 - einfo "file like '${HOME}/.my.cnf'."
1083 - einfo "To continue please provide a password for the mysql 'root' user"
1084 - einfo "now on console:"
1085 - ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
1086 - read -rsp " >" pwd1 ; echo
1087 -
1088 - einfo "Retype the password"
1089 - read -rsp " >" pwd2 ; echo
1090 -
1091 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1092 - die "Passwords are not the same!"
1093 - fi
1094 -
1095 - MYSQL_ROOT_PASSWORD="${pwd1}"
1096 - unset pwd1 pwd2
1097 -
1098 - echo
1099 - fi
1100 -
1101 - local -a mysqld_options
1102 -
1103 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1104 - # see http://bugs.mysql.com/bug.php?id=31312
1105 - use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
1106 -
1107 - # Figure out which options we need to disable to do the setup
1108 - local helpfile="${TMPDIR}/mysqld-help"
1109 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
1110 -
1111 - local opt optexp optfull
1112 - for opt in host-cache name-resolve networking slave-start \
1113 - federated ssl log-bin relay-log slow-query-log external-locking \
1114 - log-slave-updates \
1115 - ; do
1116 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1117 - egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
1118 - done
1119 -
1120 - # Prepare timezones, see
1121 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
1122 - local tz_sql="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")"
1123 - [[ -z "${tz_sql}" ]] \
1124 - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!"
1125 -
1126 - echo "USE mysql;" >"${tz_sql}"
1127 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
1128 - if [[ $? -ne 0 ]] ; then
1129 - die "mysql_tzinfo_to_sql failed!"
1130 - fi
1131 -
1132 - # --initialize-insecure will not set root password
1133 - # --initialize would set a random one in the log which we don't need as we set it ourselves
1134 - local cmd=(
1135 - "${mysqld_binary}"
1136 - "${mysqld_options[@]}"
1137 - "--initialize-insecure"
1138 - "--init-file='${tz_sql}'"
1139 - "--basedir='${EROOT}/usr'"
1140 - "--datadir='${MY_DATADIR}'"
1141 - "--tmpdir='${MYSQL_TMPDIR}'"
1142 - "--log-error='${mysql_install_log}'"
1143 - "--user=${MYSQL_USER}"
1144 - )
1145 -
1146 - einfo "Initializing ${PN} data directory: ${cmd[@]}"
1147 - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
1148 -
1149 - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then
1150 - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
1151 - die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
1152 - fi
1153 -
1154 - rm "${tz_sql}" || die
1155 -
1156 - local x=${RANDOM}
1157 - local socket="${EROOT}${PID_DIR}/mysqld${x}.sock"
1158 - local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid"
1159 - unset x
1160 -
1161 - cmd=(
1162 - "${mysqld_binary}"
1163 - "${mysqld_options[@]}"
1164 - "--basedir='${EROOT}/usr'"
1165 - "--datadir='${MY_DATADIR}'"
1166 - "--tmpdir='${MYSQL_TMPDIR}'"
1167 - --max_allowed_packet=8M
1168 - --net_buffer_length=16K
1169 - "--socket='${socket}'"
1170 - "--pid-file='${pidfile}'"
1171 - "--log-error='${mysqld_logfile}'"
1172 - "--user=${MYSQL_USER}"
1173 - )
1174 -
1175 - einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
1176 - eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
1177 -
1178 - echo -n "Waiting for mysqld to accept connections "
1179 - local maxtry=15
1180 - while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
1181 - maxtry=$((${maxtry}-1))
1182 - echo -n "."
1183 - sleep 1
1184 - done
1185 -
1186 - if [[ -S "${socket}" ]] ; then
1187 - # Even with a socket we don't know if mysqld will abort
1188 - # start due to an error so just wait a little bit more...
1189 - maxtry=5
1190 - while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
1191 - maxtry=$((${maxtry}-1))
1192 - echo -n "."
1193 - sleep 1
1194 - done
1195 - fi
1196 -
1197 - echo
1198 -
1199 - if [[ ! -S "${socket}" ]] ; then
1200 - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
1201 - die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
1202 - fi
1203 -
1204 - local mysql_logfile="${TMPDIR}/set_root_pw.log"
1205 - touch "${mysql_logfile}" || die
1206 -
1207 - ebegin "Setting root password"
1208 - # Do this from memory, as we don't want clear text passwords in temp files
1209 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
1210 - cmd=(
1211 - "${mysql_binary}"
1212 - --no-defaults
1213 - "--socket='${socket}'"
1214 - -hlocalhost
1215 - "-e \"${sql}\""
1216 - )
1217 - eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
1218 - local rc=$?
1219 - eend ${rc}
1220 -
1221 - if [[ ${rc} -ne 0 ]] ; then
1222 - # Poor man's solution which tries to avoid having password
1223 - # in log. NOTE: sed can fail if user didn't follow advice
1224 - # and included character which will require escaping...
1225 - sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
1226 -
1227 - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
1228 - die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
1229 - fi
1230 -
1231 - # Stop the server
1232 - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
1233 - echo -n "Stopping the server "
1234 - pkill -F "${pidfile}" &>/dev/null
1235 -
1236 - maxtry=10
1237 - while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
1238 - maxtry=$((${maxtry}-1))
1239 - echo -n "."
1240 - sleep 1
1241 - done
1242 -
1243 - echo
1244 -
1245 - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
1246 - # We somehow failed to stop server.
1247 - # However, not a fatal error. Just warn the user.
1248 - ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
1249 - fi
1250 - fi
1251 -
1252 - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
1253 -}