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, 22 Jan 2020 20:26:06
Message-Id: 1579724750.06a83f7538fd6af4647b2585d5e7b3e75375ba72.whissi@gentoo
1 commit: 06a83f7538fd6af4647b2585d5e7b3e75375ba72
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 22 20:12:15 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 22 20:25:50 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06a83f75
7
8 dev-db/percona-server: drop old
9
10 Package-Manager: Portage-2.3.84, Repoman-2.3.20
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-db/percona-server/Manifest | 4 -
14 .../percona-server-5.7.26.29-r1.ebuild | 1108 -------------------
15 .../percona-server/percona-server-8.0.17.8.ebuild | 1132 --------------------
16 3 files changed, 2244 deletions(-)
17
18 diff --git a/dev-db/percona-server/Manifest b/dev-db/percona-server/Manifest
19 index bee9002e731..8a3cd032910 100644
20 --- a/dev-db/percona-server/Manifest
21 +++ b/dev-db/percona-server/Manifest
22 @@ -1,10 +1,6 @@
23 DIST boost_1_59_0.tar.gz 83709983 BLAKE2B 8c6676fa05fa401a6ecb3b890d95aceb4421ec48dd0eab38ce8d170c618e177c82dc67a165938f6be1a01daab24ce41888f5442dbc19ad3dd41368a01a6f89e4 SHA512 05fdbe5637543defdbc630b921515425885593d16db14534ed7b9aa60925ade8fb598d50cb894aed6dae688e789047216daa1bf03fa1aeb6b531060d9dae52ae
24 -DIST boost_1_69_0.tar.bz2 95078138 BLAKE2B ccab52b911066ed41db6555fe13fbc142cd51250ad620665d3fcf25508e158b7b766f4f3654333b4a19517215ebe4a6ce14e64395b093b9604b3f0e570419841 SHA512 d0e9bb858c44880d56c0291afef6a1b011a62f659a2d8f58dcb6147ea0899f9157bd8db3097896618fee0116847ebeac78b6d0f0fec8a92c3469500828bbe552
25 DIST boost_1_70_0.tar.bz2 97887058 BLAKE2B dc7a974c6dc2662b767dbd87cb832cd1749c24fb745779d1059b73f19f7e52b33b645adfe72b0296c5e098e5cdb3b9f5eddd382374f33fbcd2ad5739287b2206 SHA512 7f2ea9636baf0210e8ed1d21ee798efb6ce23c0710ff8228b285e2214f82193bcd2d912fd435929c554289a59101c7be2e27ce798f93833f307976f0dd070b49
26 DIST mysql-extras-20190822-1908Z.tar.bz2 338830 BLAKE2B bc197f8e541206548d8982814e82e028d699ba9c41aec8d5191bcc46581f7880ed2741dbe2206fde44a5e8d8d54bbcf40efbd0709b357636c4c8fdb2ccc3a7bb SHA512 be469e55f7e9966638600d6836a44258c74e5600240fafe2d79eaeebe7d1695b043678184b5d18ee9946f28154bc2529586a7f860b510180a30c82454ed575c8
27 -DIST mysql-extras-20191031-0134Z.tar.bz2 340718 BLAKE2B 8c228d6953aa888449a006ab1000ef3ecb1747fd055f58a8eaa5f5680b223fa840debbb7fce7404aa7ef4524ce71144a6a970483ad6536ff7521bd949f4dfa90 SHA512 6d61c4a70980759ac90fc3ac35a677a340d88f63260fb2c130ef70de0c05654895fe17b5f4915ca6d96f2406f215559182af61f7d88c1a4157e9bcbcc0f4d4e2
28 DIST mysql-extras-20200122-2007Z.tar.bz2 344188 BLAKE2B e12a9886bb0c55f1af1ea979c9b1491b65195a54f927f0060f466fe858ea9dd2faffb6eeb7acb7efd28dfb37383b6730c314ea54fbaed2ec3e54655546c883e3 SHA512 ef43324b70081214f3e02eb677bde0e4e3575d2b3b1cb7fb8da18f50ff43a9554e13d13594c0d875bd1438695725ed28a586e4f67f4f4e39054d54671f9525de
29 -DIST percona-server-5.7.26-29.tar.gz 84327421 BLAKE2B beedb4b5025c337a63ae56644e47991e90c2c0e57c6d03f1562095f9470cef4b67c8df6c3774d88dfc6ed6dfb81f9dd4b62325db30bc26802651279921bd3a2d SHA512 c8100e69f7e29a5aa2de9dddbc1a3cba9836fe485b7f829a8db0a7e5ac1d1bdabfb1360dacad90665f4c9c78ac91226209c6c15158ef449e84519e36bb06f0a1
30 DIST percona-server-5.7.27-30.tar.gz 84672298 BLAKE2B 8431d231f602b704195868110e8eb73adb3db7c761906c15eff182e54634ef091a3ffa0d4f3498a93dbfbf65cd5cdd12102871abaaaa0f32378ba3068d083b2b SHA512 d62c66de3128df87dce52292ad1671e01fe2c923e668ef0faf9cb663c11c9cd0b976345aea1de6ea2bc458d0e1066b42c022849e422121d96cea082ed12c8f4b
31 -DIST percona-server-8.0.17-8.tar.gz 249562136 BLAKE2B d3bf20d9fee43f17b8aef3e403e74d9c5924a5a012d0c4208b22ffffce37f48867a2a1fb7992d7837f35492d5c5871901f3e0f68cde54793090bb2c089cee310 SHA512 c875492e8b67307aef439ae54b8ff6320464ac495a2d06029f1b33b2117e56bd1c2b3ce4ba7b406c1bd6604d0016d04a5c3f36643097cbf36425d60a44b6adc3
32 DIST percona-server-8.0.18-9.tar.gz 256867152 BLAKE2B 34c7b7b320f973313ecd95e658999a17748fc70ff46b1dc58144df02c17b7870cf33d68a555ee8aaaecb66c5b1003e6023154f7100a6f413514e89d495330dd2 SHA512 ce537a160b48e7c3dc35b15a293c39142a5b633111b5c9c5f9c1150476f0faa5e9cf81b34c9ca85286463455e3ae3fce7a200d253d880e3b67b3c71eefdbdcd4
33
34 diff --git a/dev-db/percona-server/percona-server-5.7.26.29-r1.ebuild b/dev-db/percona-server/percona-server-5.7.26.29-r1.ebuild
35 deleted file mode 100644
36 index 6f2590a7c1a..00000000000
37 --- a/dev-db/percona-server/percona-server-5.7.26.29-r1.ebuild
38 +++ /dev/null
39 @@ -1,1108 +0,0 @@
40 -# Copyright 1999-2019 Gentoo Authors
41 -# Distributed under the terms of the GNU General Public License v2
42 -
43 -EAPI="6"
44 -MY_EXTRAS_VER="20190822-1908Z"
45 -
46 -CMAKE_MAKEFILE_GENERATOR=emake
47 -
48 -# Python2 required for innodb_stress.innodb_stress{,_blob,_crash} test
49 -PYTHON_COMPAT=( python2_7 )
50 -
51 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
52 -
53 -inherit eapi7-ver cmake-utils eutils flag-o-matic linux-info \
54 - prefix python-any-r1 toolchain-funcs multilib-minimal
55 -
56 -MY_PV=$(ver_rs 3 '-')
57 -MY_PN="Percona-Server"
58 -MY_P="${PN}-${MY_PV}"
59 -MY_MAJOR_PV=$(ver_cut 1-2)
60 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/5.7/release-notes/release-notes_index.html"
61 -
62 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz
63 - mirror://sourceforge/boost/boost_1_59_0.tar.gz
64 -"
65 -
66 -# Gentoo patches to MySQL
67 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then
68 - SRC_URI="${SRC_URI}
69 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
70 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
71 -fi
72 -
73 -HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server"
74 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
75 -LICENSE="GPL-2"
76 -SLOT="0/18"
77 -IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 libressl numa pam +perl profiling rocksdb
78 - selinux +server static static-libs systemtap tcmalloc test tokudb tokudb-backup-plugin yassl"
79 -
80 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
81 -RESTRICT="!test? ( test ) libressl? ( test )"
82 -
83 -REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
84 -
85 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
86 -
87 -# Shorten the path because the socket path length must be shorter than 107 chars
88 -# and we will run a mysql server during test phase
89 -S="${WORKDIR}/mysql"
90 -
91 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
92 - inherit git-r3
93 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
94 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
95 - EGIT_CLONE_TYPE=shallow
96 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
97 -else
98 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
99 -fi
100 -
101 -PATCHES=(
102 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch
103 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch
104 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch
105 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.26-without-clientlibs-tools.patch
106 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.25-fix-libressl-support.patch
107 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-add-missing-gcc-8-fix.patch
108 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch
109 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch
110 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-mips-ASM.patch
111 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-rocksdb-use-system-libs.patch
112 -)
113 -
114 -# Be warned, *DEPEND are version-dependant
115 -# These are used for both runtime and compiletime
116 -# MULTILIB_USEDEP only set for libraries used by the client library
117 -COMMON_DEPEND="net-misc/curl:=
118 - >=sys-apps/sed-4
119 - >=sys-apps/texinfo-4.7-r1
120 - sys-libs/ncurses:0=
121 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
122 - !client-libs? (
123 - dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?]
124 - >=sys-libs/zlib-1.2.3:0=
125 - )
126 - jemalloc? ( dev-libs/jemalloc:0= )
127 - kernel_linux? (
128 - dev-libs/libaio:0=
129 - sys-process/procps:0=
130 - )
131 - server? (
132 - >=app-arch/lz4-0_p131:=
133 - cjk? ( app-text/mecab:= )
134 - experimental? (
135 - dev-libs/libevent:=
136 - dev-libs/protobuf:=
137 - net-libs/libtirpc:=
138 - )
139 - numa? ( sys-process/numactl )
140 - pam? ( sys-libs/pam:0= )
141 - rocksdb? (
142 - app-arch/zstd:=
143 - dev-libs/protobuf:=
144 - )
145 - tokudb? (
146 - app-arch/snappy:=
147 - app-arch/xz-utils:=
148 - )
149 - tokudb-backup-plugin? ( dev-util/valgrind )
150 - )
151 - systemtap? ( >=dev-util/systemtap-1.3:0= )
152 - tcmalloc? ( dev-util/google-perftools:0= )
153 - !yassl? (
154 - client-libs? (
155 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
156 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
157 - )
158 - !client-libs? (
159 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
160 - libressl? ( dev-libs/libressl:0= )
161 - )
162 - )
163 -"
164 -DEPEND="${COMMON_DEPEND}
165 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
166 - dev-libs/protobuf
167 - virtual/yacc
168 - server? (
169 - dev-libs/libevent
170 - experimental? ( net-libs/rpcsvc-proto )
171 - )
172 - static? ( sys-libs/ncurses[static-libs] )
173 - test? (
174 - acct-group/mysql acct-user/mysql
175 - dev-perl/JSON
176 - || (
177 - $(python_gen_any_dep 'dev-python/mysqlclient[${PYTHON_USEDEP}]')
178 - $(python_gen_any_dep 'dev-python/mysql-python[${PYTHON_USEDEP}]')
179 - )
180 - )
181 -"
182 -RDEPEND="${COMMON_DEPEND}
183 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
184 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= )
185 - selinux? ( sec-policy/selinux-mysql )
186 - server? (
187 - !prefix? (
188 - acct-group/mysql acct-user/mysql
189 - dev-db/mysql-init-scripts
190 - )
191 - )
192 -"
193 -# For other stuff to bring us in
194 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
195 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
196 -
197 -python_check_deps() {
198 - has_version "dev-python/mysqlclient[${PYTHON_USEDEP}]" \
199 - || has_version "dev-python/mysql-python[${PYTHON_USEDEP}]"
200 -}
201 -
202 -mysql_init_vars() {
203 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
204 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
205 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
206 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
207 -
208 - if [[ -z "${MY_DATADIR}" ]] ; then
209 - MY_DATADIR=""
210 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
211 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
212 - | sed -ne '/datadir/s|^--datadir=||p' \
213 - | tail -n1`
214 - if [[ -z "${MY_DATADIR}" ]] ; then
215 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
216 - | sed -e 's/.*=\s*//' \
217 - | tail -n1`
218 - fi
219 - fi
220 - if [[ -z "${MY_DATADIR}" ]] ; then
221 - MY_DATADIR="${MY_LOCALSTATEDIR}"
222 - einfo "Using default MY_DATADIR"
223 - fi
224 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
225 -
226 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
227 - if [[ -e "${MY_DATADIR}" ]] ; then
228 - # If you get this and you're wondering about it, see bug #207636
229 - elog "MySQL datadir found in ${MY_DATADIR}"
230 - elog "A new one will not be created."
231 - PREVIOUS_DATADIR="yes"
232 - else
233 - PREVIOUS_DATADIR="no"
234 - fi
235 - export PREVIOUS_DATADIR
236 - fi
237 - else
238 - if [[ ${EBUILD_PHASE} == "config" ]] ; then
239 - local new_MY_DATADIR
240 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
241 - | sed -ne '/datadir/s|^--datadir=||p' \
242 - | tail -n1`
243 -
244 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then
245 - ewarn "MySQL MY_DATADIR has changed"
246 - ewarn "from ${MY_DATADIR}"
247 - ewarn "to ${new_MY_DATADIR}"
248 - MY_DATADIR="${new_MY_DATADIR}"
249 - fi
250 - fi
251 - fi
252 -
253 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
254 - export MY_LOCALSTATEDIR MY_LOGDIR
255 - export MY_DATADIR
256 -}
257 -
258 -pkg_pretend() {
259 - if use numa ; then
260 - local CONFIG_CHECK="~NUMA"
261 -
262 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
263 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
264 -
265 - check_extra_config
266 - fi
267 -}
268 -
269 -pkg_setup() {
270 - if [[ ${MERGE_TYPE} != binary ]] ; then
271 - local GCC_MAJOR_SET=$(gcc-major-version)
272 - local GCC_MINOR_SET=$(gcc-minor-version)
273 - # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on
274 - # non x86{,_64} arches
275 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
276 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
277 - eerror "${PN} needs to be built with gcc-4.7 or later."
278 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
279 - die
280 - fi
281 -
282 - use test && python-any-r1_pkg_setup
283 - fi
284 -
285 - if has test ${FEATURES} && \
286 - use server && ! has userpriv ${FEATURES} ; then
287 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
288 - fi
289 -}
290 -
291 -pkg_preinst() {
292 - # Here we need to see if the implementation switched client libraries
293 - # We check if this is a new instance of the package and a client library already exists
294 - local SHOW_ABI_MESSAGE libpath
295 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so" ]] ; then
296 - libpath=$(readlink "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so")
297 - elog "Due to ABI changes when switching between different client libraries,"
298 - elog "revdep-rebuild must find and rebuild all packages linking to libperconaserverclient."
299 - elog "Please run: revdep-rebuild --library ${libpath}"
300 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
301 - fi
302 -}
303 -
304 -pkg_postinst() {
305 - # Make sure the vars are correctly initialized
306 - mysql_init_vars
307 -
308 - # Create log directory securely if it does not exist
309 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
310 -
311 - if use server ; then
312 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
313 - einfo
314 - elog "You might want to run:"
315 - elog "\"emerge --config =${CATEGORY}/${PF}\""
316 - elog "if this is a new install."
317 - elog
318 - elog "If you are switching server implentations, you should run the"
319 - elog "mysql_upgrade tool."
320 - einfo
321 - else
322 - einfo
323 - elog "If you are upgrading major versions, you should run the"
324 - elog "mysql_upgrade tool."
325 - einfo
326 - fi
327 - fi
328 -
329 - # Note about configuration change
330 - einfo
331 - elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
332 - elog "to several files in /etc/mysql/mysql.d."
333 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
334 - elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
335 - elog "You may have as many files as needed and they are read alphabetically."
336 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
337 - einfo
338 -}
339 -
340 -src_unpack() {
341 - unpack ${A}
342 - # Grab the patches
343 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
344 -
345 - mv -f "${WORKDIR}/${MY_P}" "${S}" || die
346 -}
347 -
348 -src_prepare() {
349 - cmake-utils_src_prepare
350 -
351 - if use jemalloc ; then
352 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
353 - fi
354 -
355 - if use tcmalloc ; then
356 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
357 - fi
358 -
359 - # Don't build bundled xz-utils
360 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
361 - echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
362 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
363 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
364 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
365 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
366 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
367 - fi
368 -
369 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
370 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
371 - fi
372 -
373 - # Remove bundled libs so we cannot accidentally use them
374 - # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394
375 - rm -rv \
376 - "${S}"/extra/protobuf \
377 - "${S}"/extra/libevent \
378 - "${S}"/storage/rocksdb/third_party \
379 - "${S}"/storage/tokudb/PerconaFT/third_party \
380 - "${S}"/zlib \
381 - || die
382 -
383 - # Don't clash with dev-db/mysql-connector-c
384 - rm \
385 - man/my_print_defaults.1 \
386 - man/perror.1 \
387 - man/zlib_decompress.1 \
388 - || die
389 -
390 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
391 - if [[ -d "${S}/support-files/SELinux" ]] ; then
392 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
393 - fi
394 -
395 - if use libressl ; then
396 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
397 - "${S}/cmake/ssl.cmake" || die
398 - fi
399 -
400 - sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
401 -}
402 -
403 -src_configure(){
404 - # Bug #114895, bug #110149
405 - filter-flags "-O" "-O[01]"
406 -
407 - append-cxxflags -felide-constructors
408 -
409 - # bug #283926, with GCC4.4, this is required to get correct behavior.
410 - append-flags -fno-strict-aliasing
411 -
412 - if use tokudb ; then
413 - # https://jira.percona.com/browse/PS-4399
414 - append-cxxflags -Wno-error=shadow
415 - fi
416 -
417 - if use client-libs ; then
418 - multilib-minimal_src_configure
419 - else
420 - multilib_src_configure
421 - fi
422 -}
423 -
424 -multilib_src_configure() {
425 - debug-print-function ${FUNCNAME} "$@"
426 -
427 - if ! multilib_is_native_abi && ! use client-libs ; then
428 - return
429 - fi
430 -
431 - CMAKE_BUILD_TYPE="RelWithDebInfo"
432 -
433 - # debug hack wrt #497532
434 - mycmakeargs=(
435 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
436 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
437 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
438 - -DMYSQL_DATADIR="${EPREFIX%/}/var/lib/mysql"
439 - -DSYSCONFDIR="${EPREFIX%/}/etc/mysql"
440 - -DINSTALL_BINDIR=bin
441 - -DINSTALL_DOCDIR=share/doc/${PF}
442 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
443 - -DINSTALL_INCLUDEDIR=include/mysql
444 - -DINSTALL_INFODIR=share/info
445 - -DINSTALL_LIBDIR=$(get_libdir)
446 - -DINSTALL_MANDIR=share/man
447 - -DINSTALL_MYSQLSHAREDIR=share/mysql
448 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
449 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
450 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
451 - -DINSTALL_SBINDIR=sbin
452 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
453 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
454 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
455 - ### TODO: make this system but issues with UTF-8 prevent it
456 - -DWITH_EDITLINE=bundled
457 - -DWITH_ZLIB=system
458 - -DWITH_LIBWRAP=0
459 - -DENABLED_LOCAL_INFILE=1
460 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
461 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
462 - -DWITH_DEFAULT_FEATURE_SET=0
463 - # The build forces this to be defined when cross-compiling. We pass it
464 - # all the time for simplicity and to make sure it is actually correct.
465 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
466 - -DWITH_CURL=system
467 - -DWITH_BOOST="${WORKDIR}/boost_1_59_0"
468 - -DWITH_PROTOBUF=system
469 - )
470 -
471 - if use test ; then
472 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
473 - else
474 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
475 - fi
476 -
477 - if ! use yassl ; then
478 - mycmakeargs+=( -DWITH_SSL=system )
479 - else
480 - mycmakeargs+=( -DWITH_SSL=bundled )
481 - fi
482 -
483 - if ! use client-libs ; then
484 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
485 - fi
486 -
487 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
488 - # systemtap only works on native ABI, bug 530132
489 - if multilib_is_native_abi ; then
490 - mycmakeargs+=(
491 - -DENABLE_DTRACE=$(usex systemtap)
492 - )
493 - else
494 - mycmakeargs+=(
495 - -DWITHOUT_TOOLS=1
496 - -DWITH_READLINE=1
497 - -DENABLE_DTRACE=0
498 - )
499 - fi
500 -
501 - if multilib_is_native_abi && use server ; then
502 - mycmakeargs+=(
503 - -DWITH_LIBEVENT=system
504 - -DWITH_LZ4=system
505 - -DWITH_MECAB=$(usex cjk system OFF)
506 - -DWITH_NUMA=$(usex numa ON OFF)
507 - -DWITH_RAPID=$(usex experimental ON OFF)
508 - )
509 -
510 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then
511 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
512 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
513 - ewarn "You MUST file bugs without these variables set."
514 -
515 - mycmakeargs+=(
516 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
517 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
518 - )
519 - elif ! use latin1 ; then
520 - mycmakeargs+=(
521 - -DDEFAULT_CHARSET=utf8
522 - -DDEFAULT_COLLATION=utf8_general_ci
523 - )
524 - else
525 - mycmakeargs+=(
526 - -DDEFAULT_CHARSET=latin1
527 - -DDEFAULT_COLLATION=latin1_swedish_ci
528 - )
529 - fi
530 -
531 - mycmakeargs+=(
532 - -DEXTRA_CHARSETS=all
533 - -DDISABLE_SHARED=$(usex static YES NO)
534 - -DWITH_DEBUG=$(usex debug)
535 - -DWITH_EMBEDDED_SERVER=OFF
536 - )
537 -
538 - if use profiling ; then
539 - # Setting to OFF doesn't work: Once set, profiling options will be added
540 - # to `mysqld --help` output via sql/sys_vars.cc causing
541 - # "main.mysqld--help-notwin" test to fail
542 - mycmakeargs+=( -DENABLED_PROFILING=ON )
543 - fi
544 -
545 - if use static ; then
546 - mycmakeargs+=( -DWITH_PIC=1 )
547 - fi
548 -
549 - # Storage engines
550 - mycmakeargs+=(
551 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
552 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
553 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
554 - -DWITH_CSV_STORAGE_ENGINE=1
555 - -DWITH_FEDERATED_STORAGE_ENGINE=1
556 - -DWITH_HEAP_STORAGE_ENGINE=1
557 - -DWITH_INNOBASE_STORAGE_ENGINE=1
558 - -DWITH_INNODB_MEMCACHED=0
559 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
560 - -DWITH_MYISAM_STORAGE_ENGINE=1
561 - -DWITH_PARTITION_STORAGE_ENGINE=1
562 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
563 - $(usex tokudb '' -DWITHOUT_TOKUDB=1)
564 - )
565 -
566 - if use tokudb ; then
567 - # TokuDB Backup plugin requires valgrind unconditionally
568 - mycmakeargs+=(
569 - $(usex tokudb-backup-plugin '' -DTOKUDB_BACKUP_DISABLED=1)
570 - )
571 - fi
572 -
573 - else
574 - mycmakeargs+=(
575 - -DWITHOUT_SERVER=1
576 - -DWITH_EMBEDDED_SERVER=OFF
577 - -DEXTRA_CHARSETS=none
578 - )
579 - fi
580 -
581 - cmake-utils_src_configure
582 -}
583 -
584 -src_compile() {
585 - if use client-libs ; then
586 - multilib-minimal_src_compile
587 - else
588 - multilib_src_compile
589 - fi
590 -}
591 -
592 -multilib_src_compile() {
593 - cmake-utils_src_compile
594 -}
595 -
596 -# Official test instructions:
597 -# ulimit -n 16500 && \
598 -# USE='latin1 perl server' \
599 -# FEATURES='test userpriv -usersandbox' \
600 -# ebuild percona-server-X.X.XX.ebuild \
601 -# digest clean package
602 -src_test() {
603 - _disable_test() {
604 - local rawtestname reason
605 - rawtestname="${1}" ; shift
606 - reason="${@}"
607 - ewarn "test '${rawtestname}' disabled: '${reason}'"
608 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
609 - }
610 -
611 - local TESTDIR="${BUILD_DIR}/mysql-test"
612 - local retstatus_unit
613 - local retstatus_tests
614 -
615 - if ! use server ; then
616 - einfo "Skipping server tests due to minimal build."
617 - return 0
618 - fi
619 -
620 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
621 - # localhost. Also causes weird failures.
622 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
623 -
624 - if [[ $UID -eq 0 ]] ; then
625 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
626 - fi
627 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
628 -
629 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
630 -
631 - # Run CTest (test-units)
632 - cmake-utils_src_test
633 - retstatus_unit=$?
634 -
635 - # Ensure that parallel runs don't die
636 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
637 - # Enable parallel testing, auto will try to detect number of cores
638 - # You may set this by hand.
639 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
640 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
641 -
642 - # create directories because mysqladmin might run out of order
643 - mkdir -p "${T}"/var-tests{,/log} || die
644 -
645 - # Run mysql tests
646 - pushd "${TESTDIR}" &>/dev/null || die
647 -
648 - touch "${T}/disabled.def"
649 - # These are failing in Percona-Server 5.7 for now and are believed to be
650 - # false positives or are known to fail:
651 - #
652 - # group_replication.gr_communication_configuration: requires a valid local network address
653 - # which clashes with FEATURES=network-sandbox
654 - # innodb.xtradb_compressed_columns_consistency: long running test which tends to timeout
655 - # on a busy host
656 - # keyring_vault.keyring_vault_timeout: requires network access to vault.public-ci.percona.com
657 - # which clashes with FEATURES=network-sandbox
658 - # rocksdb.prefix_extractor_override: https://jira.percona.com/browse/PS-5199
659 - # rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223
660 - # rpl.rpl_multi_source_mts_reset_worker_info: https://jira.percona.com/browse/PS-3786
661 - # tokudb.bugs.5733_tokudb: https://jira.percona.com/browse/PS-4274
662 - # x.crud_insert_cast: https://jira.percona.com/browse/PS-5032
663 - # x.insert_table_bad_column: https://jira.percona.com/browse/PS-5032
664 - # x.insert_table_bad_numcolumns: https://jira.percona.com/browse/PS-5032
665 - # x.insert_table_bad_column_type: https://jira.percona.com/browse/PS-5032
666 - # x.insert_table: https://jira.percona.com/browse/PS-5032
667 - # x.update_crud_arrayappend_o: https://jira.percona.com/browse/PS-5032
668 - # x.update_crud_arrayinsert_o: https://jira.percona.com/browse/PS-5032
669 - # x.mysqlxtest_help: https://jira.percona.com/browse/PS-5019
670 - # x.admin_kill_client_mysqlx: https://jira.percona.com/browse/PS-5019
671 - #
672 - local t
673 -
674 - for t in \
675 - group_replication.gr_communication_configuration \
676 - innodb.xtradb_compressed_columns_consistency \
677 - keyring_vault.keyring_vault_timeout \
678 - rocksdb.prefix_extractor_override \
679 - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \
680 - rpl.rpl_multi_source_mts_reset_worker_info \
681 - tokudb.bugs.5733_tokudb \
682 - x.crud_insert_cast \
683 - x.insert_table_bad_column \
684 - x.insert_table_bad_numcolumns \
685 - x.insert_table_bad_column_type \
686 - x.insert_table \
687 - x.update_crud_arrayappend_o \
688 - x.update_crud_arrayinsert_o \
689 - x.mysqlxtest_help \
690 - x.admin_kill_client_mysqlx \
691 - ; do
692 - _disable_test "$t" "False positives in Gentoo / Known bug"
693 - done
694 -
695 - if has_version ">=dev-libs/openssl-1.1.1" ; then
696 - for t in \
697 - main.ssl_8k_key \
698 - auth_sec.mysql_ssl_connection \
699 - main.ssl_verify_identity \
700 - main.ssl_crl \
701 - main.grant_alter_user_qa \
702 - auth_sec.ssl_auto_detect \
703 - encryption.innodb_onlinealter_encryption \
704 - main.ssl_ca \
705 - main.ssl_cipher \
706 - main.grant_user_lock_qa \
707 - auth_sec.openssl_cert_generation \
708 - main.ssl_bug75311 \
709 - main.ssl_compress \
710 - main.ssl \
711 - main.plugin_auth_sha256_tls \
712 - main.ssl_ecdh \
713 - main.openssl_1 \
714 - auth_sec.cert_verify \
715 - main.mysql_ssl_default \
716 - main.percona_tls \
717 - auth_sec.tls \
718 - auth_sec.ssl_mode \
719 - binlog.binlog_grant_alter_user \
720 - x.connection_tls_version \
721 - x.connection_openssl \
722 - ; do
723 - _disable_test "$t" "Known >=openssl-1.1.1 failures"
724 - done
725 - fi
726 -
727 - if use numa && use kernel_linux ; then
728 - # bug 584880
729 - if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then
730 - for t in sys_vars.innodb_numa_interleave_basic ; do
731 - _disable_test "$t" "Test $t requires system with NUMA support"
732 - done
733 - fi
734 - fi
735 -
736 - if use tokudb ; then
737 - if [[ -f "/sys/kernel/mm/transparent_hugepage/enabled" ]] ; then
738 - if grep -q -E "\[always\]" /sys/kernel/mm/transparent_hugepage/enabled &>/dev/null ; then
739 - # TokuDB refuses to start when transparent hugepages are enabled
740 - for t in \
741 - tokudb.rows-32m-rand-insert \
742 - tokudb.savepoint-2 \
743 - tokudb.savepoint-3 \
744 - tokudb.savepoint-4 \
745 - tokudb.savepoint-1078 \
746 - tokudb.savepoint-1078-2 \
747 - tokudb.savepoint-1078-3 \
748 - tokudb.savepoint-1078-4 \
749 - ; do
750 - _disable_test "$t" "TokuDB will not work with transparent hugepages enabled"
751 - done
752 - fi
753 - else
754 - einfo "Cannot determine transparent hugepage status."
755 - einfo "Please note that TokuDB refuses to start when transparent hugepages are enabled!"
756 - fi
757 - fi
758 -
759 - if ! use latin1 ; then
760 - # The following tests will fail if DEFAULT_CHARSET
761 - # isn't set to latin1:
762 - for t in \
763 - binlog.binlog_mysqlbinlog_filter \
764 - binlog.binlog_xa_prepared_disconnect \
765 - funcs_1.is_columns_mysql \
766 - funcs_1.is_tables_mysql \
767 - funcs_1.is_triggers \
768 - innodb.innodb_pagesize_max_recordsize \
769 - innodb.innodb-system-table-view \
770 - innodb.mysqldump_max_recordsize \
771 - main.mysql_client_test \
772 - main.mysqld--help-notwin \
773 - main.type_string \
774 - main.information_schema \
775 - perfschema.binlog_edge_mix \
776 - perfschema.binlog_edge_stmt \
777 - rpl.rpl_xa_survive_disconnect \
778 - rpl.rpl_xa_survive_disconnect_lsu_off \
779 - rpl.rpl_xa_survive_disconnect_table \
780 - ; do
781 - _disable_test "$t" "requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set"
782 - done
783 - fi
784 -
785 - # Try to increase file limits to increase test coverage
786 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
787 - # Upper limit comes from parts.partition_* tests
788 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
789 -
790 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
791 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
792 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
793 -
794 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
795 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
796 - else
797 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
798 - fi
799 - else
800 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
801 - fi
802 - else
803 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
804 - fi
805 -
806 - # run mysql-test tests
807 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
808 - retstatus_tests=$?
809 -
810 - popd &>/dev/null || die
811 -
812 - # Cleanup is important for these testcases.
813 - pkill -9 -f "${S}/ndb" 2>/dev/null
814 - pkill -9 -f "${S}/sql" 2>/dev/null
815 -
816 - local failures=""
817 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
818 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
819 -
820 - [[ -z "$failures" ]] || die "Test failures: $failures"
821 - einfo "Tests successfully completed"
822 -}
823 -
824 -src_install() {
825 - local MULTILIB_WRAPPED_HEADERS
826 - local MULTILIB_CHOST_TOOLS
827 - if use client-libs ; then
828 - # headers with ABI specific data
829 - MULTILIB_WRAPPED_HEADERS=(
830 - /usr/include/mysql/server/my_config.h
831 - /usr/include/mysql/server/mysql_version.h )
832 -
833 - # wrap the config scripts
834 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
835 - multilib-minimal_src_install
836 - else
837 - multilib_src_install
838 - multilib_src_install_all
839 - fi
840 -}
841 -
842 -# Intentionally override eclass function
843 -multilib_src_install() {
844 -
845 - cmake-utils_src_install
846 -
847 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
848 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
849 -}
850 -
851 -multilib_src_install_all() {
852 - # Make sure the vars are correctly initialized
853 - mysql_init_vars
854 -
855 - # Convenience links
856 - einfo "Making Convenience links for mysqlcheck multi-call binary"
857 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
858 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
859 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
860 -
861 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
862 - if [[ -d "${ED}/usr/data" ]] ; then
863 - rm -Rf "${ED}/usr/data" || die
864 - fi
865 -
866 - # Unless they explicitly specific USE=test, then do not install the
867 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
868 - # validation of your database configuration after tuning it.
869 - if ! use test ; then
870 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
871 - fi
872 -
873 - # Configuration stuff
874 - einfo "Building default configuration ..."
875 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
876 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
877 - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
878 - eprefixify "${TMPDIR}/my.cnf"
879 - doins "${TMPDIR}/my.cnf"
880 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
881 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
882 - eprefixify "${TMPDIR}/50-distro-client.cnf"
883 - doins "${TMPDIR}/50-distro-client.cnf"
884 -
885 - if use server ; then
886 - mycnf_src="my.cnf.distro-server"
887 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
888 - "${FILESDIR}/${mycnf_src}" \
889 - > "${TMPDIR}/my.cnf.ok" || die
890 -
891 - if use prefix ; then
892 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
893 - "${TMPDIR}/my.cnf.ok" || die
894 - fi
895 -
896 - if use latin1 ; then
897 - sed -i \
898 - -e "/character-set/s|utf8|latin1|g" \
899 - "${TMPDIR}/my.cnf.ok" || die
900 - fi
901 -
902 - eprefixify "${TMPDIR}/my.cnf.ok"
903 -
904 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
905 -
906 - if use tokudb ; then
907 - # Remove some unwanted files
908 - rm -fv \
909 - "${ED%/}"/usr/COPYING.AGPLv3 \
910 - "${ED%/}"/usr/COPYING.GPLv2 \
911 - "${ED%/}"/usr/PATENTS \
912 - "${ED%/}"/usr/README.md \
913 - || die
914 - fi
915 - fi
916 -
917 - #Remove mytop if perl is not selected
918 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
919 -}
920 -
921 -pkg_config() {
922 - _getoptval() {
923 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
924 - local section="$1"
925 - local flag="--${2}="
926 - local extra_options="${3}"
927 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
928 - }
929 - local old_MY_DATADIR="${MY_DATADIR}"
930 - local old_HOME="${HOME}"
931 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
932 - export HOME=${EPREFIX%/}/root
933 -
934 - # Make sure the vars are correctly initialized
935 - mysql_init_vars
936 -
937 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
938 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
939 - die "Minimal builds do NOT include the MySQL server"
940 - fi
941 -
942 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then
943 - local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}"
944 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
945 - local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}"
946 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
947 -
948 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then
949 - if [[ -d "${MY_DATADIR_s}" ]] ; then
950 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
951 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
952 - else
953 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
954 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
955 - || die "Moving MY_DATADIR failed"
956 - fi
957 - else
958 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
959 - if [[ -d "${MY_DATADIR_s}" ]] ; then
960 - ewarn "Attempting to use ${MY_DATADIR_s}"
961 - else
962 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
963 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
964 - fi
965 - fi
966 - fi
967 -
968 - local pwd1="a"
969 - local pwd2="b"
970 - local maxtry=15
971 -
972 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
973 - local tmp_mysqld_password_source=
974 -
975 - for tmp_mysqld_password_source in mysql client ; do
976 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
977 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
978 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
979 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
980 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
981 - MYSQL_ROOT_PASSWORD=
982 - continue
983 - fi
984 -
985 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
986 - break
987 - fi
988 - done
989 -
990 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
991 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
992 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
993 - fi
994 -
995 - unset tmp_mysqld_password_source
996 - fi
997 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
998 - # These are dir+prefix
999 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
1000 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1001 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
1002 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1003 -
1004 - if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then
1005 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
1006 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR"
1007 - fi
1008 -
1009 - if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then
1010 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
1011 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN"
1012 - fi
1013 -
1014 - if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then
1015 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
1016 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG"
1017 - fi
1018 -
1019 - if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then
1020 - ewarn "You have already a MySQL database in place."
1021 - ewarn "(${ROOT%/}/${MY_DATADIR}/*)"
1022 - ewarn "Please rename or delete it if you wish to replace it."
1023 - die "MySQL database already exists!"
1024 - fi
1025 -
1026 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1027 - # localhost. Also causes weird failures.
1028 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1029 -
1030 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
1031 -
1032 - einfo "Please provide a password for the mysql 'root' user now"
1033 - einfo "or through the ${HOME}/.my.cnf file."
1034 - ewarn "Avoid [\"'\\_%] characters in the password"
1035 - read -rsp " >" pwd1 ; echo
1036 -
1037 - einfo "Retype the password"
1038 - read -rsp " >" pwd2 ; echo
1039 -
1040 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1041 - die "Passwords are not the same"
1042 - fi
1043 - MYSQL_ROOT_PASSWORD="${pwd1}"
1044 - unset pwd1 pwd2
1045 - fi
1046 -
1047 - local options
1048 - local sqltmp="$(emktemp)"
1049 -
1050 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1051 - # see http://bugs.mysql.com/bug.php?id=31312
1052 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
1053 -
1054 - # Figure out which options we need to disable to do the setup
1055 - local helpfile="${TMPDIR%/}/mysqld-help"
1056 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
1057 - for opt in host-cache name-resolve networking slave-start \
1058 - federated ssl log-bin relay-log slow-query-log external-locking \
1059 - log-slave-updates \
1060 - ; do
1061 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1062 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1063 - done
1064 -
1065 - einfo "Creating the mysql database and setting proper permissions on it ..."
1066 -
1067 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
1068 - PID_DIR="${EROOT%/}/var/run/mysqld"
1069 - if [[ ! -d "${PID_DIR}" ]] ; then
1070 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
1071 - fi
1072 -
1073 - if [[ ! -d "${MY_DATADIR}" ]] ; then
1074 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
1075 - fi
1076 -
1077 - pushd "${TMPDIR}" &>/dev/null || die
1078 -
1079 - # Filling timezones, see
1080 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
1081 - echo "USE mysql;" >"${sqltmp}"
1082 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
1083 - chown mysql "${sqltmp}" || die
1084 -
1085 - # --initialize-insecure will not set root password
1086 - # --initialize would set a random one in the log which we don't need as we set it ourselves
1087 - local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
1088 - cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
1089 - einfo "Command: ${cmd[*]}"
1090 - su -s /bin/sh -c "${cmd[*]}" mysql \
1091 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
1092 - if [[ $? -ne 0 ]] ; then
1093 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
1094 - die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
1095 - fi
1096 - popd &>/dev/null || die
1097 - [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \
1098 - || die "MySQL databases not installed"
1099 -
1100 - use prefix || options="${options} --user=mysql"
1101 -
1102 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
1103 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
1104 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
1105 - ${options} \
1106 - $(use prefix || echo --user=mysql) \
1107 - --log-warnings=0 \
1108 - --basedir=${EROOT%/}/usr \
1109 - --datadir=${ROOT%/}/${MY_DATADIR} \
1110 - --max_allowed_packet=8M \
1111 - --net_buffer_length=16K \
1112 - --socket=${socket} \
1113 - --pid-file=${pidfile} \
1114 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
1115 - #einfo "About to start mysqld: ${mysqld}"
1116 - ebegin "Starting mysqld"
1117 - einfo "Command ${mysqld}"
1118 - ${mysqld} &
1119 - rc=$?
1120 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1121 - maxtry=$((${maxtry}-1))
1122 - echo -n "."
1123 - sleep 1
1124 - done
1125 - eend $rc
1126 -
1127 - if ! [[ -S "${socket}" ]] ; then
1128 - die "Completely failed to start up mysqld with: ${mysqld}"
1129 - fi
1130 -
1131 - ebegin "Setting root password"
1132 - # Do this from memory, as we don't want clear text passwords in temp files
1133 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'"
1134 - "${EROOT%/}/usr/bin/mysql" \
1135 - --no-defaults \
1136 - "--socket=${socket}" \
1137 - -hlocalhost \
1138 - -e "${sql}"
1139 - eend $?
1140 -
1141 - # Stop the server and cleanup
1142 - einfo "Stopping the server ..."
1143 - kill $(< "${pidfile}" )
1144 - rm -f "${sqltmp}"
1145 - wait %1
1146 - einfo "Done"
1147 -}
1148
1149 diff --git a/dev-db/percona-server/percona-server-8.0.17.8.ebuild b/dev-db/percona-server/percona-server-8.0.17.8.ebuild
1150 deleted file mode 100644
1151 index 4bb5df6ecd4..00000000000
1152 --- a/dev-db/percona-server/percona-server-8.0.17.8.ebuild
1153 +++ /dev/null
1154 @@ -1,1132 +0,0 @@
1155 -# Copyright 1999-2019 Gentoo Authors
1156 -# Distributed under the terms of the GNU General Public License v2
1157 -
1158 -EAPI="7"
1159 -MY_EXTRAS_VER="20191031-0134Z"
1160 -
1161 -CMAKE_MAKEFILE_GENERATOR=emake
1162 -
1163 -inherit cmake-utils flag-o-matic linux-info \
1164 - multiprocessing prefix toolchain-funcs check-reqs
1165 -
1166 -MY_BOOST_VERSION="1.69.0"
1167 -MY_PV=$(ver_rs 3 '-')
1168 -MY_PV="${MY_PV//_pre*}"
1169 -MY_PN="Percona-Server"
1170 -MY_P="${PN}-${MY_PV}"
1171 -MY_MAJOR_PV=$(ver_cut 1-2)
1172 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/${MY_MAJOR_PV}/"
1173 -
1174 -S="${WORKDIR}/${PN}-${MY_PV}"
1175 -
1176 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz
1177 - https://dl.bintray.com/boostorg/release/${MY_BOOST_VERSION}/source/boost_$(ver_rs 1- _ ${MY_BOOST_VERSION}).tar.bz2
1178 -"
1179 -
1180 -# Gentoo patches to MySQL
1181 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then
1182 - SRC_URI="${SRC_URI}
1183 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1184 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
1185 -fi
1186 -
1187 -HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server"
1188 -DESCRIPTION="Fully compatible, enhanced and open source drop-in replacement for MySQL"
1189 -LICENSE="GPL-2"
1190 -SLOT="0"
1191 -IUSE="cjk cracklib debug jemalloc latin1 libressl numa pam +perl profiling
1192 - rocksdb router selinux +server tcmalloc test tokudb tokudb-backup-plugin"
1193 -
1194 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
1195 -RESTRICT="!test? ( test ) libressl? ( test )"
1196 -
1197 -REQUIRED_USE="?? ( tcmalloc jemalloc )"
1198 -
1199 -KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
1200 -
1201 -# Shorten the path because the socket path length must be shorter than 107 chars
1202 -# and we will run a mysql server during test phase
1203 -S="${WORKDIR}/mysql"
1204 -
1205 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
1206 - inherit git-r3
1207 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
1208 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
1209 - EGIT_CLONE_TYPE=shallow
1210 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
1211 -else
1212 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
1213 -fi
1214 -
1215 -PATCHES=(
1216 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-8.0.17.patch
1217 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-8.0.17.patch
1218 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch
1219 - "${MY_PATCH_DIR}"/20018_all_percona-server-8.0.17-without-clientlibs-tools.patch
1220 - "${MY_PATCH_DIR}"/20018_all_mysql-8.0.17-add-protobuf-3.8+-support.patch
1221 - "${MY_PATCH_DIR}"/20018_all_percona-server-8.0.17-fix-libressl-support.patch
1222 - "${MY_PATCH_DIR}"/20018_all_percona-server-8.0.16-dont-install-tokudb-misc-files.patch
1223 - "${MY_PATCH_DIR}"/20038_all_percona-server-8.0.16-PS-5873.patch
1224 -)
1225 -
1226 -# Be warned, *DEPEND are version-dependant
1227 -# These are used for both runtime and compiletime
1228 -COMMON_DEPEND="
1229 - >=app-arch/lz4-0_p131:=
1230 - dev-libs/icu:=
1231 - dev-libs/libedit
1232 - dev-libs/libevent:=
1233 - >=dev-libs/protobuf-3.8:=
1234 - net-libs/libtirpc:=
1235 - >=sys-libs/zlib-1.2.3:0=
1236 - cjk? ( app-text/mecab:= )
1237 - jemalloc? ( dev-libs/jemalloc:0= )
1238 - kernel_linux? (
1239 - dev-libs/libaio:0=
1240 - sys-process/procps:0=
1241 - )
1242 - libressl? ( dev-libs/libressl:0= )
1243 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
1244 - numa? ( sys-process/numactl )
1245 - server? (
1246 - pam? ( sys-libs/pam:0= )
1247 - )
1248 - tcmalloc? ( dev-util/google-perftools:0= )
1249 -"
1250 -DEPEND="${COMMON_DEPEND}
1251 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
1252 - dev-libs/re2
1253 - net-libs/rpcsvc-proto
1254 - virtual/yacc
1255 - test? (
1256 - acct-group/mysql acct-user/mysql
1257 - dev-perl/JSON
1258 - )
1259 -"
1260 -RDEPEND="${COMMON_DEPEND}
1261 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
1262 - selinux? ( sec-policy/selinux-mysql )
1263 - !prefix? (
1264 - acct-group/mysql acct-user/mysql
1265 - dev-db/mysql-init-scripts
1266 - )
1267 -"
1268 -# For other stuff to bring us in
1269 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
1270 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
1271 -
1272 -CHECKREQS_DISK_BUILD="8G"
1273 -
1274 -mysql_init_vars() {
1275 - : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
1276 - : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
1277 - : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
1278 - : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
1279 - MY_DATADIR="${MY_LOCALSTATEDIR}"
1280 -
1281 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
1282 - export MY_LOCALSTATEDIR MY_LOGDIR
1283 - export MY_DATADIR
1284 -}
1285 -
1286 -pkg_pretend() {
1287 - [[ ${MERGE_TYPE} == binary ]] && return
1288 - use server && check-reqs_pkg_pretend
1289 -}
1290 -
1291 -pkg_setup() {
1292 - [[ ${MERGE_TYPE} == binary ]] && return
1293 -
1294 - if has test ${FEATURES} ; then
1295 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
1296 - # localhost. Also causes weird failures.
1297 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1298 -
1299 - if ! has userpriv ${FEATURES} ; then
1300 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1301 - fi
1302 -
1303 - local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null)
1304 - [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] \
1305 - && die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!"
1306 -
1307 - if use latin1 ; then
1308 - # Upstream only supports tests with default charset
1309 - die "Testing with USE=latin1 is not supported."
1310 - fi
1311 - fi
1312 -
1313 - if use kernel_linux ; then
1314 - if use numa ; then
1315 - linux-info_get_any_version
1316 -
1317 - local CONFIG_CHECK="~NUMA"
1318 -
1319 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
1320 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
1321 -
1322 - check_extra_config
1323 - fi
1324 - fi
1325 -
1326 - use server && check-reqs_pkg_setup
1327 -}
1328 -
1329 -src_unpack() {
1330 - unpack ${A}
1331 -
1332 - # Grab the patches
1333 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
1334 -
1335 - mv -f "${WORKDIR}/${MY_P}" "${S}" || die
1336 -}
1337 -
1338 -src_prepare() {
1339 - # Avoid rpm call which would trigger sandbox, #692368
1340 - sed -i \
1341 - -e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \
1342 - CMakeLists.txt || die
1343 -
1344 - if use jemalloc ; then
1345 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
1346 - fi
1347 -
1348 - if use tcmalloc ; then
1349 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
1350 - fi
1351 -
1352 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
1353 - if [[ -d "${S}/support-files/SELinux" ]] ; then
1354 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
1355 - fi
1356 -
1357 - # Remove man pages for client-lib tools we don't install
1358 - rm \
1359 - man/my_print_defaults.1 \
1360 - man/perror.1 \
1361 - man/zlib_decompress.1 \
1362 - || die
1363 -
1364 - cmake-utils_src_prepare
1365 -}
1366 -
1367 -src_configure(){
1368 - # Bug #114895, bug #110149
1369 - filter-flags "-O" "-O[01]"
1370 -
1371 - append-cxxflags -felide-constructors
1372 -
1373 - # bug #283926, with GCC4.4, this is required to get correct behavior.
1374 - append-flags -fno-strict-aliasing
1375 -
1376 - CMAKE_BUILD_TYPE="RelWithDebInfo"
1377 -
1378 - # debug hack wrt #497532
1379 - mycmakeargs=(
1380 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1381 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1382 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
1383 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
1384 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
1385 - -DINSTALL_BINDIR=bin
1386 - -DINSTALL_DOCDIR=share/doc/${PF}
1387 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
1388 - -DINSTALL_INCLUDEDIR=include/mysql
1389 - -DINSTALL_INFODIR=share/info
1390 - -DINSTALL_LIBDIR=$(get_libdir)
1391 - -DINSTALL_MANDIR=share/man
1392 - -DINSTALL_MYSQLSHAREDIR=share/mysql
1393 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
1394 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
1395 - -DINSTALL_SBINDIR=sbin
1396 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
1397 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
1398 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
1399 - -DWITH_EDITLINE=system
1400 - -DWITH_ZLIB=system
1401 - -DWITH_SSL=system
1402 - -DWITH_LIBWRAP=0
1403 - -DENABLED_LOCAL_INFILE=1
1404 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1405 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
1406 - -DWITH_DEFAULT_FEATURE_SET=0
1407 - # The build forces this to be defined when cross-compiling. We pass it
1408 - # all the time for simplicity and to make sure it is actually correct.
1409 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
1410 - -DCMAKE_POSITION_INDEPENDENT_CODE=ON
1411 - -DWITH_CURL=system
1412 - -DWITH_BOOST="${WORKDIR}/boost_$(ver_rs 1- _ ${MY_BOOST_VERSION})"
1413 - -DWITH_ROUTER=$(usex router ON OFF)
1414 - )
1415 - if use test ; then
1416 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
1417 - else
1418 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
1419 - fi
1420 -
1421 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
1422 -
1423 - # client/mysql.cc:1131:16: error: redefinition of ‘struct _hist_entry’
1424 - mycmakeargs+=(
1425 - -DUSE_LIBEDIT_INTERFACE=0
1426 - -DUSE_NEW_EDITLINE_INTERFACE=1
1427 - -DHAVE_HIST_ENTRY=1
1428 - )
1429 -
1430 - mycmakeargs+=(
1431 - -DWITH_ICU=system
1432 - -DWITH_RE2=system
1433 - -DWITH_LIBEVENT=system
1434 - -DWITH_LZ4=system
1435 - -DWITH_PROTOBUF=system
1436 - -DWITH_MECAB=$(usex cjk system OFF)
1437 - -DWITH_NUMA=$(usex numa ON OFF)
1438 - # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex
1439 - -DWITH_RAPIDJSON=bundled
1440 - )
1441 -
1442 - if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then
1443 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1444 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1445 - ewarn "You MUST file bugs without these variables set."
1446 - ewarn "Tests will probably fail!"
1447 -
1448 - mycmakeargs+=(
1449 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1450 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1451 - )
1452 - elif use latin1 ; then
1453 - mycmakeargs+=(
1454 - -DDEFAULT_CHARSET=latin1
1455 - -DDEFAULT_COLLATION=latin1_swedish_ci
1456 - )
1457 - else
1458 - mycmakeargs+=(
1459 - -DDEFAULT_CHARSET=utf8mb4
1460 - -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci
1461 - )
1462 - fi
1463 -
1464 - if use server ; then
1465 - mycmakeargs+=(
1466 - -DWITH_EXTRA_CHARSETS=all
1467 - -DWITH_DEBUG=$(usex debug)
1468 - -DWITH_PAM=$(usex pam)
1469 - )
1470 -
1471 - if use profiling ; then
1472 - # Setting to OFF doesn't work: Once set, profiling options will be added
1473 - # to `mysqld --help` output via sql/sys_vars.cc causing
1474 - # "main.mysqld--help-notwin" test to fail
1475 - mycmakeargs+=( -DENABLED_PROFILING=ON )
1476 - fi
1477 -
1478 - # Storage engines
1479 - mycmakeargs+=(
1480 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
1481 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1482 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1483 - -DWITH_CSV_STORAGE_ENGINE=1
1484 - -DWITH_FEDERATED_STORAGE_ENGINE=1
1485 - -DWITH_HEAP_STORAGE_ENGINE=1
1486 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1487 - -DWITH_INNODB_MEMCACHED=0
1488 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1489 - -DWITH_MYISAM_STORAGE_ENGINE=1
1490 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
1491 - -DWITH_TOKUDB=$(usex tokudb 1 0)
1492 - )
1493 - else
1494 - mycmakeargs+=(
1495 - -DWITHOUT_SERVER=1
1496 - -DWITH_SYSTEMD=no
1497 - )
1498 - fi
1499 -
1500 - cmake-utils_src_configure
1501 -}
1502 -
1503 -# Official test instructions:
1504 -# ulimit -n 16500 && \
1505 -# USE='perl server' \
1506 -# FEATURES='test userpriv' \
1507 -# ebuild mysql-X.X.XX.ebuild \
1508 -# digest clean package
1509 -src_test() {
1510 - _disable_test() {
1511 - local rawtestname bug reason
1512 - rawtestname="${1}" ; shift
1513 - bug="${1}" ; shift
1514 - reason="${@}"
1515 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
1516 - echo ${rawtestname} : BUG#${bug} ${reason} >> "${T}/disabled.def"
1517 - }
1518 -
1519 - local TESTDIR="${BUILD_DIR}/mysql-test"
1520 - local retstatus_unit
1521 - local retstatus_tests
1522 -
1523 - # Run CTest (test-units)
1524 - cmake-utils_src_test
1525 - retstatus_unit=$?
1526 -
1527 - # Ensure that parallel runs don't die
1528 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
1529 -
1530 - if [[ -z "${MTR_PARALLEL}" ]] ; then
1531 - local -x MTR_PARALLEL=$(makeopts_jobs)
1532 -
1533 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
1534 - # Running multiple tests in parallel usually require higher ulimit
1535 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
1536 - # are known to hit timeout when system is busy.
1537 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
1538 - # using "auto".
1539 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
1540 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
1541 - einfo "${info_msg}"
1542 - unset info_msg
1543 - MTR_PARALLEL=4
1544 - fi
1545 - else
1546 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
1547 - fi
1548 -
1549 - # create directories because mysqladmin might run out of order
1550 - mkdir -p "${T}"/var-tests{,/log} || die
1551 -
1552 - # Run mysql tests
1553 - pushd "${TESTDIR}" &>/dev/null || die
1554 -
1555 - touch "${T}/disabled.def"
1556 -
1557 - local -a disabled_tests
1558 - disabled_tests+=( "auth_sec.keyring_file_data_qa;0;Won't work with user privileges")
1559 - disabled_tests+=( "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)")
1560 - disabled_tests+=( "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)")
1561 - disabled_tests+=( "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)")
1562 - disabled_tests+=( "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)")
1563 - disabled_tests+=( "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)")
1564 - disabled_tests+=( "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)")
1565 - disabled_tests+=( "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)")
1566 - disabled_tests+=( "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)")
1567 - disabled_tests+=( "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)")
1568 - disabled_tests+=( "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)")
1569 - disabled_tests+=( "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet")
1570 - disabled_tests+=( "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet")
1571 - disabled_tests+=( "rpl_gtid.rpl_gtid_stm_drop_table;90612;Known test failure" )
1572 - disabled_tests+=( "rpl_gtid.rpl_multi_source_mtr_includes;0;Know failure - no upstream bug yet" )
1573 - disabled_tests+=( "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware")
1574 - disabled_tests+=( "main.mysqlpump_basic_lz4;6042;Extra tool output causes false positive" )
1575 - disabled_tests+=( "main.ssl_bug75311;5996;Known test failure" )
1576 -
1577 - local test_ds
1578 - for test_infos_str in "${disabled_tests[@]}" ; do
1579 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
1580 -
1581 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
1582 - die "Invalid test data set, not matching format: ${test_infos_str}"
1583 - fi
1584 -
1585 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
1586 - done
1587 - unset test_ds test_infos_str test_infos_arr
1588 -
1589 - # Try to increase file limits to increase test coverage
1590 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
1591 - # Upper limit comes from parts.partition_* tests
1592 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
1593 -
1594 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
1595 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
1596 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
1597 -
1598 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
1599 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
1600 - else
1601 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
1602 - fi
1603 - else
1604 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
1605 - fi
1606 - else
1607 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
1608 - fi
1609 -
1610 - # run mysql-test tests
1611 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
1612 - retstatus_tests=$?
1613 -
1614 - popd &>/dev/null || die
1615 -
1616 - # Cleanup is important for these testcases.
1617 - pkill -9 -f "${S}/ndb" 2>/dev/null
1618 - pkill -9 -f "${S}/sql" 2>/dev/null
1619 -
1620 - local failures=""
1621 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
1622 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
1623 -
1624 - [[ -z "$failures" ]] || die "Test failures: $failures"
1625 - einfo "Tests successfully completed"
1626 -}
1627 -
1628 -src_install() {
1629 - cmake-utils_src_install
1630 -
1631 - # Make sure the vars are correctly initialized
1632 - mysql_init_vars
1633 -
1634 - # Convenience links
1635 - einfo "Making Convenience links for mysqlcheck multi-call binary"
1636 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
1637 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
1638 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
1639 -
1640 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
1641 - if [[ -d "${ED}/usr/data" ]] ; then
1642 - rm -Rf "${ED}/usr/data" || die
1643 - fi
1644 -
1645 - # Unless they explicitly specific USE=test, then do not install the
1646 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
1647 - # validation of your database configuration after tuning it.
1648 - if ! use test ; then
1649 - rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test"
1650 - fi
1651 -
1652 - # Configuration stuff
1653 - einfo "Building default configuration ..."
1654 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
1655 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
1656 - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
1657 - eprefixify "${TMPDIR}/my.cnf"
1658 - doins "${TMPDIR}/my.cnf"
1659 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
1660 - cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
1661 - eprefixify "${TMPDIR}/50-distro-client.cnf"
1662 - doins "${TMPDIR}/50-distro-client.cnf"
1663 -
1664 - mycnf_src="my.cnf-8.0.distro-server"
1665 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
1666 - "${FILESDIR}/${mycnf_src}" \
1667 - > "${TMPDIR}/my.cnf.ok" || die
1668 -
1669 - if use prefix ; then
1670 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
1671 - "${TMPDIR}/my.cnf.ok" || die
1672 - fi
1673 -
1674 - if use latin1 ; then
1675 - sed -i \
1676 - -e "/character-set/s|utf8mb4|latin1|g" \
1677 - "${TMPDIR}/my.cnf.ok" || die
1678 - fi
1679 -
1680 - eprefixify "${TMPDIR}/my.cnf.ok"
1681 -
1682 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
1683 -
1684 - #Remove mytop if perl is not selected
1685 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
1686 -
1687 - if use router ; then
1688 - rm -rf \
1689 - "${ED}/usr/LICENSE.router" \
1690 - "${ED}/usr/README.router" \
1691 - "${ED}/usr/run" \
1692 - "${ED}/usr/var" \
1693 - || die
1694 - fi
1695 -
1696 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
1697 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
1698 -}
1699 -
1700 -pkg_postinst() {
1701 - # Make sure the vars are correctly initialized
1702 - mysql_init_vars
1703 -
1704 - # Create log directory securely if it does not exist
1705 - # NOTE: $MY_LOGDIR contains $EPREFIX by default
1706 - [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}"
1707 -
1708 - # Note about configuration change
1709 - einfo
1710 - elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
1711 - elog "to several files in /etc/mysql/mysql.d."
1712 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
1713 - elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
1714 - elog "You may have as many files as needed and they are read alphabetically."
1715 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
1716 - einfo
1717 -
1718 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1719 - einfo
1720 - elog "You might want to run:"
1721 - elog " \"emerge --config =${CATEGORY}/${PF}\""
1722 - elog "if this is a new install."
1723 - einfo
1724 - else
1725 - einfo
1726 - elog "Upgrade process for ${PN}-8.x has changed. Please read"
1727 - elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html"
1728 - einfo
1729 - fi
1730 -}
1731 -
1732 -pkg_config() {
1733 - local mysqld_binary="${EROOT}/usr/sbin/mysqld"
1734 - if [[ ! -x "${mysqld_binary}" ]] ; then
1735 - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
1736 - fi
1737 -
1738 - local mysql_binary="${EROOT}/usr/bin/mysql"
1739 - if [[ ! -x "${mysql_binary}" ]] ; then
1740 - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
1741 - fi
1742 -
1743 - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
1744 - if [[ ! -x "${my_print_defaults_binary}" ]] ; then
1745 - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
1746 - fi
1747 -
1748 - if [[ -z "${MYSQL_USER}" ]] ; then
1749 - MYSQL_USER=mysql
1750 - if use prefix ; then
1751 - MYSQL_USER=$(id -u -n 2>/dev/null)
1752 - if [[ -z "${MYSQL_USER}" ]] ; then
1753 - die "Failed to determine current username!"
1754 - fi
1755 - fi
1756 - fi
1757 -
1758 - if [[ -z "${MYSQL_GROUP}" ]] ; then
1759 - MYSQL_GROUP=mysql
1760 - if use prefix ; then
1761 - MYSQL_GROUP=$(id -g -n 2>/dev/null)
1762 - if [[ -z "${MYSQL_GROUP}" ]] ; then
1763 - die "Failed to determine current user groupname!"
1764 - fi
1765 - fi
1766 - fi
1767 -
1768 - einfo "Will use username '${MYSQL_USER}' and group '${MYSQL_GROUP}' ..."
1769 -
1770 - _getoptval() {
1771 - local section="$1"
1772 - local flag="--${2}="
1773 - local extra_options="${3}"
1774 - local cmd=(
1775 - "${my_print_defaults_binary}"
1776 - "${extra_options}"
1777 - "${section}"
1778 - )
1779 - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
1780 -
1781 - if [[ ${#results[@]} -gt 0 ]] ; then
1782 - # When option is set multiple times only return last value
1783 - echo "${results[-1]}"
1784 - fi
1785 - }
1786 -
1787 - _mktemp_dry() {
1788 - # emktemp has no --dry-run option
1789 - local template="${1}"
1790 -
1791 - if [[ -z "${template}" ]] ; then
1792 - if [[ -z "${T}" ]] ; then
1793 - template="/tmp/XXXXXXX"
1794 - else
1795 - template="${T}/XXXXXXX"
1796 - fi
1797 - fi
1798 -
1799 - local template_wo_X=${template//X/}
1800 - local n_X
1801 - let n_X=${#template}-${#template_wo_X}
1802 - if [[ ${n_X} -lt 3 ]] ; then
1803 - echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
1804 - return
1805 - fi
1806 -
1807 - local attempts=0
1808 - local character tmpfile
1809 - while [[ true ]] ; do
1810 - let attempts=attempts+1
1811 -
1812 - new_file=
1813 - while read -n1 character ; do
1814 - if [[ "${character}" == "X" ]] ; then
1815 - tmpfile+="${RANDOM:0:1}"
1816 - else
1817 - tmpfile+="${character}"
1818 - fi
1819 - done < <(echo -n "${template}")
1820 -
1821 - if [[ ! -f "${tmpfile}" ]]
1822 - then
1823 - echo "${tmpfile}"
1824 - return
1825 - fi
1826 -
1827 - if [[ ${attempts} -ge 100 ]] ; then
1828 - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
1829 - return
1830 - fi
1831 - done
1832 - }
1833 -
1834 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
1835 - local -x HOME="${EROOT}/root"
1836 -
1837 - # Make sure the vars are correctly initialized
1838 - mysql_init_vars
1839 -
1840 - # Read currently set data directory
1841 - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
1842 -
1843 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1844 - # localhost. Also causes weird failures.
1845 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1846 -
1847 - if [[ -z "${MY_DATADIR}" ]] ; then
1848 - die "Sorry, unable to find MY_DATADIR!"
1849 - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
1850 - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
1851 - ewarn "Please rename or delete its content if you wish to initialize a new data directory."
1852 - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
1853 - else
1854 - einfo "${PN} data directory detected as '${MY_DATADIR}' ..."
1855 - fi
1856 -
1857 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
1858 - # These are dir+prefix
1859 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
1860 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1861 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
1862 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1863 -
1864 - # Create missing directories.
1865 - # Always check if mysql user can write to directory even if we just
1866 - # created directory because a parent directory might be not
1867 - # accessible for that user.
1868 - PID_DIR="${EROOT}/run/mysqld"
1869 - if [[ ! -d "${PID_DIR}" ]] ; then
1870 - einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
1871 - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
1872 - || die "Failed to create PID directory '${PID_DIR}'!"
1873 - fi
1874 -
1875 - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
1876 - [[ -z "${_pid_dir_testfile}" ]] \
1877 - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
1878 -
1879 - if use prefix ; then
1880 - touch "${_pid_dir_testfile}" &>/dev/null
1881 - else
1882 - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
1883 - fi
1884 -
1885 - if [[ $? -ne 0 ]] ; then
1886 - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
1887 - else
1888 - rm "${_pid_dir_testfile}" || die
1889 - unset _pid_dir_testfile
1890 - fi
1891 -
1892 - if [[ ! -d "${MY_DATADIR}" ]] ; then
1893 - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
1894 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
1895 - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
1896 - fi
1897 -
1898 - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
1899 - [[ -z "${_my_datadir_testfile}" ]] \
1900 - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
1901 -
1902 - if use prefix ; then
1903 - touch "${_my_datadir_testfile}" &>/dev/null
1904 - else
1905 - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
1906 - fi
1907 -
1908 - if [[ $? -ne 0 ]]; then
1909 - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
1910 - else
1911 - rm "${_my_datadir_testfile}" || die
1912 - unset _my_datadir_testfile
1913 - fi
1914 -
1915 - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
1916 - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
1917 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
1918 - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
1919 - fi
1920 -
1921 - if [[ -n "${MYSQL_TMPDIR}" ]] ; then
1922 - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
1923 - [[ -z "${_my_tmpdir_testfile}" ]] \
1924 - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
1925 -
1926 - if use prefix ; then
1927 - touch "${_my_tmpdir_testfile}" &>/dev/null
1928 - else
1929 - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
1930 - fi
1931 -
1932 - if [[ $? -ne 0 ]]; then
1933 - die "${MYSQL_USER} user cannot write into data directory '${MYSQL_TMPDIR}'!"
1934 - else
1935 - rm "${_my_tmpdir_testfile}" || die
1936 - unset _my_tmpdir_testfile
1937 - fi
1938 - else
1939 - # If no tmpdir is set, mysqld will use default system tmpdir.
1940 - # However, we are using tmpdir from package manager at the
1941 - # moment which maybe isn't writeable for $MYSQL_USER...
1942 - MYSQL_TMPDIR="$(_mktemp_dry "${T}/mysqld-tmp.XXXXXXXXX")"
1943 - [[ -z "${MYSQL_TMPDIR}" ]] \
1944 - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
1945 -
1946 - mkdir "${MYSQL_TMPDIR}" || die
1947 - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
1948 - fi
1949 -
1950 - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
1951 - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
1952 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
1953 - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
1954 - fi
1955 -
1956 - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then
1957 - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
1958 - [[ -z "${_my_logbin_testfile}" ]] \
1959 - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
1960 -
1961 - if use prefix ; then
1962 - touch "${_my_logbin_testfile}" &>/dev/null
1963 - else
1964 - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
1965 - fi
1966 -
1967 - if [[ $? -ne 0 ]]; then
1968 - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
1969 - else
1970 - rm "${_my_logbin_testfile}" || die
1971 - unset _my_logbin_testfile
1972 - fi
1973 - fi
1974 -
1975 - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
1976 - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
1977 - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
1978 - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
1979 - fi
1980 -
1981 - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
1982 - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
1983 - [[ -z "${_my_relaylog_testfile}" ]] \
1984 - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
1985 -
1986 - if use prefix ; then
1987 - touch "${_my_relaylog_testfile}" &>/dev/null
1988 - else
1989 - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
1990 - fi
1991 -
1992 - if [[ $? -ne 0 ]]; then
1993 - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
1994 - else
1995 - rm "${_my_relaylog_testfile}" || die
1996 - unset _my_relaylog_testfile
1997 - fi
1998 - fi
1999 -
2000 - local -a config_files
2001 -
2002 - local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf"
2003 - if [[ -f "${config_file}" ]] ; then
2004 - config_files+=( "${config_file}" )
2005 - else
2006 - ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..."
2007 - fi
2008 -
2009 - config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf"
2010 - if [[ -f "${config_file}" ]] ; then
2011 - config_files+=( "${config_file}" )
2012 - else
2013 - ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..."
2014 - fi
2015 -
2016 - if [[ ${#config_files[@]} -gt 0 ]] ; then
2017 - if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then
2018 - local user_answer
2019 -
2020 - echo
2021 - einfo "Please select default authentication plugin (enter number or plugin name):"
2022 - einfo "1) caching_sha2_password [MySQL 8.0 default]"
2023 - einfo "2) mysql_native_password [MySQL 5.7 default]"
2024 - einfo
2025 - einfo "For details see:"
2026 - einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password"
2027 - read -p " >" user_answer
2028 - echo
2029 -
2030 - case "${user_answer}" in
2031 - 1|caching_sha2_password)
2032 - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password
2033 - ;;
2034 - 2|mysql_native_password)
2035 - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password
2036 - ;;
2037 - '')
2038 - die "No authentication plugin selected!"
2039 - ;;
2040 - *)
2041 - die "Authentication plugin '${user_answer}' is unknown/unsupported!"
2042 - ;;
2043 - esac
2044 -
2045 - unset user_answer
2046 - fi
2047 -
2048 - local cfg_option cfg_option_tabs cfg_section
2049 - for config_file in "${config_files[@]}" ; do
2050 - cfg_option="default-authentication-plugin"
2051 - cfg_section="mysqld"
2052 - cfg_option_tabs="\t\t"
2053 - if [[ "${config_file}" == *client.cnf ]] ; then
2054 - cfg_option="default-auth"
2055 - cfg_section="client"
2056 - cfg_option_tabs="\t\t\t\t"
2057 - fi
2058 -
2059 - if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then
2060 - einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
2061 - sed -i \
2062 - -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \
2063 - "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!"
2064 - else
2065 - einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
2066 - sed -i \
2067 - -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \
2068 - "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!"
2069 - fi
2070 - done
2071 - unset cfg_option cfg_option_tabs cfg_section
2072 - fi
2073 - unset config_files config_file
2074 -
2075 - echo
2076 -
2077 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
2078 - local tmp_mysqld_password_source=
2079 -
2080 - for tmp_mysqld_password_source in mysql client ; do
2081 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
2082 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
2083 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
2084 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
2085 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
2086 - MYSQL_ROOT_PASSWORD=
2087 - continue
2088 - fi
2089 -
2090 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
2091 - break
2092 - fi
2093 - done
2094 -
2095 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
2096 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
2097 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
2098 - fi
2099 -
2100 - unset tmp_mysqld_password_source
2101 - fi
2102 -
2103 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
2104 - local pwd1="a"
2105 - local pwd2="b"
2106 -
2107 - echo
2108 - einfo "No password for mysql 'root' user was specified via environment"
2109 - einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
2110 - einfo "file like '${HOME}/.my.cnf'."
2111 - einfo "To continue please provide a password for the mysql 'root' user"
2112 - einfo "now on console:"
2113 - ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
2114 - read -rsp " >" pwd1 ; echo
2115 -
2116 - einfo "Retype the password"
2117 - read -rsp " >" pwd2 ; echo
2118 -
2119 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
2120 - die "Passwords are not the same!"
2121 - fi
2122 -
2123 - MYSQL_ROOT_PASSWORD="${pwd1}"
2124 - unset pwd1 pwd2
2125 -
2126 - echo
2127 - fi
2128 -
2129 - local -a mysqld_options
2130 -
2131 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
2132 - # see http://bugs.mysql.com/bug.php?id=31312
2133 - use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
2134 -
2135 - # Figure out which options we need to disable to do the setup
2136 - local helpfile="${TMPDIR}/mysqld-help"
2137 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
2138 -
2139 - local opt optexp optfull
2140 - for opt in host-cache name-resolve networking slave-start \
2141 - federated ssl log-bin relay-log slow-query-log external-locking \
2142 - log-slave-updates \
2143 - ; do
2144 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
2145 - egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
2146 - done
2147 -
2148 - # Prepare timezones, see
2149 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
2150 - local tz_sql="${TMPDIR}/tz.sql"
2151 - echo "USE mysql;" >"${tz_sql}"
2152 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
2153 - if [[ $? -ne 0 ]] ; then
2154 - die "mysql_tzinfo_to_sql failed!"
2155 - fi
2156 -
2157 - chown ${MYSQL_USER} "${tz_sql}" || die
2158 -
2159 - local mysql_install_log="${TMPDIR}/mysql_install_db.log"
2160 - touch "${mysql_install_log}" || die
2161 - chown ${MYSQL_USER} "${mysql_install_log}" || die
2162 -
2163 - # --initialize-insecure will not set root password
2164 - # --initialize would set a random one in the log which we don't need as we set it ourselves
2165 - local cmd=(
2166 - "${mysqld_binary}"
2167 - "${mysqld_options[@]}"
2168 - "--initialize-insecure"
2169 - "--init-file='${tz_sql}'"
2170 - "--basedir='${EROOT}/usr'"
2171 - "--datadir='${MY_DATADIR}'"
2172 - "--tmpdir='${MYSQL_TMPDIR}'"
2173 - "--log-error='${mysql_install_log}'"
2174 - "--user=${MYSQL_USER}"
2175 - )
2176 -
2177 - einfo "Initializing ${PN} data directory: ${cmd[@]}"
2178 - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
2179 -
2180 - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then
2181 - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
2182 - die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
2183 - fi
2184 -
2185 - local x=${RANDOM}
2186 - local socket="${EROOT}/run/mysqld/mysqld${x}.sock"
2187 - local pidfile="${EROOT}/run/mysqld/mysqld${x}.pid"
2188 - unset x
2189 -
2190 - local mysqld_logfile="${TMPDIR}/mysqld.log"
2191 - touch "${mysqld_logfile}" || die
2192 - chown ${MYSQL_USER} "${mysqld_logfile}" || die
2193 -
2194 - cmd=(
2195 - "${mysqld_binary}"
2196 - "${mysqld_options[@]}"
2197 - "--basedir='${EROOT}/usr'"
2198 - "--datadir='${MY_DATADIR}'"
2199 - "--tmpdir='${MYSQL_TMPDIR}'"
2200 - --max_allowed_packet=8M
2201 - --net_buffer_length=16K
2202 - "--socket='${socket}'"
2203 - "--pid-file='${pidfile}'"
2204 - "--log-error='${mysqld_logfile}'"
2205 - "--user=${MYSQL_USER}"
2206 - )
2207 -
2208 - einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
2209 - eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
2210 -
2211 - echo -n "Waiting for mysqld to accept connections "
2212 - local maxtry=15
2213 - while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
2214 - maxtry=$((${maxtry}-1))
2215 - echo -n "."
2216 - sleep 1
2217 - done
2218 -
2219 - if [[ -S "${socket}" ]] ; then
2220 - # Even with a socket we don't know if mysqld will abort
2221 - # start due to an error so just wait a little bit more...
2222 - maxtry=5
2223 - while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
2224 - maxtry=$((${maxtry}-1))
2225 - echo -n "."
2226 - sleep 1
2227 - done
2228 - fi
2229 -
2230 - echo
2231 -
2232 - if [[ ! -S "${socket}" ]] ; then
2233 - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
2234 - die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
2235 - fi
2236 -
2237 - local mysql_logfile="${TMPDIR}/set_root_pw.log"
2238 - touch "${mysql_logfile}" || die
2239 -
2240 - ebegin "Setting root password"
2241 - # Do this from memory, as we don't want clear text passwords in temp files
2242 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
2243 - cmd=(
2244 - "${mysql_binary}"
2245 - --no-defaults
2246 - "--socket='${socket}'"
2247 - -hlocalhost
2248 - "-e \"${sql}\""
2249 - )
2250 - eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
2251 - local rc=$?
2252 - eend ${rc}
2253 -
2254 - if [[ ${rc} -ne 0 ]] ; then
2255 - # Poor man's solution which tries to avoid having password
2256 - # in log. NOTE: sed can fail if user didn't follow advice
2257 - # and included character which will require escaping...
2258 - sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
2259 -
2260 - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
2261 - die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
2262 - fi
2263 -
2264 - # Stop the server
2265 - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
2266 - echo -n "Stopping the server "
2267 - pkill -F "${pidfile}" &>/dev/null
2268 -
2269 - maxtry=10
2270 - while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
2271 - maxtry=$((${maxtry}-1))
2272 - echo -n "."
2273 - sleep 1
2274 - done
2275 -
2276 - echo
2277 -
2278 - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
2279 - # We somehow failed to stop server.
2280 - # However, not a fatal error. Just warn the user.
2281 - ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
2282 - fi
2283 - fi
2284 -
2285 - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
2286 -}