Diff mysql-5.7.41 with a mysql-8.0.27-r1

/usr/portage/dev-db/mysql/mysql-8.0.27-r1.ebuild 2024-12-25 14:59:47.791270057 +0300
1 1
# Copyright 1999-2024 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI="7"
4
EAPI="8"
5 5

  
6 6
CMAKE_MAKEFILE_GENERATOR=emake
7 7

  
8 8
inherit check-reqs cmake flag-o-matic linux-info \
9
	multiprocessing prefix toolchain-funcs multilib-minimal
9
	multiprocessing prefix toolchain-funcs
10

  
11
MY_PV="${PV//_pre*}"
12
MY_P="${PN}-${MY_PV}"
10 13

  
11 14
# Patch version
12
PATCH_SET="mirror://gentoo/51/${PN}-5.7.36-patches-01.tar.xz"
15
PATCH_SET=( https://dev.gentoo.org/~{whissi,dlan}/dist/mysql/${P}-patches-03.tar.xz )
13 16

  
14
SRC_URI="https://cdn.mysql.com/Downloads/MySQL-$(ver_cut 1-2)/${PN}-boost-${PV}.tar.gz
15
	https://cdn.mysql.com/archives/mysql-$(ver_cut 1-2)/mysql-boost-${PV}.tar.gz
16
	http://downloads.mysql.com/archives/MySQL-$(ver_cut 1-2)/${PN}-boost-${PV}.tar.gz
17
	${PATCH_SET}"
17
SRC_URI="https://cdn.mysql.com/Downloads/MySQL-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz
18
	https://cdn.mysql.com/archives/mysql-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz
19
	http://downloads.mysql.com/archives/MySQL-$(ver_cut 1-2)/${PN}-boost-${MY_PV}.tar.gz
20
	${PATCH_SET[@]}"
18 21

  
19 22
HOMEPAGE="https://www.mysql.com/"
20 23
DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
21 24
LICENSE="GPL-2"
22
SLOT="5.7/18"
23
IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 numa +perl profiling
24
	selinux +server static static-libs systemtap tcmalloc test"
25
SLOT="8.0"
26
IUSE="cjk cracklib debug jemalloc latin1 numa +perl profiling
27
	router selinux +server tcmalloc test"
25 28

  
26 29
RESTRICT="!test? ( test )"
27 30

  
28
REQUIRED_USE="?? ( tcmalloc jemalloc )"
31
REQUIRED_USE="?? ( tcmalloc jemalloc )
32
	cjk? ( server )
33
	jemalloc? ( server )
34
	numa? ( server )
35
	profiling? ( server )
36
	router? ( server )
37
	tcmalloc? ( server )"
29 38

  
30
KEYWORDS="amd64 arm arm64 ~hppa ~mips ~ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
39
# -ppc, -riscv for bug #761715
40
KEYWORDS="amd64 arm arm64 ~hppa ~mips -ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
31 41

  
32 42
# Shorten the path because the socket path length must be shorter than 107 chars
33 43
# and we will run a mysql server during test phase
......
35 45

  
36 46
# Be warned, *DEPEND are version-dependant
37 47
# These are used for both runtime and compiletime
38
# MULTILIB_USEDEP only set for libraries used by the client library
39 48
COMMON_DEPEND="
49
	>=app-arch/lz4-0_p131:=
50
	app-arch/zstd:=
40 51
	sys-libs/ncurses:0=
41
	client-libs? (
42
		>=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?]
43
		>=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?]
44
	)
45
	!client-libs? (
46
		dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?]
47
		>=sys-libs/zlib-1.2.3:0=
48
		>=dev-libs/openssl-1.0.0:0=
49
	)
52
	>=sys-libs/zlib-1.2.3:0=
53
	>=dev-libs/openssl-1.0.0:0=
50 54
	server? (
51
		>=app-arch/lz4-0_p131:=
52
		virtual/libcrypt:=
55
		dev-libs/icu:=
56
		dev-libs/libevent:=[ssl,threads(+)]
57
		>=dev-libs/protobuf-3.8:=
58
		net-libs/libtirpc:=
53 59
		cjk? ( app-text/mecab:= )
54
		experimental? (
55
			dev-libs/libevent:=[ssl]
56
			dev-libs/protobuf:=
57
			net-libs/libtirpc:=
58
		)
59 60
		jemalloc? ( dev-libs/jemalloc:0= )
60 61
		kernel_linux? (
61 62
			dev-libs/libaio:0=
62 63
			sys-process/procps:0=
63 64
		)
64 65
		numa? ( sys-process/numactl )
66
		tcmalloc? ( dev-util/google-perftools:0= )
65 67
	)
66
	systemtap? ( >=dev-debug/systemtap-1.3:0= )
67
	tcmalloc? ( dev-util/google-perftools:0= )
68 68
"
69 69

  
70 70
DEPEND="
71 71
	${COMMON_DEPEND}
72 72
	|| ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
73
	dev-libs/protobuf
74 73
	app-alternatives/yacc
75
	server? (
76
		dev-libs/libevent:=[ssl]
77
		experimental? ( net-libs/rpcsvc-proto )
78
	)
79
	static? ( sys-libs/ncurses[static-libs] )
74
	server? ( net-libs/rpcsvc-proto )
80 75
	test? (
81 76
		acct-group/mysql acct-user/mysql
82 77
		dev-perl/JSON
......
87 82
	${COMMON_DEPEND}
88 83
	!dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
89 84
	!dev-db/mysql:0
90
	!dev-db/mysql:8.0
91
	client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= )
85
	!dev-db/mysql:5.7
92 86
	selinux? ( sec-policy/selinux-mysql )
93
	server? (
94
		!prefix? (
95
			acct-group/mysql acct-user/mysql
96
			dev-db/mysql-init-scripts
97
		)
87
	!prefix? (
88
		acct-group/mysql acct-user/mysql
89
		dev-db/mysql-init-scripts
98 90
	)
99 91
"
100 92

  
......
170 162
	fi
171 163
}
172 164

  
173
pkg_preinst() {
174
	# Here we need to see if the implementation switched client libraries
175
	# We check if this is a new instance of the package and a client library already exists
176
	local SHOW_ABI_MESSAGE libpath
177
	if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
178
		libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
179
		elog "Due to ABI changes when switching between different client libraries,"
180
		elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
181
		elog "Please run: revdep-rebuild --library ${libpath}"
182
		ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
183
	fi
184
}
185

  
186
pkg_postinst() {
187
	# Make sure the vars are correctly initialized
188
	mysql_init_vars
189

  
190
	# Create log directory securely if it does not exist
191
	[[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
192

  
193
	if use server ; then
194
		if [[ -z "${REPLACING_VERSIONS}" ]] ; then
195
			einfo
196
			elog "You might want to run:"
197
			elog "\"emerge --config =${CATEGORY}/${PF}\""
198
			elog "if this is a new install."
199
			elog
200
			elog "If you are switching server implentations, you should run the"
201
			elog "mysql_upgrade tool."
202
			einfo
203
		else
204
			einfo
205
			elog "If you are upgrading major versions, you should run the"
206
			elog "mysql_upgrade tool."
207
			einfo
208
		fi
209
	fi
210

  
211
	# Note about configuration change
212
	einfo
213
	elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
214
	elog "to several files in /etc/mysql/mysql.d."
215
	elog "Please backup any changes you made to /etc/mysql/my.cnf"
216
	elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
217
	elog "You may have as many files as needed and they are read alphabetically."
218
	elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
219
	einfo
220
}
221

  
222 165
src_unpack() {
223 166
	unpack ${A}
224 167

  
225
	mv -f "${WORKDIR}/${P}" "${S}" || die
168
	mv -f "${WORKDIR}/${MY_P}" "${S}" || die
226 169
}
227 170

  
228 171
src_prepare() {
229 172
	eapply "${WORKDIR}"/mysql-patches
173
	eapply "${FILESDIR}"/${PN}-8.0.27-gcc12.patch
230 174

  
231
	if use jemalloc ; then
232
		echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
233
	fi
234

  
235
	if use tcmalloc ; then
236
		echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
237
	fi
175
	# Avoid rpm call which would trigger sandbox, #692368
176
	sed -i \
177
		-e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \
178
		CMakeLists.txt || die
238 179

  
239 180
	# Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
240 181
	if [[ -d "${S}/support-files/SELinux" ]] ; then
241 182
		echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
242 183
	fi
243 184

  
244
	# Remove bundled libs so we cannot accidentally use them
245
	# We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394
246
	rm -rv \
247
		"${S}"/extra/protobuf \
248
		"${S}"/extra/libevent \
249
		|| die
250

  
251
	# Don't clash with dev-db/mysql-connector-c
185
	# Remove man pages for client-lib tools we don't install
252 186
	rm \
253 187
		man/my_print_defaults.1 \
254 188
		man/perror.1 \
255 189
		man/zlib_decompress.1 \
256 190
		|| die
257 191

  
258
	sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
259

  
260 192
	cmake_src_prepare
261 193
}
262 194

  
263 195
src_configure() {
264
	# Filter LTO for legacy branch with ODR violations (bug #855242)
265
	filter-lto
266

  
267 196
	# Bug #114895, bug #110149
268 197
	filter-flags "-O" "-O[01]"
269 198

  
270
	append-cxxflags -felide-constructors
271

  
272
	# code is not C++17 ready, bug #786402
273
	append-cxxflags -std=c++14
274

  
275
	# bug #283926, with GCC4.4, this is required to get correct behavior.
276
	append-flags -fno-strict-aliasing
277

  
278
	if use client-libs ; then
279
		multilib-minimal_src_configure
280
	else
281
		multilib_src_configure
282
	fi
283
}
284

  
285
multilib_src_configure() {
286
	debug-print-function ${FUNCNAME} "$@"
287

  
288
	if ! multilib_is_native_abi && ! use client-libs ; then
289
		return
290
	fi
199
	# Code is now requiring C++17 due to https://github.com/mysql/mysql-server/commit/236ab55bedd8c9eacd80766d85edde2a8afacd08
200
	append-cxxflags -std=c++17
291 201

  
292 202
	CMAKE_BUILD_TYPE="RelWithDebInfo"
293 203

  
......
306 216
		-DINSTALL_MANDIR=share/man
307 217
		-DINSTALL_MYSQLSHAREDIR=share/mysql
308 218
		-DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
309
		-DINSTALL_SCRIPTDIR=share/mysql/scripts
310 219
		-DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
311 220
		-DINSTALL_SBINDIR=sbin
312 221
		-DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
313 222
		-DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
314 223
		-DWITH_UNIT_TESTS=$(usex test ON OFF)
315
		### TODO: make this system but issues with UTF-8 prevent it
224
		# Using bundled editline to get CTRL+C working
316 225
		-DWITH_EDITLINE=bundled
317 226
		-DWITH_ZLIB=system
318 227
		-DWITH_SSL=system
......
320 229
		-DENABLED_LOCAL_INFILE=1
321 230
		-DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
322 231
		-DWITH_DEFAULT_COMPILER_OPTIONS=0
323
		-DWITH_DEFAULT_FEATURE_SET=0
324 232
		# The build forces this to be defined when cross-compiling. We pass it
325 233
		# all the time for simplicity and to make sure it is actually correct.
326 234
		-DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
235
		-DCMAKE_POSITION_INDEPENDENT_CODE=ON
327 236
		-DWITH_CURL=system
328 237
		-DWITH_BOOST="${S}/boost"
238
		-DWITH_ROUTER=$(usex router ON OFF)
329 239
	)
240

  
241
	if tc-is-lto ; then
242
		mycmakeargs+=( -DWITH_LTO=ON )
243
	else
244
		mycmakeargs+=( -DWITH_LTO=OFF )
245
	fi
246

  
330 247
	if use test ; then
331 248
		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
332 249
	else
333 250
		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
334 251
	fi
335 252

  
336
	if ! use client-libs ; then
337
		mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
338
	fi
253
	mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
254

  
255
	mycmakeargs+=(
256
		-DWITH_ICU=system
257
		-DWITH_LZ4=system
258
		# Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex
259
		-DWITH_RAPIDJSON=bundled
260
		-DWITH_ZSTD=system
261
	)
339 262

  
340
	# bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
341
	# systemtap only works on native ABI, bug 530132
342
	if multilib_is_native_abi ; then
263
	if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then
264
		ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
265
		ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
266
		ewarn "You MUST file bugs without these variables set."
267
		ewarn "Tests will probably fail!"
268

  
269
		mycmakeargs+=(
270
			-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
271
			-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
272
		)
273
	elif use latin1 ; then
343 274
		mycmakeargs+=(
344
			-DENABLE_DTRACE=$(usex systemtap)
275
			-DDEFAULT_CHARSET=latin1
276
			-DDEFAULT_COLLATION=latin1_swedish_ci
345 277
		)
346 278
	else
347 279
		mycmakeargs+=(
348
			-DWITHOUT_TOOLS=1
349
			-DWITH_READLINE=1
350
			-DENABLE_DTRACE=0
280
			-DDEFAULT_CHARSET=utf8mb4
281
			-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci
351 282
		)
352 283
	fi
353 284

  
354
	if multilib_is_native_abi && use server ; then
285
	if use server ; then
355 286
		mycmakeargs+=(
287
			-DWITH_EXTRA_CHARSETS=all
288
			-DWITH_DEBUG=$(usex debug)
289
			-DWITH_MECAB=$(usex cjk system OFF)
356 290
			-DWITH_LIBEVENT=system
357
			-DWITH_LZ4=system
358 291
			-DWITH_PROTOBUF=system
359
			-DWITH_MECAB=$(usex cjk system OFF)
360 292
			-DWITH_NUMA=$(usex numa ON OFF)
361
			-DWITH_RAPID=$(usex experimental ON OFF)
362 293
		)
363 294

  
364
		if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then
365
			ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
366
			ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
367
			ewarn "You MUST file bugs without these variables set."
368

  
369
			mycmakeargs+=(
370
				-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
371
				-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
372
			)
373
		elif ! use latin1 ; then
374
			mycmakeargs+=(
375
				-DDEFAULT_CHARSET=utf8
376
				-DDEFAULT_COLLATION=utf8_general_ci
377
			)
378
		else
379
			mycmakeargs+=(
380
				-DDEFAULT_CHARSET=latin1
381
				-DDEFAULT_COLLATION=latin1_swedish_ci
382
			)
295
		if use jemalloc ; then
296
			mycmakeargs+=( -DWITH_JEMALLOC=ON )
297
		elif use tcmalloc ; then
298
			mycmakeargs+=( -DWITH_TCMALLOC=ON )
383 299
		fi
384 300

  
385
		mycmakeargs+=(
386
			-DEXTRA_CHARSETS=all
387
			-DDISABLE_SHARED=$(usex static YES NO)
388
			-DWITH_DEBUG=$(usex debug)
389
			-DWITH_EMBEDDED_SERVER=OFF
390
		)
391

  
392 301
		if use profiling ; then
393 302
			# Setting to OFF doesn't work: Once set, profiling options will be added
394 303
			# to `mysqld --help` output via sql/sys_vars.cc causing
......
396 305
			mycmakeargs+=( -DENABLED_PROFILING=ON )
397 306
		fi
398 307

  
399
		if use static ; then
400
			mycmakeargs+=( -DWITH_PIC=1 )
401
		fi
402

  
403 308
		# Storage engines
404 309
		mycmakeargs+=(
405 310
			-DWITH_EXAMPLE_STORAGE_ENGINE=0
......
412 317
			-DWITH_INNODB_MEMCACHED=0
413 318
			-DWITH_MYISAMMRG_STORAGE_ENGINE=1
414 319
			-DWITH_MYISAM_STORAGE_ENGINE=1
415
			-DWITH_PARTITION_STORAGE_ENGINE=1
416 320
		)
417

  
418 321
	else
419 322
		mycmakeargs+=(
420 323
			-DWITHOUT_SERVER=1
421
			-DWITH_EMBEDDED_SERVER=OFF
422
			-DEXTRA_CHARSETS=none
324
			-DWITH_SYSTEMD=no
423 325
		)
424 326
	fi
425 327

  
426 328
	cmake_src_configure
427 329
}
428 330

  
429
src_compile() {
430
	if use client-libs ; then
431
		multilib-minimal_src_compile
432
	else
433
		multilib_src_compile
434
	fi
435
}
436

  
437
multilib_src_compile() {
438
	cmake_src_compile
439
}
440

  
441 331
# Official test instructions:
442 332
# ulimit -n 16500 && \
443
# USE='latin1 perl server' \
444
# FEATURES='test userpriv -usersandbox' \
333
# USE='perl server' \
334
# FEATURES='test userpriv' \
445 335
# ebuild mysql-X.X.XX.ebuild \
446 336
# digest clean package
447 337
src_test() {
448 338
	_disable_test() {
449
		local rawtestname reason
339
		local rawtestname bug reason
450 340
		rawtestname="${1}" ; shift
341
		bug="${1}" ; shift
451 342
		reason="${@}"
452
		ewarn "test '${rawtestname}' disabled: '${reason}'"
453
		echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
343
		ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
344
		echo ${rawtestname} : BUG#${bug} ${reason} >> "${T}/disabled.def"
454 345
	}
455 346

  
456 347
	local TESTDIR="${BUILD_DIR}/mysql-test"
......
490 381
	pushd "${TESTDIR}" &>/dev/null || die
491 382

  
492 383
	touch "${T}/disabled.def"
493
	# These are failing in MySQL 5.7 for now and are believed to be
494
	# false positives:
495
	#
496
	local t
497

  
498
	for t in \
499
		auth_sec.keyring_udf \
500
		innodb.alter_kill \
501
		innodb.innodb-multiple-tablespaces \
502
		innodb.import_compress_encrypt \
503
		perfschema.privilege_table_io \
504
	; do
505
			_disable_test "$t" "False positives in Gentoo"
506
	done
507

  
508
	# Unstable tests
509
	# - main.xa_prepared_binlog_off: https://bugs.mysql.com/bug.php?id=83340
510
	# - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223
511
	# - rpl.rpl_non_direct_stm_mixing_engines: MDEV-14489
512
	for t in \
513
		main.xa_prepared_binlog_off \
514
		rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \
515
		rpl.rpl_non_direct_stm_mixing_engines \
516
	; do
517
		_disable_test "$t" "Unstable test"
518
	done
519 384

  
520
	for t in \
521
		gis.geometry_class_attri_prop \
522
		gis.geometry_property_function_issimple \
523
		gis.gis_bugs_crashes \
524
		gis.spatial_op_testingfunc_mix \
525
		gis.spatial_analysis_functions_buffer \
526
		gis.spatial_analysis_functions_distance \
527
		gis.spatial_utility_function_distance_sphere \
528
		gis.spatial_utility_function_simplify \
529
		gis.spatial_analysis_functions_centroid \
530
		main.with_recursive \
531
	; do
532
		_disable_test "$t" "Known rounding error with latest AMD processors"
533
	done
385
	local -a disabled_tests
386
	disabled_tests+=( "auth_sec.atomic_rename_user;103512;Depends on user running test" )
387
	disabled_tests+=( "auth_sec.keyring_file_data_qa;0;Won't work with user privileges" )
388
	disabled_tests+=( "auth_sec.openssl_without_fips;94718;Known test failure" )
389
	disabled_tests+=( "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" )
390
	disabled_tests+=( "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" )
391
	disabled_tests+=( "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" )
392
	disabled_tests+=( "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" )
393
	disabled_tests+=( "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" )
394
	disabled_tests+=( "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" )
395
	disabled_tests+=( "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" )
396
	disabled_tests+=( "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" )
397
	disabled_tests+=( "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" )
398
	disabled_tests+=( "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" )
399
	disabled_tests+=( "gis.st_symdifference;5452;Known rounding error with latest AMD processors (PS)" )
400
	disabled_tests+=( "innodb.alter_kill;0;Known test failure -- no upstream bug yet" )
401
	disabled_tests+=( "main.derived_limit;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
402
	disabled_tests+=( "main.explain_tree;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
403
	disabled_tests+=( "main.gis-precise;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
404
	disabled_tests+=( "main.mysql_load_data_local_dir;0;Known test failure -- no upstream bug yet" )
405
	disabled_tests+=( "main.select_icp_mrr;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
406
	disabled_tests+=( "main.subquery_bugs;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
407
	disabled_tests+=( "main.subquery_sj_dupsweed;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
408
	disabled_tests+=( "main.subquery_sj_dupsweed_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
409
	disabled_tests+=( "main.subquery_sj_dupsweed_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
410
	disabled_tests+=( "main.subquery_sj_firstmatch;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
411
	disabled_tests+=( "main.subquery_sj_firstmatch_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
412
	disabled_tests+=( "main.subquery_sj_firstmatch_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
413
	disabled_tests+=( "main.subquery_sj_mat_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
414
	disabled_tests+=( "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
415
	disabled_tests+=( "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
416
	disabled_tests+=( "main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet" )
417
	disabled_tests+=( "perfschema.statement_digest_query_sample;0;Test will fail on slow hardware")
418
	disabled_tests+=( "rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch;0;Unstable test" )
419
	disabled_tests+=( "rpl_gtid.rpl_gtid_stm_drop_table;90612;Known test failure" )
420
	disabled_tests+=( "rpl_gtid.rpl_multi_source_mtr_includes;0;Known failure - no upstream bug yet" )
421
	disabled_tests+=( "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware")
422
	disabled_tests+=( "x.connection;0;Known failure - no upstream bug yet" )
423
	disabled_tests+=( "x.message_compressed_payload;0;False positive caused by protobuff-3.11+" )
424
	disabled_tests+=( "x.message_protobuf_nested;0;False positive caused by protobuff-3.11+" )
534 425

  
535 426
	if ! hash zip 1>/dev/null 2>&1 ; then
536 427
		# no need to force dep app-arch/zip for one test
537
		_disable_test "innodb.partition_upgrade_create" "Requires app-arch/zip"
538
	fi
539

  
540
	if use numa && use kernel_linux ; then
541
		# bug 584880
542
		if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then
543
			for t in sys_vars.innodb_numa_interleave_basic ; do
544
				_disable_test "$t" "Test $t requires system with NUMA support"
545
			done
546
		fi
547
	fi
548

  
549
	if ! use latin1 ; then
550
		# The following tests will fail if DEFAULT_CHARSET
551
		# isn't set to latin1:
552
		for t in \
553
			binlog.binlog_mysqlbinlog_filter \
554
			binlog.binlog_xa_prepared_disconnect \
555
			funcs_1.is_columns_mysql \
556
			funcs_1.is_tables_mysql \
557
			funcs_1.is_triggers \
558
			innodb.innodb_pagesize_max_recordsize \
559
			innodb.innodb-system-table-view \
560
			innodb.mysqldump_max_recordsize \
561
			main.mysql_client_test \
562
			main.mysqld--help-notwin \
563
			main.mysqldump_bugs \
564
			main.type_string \
565
			main.information_schema \
566
			perfschema.binlog_edge_mix \
567
			perfschema.binlog_edge_stmt \
568
			rpl.rpl_xa_survive_disconnect \
569
			rpl.rpl_xa_survive_disconnect_lsu_off \
570
			rpl.rpl_xa_survive_disconnect_table \
571
		; do
572
			_disable_test "$t" "Requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set"
573
		done
428
		disabled_tests+=( "innodb.discarded_partition_create;0;Requires app-arch/zip" )
429
		disabled_tests+=( "innodb.partition_upgrade_create;0;Requires app-arch/zip" )
574 430
	fi
575 431

  
576 432
	if has_version ">=dev-libs/openssl-3" ; then
......
618 474
		EOF
619 475

  
620 476
		local -x OPENSSL_CONF="${T}/openssl_tlsv1.cnf"
621
	fi
622 477

  
623
	if has_version '>=dev-libs/openssl-1.1.1' ; then
624
		# Tests are expecting <openssl-1.1.1 default cipher
625
		for t in \
626
			auth_sec.cert_verify \
627
			auth_sec.mysql_ssl_connection \
628
			auth_sec.openssl_cert_generation \
629
			auth_sec.ssl_auto_detect \
630
			auth_sec.ssl_mode \
631
			auth_sec.tls \
632
			binlog.binlog_grant_alter_user \
633
			encryption.innodb_onlinealter_encryption \
634
			main.grant_alter_user_qa \
635
			main.grant_user_lock_qa \
636
			main.mysql_ssl_default \
637
			main.openssl_1 \
638
			main.plugin_auth_sha256 \
639
			main.plugin_auth_sha256_2 \
640
			main.plugin_auth_sha256_server_default \
641
			main.plugin_auth_sha256_server_default_tls \
642
			main.plugin_auth_sha256_tls \
643
			main.ssl \
644
			main.ssl_8k_key \
645
			main.ssl_bug75311 \
646
			main.ssl_ca \
647
			main.ssl_cipher \
648
			main.ssl_compress \
649
			main.ssl_crl \
650
			main.ssl_ecdh \
651
			main.ssl_verify_identity \
652
			x.connection_tls_version \
653
			x.connection_openssl \
654
		; do
655
			_disable_test  "$t" "Requires <dev-libs/openssl-1.1.1"
656
		done
478
		disabled_tests+=( "x.connection_tls_version;0;Not compatible with OpenSSL 3.x error messages" )
657 479
	fi
658 480

  
481
	local test_infos_str test_infos_arr
482
	for test_infos_str in "${disabled_tests[@]}" ; do
483
		IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
484

  
485
		if [[ ${#test_infos_arr[@]} != 3 ]] ; then
486
			die "Invalid test data set, not matching format: ${test_infos_str}"
487
		fi
488

  
489
		_disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
490
	done
491
	unset test_infos_str test_infos_arr
492

  
659 493
	# Try to increase file limits to increase test coverage
660 494
	if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
661 495
		# Upper limit comes from parts.partition_* tests
......
695 529
}
696 530

  
697 531
src_install() {
698
	local MULTILIB_WRAPPED_HEADERS
699
	local MULTILIB_CHOST_TOOLS
700
	if use client-libs ; then
701
		# headers with ABI specific data
702
		MULTILIB_WRAPPED_HEADERS=(
703
			/usr/include/mysql/server/my_config.h
704
			/usr/include/mysql/server/mysql_version.h )
705

  
706
		# wrap the config scripts
707
		MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
708
		multilib-minimal_src_install
709
	else
710
		multilib_src_install
711
		multilib_src_install_all
712
	fi
713
}
714

  
715
# Intentionally override eclass function
716
multilib_src_install() {
717 532
	cmake_src_install
718 533

  
719
	# Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
720
	find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
721
}
722

  
723
multilib_src_install_all() {
724 534
	# Make sure the vars are correctly initialized
725 535
	mysql_init_vars
726 536

  
......
739 549
	# testsuite. It DOES have a use to be installed, esp. when you want to do a
740 550
	# validation of your database configuration after tuning it.
741 551
	if ! use test ; then
742
		rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
552
		rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test"
743 553
	fi
744 554

  
745 555
	# Configuration stuff
......
750 560
	eprefixify "${TMPDIR}/my.cnf"
751 561
	doins "${TMPDIR}/my.cnf"
752 562
	insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
753
	cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
563
	cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
754 564
	eprefixify "${TMPDIR}/50-distro-client.cnf"
755 565
	doins "${TMPDIR}/50-distro-client.cnf"
756 566

  
757
	if use server ; then
758
		mycnf_src="my.cnf.distro-server"
759
		sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
760
			"${FILESDIR}/${mycnf_src}" \
761
			> "${TMPDIR}/my.cnf.ok" || die
567
	mycnf_src="my.cnf-8.0.distro-server"
568
	sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
569
		"${FILESDIR}/${mycnf_src}" \
570
		> "${TMPDIR}/my.cnf.ok" || die
762 571

  
763
		if use prefix ; then
764
			sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
765
				"${TMPDIR}/my.cnf.ok" || die
766
		fi
572
	if use prefix ; then
573
		sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
574
			"${TMPDIR}/my.cnf.ok" || die
575
	fi
767 576

  
768
		if use latin1 ; then
769
			sed -i \
770
				-e "/character-set/s|utf8|latin1|g" \
771
				"${TMPDIR}/my.cnf.ok" || die
772
		fi
577
	if use latin1 ; then
578
		sed -i \
579
			-e "/character-set/s|utf8mb4|latin1|g" \
580
			"${TMPDIR}/my.cnf.ok" || die
581
	fi
773 582

  
774
		eprefixify "${TMPDIR}/my.cnf.ok"
583
	eprefixify "${TMPDIR}/my.cnf.ok"
775 584

  
776
		newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
777
	fi
585
	newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
778 586

  
779 587
	#Remove mytop if perl is not selected
780 588
	[[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
589

  
590
	if use router ; then
591
		rm -rf \
592
			"${ED}/usr/LICENSE.router" \
593
			"${ED}/usr/README.router" \
594
			"${ED}/usr/run" \
595
			"${ED}/usr/var" \
596
			|| die
597
	fi
598

  
599
	# Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
600
	find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
601
}
602

  
603
pkg_postinst() {
604
	# Make sure the vars are correctly initialized
605
	mysql_init_vars
606

  
607
	# Create log directory securely if it does not exist
608
	# NOTE: $MY_LOGDIR contains $EPREFIX by default
609
	[[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}"
610

  
611
	# Note about configuration change
612
	einfo
613
	elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
614
	elog "to several files in /etc/mysql/mysql.d."
615
	elog "Please backup any changes you made to /etc/mysql/my.cnf"
616
	elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
617
	elog "You may have as many files as needed and they are read alphabetically."
618
	elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
619
	einfo
620

  
621
	if [[ -z "${REPLACING_VERSIONS}" ]] ; then
622
		einfo
623
		elog "You might want to run:"
624
		elog "  \"emerge --config =${CATEGORY}/${PF}\""
625
		elog "if this is a new install."
626
		einfo
627
	else
628
		einfo
629
		elog "Upgrade process for ${PN}-8.x has changed. Please read"
630
		elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html"
631
		einfo
632
	fi
781 633
}
782 634

  
783 635
pkg_config() {
......
1081 933
	einfo "Install db log:\t\t\t${mysql_install_log}"
1082 934
	einfo "Install server log:\t\t\t${mysqld_logfile}"
1083 935

  
936
	local -a config_files
937

  
938
	local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf"
939
	if [[ -f "${config_file}" ]] ; then
940
		config_files+=( "${config_file}" )
941
	else
942
		ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..."
943
	fi
944

  
945
	config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf"
946
	if [[ -f "${config_file}" ]] ; then
947
		config_files+=( "${config_file}" )
948
	else
949
		ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..."
950
	fi
951

  
952
	if [[ ${#config_files[@]} -gt 0 ]] ; then
953
		if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then
954
			local user_answer
955

  
956
			echo
957
			einfo "Please select default authentication plugin (enter number or plugin name):"
958
			einfo "1) caching_sha2_password [MySQL 8.0 default]"
959
			einfo "2) mysql_native_password [MySQL 5.7 default]"
960
			einfo
961
			einfo "For details see:"
962
			einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password"
963
			read -p "    >" user_answer
964
			echo
965

  
966
			case "${user_answer}" in
967
				1|caching_sha2_password)
968
					MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password
969
					;;
970
				2|mysql_native_password)
971
					MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password
972
					;;
973
				'')
974
					die "No authentication plugin selected!"
975
					;;
976
				*)
977
					die "Authentication plugin '${user_answer}' is unknown/unsupported!"
978
					;;
979
			esac
980

  
981
			echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}"
982

  
983
			unset user_answer
984
		fi
985

  
986
		local cfg_option cfg_option_tabs cfg_section
987
		for config_file in "${config_files[@]}" ; do
988
			cfg_option="default-authentication-plugin"
989
			cfg_section="mysqld"
990
			cfg_option_tabs="\t\t"
991
			if [[ "${config_file}" == *client.cnf ]] ; then
992
				cfg_option="default-auth"
993
				cfg_section="client"
994
				cfg_option_tabs="\t\t\t\t"
995
			fi
996

  
997
			if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then
998
				einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
999
				sed -i \
1000
					-e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \
1001
					"${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!"
1002
			else
1003
				einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
1004
				sed -i \
1005
					-e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \
1006
					"${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!"
1007
			fi
1008
		done
1009
		unset cfg_option cfg_option_tabs cfg_section
1010
	fi
1011
	unset config_files config_file
1012

  
1013
	echo
1014

  
1084 1015
	if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
1085 1016
		local tmp_mysqld_password_source=
1086 1017

  
......
1181 1112
	einfo "Initializing ${PN} data directory: ${cmd[@]}"
1182 1113
	eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
1183 1114

  
1184
	if [[ $? -ne 0 ]] ; then
1115
	if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then
1185 1116
		grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
1186 1117
		die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
1187 1118
	fi
Thank you!