Diff mysql-5.7.41 with a mysql-8.0.27-r1

/usr/portage/dev-db/mysql/mysql-8.0.27-r1.ebuild 2023-10-09 14:52:29.324368346 +0300
1 1
# Copyright 1999-2023 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="https://dev.gentoo.org/~whissi/dist/mysql/${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 ~ia64 ~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 ~ia64 ~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-util/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

  
......
264 196
	# Bug #114895, bug #110149
265 197
	filter-flags "-O" "-O[01]"
266 198

  
267
	append-cxxflags -felide-constructors
268

  
269
	# code is not C++17 ready, bug #786402
270
	append-cxxflags -std=c++14
271

  
272
	# bug #283926, with GCC4.4, this is required to get correct behavior.
273
	append-flags -fno-strict-aliasing
274

  
275
	if use client-libs ; then
276
		multilib-minimal_src_configure
277
	else
278
		multilib_src_configure
279
	fi
280
}
281

  
282
multilib_src_configure() {
283
	debug-print-function ${FUNCNAME} "$@"
284

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

  
289 202
	CMAKE_BUILD_TYPE="RelWithDebInfo"
290 203

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

  
241
	if is-flagq -fno-lto ; then
242
		einfo "LTO disabled via {C,CXX,F,FC}FLAGS"
243
		mycmakeargs+=( -DWITH_LTO=OFF )
244
	elif is-flagq -flto ; then
245
		einfo "LTO forced via {C,CXX,F,FC}FLAGS"
246
		myconf+=( -DWITH_LTO=ON )
247
	else
248
		# Disable automagic
249
		myconf+=( -DWITH_LTO=OFF )
250
	fi
251

  
327 252
	if use test ; then
328 253
		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
329 254
	else
330 255
		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
331 256
	fi
332 257

  
333
	if ! use client-libs ; then
334
		mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
335
	fi
258
	mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
259

  
260
	mycmakeargs+=(
261
		-DWITH_ICU=system
262
		-DWITH_LZ4=system
263
		# Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex
264
		-DWITH_RAPIDJSON=bundled
265
		-DWITH_ZSTD=system
266
	)
336 267

  
337
	# bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
338
	# systemtap only works on native ABI, bug 530132
339
	if multilib_is_native_abi ; then
268
	if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then
269
		ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
270
		ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
271
		ewarn "You MUST file bugs without these variables set."
272
		ewarn "Tests will probably fail!"
273

  
274
		mycmakeargs+=(
275
			-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
276
			-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
277
		)
278
	elif use latin1 ; then
340 279
		mycmakeargs+=(
341
			-DENABLE_DTRACE=$(usex systemtap)
280
			-DDEFAULT_CHARSET=latin1
281
			-DDEFAULT_COLLATION=latin1_swedish_ci
342 282
		)
343 283
	else
344 284
		mycmakeargs+=(
345
			-DWITHOUT_TOOLS=1
346
			-DWITH_READLINE=1
347
			-DENABLE_DTRACE=0
285
			-DDEFAULT_CHARSET=utf8mb4
286
			-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci
348 287
		)
349 288
	fi
350 289

  
351
	if multilib_is_native_abi && use server ; then
290
	if use server ; then
352 291
		mycmakeargs+=(
292
			-DWITH_EXTRA_CHARSETS=all
293
			-DWITH_DEBUG=$(usex debug)
294
			-DWITH_MECAB=$(usex cjk system OFF)
353 295
			-DWITH_LIBEVENT=system
354
			-DWITH_LZ4=system
355 296
			-DWITH_PROTOBUF=system
356
			-DWITH_MECAB=$(usex cjk system OFF)
357 297
			-DWITH_NUMA=$(usex numa ON OFF)
358
			-DWITH_RAPID=$(usex experimental ON OFF)
359 298
		)
360 299

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

  
366
			mycmakeargs+=(
367
				-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
368
				-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
369
			)
370
		elif ! use latin1 ; then
371
			mycmakeargs+=(
372
				-DDEFAULT_CHARSET=utf8
373
				-DDEFAULT_COLLATION=utf8_general_ci
374
			)
375
		else
376
			mycmakeargs+=(
377
				-DDEFAULT_CHARSET=latin1
378
				-DDEFAULT_COLLATION=latin1_swedish_ci
379
			)
300
		if use jemalloc ; then
301
			mycmakeargs+=( -DWITH_JEMALLOC=ON )
302
		elif use tcmalloc ; then
303
			mycmakeargs+=( -DWITH_TCMALLOC=ON )
380 304
		fi
381 305

  
382
		mycmakeargs+=(
383
			-DEXTRA_CHARSETS=all
384
			-DDISABLE_SHARED=$(usex static YES NO)
385
			-DWITH_DEBUG=$(usex debug)
386
			-DWITH_EMBEDDED_SERVER=OFF
387
		)
388

  
389 306
		if use profiling ; then
390 307
			# Setting to OFF doesn't work: Once set, profiling options will be added
391 308
			# to `mysqld --help` output via sql/sys_vars.cc causing
......
393 310
			mycmakeargs+=( -DENABLED_PROFILING=ON )
394 311
		fi
395 312

  
396
		if use static ; then
397
			mycmakeargs+=( -DWITH_PIC=1 )
398
		fi
399

  
400 313
		# Storage engines
401 314
		mycmakeargs+=(
402 315
			-DWITH_EXAMPLE_STORAGE_ENGINE=0
......
409 322
			-DWITH_INNODB_MEMCACHED=0
410 323
			-DWITH_MYISAMMRG_STORAGE_ENGINE=1
411 324
			-DWITH_MYISAM_STORAGE_ENGINE=1
412
			-DWITH_PARTITION_STORAGE_ENGINE=1
413 325
		)
414

  
415 326
	else
416 327
		mycmakeargs+=(
417 328
			-DWITHOUT_SERVER=1
418
			-DWITH_EMBEDDED_SERVER=OFF
419
			-DEXTRA_CHARSETS=none
329
			-DWITH_SYSTEMD=no
420 330
		)
421 331
	fi
422 332

  
423 333
	cmake_src_configure
424 334
}
425 335

  
426
src_compile() {
427
	if use client-libs ; then
428
		multilib-minimal_src_compile
429
	else
430
		multilib_src_compile
431
	fi
432
}
433

  
434
multilib_src_compile() {
435
	cmake_src_compile
436
}
437

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

  
453 352
	local TESTDIR="${BUILD_DIR}/mysql-test"
......
487 386
	pushd "${TESTDIR}" &>/dev/null || die
488 387

  
489 388
	touch "${T}/disabled.def"
490
	# These are failing in MySQL 5.7 for now and are believed to be
491
	# false positives:
492
	#
493
	local t
494

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

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

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

  
532 431
	if ! hash zip 1>/dev/null 2>&1 ; then
533 432
		# no need to force dep app-arch/zip for one test
534
		_disable_test "innodb.partition_upgrade_create" "Requires app-arch/zip"
535
	fi
536

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

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

  
573 437
	if has_version ">=dev-libs/openssl-3" ; then
......
615 479
		EOF
616 480

  
617 481
		local -x OPENSSL_CONF="${T}/openssl_tlsv1.cnf"
618
	fi
619 482

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

  
486
	local test_infos_str test_infos_arr
487
	for test_infos_str in "${disabled_tests[@]}" ; do
488
		IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
489

  
490
		if [[ ${#test_infos_arr[@]} != 3 ]] ; then
491
			die "Invalid test data set, not matching format: ${test_infos_str}"
492
		fi
493

  
494
		_disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
495
	done
496
	unset test_infos_str test_infos_arr
497

  
656 498
	# Try to increase file limits to increase test coverage
657 499
	if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
658 500
		# Upper limit comes from parts.partition_* tests
......
692 534
}
693 535

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

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

  
712
# Intentionally override eclass function
713
multilib_src_install() {
714 537
	cmake_src_install
715 538

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

  
720
multilib_src_install_all() {
721 539
	# Make sure the vars are correctly initialized
722 540
	mysql_init_vars
723 541

  
......
736 554
	# testsuite. It DOES have a use to be installed, esp. when you want to do a
737 555
	# validation of your database configuration after tuning it.
738 556
	if ! use test ; then
739
		rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
557
		rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test"
740 558
	fi
741 559

  
742 560
	# Configuration stuff
......
747 565
	eprefixify "${TMPDIR}/my.cnf"
748 566
	doins "${TMPDIR}/my.cnf"
749 567
	insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
750
	cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
568
	cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
751 569
	eprefixify "${TMPDIR}/50-distro-client.cnf"
752 570
	doins "${TMPDIR}/50-distro-client.cnf"
753 571

  
754
	if use server ; then
755
		mycnf_src="my.cnf.distro-server"
756
		sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
757
			"${FILESDIR}/${mycnf_src}" \
758
			> "${TMPDIR}/my.cnf.ok" || die
572
	mycnf_src="my.cnf-8.0.distro-server"
573
	sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
574
		"${FILESDIR}/${mycnf_src}" \
575
		> "${TMPDIR}/my.cnf.ok" || die
759 576

  
760
		if use prefix ; then
761
			sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
762
				"${TMPDIR}/my.cnf.ok" || die
763
		fi
577
	if use prefix ; then
578
		sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
579
			"${TMPDIR}/my.cnf.ok" || die
580
	fi
764 581

  
765
		if use latin1 ; then
766
			sed -i \
767
				-e "/character-set/s|utf8|latin1|g" \
768
				"${TMPDIR}/my.cnf.ok" || die
769
		fi
582
	if use latin1 ; then
583
		sed -i \
584
			-e "/character-set/s|utf8mb4|latin1|g" \
585
			"${TMPDIR}/my.cnf.ok" || die
586
	fi
770 587

  
771
		eprefixify "${TMPDIR}/my.cnf.ok"
588
	eprefixify "${TMPDIR}/my.cnf.ok"
772 589

  
773
		newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
774
	fi
590
	newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
775 591

  
776 592
	#Remove mytop if perl is not selected
777 593
	[[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
594

  
595
	if use router ; then
596
		rm -rf \
597
			"${ED}/usr/LICENSE.router" \
598
			"${ED}/usr/README.router" \
599
			"${ED}/usr/run" \
600
			"${ED}/usr/var" \
601
			|| die
602
	fi
603

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

  
608
pkg_postinst() {
609
	# Make sure the vars are correctly initialized
610
	mysql_init_vars
611

  
612
	# Create log directory securely if it does not exist
613
	# NOTE: $MY_LOGDIR contains $EPREFIX by default
614
	[[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}"
615

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

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

  
780 640
pkg_config() {
......
1078 938
	einfo "Install db log:\t\t\t${mysql_install_log}"
1079 939
	einfo "Install server log:\t\t\t${mysqld_logfile}"
1080 940

  
941
	local -a config_files
942

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

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

  
957
	if [[ ${#config_files[@]} -gt 0 ]] ; then
958
		if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then
959
			local user_answer
960

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

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

  
986
			echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}"
987

  
988
			unset user_answer
989
		fi
990

  
991
		local cfg_option cfg_option_tabs cfg_section
992
		for config_file in "${config_files[@]}" ; do
993
			cfg_option="default-authentication-plugin"
994
			cfg_section="mysqld"
995
			cfg_option_tabs="\t\t"
996
			if [[ "${config_file}" == *client.cnf ]] ; then
997
				cfg_option="default-auth"
998
				cfg_section="client"
999
				cfg_option_tabs="\t\t\t\t"
1000
			fi
1001

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

  
1018
	echo
1019

  
1081 1020
	if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
1082 1021
		local tmp_mysqld_password_source=
1083 1022

  
......
1178 1117
	einfo "Initializing ${PN} data directory: ${cmd[@]}"
1179 1118
	eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
1180 1119

  
1181
	if [[ $? -ne 0 ]] ; then
1120
	if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then
1182 1121
		grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
1183 1122
		die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
1184 1123
	fi
Thank you!