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/, dev-db/percona-server/files/
Date: Sat, 29 Dec 2018 20:19:14
Message-Id: 1546114742.c0a34f0628ff67e3d2d9089b145b5bb2263e9f28.whissi@gentoo
1 commit: c0a34f0628ff67e3d2d9089b145b5bb2263e9f28
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 29 20:18:47 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 29 20:19:02 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0a34f06
7
8 dev-db/percona-server: drop old
9
10 Package-Manager: Portage-2.3.53, Repoman-2.3.12
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-db/percona-server/Manifest | 6 -
14 dev-db/percona-server/files/my.cnf-5.6 | 140 ---
15 dev-db/percona-server/metadata.xml | 1 -
16 .../percona-server-5.6.40.84.0.ebuild | 944 -----------------
17 .../percona-server-5.6.41.84.1.ebuild | 944 -----------------
18 .../percona-server-5.7.23.23-r1.ebuild | 1038 -------------------
19 .../percona-server/percona-server-5.7.23.24.ebuild | 1066 --------------------
20 .../percona-server/percona-server-5.7.23.25.ebuild | 1066 --------------------
21 8 files changed, 5205 deletions(-)
22
23 diff --git a/dev-db/percona-server/Manifest b/dev-db/percona-server/Manifest
24 index c00c6e6cf18..e532723c966 100644
25 --- a/dev-db/percona-server/Manifest
26 +++ b/dev-db/percona-server/Manifest
27 @@ -1,9 +1,3 @@
28 DIST boost_1_59_0.tar.gz 83709983 BLAKE2B 8c6676fa05fa401a6ecb3b890d95aceb4421ec48dd0eab38ce8d170c618e177c82dc67a165938f6be1a01daab24ce41888f5442dbc19ad3dd41368a01a6f89e4 SHA512 05fdbe5637543defdbc630b921515425885593d16db14534ed7b9aa60925ade8fb598d50cb894aed6dae688e789047216daa1bf03fa1aeb6b531060d9dae52ae
29 -DIST mysql-extras-20180628-0201Z.tar.bz2 322141 BLAKE2B fce35cfea4ffa9860908fcdf440cd0d714c402c42ee2afb22cec9e727971c216310c7db561ca1b37deebb2cea5137fe24f19b491ad500949e3170ccec3de0b13 SHA512 71a3800ec091b41e41d25536199149eb714c0bbfc0f6fc478e8e4dcaf4cf87a7e4d49c513da3c9badc0de810d7d78c05ad91dd898e45005b42136346237de42a
30 DIST mysql-extras-20181017-2201Z.tar.bz2 328311 BLAKE2B f1b179e0f2d63105f03ba238125e6cfa2c0cbf2084251b6c344bd02517899322bd161470eddab28c514349caac6401c35909b2f37264fdaf2dc196a309d3cc27 SHA512 26e26a3ad926bc9267d89f0bc34b030bc6292f21d3007185c4c1155beaa608566b4268f93edb64fd6156dbae80ac4f2817e78c1e92e90985e2675c2b1f97854e
31 -DIST percona-server-5.6.40-84.0.tar.gz 52684007 BLAKE2B 11658be2319880f7e8815c7b620b7d460dd7a559316ca96905573b0fa2d7180b084ed425f76f6d850f06862e424b5a8d6ced8356f9075826b77e89e86095eb40 SHA512 b1075933bdf1afb726acd799e834cb45a1d2a15d3f37f313da71f8da03a7b9480d7ccfb4cb6a820fb6ccf58851d8c9473bce975203cd6bc007a2b74b36a1127f
32 -DIST percona-server-5.6.41-84.1.tar.gz 52736448 BLAKE2B 1ec5e17f08274caa3882f829f25bbf74a3b37d2ba208f62376106f0d89e5470f461f7852e365d5da9503d5500702e28f08461e5aa0c5ae6b1a30a0e98dbb426b SHA512 60783154f9ab097083a484c34e584b396eeba4aa53dc8616c467ca9c85cc626be08e3165740703453cc4fb35f3af94ac34260f1e2bb133d60f832661251cbb3c
33 -DIST percona-server-5.7.23-23.tar.gz 79165468 BLAKE2B a460ac88886fa2be65abb0520d541db54413274599e02d8de3a01a68f8c3da431bfe819eb32bf80518fdff69bbcfae90ee089d2a096ee6210f9e4efe60dbab25 SHA512 351d40d3f7c3fe72f733443a6ef3902e1455390835e52e73d7eb48698ac6f2363e07811d40b22af5b1c7607622017d613279581940522c5e99660fac89d4d4c6
34 -DIST percona-server-5.7.23-24.tar.gz 81641623 BLAKE2B f23e8787f7c3b38517e22b8b12da38f549b03343091cdb7ff17b0b719036a10aa954f30162fdf032fa4813f6ee59881fa9334f7ce6d1a646fa2c338b4bf3f2cb SHA512 9449cf4f5e6b9abb062b17652a258ddf99397d82efd89c9b0c1b20ddfef3d3531c2c1b71cb91664ea6ee897c136310af58fcc900d5f80d37e8eb73a2a616fa41
35 -DIST percona-server-5.7.23-25.tar.gz 81600024 BLAKE2B 5db3f3abe5a88b4178bb7f93801a8169994a75caa3677e7653a169e380c221a9bd8c390254207b0104e3b74bd751476720ba25f65cd965d7e4b0ad86174f749d SHA512 1ce27b4a08f1e882e8635c688d44f593d95bfe30dc0678a0e6779381e80c081bf147047b40d990613893cfcb5e0d870ac3fcec1f24cd52b64efd0ed78ed05ccb
36 DIST percona-server-5.7.24-27.tar.gz 81757023 BLAKE2B 80c28ca3195874133b127ba7268aa6a6af89f4d1a38ee34f0a761e8c35b8da2c8a94781e7672e241164b9887549846875fc294e36e4229f8e2c4d3f65562350e SHA512 f2a5af3c75577da911bcee5bf962e5b6d723ede1a21f19f9211cda1a7e37a3523d904ea0af6fa9787418959c8824c0cf48726b8b0a426b81df01e5a51214b70d
37
38 diff --git a/dev-db/percona-server/files/my.cnf-5.6 b/dev-db/percona-server/files/my.cnf-5.6
39 deleted file mode 100644
40 index 047c8d79be4..00000000000
41 --- a/dev-db/percona-server/files/my.cnf-5.6
42 +++ /dev/null
43 @@ -1,140 +0,0 @@
44 -# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/my.cnf: The global mysql configuration file.
45 -
46 -# The following options will be passed to all MySQL clients
47 -[client]
48 -#password = your_password
49 -port = 3306
50 -socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
51 -
52 -[mysql]
53 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
54 -default-character-set=utf8
55 -
56 -[mysqladmin]
57 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
58 -default-character-set=utf8
59 -
60 -[mysqlcheck]
61 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
62 -default-character-set=utf8
63 -
64 -[mysqldump]
65 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
66 -default-character-set=utf8
67 -
68 -[mysqlimport]
69 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
70 -default-character-set=utf8
71 -
72 -[mysqlshow]
73 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
74 -default-character-set=utf8
75 -
76 -[myisamchk]
77 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
78 -
79 -[myisampack]
80 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
81 -
82 -# use [safe_mysqld] with mysql-3
83 -[mysqld_safe]
84 -err-log = @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysql.err
85 -
86 -# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations
87 -[mysqld]
88 -character-set-server = utf8
89 -user = mysql
90 -port = 3306
91 -socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
92 -pid-file = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.pid
93 -log-error = @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err
94 -basedir = @GENTOO_PORTAGE_EPREFIX@/usr
95 -datadir = @DATADIR@
96 -skip-external-locking
97 -key_buffer_size = 16M
98 -max_allowed_packet = 4M
99 -table_open_cache = 400
100 -sort_buffer_size = 512K
101 -net_buffer_length = 16K
102 -read_buffer_size = 256K
103 -read_rnd_buffer_size = 512K
104 -myisam_sort_buffer_size = 8M
105 -lc_messages_dir = @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql
106 -#Set this to your desired error message language
107 -lc_messages = en_US
108 -
109 -# security:
110 -# using "localhost" in connects uses sockets by default
111 -# skip-networking
112 -bind-address = 127.0.0.1
113 -
114 -log-bin
115 -server-id = 1
116 -
117 -# point the following paths to different dedicated disks
118 -tmpdir = @GENTOO_PORTAGE_EPREFIX@/tmp/
119 -#log-update = @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname
120 -
121 -# you need the debug USE flag enabled to use the following directives,
122 -# if needed, uncomment them, start the server and issue
123 -# #tail -f @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.sql @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.trace
124 -# this will show you *exactly* what's happening in your server ;)
125 -
126 -#log = @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.sql
127 -#gdb
128 -#debug = d:t:i:o,/tmp/mysqld.trace
129 -#one-thread
130 -
131 -# the rest of the innodb config follows:
132 -# don't eat too much memory, we're trying to be safe on 64Mb boxes
133 -# you might want to bump this up a bit on boxes with more RAM
134 -innodb_buffer_pool_size = 128M
135 -#
136 -# i'd like to use @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/innodb, but that is seen as a database :-(
137 -# and upstream wants things to be under @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/, so that's the route
138 -# we have to take for the moment
139 -#innodb_data_home_dir = @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/
140 -#innodb_log_arch_dir = @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/
141 -#innodb_log_group_home_dir = @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/
142 -# you may wish to change this size to be more suitable for your system
143 -# the max is there to avoid run-away growth on your machine
144 -innodb_data_file_path = ibdata1:10M:autoextend:max:128M
145 -# we keep this at around 25% of of innodb_buffer_pool_size
146 -# sensible values range from 1MB to (1/innodb_log_files_in_group*innodb_buffer_pool_size)
147 -innodb_log_file_size = 48M
148 -# this is the default, increase it if you have very large transactions going on
149 -innodb_log_buffer_size = 8M
150 -# this is the default and won't hurt you
151 -# you shouldn't need to tweak it
152 -innodb_log_files_in_group=2
153 -# see the innodb config docs, the other options are not always safe
154 -innodb_flush_log_at_trx_commit = 1
155 -innodb_lock_wait_timeout = 50
156 -innodb_file_per_table
157 -
158 -# Uncomment this to get FEDERATED engine support
159 -#plugin-load=federated=ha_federated.so
160 -loose-federated
161 -
162 -[mysqldump]
163 -quick
164 -max_allowed_packet = 16M
165 -
166 -[mysql]
167 -# uncomment the next directive if you are not familiar with SQL
168 -#safe-updates
169 -
170 -[isamchk]
171 -key_buffer_size = 20M
172 -sort_buffer_size = 20M
173 -read_buffer = 2M
174 -write_buffer = 2M
175 -
176 -[myisamchk]
177 -key_buffer_size = 20M
178 -sort_buffer_size = 20M
179 -read_buffer_size = 2M
180 -write_buffer_size = 2M
181 -
182 -[mysqlhotcopy]
183 -interactive-timeout
184
185 diff --git a/dev-db/percona-server/metadata.xml b/dev-db/percona-server/metadata.xml
186 index 6cc220d337d..01da26f9882 100644
187 --- a/dev-db/percona-server/metadata.xml
188 +++ b/dev-db/percona-server/metadata.xml
189 @@ -16,7 +16,6 @@
190 <flag name="rocksdb">Add support for RocksDB; a key/value, LSM database optimized for flash storage</flag>
191 <flag name="server">Build the server program</flag>
192 <flag name="systemtap">Build support for profiling and tracing using <pkg>dev-util/systemtap</pkg></flag>
193 - <flag name="test-suite">Install upstream testsuites for end use.</flag>
194 <flag name="tokudb">Add support for TokuDB storage engine</flag>
195 <flag name="tokudb-backup-plugin">Builds the TokuDB backup plugin</flag>
196 <flag name="yassl">Enable SSL connections and crypto functions using the bundled yaSSL</flag>
197
198 diff --git a/dev-db/percona-server/percona-server-5.6.40.84.0.ebuild b/dev-db/percona-server/percona-server-5.6.40.84.0.ebuild
199 deleted file mode 100644
200 index 2e7c3b95a1f..00000000000
201 --- a/dev-db/percona-server/percona-server-5.6.40.84.0.ebuild
202 +++ /dev/null
203 @@ -1,944 +0,0 @@
204 -# Copyright 1999-2018 Gentoo Authors
205 -# Distributed under the terms of the GNU General Public License v2
206 -
207 -EAPI="6"
208 -MY_EXTRAS_VER="20180628-0201Z"
209 -PYTHON_COMPAT=( python2_7 )
210 -CMAKE_MAKEFILE_GENERATOR=emake
211 -
212 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
213 -
214 -inherit linux-info python-any-r1 eutils flag-o-matic prefix toolchain-funcs \
215 - eapi7-ver user cmake-utils multilib-minimal
216 -
217 -MY_PV=$(ver_rs 3 '-')
218 -MY_PN="Percona-Server"
219 -MY_MAJOR_PV=$(ver_cut 1-2)
220 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/5.6/release-notes/release-notes_index.html"
221 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz"
222 -
223 -# Gentoo patches to MySQL
224 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
225 - SRC_URI="${SRC_URI}
226 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
227 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
228 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
229 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
230 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
231 -fi
232 -
233 -HOMEPAGE="https://www.percona.com/software/percona-server"
234 -DESCRIPTION="An enhanced, drop-in replacement for MySQL from the Percona team"
235 -LICENSE="GPL-2"
236 -SLOT="0/18"
237 -IUSE="-client-libs cracklib debug jemalloc latin1 libressl numa pam +perl profiling rocksdb selinux
238 - +server static static-libs systemtap tcmalloc test test-suite tokudb tokudb-backup-plugin yassl"
239 -
240 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
241 -RESTRICT="libressl? ( test )"
242 -
243 -REQUIRED_USE="tokudb-backup-plugin? ( tokudb ) tokudb? ( jemalloc !tcmalloc ) ?? ( tcmalloc jemalloc ) static? ( yassl )"
244 -
245 -KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
246 -
247 -# Shorten the path because the socket path length must be shorter than 107 chars
248 -# and we will run a mysql server during test phase
249 -S="${WORKDIR}/mysql"
250 -
251 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
252 - inherit git-r3
253 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
254 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
255 - EGIT_CLONE_TYPE=shallow
256 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
257 -else
258 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
259 -fi
260 -
261 -PATCHES=(
262 - "${MY_PATCH_DIR}"/01050_all_mysql_config_cleanup-5.6.patch
263 - "${MY_PATCH_DIR}"/02040_all_embedded-library-shared-5.5.10.patch
264 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.6.20.patch
265 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.6.22.patch
266 - "${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.6.37.patch
267 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.6.patch
268 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.6.39-without-clientlibs-tools.patch
269 -)
270 -
271 -# Be warned, *DEPEND are version-dependant
272 -# These are used for both runtime and compiletime
273 -# MULTILIB_USEDEP only set for libraries used by the client library
274 -COMMON_DEPEND="
275 - kernel_linux? (
276 - sys-process/procps:0=
277 - dev-libs/libaio:0=
278 - )
279 - >=sys-apps/sed-4
280 - >=sys-apps/texinfo-4.7-r1
281 - jemalloc? ( dev-libs/jemalloc:0= )
282 - tcmalloc? ( dev-util/google-perftools:0= )
283 - systemtap? ( >=dev-util/systemtap-1.3:0= )
284 - !yassl? (
285 - client-libs? (
286 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
287 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
288 - )
289 - !client-libs? (
290 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
291 - libressl? ( dev-libs/libressl:0= )
292 - )
293 - )
294 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
295 - !client-libs? ( >=sys-libs/zlib-1.2.3:0= )
296 - sys-libs/ncurses:0=
297 - server? (
298 - >=dev-libs/boost-1.65.0:=
299 - numa? ( sys-process/numactl )
300 - pam? ( virtual/pam:0= )
301 - tokudb? ( app-arch/snappy )
302 - tokudb-backup-plugin? ( dev-util/valgrind )
303 - )
304 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
305 -"
306 -DEPEND="virtual/yacc
307 - static? ( sys-libs/ncurses[static-libs] )
308 - test? (
309 - $(python_gen_any_dep 'dev-python/mysql-python[${PYTHON_USEDEP}]')
310 - dev-perl/JSON
311 - )
312 - ${COMMON_DEPEND}"
313 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
314 - abi_x86_32? ( !app-emulation/emul-linux-x86-db[-abi_x86_32(-)] )
315 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
316 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
317 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
318 - ${COMMON_DEPEND}
319 -"
320 -# For other stuff to bring us in
321 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
322 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
323 -
324 -python_check_deps() {
325 - has_version "dev-python/mysql-python[${PYTHON_USEDEP}]"
326 -}
327 -
328 -mysql_init_vars() {
329 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
330 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
331 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
332 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
333 -
334 - if [[ -z "${MY_DATADIR}" ]] ; then
335 - MY_DATADIR=""
336 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
337 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
338 - | sed -ne '/datadir/s|^--datadir=||p' \
339 - | tail -n1`
340 - if [[ -z "${MY_DATADIR}" ]] ; then
341 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
342 - | sed -e 's/.*=\s*//' \
343 - | tail -n1`
344 - fi
345 - fi
346 - if [[ -z "${MY_DATADIR}" ]] ; then
347 - MY_DATADIR="${MY_LOCALSTATEDIR}"
348 - einfo "Using default MY_DATADIR"
349 - fi
350 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
351 -
352 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
353 - if [[ -e "${MY_DATADIR}" ]] ; then
354 - # If you get this and you're wondering about it, see bug #207636
355 - elog "MySQL datadir found in ${MY_DATADIR}"
356 - elog "A new one will not be created."
357 - PREVIOUS_DATADIR="yes"
358 - else
359 - PREVIOUS_DATADIR="no"
360 - fi
361 - export PREVIOUS_DATADIR
362 - fi
363 - else
364 - if [[ ${EBUILD_PHASE} == "config" ]] ; then
365 - local new_MY_DATADIR
366 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
367 - | sed -ne '/datadir/s|^--datadir=||p' \
368 - | tail -n1`
369 -
370 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then
371 - ewarn "MySQL MY_DATADIR has changed"
372 - ewarn "from ${MY_DATADIR}"
373 - ewarn "to ${new_MY_DATADIR}"
374 - MY_DATADIR="${new_MY_DATADIR}"
375 - fi
376 - fi
377 - fi
378 -
379 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
380 - export MY_LOCALSTATEDIR MY_LOGDIR
381 - export MY_DATADIR
382 -}
383 -
384 -pkg_pretend() {
385 - if use numa; then
386 - local CONFIG_CHECK="~NUMA"
387 -
388 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
389 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
390 -
391 - check_extra_config
392 - fi
393 -}
394 -
395 -pkg_setup() {
396 - if [[ ${MERGE_TYPE} != binary ]] ; then
397 - local GCC_MAJOR_SET=$(gcc-major-version)
398 - local GCC_MINOR_SET=$(gcc-minor-version)
399 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
400 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
401 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
402 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
403 - die
404 - fi
405 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
406 - # non x86{,_64} arches
407 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
408 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
409 - eerror "${PN} needs to be built with gcc-4.7 or later."
410 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
411 - die
412 - fi
413 - fi
414 - if has test ${FEATURES} && \
415 - use server && ! has userpriv ${FEATURES} ; then
416 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
417 - fi
418 -
419 - # This should come after all of the die statements
420 - enewgroup mysql 60 || die "problem adding 'mysql' group"
421 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
422 -}
423 -
424 -src_unpack() {
425 - unpack ${A}
426 -
427 - # Grab the patches
428 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
429 -
430 - mv -f "${WORKDIR}/${PN}-${MY_PV}" "${S}" || die
431 -}
432 -
433 -src_prepare() {
434 - if use jemalloc ; then
435 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
436 - elif use tcmalloc ; then
437 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
438 - fi
439 -
440 - # Don't build bundled xz-utils
441 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
442 - echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
443 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
444 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
445 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
446 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
447 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
448 - fi
449 -
450 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
451 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
452 - fi
453 -
454 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
455 - if [[ -d "${S}/support-files/SELinux" ]] ; then
456 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
457 - fi
458 -
459 - if use libressl ; then
460 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
461 - "${S}/cmake/ssl.cmake" || die
462 - fi
463 -
464 - cmake-utils_src_prepare
465 -}
466 -
467 -src_configure() {
468 - # bug 508724 mariadb cannot use ld.gold
469 - tc-ld-disable-gold
470 -
471 - # Bug #114895, bug #110149
472 - filter-flags "-O" "-O[01]"
473 -
474 - append-cxxflags -felide-constructors
475 -
476 - # bug #283926, with GCC4.4, this is required to get correct behavior.
477 - append-flags -fno-strict-aliasing
478 -
479 - if use client-libs ; then
480 - multilib-minimal_src_configure
481 - else
482 - multilib_src_configure
483 - fi
484 -}
485 -
486 -multilib_src_configure() {
487 - debug-print-function ${FUNCNAME} "$@"
488 -
489 - if ! multilib_is_native_abi && ! use client-libs ; then
490 - return
491 - fi
492 -
493 - CMAKE_BUILD_TYPE="RelWithDebInfo"
494 -
495 - # debug hack wrt #497532
496 - mycmakeargs=(
497 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
498 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
499 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
500 - -DMYSQL_DATADIR="${EPREFIX%/}/var/lib/mysql"
501 - -DSYSCONFDIR="${EPREFIX%/}/etc/mysql"
502 - -DINSTALL_BINDIR=bin
503 - -DINSTALL_DOCDIR=share/doc/${PF}
504 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
505 - -DINSTALL_INCLUDEDIR=include/mysql
506 - -DINSTALL_INFODIR=share/info
507 - -DINSTALL_LIBDIR=$(get_libdir)
508 - -DINSTALL_MANDIR=share/man
509 - -DINSTALL_MYSQLSHAREDIR=share/mysql
510 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
511 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
512 - -DINSTALL_SQLBENCHDIR=NO
513 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
514 - -DINSTALL_SBINDIR=sbin
515 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
516 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
517 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
518 - ### TODO: make this system but issues with UTF-8 prevent it
519 - -DWITH_EDITLINE=bundled
520 - -DWITH_ZLIB=system
521 - -DWITH_LIBWRAP=0
522 - -DENABLED_LOCAL_INFILE=1
523 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
524 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
525 - -DWITH_DEFAULT_FEATURE_SET=0
526 - # The build forces this to be defined when cross-compiling. We pass it
527 - # all the time for simplicity and to make sure it is actually correct.
528 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
529 - -DWITH_LIBEVENT=NO
530 - )
531 - if use test || use test-suite ; then
532 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
533 - else
534 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
535 - fi
536 -
537 - if ! use yassl ; then
538 - mycmakeargs+=( -DWITH_SSL=system )
539 - else
540 - mycmakeargs+=( -DWITH_SSL=bundled )
541 - fi
542 -
543 - if ! use client-libs ; then
544 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
545 - fi
546 -
547 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
548 - # systemtap only works on native ABI bug 530132
549 - if multilib_is_native_abi; then
550 - mycmakeargs+=(
551 - -DENABLE_DTRACE=$(usex systemtap)
552 - )
553 - else
554 - mycmakeargs+=(
555 - -DWITHOUT_TOOLS=1
556 - -DWITH_READLINE=1
557 - -DENABLE_DTRACE=0
558 - )
559 - fi
560 -
561 - if multilib_is_native_abi && use server ; then
562 - mycmakeargs+=(
563 - -DWITH_PAM=$(usex pam)
564 - -DWITH_NUMA=$(usex numa ON OFF)
565 - )
566 -
567 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then
568 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
569 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
570 - ewarn "You MUST file bugs without these variables set."
571 -
572 - mycmakeargs+=(
573 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
574 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
575 - )
576 -
577 - elif ! use latin1 ; then
578 - mycmakeargs+=(
579 - -DDEFAULT_CHARSET=utf8
580 - -DDEFAULT_COLLATION=utf8_general_ci
581 - )
582 - else
583 - mycmakeargs+=(
584 - -DDEFAULT_CHARSET=latin1
585 - -DDEFAULT_COLLATION=latin1_swedish_ci
586 - )
587 - fi
588 - mycmakeargs+=(
589 - -DEXTRA_CHARSETS=all
590 - -DDISABLE_SHARED=$(usex static YES NO)
591 - -DWITH_DEBUG=$(usex debug)
592 - -DWITH_EMBEDDED_SERVER=OFF
593 - -DENABLED_PROFILING=$(usex profiling)
594 - )
595 -
596 - if use static; then
597 - mycmakeargs+=( -DWITH_PIC=1 )
598 - fi
599 -
600 - # Storage engines
601 - mycmakeargs+=(
602 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
603 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
604 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
605 - -DWITH_CSV_STORAGE_ENGINE=1
606 - -DWITH_HEAP_STORAGE_ENGINE=1
607 - -DWITH_INNOBASE_STORAGE_ENGINE=1
608 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
609 - -DWITH_MYISAM_STORAGE_ENGINE=1
610 - -DWITH_PARTITION_STORAGE_ENGINE=1
611 - -DWITH_FEDERATED_STORAGE_ENGINE=1
612 - -DWITH_INNODB_MEMCACHED=0
613 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
614 - $(usex tokudb '' -DWITHOUT_TOKUDB=1)
615 - )
616 -
617 - if use tokudb ; then
618 - # TokuDB Backup plugin requires valgrind unconditionally
619 - mycmakeargs+=(
620 - $(usex tokudb-backup-plugin '' -DTOKUDB_BACKUP_DISABLED=1)
621 - )
622 - fi
623 -
624 - else
625 - mycmakeargs+=(
626 - -DWITHOUT_SERVER=1
627 - -DWITH_EMBEDDED_SERVER=OFF
628 - -DEXTRA_CHARSETS=none
629 - )
630 - fi
631 -
632 - cmake-utils_src_configure
633 -}
634 -
635 -src_compile() {
636 - if use client-libs ; then
637 - multilib-minimal_src_compile
638 - else
639 - multilib_src_compile
640 - fi
641 -}
642 -
643 -multilib_src_compile() {
644 - cmake-utils_src_compile
645 -}
646 -
647 -# Official test instructions:
648 -# FEATURES='test userpriv -usersandbox' \
649 -# ebuild percona-server-X.X.XX.ebuild \
650 -# digest clean package
651 -src_test() {
652 - _disable_test() {
653 - local rawtestname reason
654 - rawtestname="${1}" ; shift
655 - reason="${@}"
656 - ewarn "test '${rawtestname}' disabled: '${reason}'"
657 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
658 - }
659 -
660 - local TESTDIR="${BUILD_DIR}/mysql-test"
661 - local retstatus_unit
662 - local retstatus_tests
663 -
664 - if ! use server ; then
665 - einfo "Skipping server tests due to minimal build."
666 - return 0
667 - fi
668 -
669 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
670 - # localhost. Also causes weird failures.
671 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
672 -
673 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
674 -
675 - # Run CTest (test-units)
676 - cmake-utils_src_test
677 - retstatus_unit=$?
678 -
679 - # Ensure that parallel runs don't die
680 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
681 - # Enable parallel testing, auto will try to detect number of cores
682 - # You may set this by hand.
683 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
684 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
685 -
686 - # create directories because mysqladmin might run out of order
687 - mkdir -p "${T}"/var-tests{,/log} || die "Failed to create \"${T}/var-tests{,/log}\""
688 -
689 - # Run mysql tests
690 - pushd "${TESTDIR}" > /dev/null || die "Failed to chdir into \"${TESTDIR}\""
691 -
692 - touch "${T}/disabled.def"
693 - # These are failing in MySQL 5.6 for now and are believed to be
694 - # false positives:
695 -
696 - local t
697 - for t in main.mysql_client_test \
698 - binlog.binlog_statement_insert_delayed main.information_schema \
699 - main.mysqld--help-notwin binlog.binlog_mysqlbinlog_filter \
700 - perfschema.binlog_edge_mix perfschema.binlog_edge_stmt \
701 - funcs_1.is_columns_mysql funcs_1.is_tables_mysql funcs_1.is_triggers \
702 - main.variables main.myisam main.merge_recover \
703 - engines/funcs.db_alter_character_set engines/funcs.db_alter_character_set_collate \
704 - engines/funcs.db_alter_collate_ascii engines/funcs.db_alter_collate_utf8 \
705 - engines/funcs.db_create_character_set engines/funcs.db_create_character_set_collate \
706 - main.percona_bug1289599 main.mysqlhotcopy_archive main.mysqlhotcopy_myisam ; do
707 - _disable_test "$t" "False positives in Gentoo"
708 - done
709 -
710 - if use numa && use kernel_linux ; then
711 - # bug 584880
712 - if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then
713 - for t in sys_vars.innodb_buffer_pool_populate_basic ; do
714 - _disable_test "$t" "Test $t requires system with NUMA support"
715 - done
716 - fi
717 - fi
718 -
719 - # Set file limits higher so tests run
720 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
721 - # Upper limit comes from parts.partition_* tests
722 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
723 -
724 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
725 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
726 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
727 -
728 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
729 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
730 - else
731 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
732 - fi
733 - else
734 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
735 - fi
736 - else
737 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
738 - fi
739 -
740 - python_setup
741 - # run mysql-test tests
742 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" \
743 - --testcase-timeout=30 --reorder --skip-test-list="${T}/disabled.def"
744 - retstatus_tests=$?
745 -
746 - popd > /dev/null || die
747 -
748 - # Cleanup is important for these testcases.
749 - pkill -9 -f "${S}/ndb" 2>/dev/null
750 - pkill -9 -f "${S}/sql" 2>/dev/null
751 -
752 - local failures=""
753 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
754 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
755 -
756 - if [[ -n "$failures" ]] ; then
757 - if has usersandbox ${FEATURES}; then
758 - ewarn "Some tests may have failed due to FEATURES=usersandbox"
759 - ewarn "Please confirm test failure with FEATURES=-usersandbox before reporting a bug."
760 - fi
761 -
762 - die "Test failures: $failures"
763 - fi
764 -
765 - einfo "Tests successfully completed"
766 -}
767 -
768 -src_install() {
769 - local MULTILIB_WRAPPED_HEADERS
770 - local MULTILIB_CHOST_TOOLS
771 - if use client-libs ; then
772 - # headers with ABI specific data
773 - MULTILIB_WRAPPED_HEADERS=(
774 - /usr/include/mysql/server/my_config.h
775 - /usr/include/mysql/server/mysql_version.h )
776 -
777 - # wrap the config scripts
778 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
779 - multilib-minimal_src_install
780 - else
781 - multilib_src_install
782 - multilib_src_install_all
783 - fi
784 -}
785 -
786 -# Intentionally override eclass function
787 -multilib_src_install() {
788 - cmake-utils_src_install
789 -
790 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
791 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
792 -}
793 -
794 -multilib_src_install_all() {
795 - # Make sure the vars are correctly initialized
796 - mysql_init_vars
797 -
798 - # Convenience links
799 - einfo "Making Convenience links for mysqlcheck multi-call binary"
800 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
801 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
802 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
803 -
804 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
805 - if [[ -d "${ED}/usr/data" ]] ; then
806 - rm -rf "${ED%/}/usr/data" || die
807 - fi
808 -
809 - # Unless they explicitly specific USE=test, then do not install the
810 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
811 - # validation of your database configuration after tuning it.
812 - if ! use test-suite ; then
813 - rm -rf "${D%/}/${MY_SHAREDSTATEDIR#/}/mysql-test" || die
814 - fi
815 -
816 - # Configuration stuff
817 - einfo "Building default configuration ..."
818 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
819 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
820 - mycnf_src="my.cnf-5.6"
821 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
822 - "${FILESDIR}/${mycnf_src}" \
823 - > "${TMPDIR}/my.cnf.ok" || die
824 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
825 - if use latin1 ; then
826 - sed -i \
827 - -e "/character-set/s|utf8|latin1|g" \
828 - "${TMPDIR}/my.cnf.ok" || die
829 - fi
830 - eprefixify "${TMPDIR}/my.cnf.ok"
831 - newins "${TMPDIR}/my.cnf.ok" my.cnf
832 -
833 - if use server ; then
834 - einfo "Including support files and sample configurations"
835 - docinto "support-files"
836 - for script in \
837 - "${S}"/support-files/my-*.cnf.sh \
838 - "${S}"/support-files/magic \
839 - "${S}"/support-files/ndb-config-2-node.ini.sh
840 - do
841 - [[ -f $script ]] && dodoc "${script}"
842 - done
843 -
844 - docinto "scripts"
845 - for script in "${S}"/scripts/mysql* ; do
846 - [[ ( -f $script ) && ( ${script%.sh} == ${script} ) ]] && dodoc "${script}"
847 - done
848 - fi
849 -
850 - #Remove mytop if perl is not selected
851 - [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
852 -}
853 -
854 -pkg_preinst() {
855 - # Here we need to see if the implementation switched client libraries
856 - # We check if this is a new instance of the package and a client library already exists
857 - local SHOW_ABI_MESSAGE libpath
858 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
859 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
860 - elog "Due to ABI changes when switching between different client libraries,"
861 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
862 - elog "Please run: revdep-rebuild --library ${libpath}"
863 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
864 - fi
865 -}
866 -
867 -pkg_postinst() {
868 - # Make sure the vars are correctly initialized
869 - mysql_init_vars
870 -
871 - # Create log directory securely if it does not exist
872 - [[ -d "${EROOT%/}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${EROOT%/}${MY_LOGDIR}"
873 -
874 - if use server ; then
875 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
876 - einfo
877 - elog "You might want to run:"
878 - elog " \"emerge --config =${CATEGORY}/${PF}\""
879 - elog "if this is a new install."
880 - elog
881 - elog "If you are switching server implentations, you should run the"
882 - elog "mysql_upgrade tool."
883 - einfo
884 - else
885 - local _replacing_version=
886 - local _new_version_branch=$(ver_cut 1-3 "${PV}")
887 - for _replacing_version in ${REPLACING_VERSIONS}; do
888 - local _replacing_version_branch=$(ver_cut 1-3 "${_replacing_version}")
889 - debug-print "Updating an existing installation (v${_replacing_version}; branch '${_replacing_version_branch}') ..."
890 -
891 - if ver_test "${_new_version_branch}" -gt "${_replacing_version_branch}"; then
892 - debug-print "Upgrading from v${_replacing_version_branch} to v${_new_version_branch} ..."
893 - # https://www.percona.com/blog/2014/09/19/mysql-upgrade-best-practices/
894 -
895 - einfo
896 - elog "You are upgrading an existing ${PN} installation, you should review"
897 - elog "release notes at ${MY_RELEASE_NOTES_URI}"
898 - elog "and run the mysql_upgrade tool."
899 - einfo
900 -
901 - // Break loop - we only want to show this hint once
902 - break
903 - fi
904 - done
905 - fi
906 -
907 - elog "Since ${PN}-5.6.39.83.1-r1 we no longer provide client libs."
908 - elog "Applications depending on client libs should migrate to virtual/libmysqlclient"
909 - elog "which will pull-in dev-db/mysql-connector-c as their new client lib provider."
910 - einfo
911 - fi
912 -}
913 -
914 -pkg_config() {
915 - _getoptval() {
916 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
917 - local section="${1}"
918 - local flag="--${2}="
919 - local extra_options="${3}"
920 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
921 - }
922 -
923 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
924 - # localhost. Also causes weird failures.
925 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
926 -
927 - local old_MY_DATADIR="${MY_DATADIR}"
928 - local old_HOME="${HOME}"
929 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
930 - export HOME=${EPREFIX%/}/root
931 -
932 - # Make sure the vars are correctly initialized
933 - mysql_init_vars
934 -
935 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
936 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
937 - die "Minimal builds do NOT include the MySQL server"
938 - fi
939 -
940 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then
941 - local MY_DATADIR_s="${EROOT%/}/${MY_DATADIR#/}"
942 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
943 - local old_MY_DATADIR_s="${EROOT%/}/${old_MY_DATADIR#/}"
944 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
945 -
946 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then
947 - if [[ -d "${MY_DATADIR_s}" ]]; then
948 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
949 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
950 - else
951 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
952 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
953 - || die "Moving MY_DATADIR failed"
954 - fi
955 - else
956 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
957 - if [[ -d "${MY_DATADIR_s}" ]] ; then
958 - ewarn "Attempting to use ${MY_DATADIR_s}"
959 - else
960 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
961 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
962 - fi
963 - fi
964 - fi
965 -
966 - # These are dir+prefix
967 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
968 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
969 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
970 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
971 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
972 -
973 - if [[ -d "${EROOT%/}/${MY_DATADIR#/}/mysql" ]] ; then
974 - ewarn "You have already a MySQL database in place."
975 - ewarn "(${EROOT%/}/${MY_DATADIR#/}/*)"
976 - ewarn "Please rename or delete it if you wish to replace it."
977 - die "MySQL database already exists!"
978 - fi
979 -
980 - if [[ ! -d "${EROOT%/}/${MYSQL_TMPDIR#/}" ]] ; then
981 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
982 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/${MYSQL_TMPDIR#/}"
983 - fi
984 - if [[ ! -d "${EROOT%/}/${MYSQL_LOG_BIN#/}" ]] ; then
985 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
986 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/${MYSQL_LOG_BIN#/}"
987 - fi
988 - if [[ ! -d "${EROOT%/}/${MYSQL_RELAY_LOG#/}" ]] ; then
989 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
990 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/${MYSQL_RELAY_LOG#/}"
991 - fi
992 -
993 - local pwd1="a"
994 - local pwd2="b"
995 - local maxtry=15
996 -
997 - if [ -z "${MYSQL_ROOT_PASSWORD}" ] ; then
998 - local tmp_mysqld_password_source=
999 -
1000 - for tmp_mysqld_password_source in mysql client; do
1001 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1002 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
1003 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
1004 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
1005 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1006 - MYSQL_ROOT_PASSWORD=
1007 - continue
1008 - fi
1009 -
1010 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1011 - break
1012 - fi
1013 - done
1014 -
1015 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1016 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
1017 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
1018 - fi
1019 -
1020 - unset tmp_mysqld_password_source
1021 - fi
1022 -
1023 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
1024 - einfo "Please provide a password for the mysql 'root' user now"
1025 - einfo "or through the ${HOME}/.my.cnf file."
1026 - ewarn "Avoid [\"'\\_%] characters in the password"
1027 - read -rsp " >" pwd1 ; echo
1028 -
1029 - einfo "Retype the password"
1030 - read -rsp " >" pwd2 ; echo
1031 -
1032 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1033 - die "Passwords are not the same"
1034 - fi
1035 - MYSQL_ROOT_PASSWORD="${pwd1}"
1036 - unset pwd1 pwd2
1037 - fi
1038 -
1039 - local options
1040 - local sqltmp="$(emktemp)"
1041 -
1042 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1043 - # see http://bugs.mysql.com/bug.php?id=31312
1044 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR%/}/my.cnf'"
1045 -
1046 - # Figure out which options we need to disable to do the setup
1047 - local helpfile="${TMPDIR%/}/mysqld-help"
1048 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
1049 - for opt in grant-tables host-cache name-resolve networking slave-start \
1050 - federated ssl log-bin relay-log slow-query-log external-locking \
1051 - log-slave-updates \
1052 - ; do
1053 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1054 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1055 - done
1056 -
1057 - einfo "Creating the mysql database and setting proper permissions on it ..."
1058 -
1059 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
1060 - PID_DIR="${EROOT%/}/var/run/mysqld"
1061 - if [[ ! -d "${PID_DIR}" ]] ; then
1062 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
1063 - fi
1064 -
1065 - if [[ ! -d "${EROOT%/}/${MY_DATADIR#/}" ]] ; then
1066 - install -d -m 750 -o mysql -g mysql "${EROOT%/}/${MY_DATADIR#/}" || die "Could not create data directory"
1067 - fi
1068 -
1069 - pushd "${TMPDIR}" &>/dev/null || die
1070 -
1071 - # Filling timezones, see
1072 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
1073 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
1074 -
1075 - local cmd=( "${EROOT%/}/usr/share/mysql/scripts/mysql_install_db" )
1076 - [[ -f "${cmd}" ]] || cmd=( "${EROOT%/}/usr/bin/mysql_install_db" )
1077 - cmd+=( "--basedir=${EROOT%/}/usr" ${options} "--datadir=${EROOT%/}/${MY_DATADIR#/}" "--tmpdir=${EROOT%/}/${MYSQL_TMPDIR#/}" )
1078 - einfo "Command: ${cmd[*]}"
1079 - su -s /bin/sh -c "${cmd[*]}" mysql \
1080 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
1081 - if [[ $? -ne 0 ]] ; then
1082 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
1083 - die "Failed to initialize mysqld. Please review ${EROOT%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
1084 - fi
1085 - popd &>/dev/null || die
1086 - [[ -f "${EROOT%/}/${MY_DATADIR#/}/mysql/user.frm" ]] \
1087 - || die "MySQL databases not installed"
1088 -
1089 - use prefix || options="${options} --user=mysql"
1090 -
1091 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
1092 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
1093 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
1094 - ${options} \
1095 - --log-warnings=0 \
1096 - --basedir=${EROOT%/}/usr \
1097 - --datadir=${EROOT%/}/${MY_DATADIR#/} \
1098 - --max_allowed_packet=8M \
1099 - --net_buffer_length=16K \
1100 - --socket=${socket} \
1101 - --pid-file=${pidfile} \
1102 - --tmpdir=${EROOT%/}/${MYSQL_TMPDIR#/}"
1103 - #einfo "About to start mysqld: ${mysqld}"
1104 - ebegin "Starting mysqld"
1105 - einfo "Command ${mysqld}"
1106 - ${mysqld} &
1107 - rc=$?
1108 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1109 - maxtry=$((${maxtry}-1))
1110 - echo -n "."
1111 - sleep 1
1112 - done
1113 - eend $rc
1114 -
1115 - if ! [[ -S "${socket}" ]] ; then
1116 - die "Completely failed to start up mysqld with: ${mysqld}"
1117 - fi
1118 -
1119 - ebegin "Setting root password"
1120 - # Do this from memory, as we don't want clear text passwords in temp files
1121 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
1122 - "${EROOT%/}/usr/bin/mysql" \
1123 - "--socket=${socket}" \
1124 - -hlocalhost \
1125 - -e "${sql}"
1126 - eend $?
1127 -
1128 - if [[ -n "${sqltmp}" ]] ; then
1129 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
1130 - "${EROOT%/}/usr/bin/mysql" \
1131 - "--socket=${socket}" \
1132 - -hlocalhost \
1133 - -uroot \
1134 - --password="${MYSQL_ROOT_PASSWORD}" \
1135 - mysql < "${sqltmp}"
1136 - rc=$?
1137 - eend $?
1138 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
1139 - fi
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-5.6.41.84.1.ebuild b/dev-db/percona-server/percona-server-5.6.41.84.1.ebuild
1150 deleted file mode 100644
1151 index 636f75b830f..00000000000
1152 --- a/dev-db/percona-server/percona-server-5.6.41.84.1.ebuild
1153 +++ /dev/null
1154 @@ -1,944 +0,0 @@
1155 -# Copyright 1999-2018 Gentoo Authors
1156 -# Distributed under the terms of the GNU General Public License v2
1157 -
1158 -EAPI="6"
1159 -MY_EXTRAS_VER="20180628-0201Z"
1160 -PYTHON_COMPAT=( python2_7 )
1161 -CMAKE_MAKEFILE_GENERATOR=emake
1162 -
1163 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
1164 -
1165 -inherit linux-info python-any-r1 eutils flag-o-matic prefix toolchain-funcs \
1166 - eapi7-ver user cmake-utils multilib-minimal
1167 -
1168 -MY_PV=$(ver_rs 3 '-')
1169 -MY_PN="Percona-Server"
1170 -MY_MAJOR_PV=$(ver_cut 1-2)
1171 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/5.6/release-notes/release-notes_index.html"
1172 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz"
1173 -
1174 -# Gentoo patches to MySQL
1175 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
1176 - SRC_URI="${SRC_URI}
1177 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1178 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1179 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1180 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1181 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
1182 -fi
1183 -
1184 -HOMEPAGE="https://www.percona.com/software/percona-server"
1185 -DESCRIPTION="An enhanced, drop-in replacement for MySQL from the Percona team"
1186 -LICENSE="GPL-2"
1187 -SLOT="0/18"
1188 -IUSE="-client-libs cracklib debug jemalloc latin1 libressl numa pam +perl profiling rocksdb selinux
1189 - +server static static-libs systemtap tcmalloc test test-suite tokudb tokudb-backup-plugin yassl"
1190 -
1191 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
1192 -RESTRICT="libressl? ( test )
1193 - !test? ( test )"
1194 -
1195 -REQUIRED_USE="tokudb-backup-plugin? ( tokudb ) tokudb? ( jemalloc !tcmalloc ) ?? ( tcmalloc jemalloc ) static? ( yassl )"
1196 -
1197 -KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
1198 -
1199 -# Shorten the path because the socket path length must be shorter than 107 chars
1200 -# and we will run a mysql server during test phase
1201 -S="${WORKDIR}/mysql"
1202 -
1203 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
1204 - inherit git-r3
1205 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
1206 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
1207 - EGIT_CLONE_TYPE=shallow
1208 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
1209 -else
1210 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
1211 -fi
1212 -
1213 -PATCHES=(
1214 - "${MY_PATCH_DIR}"/01050_all_mysql_config_cleanup-5.6.patch
1215 - "${MY_PATCH_DIR}"/02040_all_embedded-library-shared-5.5.10.patch
1216 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.6.20.patch
1217 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.6.22.patch
1218 - "${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.6.37.patch
1219 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.6.patch
1220 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.6.39-without-clientlibs-tools.patch
1221 -)
1222 -
1223 -# Be warned, *DEPEND are version-dependant
1224 -# These are used for both runtime and compiletime
1225 -# MULTILIB_USEDEP only set for libraries used by the client library
1226 -COMMON_DEPEND="
1227 - kernel_linux? (
1228 - sys-process/procps:0=
1229 - dev-libs/libaio:0=
1230 - )
1231 - >=sys-apps/sed-4
1232 - >=sys-apps/texinfo-4.7-r1
1233 - jemalloc? ( dev-libs/jemalloc:0= )
1234 - tcmalloc? ( dev-util/google-perftools:0= )
1235 - systemtap? ( >=dev-util/systemtap-1.3:0= )
1236 - !yassl? (
1237 - client-libs? (
1238 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
1239 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
1240 - )
1241 - !client-libs? (
1242 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
1243 - libressl? ( dev-libs/libressl:0= )
1244 - )
1245 - )
1246 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
1247 - !client-libs? ( >=sys-libs/zlib-1.2.3:0= )
1248 - sys-libs/ncurses:0=
1249 - server? (
1250 - >=dev-libs/boost-1.65.0:=
1251 - numa? ( sys-process/numactl )
1252 - pam? ( virtual/pam:0= )
1253 - tokudb? ( app-arch/snappy )
1254 - tokudb-backup-plugin? ( dev-util/valgrind )
1255 - )
1256 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
1257 -"
1258 -DEPEND="virtual/yacc
1259 - static? ( sys-libs/ncurses[static-libs] )
1260 - test? (
1261 - $(python_gen_any_dep 'dev-python/mysql-python[${PYTHON_USEDEP}]')
1262 - dev-perl/JSON
1263 - )
1264 - ${COMMON_DEPEND}"
1265 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
1266 - abi_x86_32? ( !app-emulation/emul-linux-x86-db[-abi_x86_32(-)] )
1267 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
1268 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
1269 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
1270 - ${COMMON_DEPEND}
1271 -"
1272 -# For other stuff to bring us in
1273 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
1274 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
1275 -
1276 -python_check_deps() {
1277 - has_version "dev-python/mysql-python[${PYTHON_USEDEP}]"
1278 -}
1279 -
1280 -mysql_init_vars() {
1281 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
1282 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
1283 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
1284 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
1285 -
1286 - if [[ -z "${MY_DATADIR}" ]] ; then
1287 - MY_DATADIR=""
1288 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
1289 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1290 - | sed -ne '/datadir/s|^--datadir=||p' \
1291 - | tail -n1`
1292 - if [[ -z "${MY_DATADIR}" ]] ; then
1293 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
1294 - | sed -e 's/.*=\s*//' \
1295 - | tail -n1`
1296 - fi
1297 - fi
1298 - if [[ -z "${MY_DATADIR}" ]] ; then
1299 - MY_DATADIR="${MY_LOCALSTATEDIR}"
1300 - einfo "Using default MY_DATADIR"
1301 - fi
1302 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
1303 -
1304 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
1305 - if [[ -e "${MY_DATADIR}" ]] ; then
1306 - # If you get this and you're wondering about it, see bug #207636
1307 - elog "MySQL datadir found in ${MY_DATADIR}"
1308 - elog "A new one will not be created."
1309 - PREVIOUS_DATADIR="yes"
1310 - else
1311 - PREVIOUS_DATADIR="no"
1312 - fi
1313 - export PREVIOUS_DATADIR
1314 - fi
1315 - else
1316 - if [[ ${EBUILD_PHASE} == "config" ]] ; then
1317 - local new_MY_DATADIR
1318 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1319 - | sed -ne '/datadir/s|^--datadir=||p' \
1320 - | tail -n1`
1321 -
1322 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then
1323 - ewarn "MySQL MY_DATADIR has changed"
1324 - ewarn "from ${MY_DATADIR}"
1325 - ewarn "to ${new_MY_DATADIR}"
1326 - MY_DATADIR="${new_MY_DATADIR}"
1327 - fi
1328 - fi
1329 - fi
1330 -
1331 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
1332 - export MY_LOCALSTATEDIR MY_LOGDIR
1333 - export MY_DATADIR
1334 -}
1335 -
1336 -pkg_pretend() {
1337 - if use numa; then
1338 - local CONFIG_CHECK="~NUMA"
1339 -
1340 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
1341 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
1342 -
1343 - check_extra_config
1344 - fi
1345 -}
1346 -
1347 -pkg_setup() {
1348 - if [[ ${MERGE_TYPE} != binary ]] ; then
1349 - local GCC_MAJOR_SET=$(gcc-major-version)
1350 - local GCC_MINOR_SET=$(gcc-minor-version)
1351 -
1352 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
1353 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1354 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
1355 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1356 - die "Unsupported GCC version"
1357 - fi
1358 -
1359 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
1360 - # non x86{,_64} arches
1361 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
1362 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1363 - eerror "${PN} needs to be built with gcc-4.7 or later."
1364 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1365 - die "Unsupported GCC version"
1366 - fi
1367 -
1368 - use test && python-any-r1_pkg_setup
1369 - fi
1370 -
1371 - # This should come after all of the die statements
1372 - enewgroup mysql 60 || die "problem adding 'mysql' group"
1373 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
1374 -}
1375 -
1376 -src_unpack() {
1377 - unpack ${A}
1378 -
1379 - # Grab the patches
1380 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
1381 -
1382 - mv -f "${WORKDIR}/${PN}-${MY_PV}" "${S}" || die
1383 -}
1384 -
1385 -src_prepare() {
1386 - if use jemalloc ; then
1387 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
1388 - elif use tcmalloc ; then
1389 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
1390 - fi
1391 -
1392 - # Don't build bundled xz-utils
1393 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
1394 - echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
1395 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
1396 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
1397 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
1398 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
1399 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
1400 - fi
1401 -
1402 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
1403 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
1404 - fi
1405 -
1406 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
1407 - if [[ -d "${S}/support-files/SELinux" ]] ; then
1408 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
1409 - fi
1410 -
1411 - if use libressl ; then
1412 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
1413 - "${S}/cmake/ssl.cmake" || die
1414 - fi
1415 -
1416 - cmake-utils_src_prepare
1417 -}
1418 -
1419 -src_configure() {
1420 - # bug 508724 mariadb cannot use ld.gold
1421 - tc-ld-disable-gold
1422 -
1423 - # Bug #114895, bug #110149
1424 - filter-flags "-O" "-O[01]"
1425 -
1426 - append-cxxflags -felide-constructors
1427 -
1428 - # bug #283926, with GCC4.4, this is required to get correct behavior.
1429 - append-flags -fno-strict-aliasing
1430 -
1431 - if use client-libs ; then
1432 - multilib-minimal_src_configure
1433 - else
1434 - multilib_src_configure
1435 - fi
1436 -}
1437 -
1438 -multilib_src_configure() {
1439 - debug-print-function ${FUNCNAME} "$@"
1440 -
1441 - if ! multilib_is_native_abi && ! use client-libs ; then
1442 - return
1443 - fi
1444 -
1445 - CMAKE_BUILD_TYPE="RelWithDebInfo"
1446 -
1447 - # debug hack wrt #497532
1448 - mycmakeargs=(
1449 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1450 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1451 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
1452 - -DMYSQL_DATADIR="${EPREFIX%/}/var/lib/mysql"
1453 - -DSYSCONFDIR="${EPREFIX%/}/etc/mysql"
1454 - -DINSTALL_BINDIR=bin
1455 - -DINSTALL_DOCDIR=share/doc/${PF}
1456 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
1457 - -DINSTALL_INCLUDEDIR=include/mysql
1458 - -DINSTALL_INFODIR=share/info
1459 - -DINSTALL_LIBDIR=$(get_libdir)
1460 - -DINSTALL_MANDIR=share/man
1461 - -DINSTALL_MYSQLSHAREDIR=share/mysql
1462 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
1463 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
1464 - -DINSTALL_SQLBENCHDIR=NO
1465 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
1466 - -DINSTALL_SBINDIR=sbin
1467 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
1468 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
1469 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
1470 - ### TODO: make this system but issues with UTF-8 prevent it
1471 - -DWITH_EDITLINE=bundled
1472 - -DWITH_ZLIB=system
1473 - -DWITH_LIBWRAP=0
1474 - -DENABLED_LOCAL_INFILE=1
1475 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
1476 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
1477 - -DWITH_DEFAULT_FEATURE_SET=0
1478 - # The build forces this to be defined when cross-compiling. We pass it
1479 - # all the time for simplicity and to make sure it is actually correct.
1480 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
1481 - -DWITH_LIBEVENT=NO
1482 - )
1483 - if use test || use test-suite ; then
1484 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
1485 - else
1486 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
1487 - fi
1488 -
1489 - if ! use yassl ; then
1490 - mycmakeargs+=( -DWITH_SSL=system )
1491 - else
1492 - mycmakeargs+=( -DWITH_SSL=bundled )
1493 - fi
1494 -
1495 - if ! use client-libs ; then
1496 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
1497 - fi
1498 -
1499 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
1500 - # systemtap only works on native ABI bug 530132
1501 - if multilib_is_native_abi; then
1502 - mycmakeargs+=(
1503 - -DENABLE_DTRACE=$(usex systemtap)
1504 - )
1505 - else
1506 - mycmakeargs+=(
1507 - -DWITHOUT_TOOLS=1
1508 - -DWITH_READLINE=1
1509 - -DENABLE_DTRACE=0
1510 - )
1511 - fi
1512 -
1513 - if multilib_is_native_abi && use server ; then
1514 - mycmakeargs+=(
1515 - -DWITH_PAM=$(usex pam)
1516 - -DWITH_NUMA=$(usex numa ON OFF)
1517 - )
1518 -
1519 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then
1520 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1521 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1522 - ewarn "You MUST file bugs without these variables set."
1523 -
1524 - mycmakeargs+=(
1525 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1526 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1527 - )
1528 -
1529 - elif ! use latin1 ; then
1530 - mycmakeargs+=(
1531 - -DDEFAULT_CHARSET=utf8
1532 - -DDEFAULT_COLLATION=utf8_general_ci
1533 - )
1534 - else
1535 - mycmakeargs+=(
1536 - -DDEFAULT_CHARSET=latin1
1537 - -DDEFAULT_COLLATION=latin1_swedish_ci
1538 - )
1539 - fi
1540 - mycmakeargs+=(
1541 - -DEXTRA_CHARSETS=all
1542 - -DDISABLE_SHARED=$(usex static YES NO)
1543 - -DWITH_DEBUG=$(usex debug)
1544 - -DWITH_EMBEDDED_SERVER=OFF
1545 - -DENABLED_PROFILING=$(usex profiling)
1546 - )
1547 -
1548 - if use static; then
1549 - mycmakeargs+=( -DWITH_PIC=1 )
1550 - fi
1551 -
1552 - # Storage engines
1553 - mycmakeargs+=(
1554 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
1555 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1556 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1557 - -DWITH_CSV_STORAGE_ENGINE=1
1558 - -DWITH_HEAP_STORAGE_ENGINE=1
1559 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1560 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1561 - -DWITH_MYISAM_STORAGE_ENGINE=1
1562 - -DWITH_PARTITION_STORAGE_ENGINE=1
1563 - -DWITH_FEDERATED_STORAGE_ENGINE=1
1564 - -DWITH_INNODB_MEMCACHED=0
1565 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
1566 - $(usex tokudb '' -DWITHOUT_TOKUDB=1)
1567 - )
1568 -
1569 - if use tokudb ; then
1570 - # TokuDB Backup plugin requires valgrind unconditionally
1571 - mycmakeargs+=(
1572 - $(usex tokudb-backup-plugin '' -DTOKUDB_BACKUP_DISABLED=1)
1573 - )
1574 - fi
1575 -
1576 - else
1577 - mycmakeargs+=(
1578 - -DWITHOUT_SERVER=1
1579 - -DWITH_EMBEDDED_SERVER=OFF
1580 - -DEXTRA_CHARSETS=none
1581 - )
1582 - fi
1583 -
1584 - cmake-utils_src_configure
1585 -}
1586 -
1587 -src_compile() {
1588 - if use client-libs ; then
1589 - multilib-minimal_src_compile
1590 - else
1591 - multilib_src_compile
1592 - fi
1593 -}
1594 -
1595 -multilib_src_compile() {
1596 - cmake-utils_src_compile
1597 -}
1598 -
1599 -# Official test instructions:
1600 -# FEATURES='test userpriv -usersandbox' \
1601 -# ebuild percona-server-X.X.XX.ebuild \
1602 -# digest clean package
1603 -src_test() {
1604 - _disable_test() {
1605 - local rawtestname reason
1606 - rawtestname="${1}" ; shift
1607 - reason="${@}"
1608 - ewarn "test '${rawtestname}' disabled: '${reason}'"
1609 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
1610 - }
1611 -
1612 - local TESTDIR="${BUILD_DIR}/mysql-test"
1613 - local retstatus_unit
1614 - local retstatus_tests
1615 -
1616 - if ! use server ; then
1617 - einfo "Skipping server tests due to minimal build."
1618 - return 0
1619 - fi
1620 -
1621 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1622 - # localhost. Also causes weird failures.
1623 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1624 -
1625 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1626 -
1627 - # Run CTest (test-units)
1628 - cmake-utils_src_test
1629 - retstatus_unit=$?
1630 -
1631 - # Ensure that parallel runs don't die
1632 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
1633 - # Enable parallel testing, auto will try to detect number of cores
1634 - # You may set this by hand.
1635 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
1636 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
1637 -
1638 - # create directories because mysqladmin might run out of order
1639 - mkdir -p "${T}"/var-tests{,/log} || die "Failed to create \"${T}/var-tests{,/log}\""
1640 -
1641 - # Run mysql tests
1642 - pushd "${TESTDIR}" > /dev/null || die "Failed to chdir into \"${TESTDIR}\""
1643 -
1644 - touch "${T}/disabled.def"
1645 - # These are failing in MySQL 5.6 for now and are believed to be
1646 - # false positives:
1647 -
1648 - local t
1649 - for t in main.mysql_client_test \
1650 - binlog.binlog_statement_insert_delayed main.information_schema \
1651 - main.mysqld--help-notwin binlog.binlog_mysqlbinlog_filter \
1652 - perfschema.binlog_edge_mix perfschema.binlog_edge_stmt \
1653 - funcs_1.is_columns_mysql funcs_1.is_tables_mysql funcs_1.is_triggers \
1654 - main.variables main.myisam main.merge_recover \
1655 - engines/funcs.db_alter_character_set engines/funcs.db_alter_character_set_collate \
1656 - engines/funcs.db_alter_collate_ascii engines/funcs.db_alter_collate_utf8 \
1657 - engines/funcs.db_create_character_set engines/funcs.db_create_character_set_collate \
1658 - main.percona_bug1289599 main.mysqlhotcopy_archive main.mysqlhotcopy_myisam ; do
1659 - _disable_test "$t" "False positives in Gentoo"
1660 - done
1661 -
1662 - if use numa && use kernel_linux ; then
1663 - # bug 584880
1664 - if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then
1665 - for t in sys_vars.innodb_buffer_pool_populate_basic ; do
1666 - _disable_test "$t" "Test $t requires system with NUMA support"
1667 - done
1668 - fi
1669 - fi
1670 -
1671 - # Set file limits higher so tests run
1672 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
1673 - # Upper limit comes from parts.partition_* tests
1674 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
1675 -
1676 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
1677 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
1678 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
1679 -
1680 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
1681 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
1682 - else
1683 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
1684 - fi
1685 - else
1686 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
1687 - fi
1688 - else
1689 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
1690 - fi
1691 -
1692 - # run mysql-test tests
1693 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" \
1694 - --testcase-timeout=30 --reorder --skip-test-list="${T}/disabled.def"
1695 - retstatus_tests=$?
1696 -
1697 - popd > /dev/null || die
1698 -
1699 - # Cleanup is important for these testcases.
1700 - pkill -9 -f "${S}/ndb" 2>/dev/null
1701 - pkill -9 -f "${S}/sql" 2>/dev/null
1702 -
1703 - local failures=""
1704 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
1705 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
1706 -
1707 - if [[ -n "$failures" ]] ; then
1708 - if has usersandbox ${FEATURES}; then
1709 - ewarn "Some tests may have failed due to FEATURES=usersandbox"
1710 - ewarn "Please confirm test failure with FEATURES=-usersandbox before reporting a bug."
1711 - fi
1712 -
1713 - die "Test failures: $failures"
1714 - fi
1715 -
1716 - einfo "Tests successfully completed"
1717 -}
1718 -
1719 -src_install() {
1720 - local MULTILIB_WRAPPED_HEADERS
1721 - local MULTILIB_CHOST_TOOLS
1722 - if use client-libs ; then
1723 - # headers with ABI specific data
1724 - MULTILIB_WRAPPED_HEADERS=(
1725 - /usr/include/mysql/server/my_config.h
1726 - /usr/include/mysql/server/mysql_version.h )
1727 -
1728 - # wrap the config scripts
1729 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
1730 - multilib-minimal_src_install
1731 - else
1732 - multilib_src_install
1733 - multilib_src_install_all
1734 - fi
1735 -}
1736 -
1737 -# Intentionally override eclass function
1738 -multilib_src_install() {
1739 - cmake-utils_src_install
1740 -
1741 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
1742 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
1743 -}
1744 -
1745 -multilib_src_install_all() {
1746 - # Make sure the vars are correctly initialized
1747 - mysql_init_vars
1748 -
1749 - # Convenience links
1750 - einfo "Making Convenience links for mysqlcheck multi-call binary"
1751 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
1752 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
1753 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
1754 -
1755 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
1756 - if [[ -d "${ED}/usr/data" ]] ; then
1757 - rm -rf "${ED%/}/usr/data" || die
1758 - fi
1759 -
1760 - # Unless they explicitly specific USE=test, then do not install the
1761 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
1762 - # validation of your database configuration after tuning it.
1763 - if ! use test-suite ; then
1764 - rm -rf "${D%/}/${MY_SHAREDSTATEDIR#/}/mysql-test" || die
1765 - fi
1766 -
1767 - # Configuration stuff
1768 - einfo "Building default configuration ..."
1769 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
1770 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
1771 - mycnf_src="my.cnf-5.6"
1772 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
1773 - "${FILESDIR}/${mycnf_src}" \
1774 - > "${TMPDIR}/my.cnf.ok" || die
1775 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
1776 - if use latin1 ; then
1777 - sed -i \
1778 - -e "/character-set/s|utf8|latin1|g" \
1779 - "${TMPDIR}/my.cnf.ok" || die
1780 - fi
1781 - eprefixify "${TMPDIR}/my.cnf.ok"
1782 - newins "${TMPDIR}/my.cnf.ok" my.cnf
1783 -
1784 - if use server ; then
1785 - einfo "Including support files and sample configurations"
1786 - docinto "support-files"
1787 - for script in \
1788 - "${S}"/support-files/my-*.cnf.sh \
1789 - "${S}"/support-files/magic \
1790 - "${S}"/support-files/ndb-config-2-node.ini.sh
1791 - do
1792 - [[ -f $script ]] && dodoc "${script}"
1793 - done
1794 -
1795 - docinto "scripts"
1796 - for script in "${S}"/scripts/mysql* ; do
1797 - [[ ( -f $script ) && ( ${script%.sh} == ${script} ) ]] && dodoc "${script}"
1798 - done
1799 - fi
1800 -
1801 - #Remove mytop if perl is not selected
1802 - [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
1803 -}
1804 -
1805 -pkg_preinst() {
1806 - # Here we need to see if the implementation switched client libraries
1807 - # We check if this is a new instance of the package and a client library already exists
1808 - local SHOW_ABI_MESSAGE libpath
1809 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
1810 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
1811 - elog "Due to ABI changes when switching between different client libraries,"
1812 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
1813 - elog "Please run: revdep-rebuild --library ${libpath}"
1814 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
1815 - fi
1816 -}
1817 -
1818 -pkg_postinst() {
1819 - # Make sure the vars are correctly initialized
1820 - mysql_init_vars
1821 -
1822 - # Create log directory securely if it does not exist
1823 - [[ -d "${EROOT%/}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${EROOT%/}${MY_LOGDIR}"
1824 -
1825 - if use server ; then
1826 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1827 - einfo
1828 - elog "You might want to run:"
1829 - elog " \"emerge --config =${CATEGORY}/${PF}\""
1830 - elog "if this is a new install."
1831 - elog
1832 - elog "If you are switching server implentations, you should run the"
1833 - elog "mysql_upgrade tool."
1834 - einfo
1835 - else
1836 - local _replacing_version=
1837 - local _new_version_branch=$(ver_cut 1-3 "${PV}")
1838 - for _replacing_version in ${REPLACING_VERSIONS}; do
1839 - local _replacing_version_branch=$(ver_cut 1-3 "${_replacing_version}")
1840 - debug-print "Updating an existing installation (v${_replacing_version}; branch '${_replacing_version_branch}') ..."
1841 -
1842 - if ver_test "${_new_version_branch}" -gt "${_replacing_version_branch}"; then
1843 - debug-print "Upgrading from v${_replacing_version_branch} to v${_new_version_branch} ..."
1844 - # https://www.percona.com/blog/2014/09/19/mysql-upgrade-best-practices/
1845 -
1846 - einfo
1847 - elog "You are upgrading an existing ${PN} installation, you should review"
1848 - elog "release notes at ${MY_RELEASE_NOTES_URI}"
1849 - elog "and run the mysql_upgrade tool."
1850 - einfo
1851 -
1852 - // Break loop - we only want to show this hint once
1853 - break
1854 - fi
1855 - done
1856 - fi
1857 -
1858 - elog "Since ${PN}-5.6.39.83.1-r1 we no longer provide client libs."
1859 - elog "Applications depending on client libs should migrate to virtual/libmysqlclient"
1860 - elog "which will pull-in dev-db/mysql-connector-c as their new client lib provider."
1861 - einfo
1862 - fi
1863 -}
1864 -
1865 -pkg_config() {
1866 - _getoptval() {
1867 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
1868 - local section="${1}"
1869 - local flag="--${2}="
1870 - local extra_options="${3}"
1871 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
1872 - }
1873 -
1874 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1875 - # localhost. Also causes weird failures.
1876 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1877 -
1878 - local old_MY_DATADIR="${MY_DATADIR}"
1879 - local old_HOME="${HOME}"
1880 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
1881 - export HOME=${EPREFIX%/}/root
1882 -
1883 - # Make sure the vars are correctly initialized
1884 - mysql_init_vars
1885 -
1886 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
1887 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
1888 - die "Minimal builds do NOT include the MySQL server"
1889 - fi
1890 -
1891 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then
1892 - local MY_DATADIR_s="${EROOT%/}/${MY_DATADIR#/}"
1893 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
1894 - local old_MY_DATADIR_s="${EROOT%/}/${old_MY_DATADIR#/}"
1895 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
1896 -
1897 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then
1898 - if [[ -d "${MY_DATADIR_s}" ]]; then
1899 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
1900 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
1901 - else
1902 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
1903 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
1904 - || die "Moving MY_DATADIR failed"
1905 - fi
1906 - else
1907 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
1908 - if [[ -d "${MY_DATADIR_s}" ]] ; then
1909 - ewarn "Attempting to use ${MY_DATADIR_s}"
1910 - else
1911 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
1912 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
1913 - fi
1914 - fi
1915 - fi
1916 -
1917 - # These are dir+prefix
1918 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
1919 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
1920 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1921 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
1922 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1923 -
1924 - if [[ -d "${EROOT%/}/${MY_DATADIR#/}/mysql" ]] ; then
1925 - ewarn "You have already a MySQL database in place."
1926 - ewarn "(${EROOT%/}/${MY_DATADIR#/}/*)"
1927 - ewarn "Please rename or delete it if you wish to replace it."
1928 - die "MySQL database already exists!"
1929 - fi
1930 -
1931 - if [[ ! -d "${EROOT%/}/${MYSQL_TMPDIR#/}" ]] ; then
1932 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
1933 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/${MYSQL_TMPDIR#/}"
1934 - fi
1935 - if [[ ! -d "${EROOT%/}/${MYSQL_LOG_BIN#/}" ]] ; then
1936 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
1937 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/${MYSQL_LOG_BIN#/}"
1938 - fi
1939 - if [[ ! -d "${EROOT%/}/${MYSQL_RELAY_LOG#/}" ]] ; then
1940 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
1941 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/${MYSQL_RELAY_LOG#/}"
1942 - fi
1943 -
1944 - local pwd1="a"
1945 - local pwd2="b"
1946 - local maxtry=15
1947 -
1948 - if [ -z "${MYSQL_ROOT_PASSWORD}" ] ; then
1949 - local tmp_mysqld_password_source=
1950 -
1951 - for tmp_mysqld_password_source in mysql client; do
1952 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1953 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
1954 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
1955 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
1956 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1957 - MYSQL_ROOT_PASSWORD=
1958 - continue
1959 - fi
1960 -
1961 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1962 - break
1963 - fi
1964 - done
1965 -
1966 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1967 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
1968 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
1969 - fi
1970 -
1971 - unset tmp_mysqld_password_source
1972 - fi
1973 -
1974 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
1975 - einfo "Please provide a password for the mysql 'root' user now"
1976 - einfo "or through the ${HOME}/.my.cnf file."
1977 - ewarn "Avoid [\"'\\_%] characters in the password"
1978 - read -rsp " >" pwd1 ; echo
1979 -
1980 - einfo "Retype the password"
1981 - read -rsp " >" pwd2 ; echo
1982 -
1983 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1984 - die "Passwords are not the same"
1985 - fi
1986 - MYSQL_ROOT_PASSWORD="${pwd1}"
1987 - unset pwd1 pwd2
1988 - fi
1989 -
1990 - local options
1991 - local sqltmp="$(emktemp)"
1992 -
1993 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1994 - # see http://bugs.mysql.com/bug.php?id=31312
1995 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR%/}/my.cnf'"
1996 -
1997 - # Figure out which options we need to disable to do the setup
1998 - local helpfile="${TMPDIR%/}/mysqld-help"
1999 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
2000 - for opt in grant-tables host-cache name-resolve networking slave-start \
2001 - federated ssl log-bin relay-log slow-query-log external-locking \
2002 - log-slave-updates \
2003 - ; do
2004 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
2005 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
2006 - done
2007 -
2008 - einfo "Creating the mysql database and setting proper permissions on it ..."
2009 -
2010 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
2011 - PID_DIR="${EROOT%/}/var/run/mysqld"
2012 - if [[ ! -d "${PID_DIR}" ]] ; then
2013 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
2014 - fi
2015 -
2016 - if [[ ! -d "${EROOT%/}/${MY_DATADIR#/}" ]] ; then
2017 - install -d -m 750 -o mysql -g mysql "${EROOT%/}/${MY_DATADIR#/}" || die "Could not create data directory"
2018 - fi
2019 -
2020 - pushd "${TMPDIR}" &>/dev/null || die
2021 -
2022 - # Filling timezones, see
2023 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
2024 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
2025 -
2026 - local cmd=( "${EROOT%/}/usr/share/mysql/scripts/mysql_install_db" )
2027 - [[ -f "${cmd}" ]] || cmd=( "${EROOT%/}/usr/bin/mysql_install_db" )
2028 - cmd+=( "--basedir=${EROOT%/}/usr" ${options} "--datadir=${EROOT%/}/${MY_DATADIR#/}" "--tmpdir=${EROOT%/}/${MYSQL_TMPDIR#/}" )
2029 - einfo "Command: ${cmd[*]}"
2030 - su -s /bin/sh -c "${cmd[*]}" mysql \
2031 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
2032 - if [[ $? -ne 0 ]] ; then
2033 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
2034 - die "Failed to initialize mysqld. Please review ${EROOT%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
2035 - fi
2036 - popd &>/dev/null || die
2037 - [[ -f "${EROOT%/}/${MY_DATADIR#/}/mysql/user.frm" ]] \
2038 - || die "MySQL databases not installed"
2039 -
2040 - use prefix || options="${options} --user=mysql"
2041 -
2042 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
2043 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
2044 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
2045 - ${options} \
2046 - --log-warnings=0 \
2047 - --basedir=${EROOT%/}/usr \
2048 - --datadir=${EROOT%/}/${MY_DATADIR#/} \
2049 - --max_allowed_packet=8M \
2050 - --net_buffer_length=16K \
2051 - --socket=${socket} \
2052 - --pid-file=${pidfile} \
2053 - --tmpdir=${EROOT%/}/${MYSQL_TMPDIR#/}"
2054 - #einfo "About to start mysqld: ${mysqld}"
2055 - ebegin "Starting mysqld"
2056 - einfo "Command ${mysqld}"
2057 - ${mysqld} &
2058 - rc=$?
2059 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
2060 - maxtry=$((${maxtry}-1))
2061 - echo -n "."
2062 - sleep 1
2063 - done
2064 - eend $rc
2065 -
2066 - if ! [[ -S "${socket}" ]] ; then
2067 - die "Completely failed to start up mysqld with: ${mysqld}"
2068 - fi
2069 -
2070 - ebegin "Setting root password"
2071 - # Do this from memory, as we don't want clear text passwords in temp files
2072 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
2073 - "${EROOT%/}/usr/bin/mysql" \
2074 - "--socket=${socket}" \
2075 - -hlocalhost \
2076 - -e "${sql}"
2077 - eend $?
2078 -
2079 - if [[ -n "${sqltmp}" ]] ; then
2080 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
2081 - "${EROOT%/}/usr/bin/mysql" \
2082 - "--socket=${socket}" \
2083 - -hlocalhost \
2084 - -uroot \
2085 - --password="${MYSQL_ROOT_PASSWORD}" \
2086 - mysql < "${sqltmp}"
2087 - rc=$?
2088 - eend $?
2089 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
2090 - fi
2091 -
2092 - # Stop the server and cleanup
2093 - einfo "Stopping the server ..."
2094 - kill $(< "${pidfile}" )
2095 - rm -f "${sqltmp}"
2096 - wait %1
2097 - einfo "Done"
2098 -}
2099
2100 diff --git a/dev-db/percona-server/percona-server-5.7.23.23-r1.ebuild b/dev-db/percona-server/percona-server-5.7.23.23-r1.ebuild
2101 deleted file mode 100644
2102 index 4ef133731f5..00000000000
2103 --- a/dev-db/percona-server/percona-server-5.7.23.23-r1.ebuild
2104 +++ /dev/null
2105 @@ -1,1038 +0,0 @@
2106 -# Copyright 1999-2018 Gentoo Authors
2107 -# Distributed under the terms of the GNU General Public License v2
2108 -
2109 -EAPI="6"
2110 -MY_EXTRAS_VER="20181017-2201Z"
2111 -
2112 -CMAKE_MAKEFILE_GENERATOR=emake
2113 -
2114 -# Python2 required for innodb_stress.innodb_stress{,_blob,_crash} test
2115 -PYTHON_COMPAT=( python2_7 )
2116 -
2117 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
2118 -
2119 -inherit eapi7-ver cmake-utils eutils flag-o-matic linux-info \
2120 - prefix python-any-r1 toolchain-funcs user multilib-minimal
2121 -
2122 -MY_PV=$(ver_rs 3 '-')
2123 -MY_PN="Percona-Server"
2124 -MY_P="${PN}-${MY_PV}"
2125 -MY_MAJOR_PV=$(ver_cut 1-2)
2126 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/5.7/release-notes/release-notes_index.html"
2127 -
2128 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz
2129 - mirror://sourceforge/boost/boost_1_59_0.tar.gz
2130 -"
2131 -
2132 -# Gentoo patches to MySQL
2133 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then
2134 - SRC_URI="${SRC_URI}
2135 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2136 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
2137 -fi
2138 -
2139 -HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server"
2140 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
2141 -LICENSE="GPL-2"
2142 -SLOT="0/18"
2143 -IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 libressl numa pam +perl profiling rocksdb
2144 - selinux +server static static-libs systemtap tcmalloc test tokudb tokudb-backup-plugin yassl"
2145 -
2146 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
2147 -RESTRICT="libressl? ( test )"
2148 -
2149 -REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
2150 -
2151 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
2152 -
2153 -# Shorten the path because the socket path length must be shorter than 107 chars
2154 -# and we will run a mysql server during test phase
2155 -S="${WORKDIR}/mysql"
2156 -
2157 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
2158 - inherit git-r3
2159 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
2160 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
2161 - EGIT_CLONE_TYPE=shallow
2162 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
2163 -else
2164 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
2165 -fi
2166 -
2167 -PATCHES=(
2168 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch
2169 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch
2170 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch
2171 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-without-clientlibs-tools.patch
2172 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-fix-libressl-support.patch
2173 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-add-missing-gcc-8-fix.patch
2174 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch
2175 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch
2176 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-mips-ASM.patch
2177 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-rocksdb-use-system-libs.patch
2178 -)
2179 -
2180 -# Be warned, *DEPEND are version-dependant
2181 -# These are used for both runtime and compiletime
2182 -# MULTILIB_USEDEP only set for libraries used by the client library
2183 -COMMON_DEPEND="net-misc/curl:=
2184 - >=sys-apps/sed-4
2185 - >=sys-apps/texinfo-4.7-r1
2186 - sys-libs/ncurses:0=
2187 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
2188 - !client-libs? (
2189 - dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?]
2190 - >=sys-libs/zlib-1.2.3:0=
2191 - )
2192 - jemalloc? ( dev-libs/jemalloc:0= )
2193 - kernel_linux? (
2194 - dev-libs/libaio:0=
2195 - sys-process/procps:0=
2196 - )
2197 - server? (
2198 - >=app-arch/lz4-0_p131:=
2199 - cjk? ( app-text/mecab:= )
2200 - experimental? (
2201 - dev-libs/libevent:=
2202 - dev-libs/protobuf:=
2203 - net-libs/libtirpc:=
2204 - )
2205 - numa? ( sys-process/numactl )
2206 - pam? ( virtual/pam:0= )
2207 - rocksdb? (
2208 - app-arch/zstd:=
2209 - dev-libs/protobuf:=
2210 - )
2211 - tokudb? (
2212 - app-arch/snappy:=
2213 - app-arch/xz-utils:=
2214 - )
2215 - tokudb-backup-plugin? ( dev-util/valgrind )
2216 - )
2217 - systemtap? ( >=dev-util/systemtap-1.3:0= )
2218 - tcmalloc? ( dev-util/google-perftools:0= )
2219 - !yassl? (
2220 - client-libs? (
2221 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
2222 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
2223 - )
2224 - !client-libs? (
2225 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
2226 - libressl? ( dev-libs/libressl:0= )
2227 - )
2228 - )
2229 -"
2230 -DEPEND="${COMMON_DEPEND}
2231 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
2232 - dev-libs/protobuf
2233 - virtual/yacc
2234 - server? (
2235 - dev-libs/libevent
2236 - experimental? ( net-libs/rpcsvc-proto )
2237 - )
2238 - static? ( sys-libs/ncurses[static-libs] )
2239 - test? (
2240 - $(python_gen_any_dep 'dev-python/mysql-python[${PYTHON_USEDEP}]')
2241 - dev-perl/JSON
2242 - )
2243 -"
2244 -RDEPEND="${COMMON_DEPEND}
2245 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
2246 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= )
2247 - selinux? ( sec-policy/selinux-mysql )
2248 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
2249 -"
2250 -# For other stuff to bring us in
2251 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
2252 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
2253 -
2254 -python_check_deps() {
2255 - has_version "dev-python/mysql-python[${PYTHON_USEDEP}]"
2256 -}
2257 -
2258 -mysql_init_vars() {
2259 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
2260 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
2261 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
2262 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
2263 -
2264 - if [[ -z "${MY_DATADIR}" ]] ; then
2265 - MY_DATADIR=""
2266 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
2267 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2268 - | sed -ne '/datadir/s|^--datadir=||p' \
2269 - | tail -n1`
2270 - if [[ -z "${MY_DATADIR}" ]] ; then
2271 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
2272 - | sed -e 's/.*=\s*//' \
2273 - | tail -n1`
2274 - fi
2275 - fi
2276 - if [[ -z "${MY_DATADIR}" ]] ; then
2277 - MY_DATADIR="${MY_LOCALSTATEDIR}"
2278 - einfo "Using default MY_DATADIR"
2279 - fi
2280 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
2281 -
2282 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
2283 - if [[ -e "${MY_DATADIR}" ]] ; then
2284 - # If you get this and you're wondering about it, see bug #207636
2285 - elog "MySQL datadir found in ${MY_DATADIR}"
2286 - elog "A new one will not be created."
2287 - PREVIOUS_DATADIR="yes"
2288 - else
2289 - PREVIOUS_DATADIR="no"
2290 - fi
2291 - export PREVIOUS_DATADIR
2292 - fi
2293 - else
2294 - if [[ ${EBUILD_PHASE} == "config" ]] ; then
2295 - local new_MY_DATADIR
2296 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2297 - | sed -ne '/datadir/s|^--datadir=||p' \
2298 - | tail -n1`
2299 -
2300 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then
2301 - ewarn "MySQL MY_DATADIR has changed"
2302 - ewarn "from ${MY_DATADIR}"
2303 - ewarn "to ${new_MY_DATADIR}"
2304 - MY_DATADIR="${new_MY_DATADIR}"
2305 - fi
2306 - fi
2307 - fi
2308 -
2309 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
2310 - export MY_LOCALSTATEDIR MY_LOGDIR
2311 - export MY_DATADIR
2312 -}
2313 -
2314 -pkg_pretend() {
2315 - if use numa ; then
2316 - local CONFIG_CHECK="~NUMA"
2317 -
2318 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
2319 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
2320 -
2321 - check_extra_config
2322 - fi
2323 -}
2324 -
2325 -pkg_setup() {
2326 - if [[ ${MERGE_TYPE} != binary ]] ; then
2327 - local GCC_MAJOR_SET=$(gcc-major-version)
2328 - local GCC_MINOR_SET=$(gcc-minor-version)
2329 - # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on
2330 - # non x86{,_64} arches
2331 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
2332 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
2333 - eerror "${PN} needs to be built with gcc-4.7 or later."
2334 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2335 - die
2336 - fi
2337 -
2338 - use test && python-any-r1_pkg_setup
2339 - fi
2340 -
2341 - if has test ${FEATURES} && \
2342 - use server && ! has userpriv ${FEATURES} ; then
2343 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2344 - fi
2345 -
2346 - # This should come after all of the die statements
2347 - enewgroup mysql 60 || die "problem adding 'mysql' group"
2348 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
2349 -}
2350 -
2351 -pkg_preinst() {
2352 - # Here we need to see if the implementation switched client libraries
2353 - # We check if this is a new instance of the package and a client library already exists
2354 - local SHOW_ABI_MESSAGE libpath
2355 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so" ]] ; then
2356 - libpath=$(readlink "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so")
2357 - elog "Due to ABI changes when switching between different client libraries,"
2358 - elog "revdep-rebuild must find and rebuild all packages linking to libperconaserverclient."
2359 - elog "Please run: revdep-rebuild --library ${libpath}"
2360 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
2361 - fi
2362 -}
2363 -
2364 -pkg_postinst() {
2365 - # Make sure the vars are correctly initialized
2366 - mysql_init_vars
2367 -
2368 - # Create log directory securely if it does not exist
2369 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
2370 -
2371 - if use server ; then
2372 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
2373 - einfo
2374 - elog "You might want to run:"
2375 - elog "\"emerge --config =${CATEGORY}/${PF}\""
2376 - elog "if this is a new install."
2377 - elog
2378 - elog "If you are switching server implentations, you should run the"
2379 - elog "mysql_upgrade tool."
2380 - einfo
2381 - else
2382 - einfo
2383 - elog "If you are upgrading major versions, you should run the"
2384 - elog "mysql_upgrade tool."
2385 - einfo
2386 - fi
2387 - fi
2388 -
2389 - # Note about configuration change
2390 - einfo
2391 - elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
2392 - elog "to several files in /etc/mysql/mysql.d."
2393 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
2394 - elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
2395 - elog "You may have as many files as needed and they are read alphabetically."
2396 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
2397 - einfo
2398 -}
2399 -
2400 -src_unpack() {
2401 - unpack ${A}
2402 - # Grab the patches
2403 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
2404 -
2405 - mv -f "${WORKDIR}/${MY_P}" "${S}" || die
2406 -}
2407 -
2408 -src_prepare() {
2409 - cmake-utils_src_prepare
2410 -
2411 - if use jemalloc ; then
2412 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
2413 - fi
2414 -
2415 - if use tcmalloc ; then
2416 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
2417 - fi
2418 -
2419 - # Don't build bundled xz-utils
2420 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
2421 - echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
2422 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
2423 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
2424 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
2425 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
2426 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
2427 - fi
2428 -
2429 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
2430 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
2431 - fi
2432 -
2433 - # Remove bundled libs so we cannot accidentally use them
2434 - # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394
2435 - rm -rv \
2436 - "${S}"/extra/protobuf \
2437 - "${S}"/libevent \
2438 - "${S}"/storage/rocksdb/third_party \
2439 - "${S}"/storage/tokudb/PerconaFT/third_party \
2440 - "${S}"/zlib \
2441 - || die
2442 -
2443 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
2444 - if [[ -d "${S}/support-files/SELinux" ]] ; then
2445 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
2446 - fi
2447 -
2448 - if use libressl ; then
2449 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
2450 - "${S}/cmake/ssl.cmake" || die
2451 - fi
2452 -
2453 - sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
2454 -}
2455 -
2456 -src_configure(){
2457 - # Bug #114895, bug #110149
2458 - filter-flags "-O" "-O[01]"
2459 -
2460 - append-cxxflags -felide-constructors
2461 -
2462 - # bug #283926, with GCC4.4, this is required to get correct behavior.
2463 - append-flags -fno-strict-aliasing
2464 -
2465 - if use tokudb ; then
2466 - # https://jira.percona.com/browse/PS-4399
2467 - append-cxxflags -Wno-error=shadow
2468 - fi
2469 -
2470 - if use client-libs ; then
2471 - multilib-minimal_src_configure
2472 - else
2473 - multilib_src_configure
2474 - fi
2475 -}
2476 -
2477 -multilib_src_configure() {
2478 - debug-print-function ${FUNCNAME} "$@"
2479 -
2480 - if ! multilib_is_native_abi && ! use client-libs ; then
2481 - return
2482 - fi
2483 -
2484 - CMAKE_BUILD_TYPE="RelWithDebInfo"
2485 -
2486 - # debug hack wrt #497532
2487 - mycmakeargs=(
2488 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2489 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2490 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
2491 - -DMYSQL_DATADIR="${EPREFIX%/}/var/lib/mysql"
2492 - -DSYSCONFDIR="${EPREFIX%/}/etc/mysql"
2493 - -DINSTALL_BINDIR=bin
2494 - -DINSTALL_DOCDIR=share/doc/${PF}
2495 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
2496 - -DINSTALL_INCLUDEDIR=include/mysql
2497 - -DINSTALL_INFODIR=share/info
2498 - -DINSTALL_LIBDIR=$(get_libdir)
2499 - -DINSTALL_MANDIR=share/man
2500 - -DINSTALL_MYSQLSHAREDIR=share/mysql
2501 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
2502 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
2503 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
2504 - -DINSTALL_SBINDIR=sbin
2505 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
2506 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
2507 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
2508 - ### TODO: make this system but issues with UTF-8 prevent it
2509 - -DWITH_EDITLINE=bundled
2510 - -DWITH_ZLIB=system
2511 - -DWITH_LIBWRAP=0
2512 - -DENABLED_LOCAL_INFILE=1
2513 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
2514 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
2515 - -DWITH_DEFAULT_FEATURE_SET=0
2516 - # The build forces this to be defined when cross-compiling. We pass it
2517 - # all the time for simplicity and to make sure it is actually correct.
2518 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
2519 - -DWITH_CURL=system
2520 - -DWITH_BOOST="${WORKDIR}/boost_1_59_0"
2521 - -DWITH_PROTOBUF=system
2522 - )
2523 -
2524 - if use test ; then
2525 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
2526 - else
2527 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
2528 - fi
2529 -
2530 - if ! use yassl ; then
2531 - mycmakeargs+=( -DWITH_SSL=system )
2532 - else
2533 - mycmakeargs+=( -DWITH_SSL=bundled )
2534 - fi
2535 -
2536 - if ! use client-libs ; then
2537 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
2538 - fi
2539 -
2540 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
2541 - # systemtap only works on native ABI, bug 530132
2542 - if multilib_is_native_abi ; then
2543 - mycmakeargs+=(
2544 - -DENABLE_DTRACE=$(usex systemtap)
2545 - )
2546 - else
2547 - mycmakeargs+=(
2548 - -DWITHOUT_TOOLS=1
2549 - -DWITH_READLINE=1
2550 - -DENABLE_DTRACE=0
2551 - )
2552 - fi
2553 -
2554 - if multilib_is_native_abi && use server ; then
2555 - mycmakeargs+=(
2556 - -DWITH_LIBEVENT=system
2557 - -DWITH_LZ4=system
2558 - -DWITH_MECAB=$(usex cjk system OFF)
2559 - -DWITH_NUMA=$(usex numa ON OFF)
2560 - -DWITH_RAPID=$(usex experimental ON OFF)
2561 - )
2562 -
2563 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then
2564 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
2565 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
2566 - ewarn "You MUST file bugs without these variables set."
2567 -
2568 - mycmakeargs+=(
2569 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
2570 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
2571 - )
2572 - elif ! use latin1 ; then
2573 - mycmakeargs+=(
2574 - -DDEFAULT_CHARSET=utf8
2575 - -DDEFAULT_COLLATION=utf8_general_ci
2576 - )
2577 - else
2578 - mycmakeargs+=(
2579 - -DDEFAULT_CHARSET=latin1
2580 - -DDEFAULT_COLLATION=latin1_swedish_ci
2581 - )
2582 - fi
2583 -
2584 - mycmakeargs+=(
2585 - -DEXTRA_CHARSETS=all
2586 - -DDISABLE_SHARED=$(usex static YES NO)
2587 - -DWITH_DEBUG=$(usex debug)
2588 - -DWITH_EMBEDDED_SERVER=OFF
2589 - )
2590 -
2591 - if use profiling ; then
2592 - # Setting to OFF doesn't work: Once set, profiling options will be added
2593 - # to `mysqld --help` output via sql/sys_vars.cc causing
2594 - # "main.mysqld--help-notwin" test to fail
2595 - mycmakeargs+=( -DENABLED_PROFILING=ON )
2596 - fi
2597 -
2598 - if use static ; then
2599 - mycmakeargs+=( -DWITH_PIC=1 )
2600 - fi
2601 -
2602 - # Storage engines
2603 - mycmakeargs+=(
2604 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
2605 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
2606 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
2607 - -DWITH_CSV_STORAGE_ENGINE=1
2608 - -DWITH_FEDERATED_STORAGE_ENGINE=1
2609 - -DWITH_HEAP_STORAGE_ENGINE=1
2610 - -DWITH_INNOBASE_STORAGE_ENGINE=1
2611 - -DWITH_INNODB_MEMCACHED=0
2612 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
2613 - -DWITH_MYISAM_STORAGE_ENGINE=1
2614 - -DWITH_PARTITION_STORAGE_ENGINE=1
2615 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
2616 - $(usex tokudb '' -DWITHOUT_TOKUDB=1)
2617 - )
2618 -
2619 - if use tokudb ; then
2620 - # TokuDB Backup plugin requires valgrind unconditionally
2621 - mycmakeargs+=(
2622 - $(usex tokudb-backup-plugin '' -DTOKUDB_BACKUP_DISABLED=1)
2623 - )
2624 - fi
2625 -
2626 - else
2627 - mycmakeargs+=(
2628 - -DWITHOUT_SERVER=1
2629 - -DWITH_EMBEDDED_SERVER=OFF
2630 - -DEXTRA_CHARSETS=none
2631 - )
2632 - fi
2633 -
2634 - cmake-utils_src_configure
2635 -}
2636 -
2637 -src_compile() {
2638 - if use client-libs ; then
2639 - multilib-minimal_src_compile
2640 - else
2641 - multilib_src_compile
2642 - fi
2643 -}
2644 -
2645 -multilib_src_compile() {
2646 - cmake-utils_src_compile
2647 -}
2648 -
2649 -# Official test instructions:
2650 -# ulimit -n 16500 && \
2651 -# USE='latin1 perl server' \
2652 -# FEATURES='test userpriv -usersandbox' \
2653 -# ebuild percona-server-X.X.XX.ebuild \
2654 -# digest clean package
2655 -src_test() {
2656 - _disable_test() {
2657 - local rawtestname reason
2658 - rawtestname="${1}" ; shift
2659 - reason="${@}"
2660 - ewarn "test '${rawtestname}' disabled: '${reason}'"
2661 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
2662 - }
2663 -
2664 - local TESTDIR="${BUILD_DIR}/mysql-test"
2665 - local retstatus_unit
2666 - local retstatus_tests
2667 -
2668 - if ! use server ; then
2669 - einfo "Skipping server tests due to minimal build."
2670 - return 0
2671 - fi
2672 -
2673 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2674 - # localhost. Also causes weird failures.
2675 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2676 -
2677 - if [[ $UID -eq 0 ]] ; then
2678 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2679 - fi
2680 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
2681 -
2682 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
2683 -
2684 - # Run CTest (test-units)
2685 - cmake-utils_src_test
2686 - retstatus_unit=$?
2687 -
2688 - # Ensure that parallel runs don't die
2689 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
2690 - # Enable parallel testing, auto will try to detect number of cores
2691 - # You may set this by hand.
2692 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
2693 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
2694 -
2695 - # create directories because mysqladmin might run out of order
2696 - mkdir -p "${T}"/var-tests{,/log} || die
2697 -
2698 - # Run mysql tests
2699 - pushd "${TESTDIR}" &>/dev/null || die
2700 -
2701 - touch "${T}/disabled.def"
2702 - # These are failing in Percona-Server 5.7 for now and are believed to be
2703 - # false positives or are known to fail:
2704 - #
2705 - # group_replication.gr_communication_configuration: requires a valid local network address
2706 - # which clashes with FEATURES=network-sandbox
2707 - # main.percona_bug1289599: https://jira.percona.com/browse/PS-2072
2708 - # main.percona_log_slow_innodb: https://jira.percona.com/browse/PS-4930
2709 - # keyring_vault.keyring_vault_timeout: requires network access to vault.public-ci.percona.com
2710 - # which clashes with FEATURES=network-sandbox
2711 - #
2712 - local t
2713 -
2714 - for t in \
2715 - group_replication.gr_communication_configuration \
2716 - main.percona_bug1289599 \
2717 - main.percona_log_slow_innodb \
2718 - keyring_vault.keyring_vault_timeout \
2719 - ; do
2720 - _disable_test "$t" "False positives in Gentoo / Known bug"
2721 - done
2722 -
2723 - if use numa && use kernel_linux ; then
2724 - # bug 584880
2725 - if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then
2726 - for t in sys_vars.innodb_numa_interleave_basic ; do
2727 - _disable_test "$t" "Test $t requires system with NUMA support"
2728 - done
2729 - fi
2730 - fi
2731 -
2732 - if use tokudb ; then
2733 - if [[ -f "/sys/kernel/mm/transparent_hugepage/enabled" ]] ; then
2734 - if grep -q -E "\[always\]" /sys/kernel/mm/transparent_hugepage/enabled &>/dev/null ; then
2735 - # TokuDB refuses to start when transparent hugepages are enabled
2736 - for t in \
2737 - tokudb.rows-32m-rand-insert \
2738 - tokudb.savepoint-2 \
2739 - tokudb.savepoint-3 \
2740 - tokudb.savepoint-4 \
2741 - tokudb.savepoint-1078 \
2742 - tokudb.savepoint-1078-2 \
2743 - tokudb.savepoint-1078-3 \
2744 - tokudb.savepoint-1078-4 \
2745 - ; do
2746 - _disable_test "$t" "TokuDB will not work with transparent hugepages enabled"
2747 - done
2748 - fi
2749 - else
2750 - einfo "Cannot determine transparent hugepage status."
2751 - einfo "Please note that TokuDB refuses to start when transparent hugepages are enabled!"
2752 - fi
2753 - fi
2754 -
2755 - if ! use latin1 ; then
2756 - # The following tests will fail if DEFAULT_CHARSET
2757 - # isn't set to latin1:
2758 - for t in \
2759 - binlog.binlog_mysqlbinlog_filter \
2760 - binlog.binlog_xa_prepared_disconnect \
2761 - funcs_1.is_columns_mysql \
2762 - funcs_1.is_tables_mysql \
2763 - funcs_1.is_triggers \
2764 - innodb.innodb_pagesize_max_recordsize \
2765 - innodb.innodb-system-table-view \
2766 - innodb.mysqldump_max_recordsize \
2767 - main.mysql_client_test \
2768 - main.mysqld--help-notwin \
2769 - main.type_string \
2770 - main.information_schema \
2771 - perfschema.binlog_edge_mix \
2772 - perfschema.binlog_edge_stmt \
2773 - rpl.rpl_xa_survive_disconnect \
2774 - rpl.rpl_xa_survive_disconnect_lsu_off \
2775 - rpl.rpl_xa_survive_disconnect_table \
2776 - ; do
2777 - _disable_test "$t" "requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set"
2778 - done
2779 - fi
2780 -
2781 - # Try to increase file limits to increase test coverage
2782 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
2783 - # Upper limit comes from parts.partition_* tests
2784 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
2785 -
2786 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
2787 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
2788 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
2789 -
2790 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
2791 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
2792 - else
2793 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
2794 - fi
2795 - else
2796 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
2797 - fi
2798 - else
2799 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
2800 - fi
2801 -
2802 - # run mysql-test tests
2803 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
2804 - retstatus_tests=$?
2805 -
2806 - popd &>/dev/null || die
2807 -
2808 - # Cleanup is important for these testcases.
2809 - pkill -9 -f "${S}/ndb" 2>/dev/null
2810 - pkill -9 -f "${S}/sql" 2>/dev/null
2811 -
2812 - local failures=""
2813 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
2814 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
2815 -
2816 - [[ -z "$failures" ]] || die "Test failures: $failures"
2817 - einfo "Tests successfully completed"
2818 -}
2819 -
2820 -src_install() {
2821 - local MULTILIB_WRAPPED_HEADERS
2822 - local MULTILIB_CHOST_TOOLS
2823 - if use client-libs ; then
2824 - # headers with ABI specific data
2825 - MULTILIB_WRAPPED_HEADERS=(
2826 - /usr/include/mysql/server/my_config.h
2827 - /usr/include/mysql/server/mysql_version.h )
2828 -
2829 - # wrap the config scripts
2830 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
2831 - multilib-minimal_src_install
2832 - else
2833 - multilib_src_install
2834 - multilib_src_install_all
2835 - fi
2836 -}
2837 -
2838 -# Intentionally override eclass function
2839 -multilib_src_install() {
2840 -
2841 - cmake-utils_src_install
2842 -
2843 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
2844 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
2845 -}
2846 -
2847 -multilib_src_install_all() {
2848 - # Make sure the vars are correctly initialized
2849 - mysql_init_vars
2850 -
2851 - # Convenience links
2852 - einfo "Making Convenience links for mysqlcheck multi-call binary"
2853 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
2854 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
2855 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
2856 -
2857 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
2858 - if [[ -d "${ED}/usr/data" ]] ; then
2859 - rm -Rf "${ED}/usr/data" || die
2860 - fi
2861 -
2862 - # Unless they explicitly specific USE=test, then do not install the
2863 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
2864 - # validation of your database configuration after tuning it.
2865 - if ! use test ; then
2866 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
2867 - fi
2868 -
2869 - # Configuration stuff
2870 - einfo "Building default configuration ..."
2871 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
2872 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
2873 - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
2874 - eprefixify "${TMPDIR}/my.cnf"
2875 - doins "${TMPDIR}/my.cnf"
2876 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
2877 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
2878 - eprefixify "${TMPDIR}/50-distro-client.cnf"
2879 - doins "${TMPDIR}/50-distro-client.cnf"
2880 -
2881 - if use server ; then
2882 - mycnf_src="my.cnf.distro-server"
2883 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
2884 - "${FILESDIR}/${mycnf_src}" \
2885 - > "${TMPDIR}/my.cnf.ok" || die
2886 -
2887 - if use prefix ; then
2888 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
2889 - "${TMPDIR}/my.cnf.ok" || die
2890 - fi
2891 -
2892 - if use latin1 ; then
2893 - sed -i \
2894 - -e "/character-set/s|utf8|latin1|g" \
2895 - "${TMPDIR}/my.cnf.ok" || die
2896 - fi
2897 -
2898 - eprefixify "${TMPDIR}/my.cnf.ok"
2899 -
2900 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
2901 -
2902 - if use tokudb ; then
2903 - # Remove some unwanted files
2904 - rm -fv \
2905 - "${ED%/}"/usr/COPYING.AGPLv3 \
2906 - "${ED%/}"/usr/COPYING.GPLv2 \
2907 - "${ED%/}"/usr/PATENTS \
2908 - "${ED%/}"/usr/README.md \
2909 - || die
2910 - fi
2911 - fi
2912 -
2913 - #Remove mytop if perl is not selected
2914 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
2915 -}
2916 -
2917 -pkg_config() {
2918 - _getoptval() {
2919 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
2920 - local section="$1"
2921 - local flag="--${2}="
2922 - local extra_options="${3}"
2923 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
2924 - }
2925 - local old_MY_DATADIR="${MY_DATADIR}"
2926 - local old_HOME="${HOME}"
2927 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
2928 - export HOME=${EPREFIX%/}/root
2929 -
2930 - # Make sure the vars are correctly initialized
2931 - mysql_init_vars
2932 -
2933 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
2934 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
2935 - die "Minimal builds do NOT include the MySQL server"
2936 - fi
2937 -
2938 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then
2939 - local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}"
2940 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
2941 - local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}"
2942 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
2943 -
2944 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then
2945 - if [[ -d "${MY_DATADIR_s}" ]] ; then
2946 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
2947 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
2948 - else
2949 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
2950 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
2951 - || die "Moving MY_DATADIR failed"
2952 - fi
2953 - else
2954 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
2955 - if [[ -d "${MY_DATADIR_s}" ]] ; then
2956 - ewarn "Attempting to use ${MY_DATADIR_s}"
2957 - else
2958 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
2959 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
2960 - fi
2961 - fi
2962 - fi
2963 -
2964 - local pwd1="a"
2965 - local pwd2="b"
2966 - local maxtry=15
2967 -
2968 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
2969 - local tmp_mysqld_password_source=
2970 -
2971 - for tmp_mysqld_password_source in mysql client ; do
2972 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
2973 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
2974 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
2975 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
2976 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
2977 - MYSQL_ROOT_PASSWORD=
2978 - continue
2979 - fi
2980 -
2981 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
2982 - break
2983 - fi
2984 - done
2985 -
2986 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
2987 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
2988 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
2989 - fi
2990 -
2991 - unset tmp_mysqld_password_source
2992 - fi
2993 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
2994 - # These are dir+prefix
2995 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
2996 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
2997 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
2998 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
2999 -
3000 - if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then
3001 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
3002 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR"
3003 - fi
3004 -
3005 - if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then
3006 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
3007 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN"
3008 - fi
3009 -
3010 - if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then
3011 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
3012 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG"
3013 - fi
3014 -
3015 - if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then
3016 - ewarn "You have already a MySQL database in place."
3017 - ewarn "(${ROOT%/}/${MY_DATADIR}/*)"
3018 - ewarn "Please rename or delete it if you wish to replace it."
3019 - die "MySQL database already exists!"
3020 - fi
3021 -
3022 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
3023 - # localhost. Also causes weird failures.
3024 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
3025 -
3026 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
3027 -
3028 - einfo "Please provide a password for the mysql 'root' user now"
3029 - einfo "or through the ${HOME}/.my.cnf file."
3030 - ewarn "Avoid [\"'\\_%] characters in the password"
3031 - read -rsp " >" pwd1 ; echo
3032 -
3033 - einfo "Retype the password"
3034 - read -rsp " >" pwd2 ; echo
3035 -
3036 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
3037 - die "Passwords are not the same"
3038 - fi
3039 - MYSQL_ROOT_PASSWORD="${pwd1}"
3040 - unset pwd1 pwd2
3041 - fi
3042 -
3043 - local options
3044 - local sqltmp="$(emktemp)"
3045 -
3046 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
3047 - # see http://bugs.mysql.com/bug.php?id=31312
3048 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
3049 -
3050 - # Figure out which options we need to disable to do the setup
3051 - local helpfile="${TMPDIR%/}/mysqld-help"
3052 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
3053 - for opt in host-cache name-resolve networking slave-start \
3054 - federated ssl log-bin relay-log slow-query-log external-locking \
3055 - log-slave-updates \
3056 - ; do
3057 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
3058 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
3059 - done
3060 -
3061 - einfo "Creating the mysql database and setting proper permissions on it ..."
3062 -
3063 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
3064 - PID_DIR="${EROOT%/}/var/run/mysqld"
3065 - if [[ ! -d "${PID_DIR}" ]] ; then
3066 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
3067 - fi
3068 -
3069 - if [[ ! -d "${MY_DATADIR}" ]] ; then
3070 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
3071 - fi
3072 -
3073 - pushd "${TMPDIR}" &>/dev/null || die
3074 -
3075 - # Filling timezones, see
3076 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
3077 - echo "USE mysql;" >"${sqltmp}"
3078 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
3079 - chown mysql "${sqltmp}" || die
3080 -
3081 - # --initialize-insecure will not set root password
3082 - # --initialize would set a random one in the log which we don't need as we set it ourselves
3083 - local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
3084 - cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
3085 - einfo "Command: ${cmd[*]}"
3086 - su -s /bin/sh -c "${cmd[*]}" mysql \
3087 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
3088 - if [[ $? -ne 0 ]] ; then
3089 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
3090 - die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
3091 - fi
3092 - popd &>/dev/null || die
3093 - [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \
3094 - || die "MySQL databases not installed"
3095 -
3096 - use prefix || options="${options} --user=mysql"
3097 -
3098 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
3099 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
3100 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
3101 - ${options} \
3102 - $(use prefix || echo --user=mysql) \
3103 - --log-warnings=0 \
3104 - --basedir=${EROOT%/}/usr \
3105 - --datadir=${ROOT%/}/${MY_DATADIR} \
3106 - --max_allowed_packet=8M \
3107 - --net_buffer_length=16K \
3108 - --socket=${socket} \
3109 - --pid-file=${pidfile} \
3110 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
3111 - #einfo "About to start mysqld: ${mysqld}"
3112 - ebegin "Starting mysqld"
3113 - einfo "Command ${mysqld}"
3114 - ${mysqld} &
3115 - rc=$?
3116 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
3117 - maxtry=$((${maxtry}-1))
3118 - echo -n "."
3119 - sleep 1
3120 - done
3121 - eend $rc
3122 -
3123 - if ! [[ -S "${socket}" ]] ; then
3124 - die "Completely failed to start up mysqld with: ${mysqld}"
3125 - fi
3126 -
3127 - ebegin "Setting root password"
3128 - # Do this from memory, as we don't want clear text passwords in temp files
3129 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'"
3130 - "${EROOT%/}/usr/bin/mysql" \
3131 - --no-defaults \
3132 - "--socket=${socket}" \
3133 - -hlocalhost \
3134 - -e "${sql}"
3135 - eend $?
3136 -
3137 - # Stop the server and cleanup
3138 - einfo "Stopping the server ..."
3139 - kill $(< "${pidfile}" )
3140 - rm -f "${sqltmp}"
3141 - wait %1
3142 - einfo "Done"
3143 -}
3144
3145 diff --git a/dev-db/percona-server/percona-server-5.7.23.24.ebuild b/dev-db/percona-server/percona-server-5.7.23.24.ebuild
3146 deleted file mode 100644
3147 index 2c75a45d8e3..00000000000
3148 --- a/dev-db/percona-server/percona-server-5.7.23.24.ebuild
3149 +++ /dev/null
3150 @@ -1,1066 +0,0 @@
3151 -# Copyright 1999-2018 Gentoo Authors
3152 -# Distributed under the terms of the GNU General Public License v2
3153 -
3154 -EAPI="6"
3155 -MY_EXTRAS_VER="20181017-2201Z"
3156 -
3157 -CMAKE_MAKEFILE_GENERATOR=emake
3158 -
3159 -# Python2 required for innodb_stress.innodb_stress{,_blob,_crash} test
3160 -PYTHON_COMPAT=( python2_7 )
3161 -
3162 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
3163 -
3164 -inherit eapi7-ver cmake-utils eutils flag-o-matic linux-info \
3165 - prefix python-any-r1 toolchain-funcs user multilib-minimal
3166 -
3167 -MY_PV=$(ver_rs 3 '-')
3168 -MY_PN="Percona-Server"
3169 -MY_P="${PN}-${MY_PV}"
3170 -MY_MAJOR_PV=$(ver_cut 1-2)
3171 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/5.7/release-notes/release-notes_index.html"
3172 -
3173 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz
3174 - mirror://sourceforge/boost/boost_1_59_0.tar.gz
3175 -"
3176 -
3177 -# Gentoo patches to MySQL
3178 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then
3179 - SRC_URI="${SRC_URI}
3180 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
3181 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
3182 -fi
3183 -
3184 -HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server"
3185 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
3186 -LICENSE="GPL-2"
3187 -SLOT="0/18"
3188 -IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 libressl numa pam +perl profiling rocksdb
3189 - selinux +server static static-libs systemtap tcmalloc test tokudb tokudb-backup-plugin yassl"
3190 -
3191 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
3192 -RESTRICT="libressl? ( test )"
3193 -
3194 -REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
3195 -
3196 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
3197 -
3198 -# Shorten the path because the socket path length must be shorter than 107 chars
3199 -# and we will run a mysql server during test phase
3200 -S="${WORKDIR}/mysql"
3201 -
3202 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
3203 - inherit git-r3
3204 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
3205 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
3206 - EGIT_CLONE_TYPE=shallow
3207 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
3208 -else
3209 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
3210 -fi
3211 -
3212 -PATCHES=(
3213 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch
3214 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch
3215 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch
3216 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-without-clientlibs-tools.patch
3217 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-fix-libressl-support.patch
3218 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-add-missing-gcc-8-fix.patch
3219 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch
3220 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch
3221 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-mips-ASM.patch
3222 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-rocksdb-use-system-libs.patch
3223 -)
3224 -
3225 -# Be warned, *DEPEND are version-dependant
3226 -# These are used for both runtime and compiletime
3227 -# MULTILIB_USEDEP only set for libraries used by the client library
3228 -COMMON_DEPEND="net-misc/curl:=
3229 - >=sys-apps/sed-4
3230 - >=sys-apps/texinfo-4.7-r1
3231 - sys-libs/ncurses:0=
3232 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
3233 - !client-libs? (
3234 - dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?]
3235 - >=sys-libs/zlib-1.2.3:0=
3236 - )
3237 - jemalloc? ( dev-libs/jemalloc:0= )
3238 - kernel_linux? (
3239 - dev-libs/libaio:0=
3240 - sys-process/procps:0=
3241 - )
3242 - server? (
3243 - >=app-arch/lz4-0_p131:=
3244 - cjk? ( app-text/mecab:= )
3245 - experimental? (
3246 - dev-libs/libevent:=
3247 - dev-libs/protobuf:=
3248 - net-libs/libtirpc:=
3249 - )
3250 - numa? ( sys-process/numactl )
3251 - pam? ( virtual/pam:0= )
3252 - rocksdb? (
3253 - app-arch/zstd:=
3254 - dev-libs/protobuf:=
3255 - )
3256 - tokudb? (
3257 - app-arch/snappy:=
3258 - app-arch/xz-utils:=
3259 - )
3260 - tokudb-backup-plugin? ( dev-util/valgrind )
3261 - )
3262 - systemtap? ( >=dev-util/systemtap-1.3:0= )
3263 - tcmalloc? ( dev-util/google-perftools:0= )
3264 - !yassl? (
3265 - client-libs? (
3266 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
3267 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
3268 - )
3269 - !client-libs? (
3270 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
3271 - libressl? ( dev-libs/libressl:0= )
3272 - )
3273 - )
3274 -"
3275 -DEPEND="${COMMON_DEPEND}
3276 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
3277 - dev-libs/protobuf
3278 - virtual/yacc
3279 - server? (
3280 - dev-libs/libevent
3281 - experimental? ( net-libs/rpcsvc-proto )
3282 - )
3283 - static? ( sys-libs/ncurses[static-libs] )
3284 - test? (
3285 - $(python_gen_any_dep 'dev-python/mysql-python[${PYTHON_USEDEP}]')
3286 - dev-perl/JSON
3287 - )
3288 -"
3289 -RDEPEND="${COMMON_DEPEND}
3290 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
3291 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= )
3292 - selinux? ( sec-policy/selinux-mysql )
3293 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
3294 -"
3295 -# For other stuff to bring us in
3296 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
3297 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
3298 -
3299 -python_check_deps() {
3300 - has_version "dev-python/mysql-python[${PYTHON_USEDEP}]"
3301 -}
3302 -
3303 -mysql_init_vars() {
3304 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
3305 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
3306 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
3307 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
3308 -
3309 - if [[ -z "${MY_DATADIR}" ]] ; then
3310 - MY_DATADIR=""
3311 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
3312 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
3313 - | sed -ne '/datadir/s|^--datadir=||p' \
3314 - | tail -n1`
3315 - if [[ -z "${MY_DATADIR}" ]] ; then
3316 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
3317 - | sed -e 's/.*=\s*//' \
3318 - | tail -n1`
3319 - fi
3320 - fi
3321 - if [[ -z "${MY_DATADIR}" ]] ; then
3322 - MY_DATADIR="${MY_LOCALSTATEDIR}"
3323 - einfo "Using default MY_DATADIR"
3324 - fi
3325 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
3326 -
3327 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
3328 - if [[ -e "${MY_DATADIR}" ]] ; then
3329 - # If you get this and you're wondering about it, see bug #207636
3330 - elog "MySQL datadir found in ${MY_DATADIR}"
3331 - elog "A new one will not be created."
3332 - PREVIOUS_DATADIR="yes"
3333 - else
3334 - PREVIOUS_DATADIR="no"
3335 - fi
3336 - export PREVIOUS_DATADIR
3337 - fi
3338 - else
3339 - if [[ ${EBUILD_PHASE} == "config" ]] ; then
3340 - local new_MY_DATADIR
3341 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
3342 - | sed -ne '/datadir/s|^--datadir=||p' \
3343 - | tail -n1`
3344 -
3345 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then
3346 - ewarn "MySQL MY_DATADIR has changed"
3347 - ewarn "from ${MY_DATADIR}"
3348 - ewarn "to ${new_MY_DATADIR}"
3349 - MY_DATADIR="${new_MY_DATADIR}"
3350 - fi
3351 - fi
3352 - fi
3353 -
3354 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
3355 - export MY_LOCALSTATEDIR MY_LOGDIR
3356 - export MY_DATADIR
3357 -}
3358 -
3359 -pkg_pretend() {
3360 - if use numa ; then
3361 - local CONFIG_CHECK="~NUMA"
3362 -
3363 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
3364 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
3365 -
3366 - check_extra_config
3367 - fi
3368 -}
3369 -
3370 -pkg_setup() {
3371 - if [[ ${MERGE_TYPE} != binary ]] ; then
3372 - local GCC_MAJOR_SET=$(gcc-major-version)
3373 - local GCC_MINOR_SET=$(gcc-minor-version)
3374 - # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on
3375 - # non x86{,_64} arches
3376 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
3377 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
3378 - eerror "${PN} needs to be built with gcc-4.7 or later."
3379 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
3380 - die
3381 - fi
3382 -
3383 - use test && python-any-r1_pkg_setup
3384 - fi
3385 -
3386 - if has test ${FEATURES} && \
3387 - use server && ! has userpriv ${FEATURES} ; then
3388 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
3389 - fi
3390 -
3391 - # This should come after all of the die statements
3392 - enewgroup mysql 60 || die "problem adding 'mysql' group"
3393 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
3394 -}
3395 -
3396 -pkg_preinst() {
3397 - # Here we need to see if the implementation switched client libraries
3398 - # We check if this is a new instance of the package and a client library already exists
3399 - local SHOW_ABI_MESSAGE libpath
3400 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so" ]] ; then
3401 - libpath=$(readlink "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so")
3402 - elog "Due to ABI changes when switching between different client libraries,"
3403 - elog "revdep-rebuild must find and rebuild all packages linking to libperconaserverclient."
3404 - elog "Please run: revdep-rebuild --library ${libpath}"
3405 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
3406 - fi
3407 -}
3408 -
3409 -pkg_postinst() {
3410 - # Make sure the vars are correctly initialized
3411 - mysql_init_vars
3412 -
3413 - # Create log directory securely if it does not exist
3414 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
3415 -
3416 - if use server ; then
3417 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
3418 - einfo
3419 - elog "You might want to run:"
3420 - elog "\"emerge --config =${CATEGORY}/${PF}\""
3421 - elog "if this is a new install."
3422 - elog
3423 - elog "If you are switching server implentations, you should run the"
3424 - elog "mysql_upgrade tool."
3425 - einfo
3426 - else
3427 - einfo
3428 - elog "If you are upgrading major versions, you should run the"
3429 - elog "mysql_upgrade tool."
3430 - einfo
3431 - fi
3432 - fi
3433 -
3434 - # Note about configuration change
3435 - einfo
3436 - elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
3437 - elog "to several files in /etc/mysql/mysql.d."
3438 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
3439 - elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
3440 - elog "You may have as many files as needed and they are read alphabetically."
3441 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
3442 - einfo
3443 -}
3444 -
3445 -src_unpack() {
3446 - unpack ${A}
3447 - # Grab the patches
3448 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
3449 -
3450 - mv -f "${WORKDIR}/${MY_P}" "${S}" || die
3451 -}
3452 -
3453 -src_prepare() {
3454 - cmake-utils_src_prepare
3455 -
3456 - if use jemalloc ; then
3457 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
3458 - fi
3459 -
3460 - if use tcmalloc ; then
3461 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
3462 - fi
3463 -
3464 - # Don't build bundled xz-utils
3465 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
3466 - echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
3467 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
3468 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
3469 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
3470 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
3471 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
3472 - fi
3473 -
3474 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
3475 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
3476 - fi
3477 -
3478 - # Remove bundled libs so we cannot accidentally use them
3479 - # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394
3480 - rm -rv \
3481 - "${S}"/extra/protobuf \
3482 - "${S}"/libevent \
3483 - "${S}"/storage/rocksdb/third_party \
3484 - "${S}"/storage/tokudb/PerconaFT/third_party \
3485 - "${S}"/zlib \
3486 - || die
3487 -
3488 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
3489 - if [[ -d "${S}/support-files/SELinux" ]] ; then
3490 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
3491 - fi
3492 -
3493 - if use libressl ; then
3494 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
3495 - "${S}/cmake/ssl.cmake" || die
3496 - fi
3497 -
3498 - sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
3499 -}
3500 -
3501 -src_configure(){
3502 - # Bug #114895, bug #110149
3503 - filter-flags "-O" "-O[01]"
3504 -
3505 - append-cxxflags -felide-constructors
3506 -
3507 - # bug #283926, with GCC4.4, this is required to get correct behavior.
3508 - append-flags -fno-strict-aliasing
3509 -
3510 - if use tokudb ; then
3511 - # https://jira.percona.com/browse/PS-4399
3512 - append-cxxflags -Wno-error=shadow
3513 - fi
3514 -
3515 - if use client-libs ; then
3516 - multilib-minimal_src_configure
3517 - else
3518 - multilib_src_configure
3519 - fi
3520 -}
3521 -
3522 -multilib_src_configure() {
3523 - debug-print-function ${FUNCNAME} "$@"
3524 -
3525 - if ! multilib_is_native_abi && ! use client-libs ; then
3526 - return
3527 - fi
3528 -
3529 - CMAKE_BUILD_TYPE="RelWithDebInfo"
3530 -
3531 - # debug hack wrt #497532
3532 - mycmakeargs=(
3533 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
3534 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
3535 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
3536 - -DMYSQL_DATADIR="${EPREFIX%/}/var/lib/mysql"
3537 - -DSYSCONFDIR="${EPREFIX%/}/etc/mysql"
3538 - -DINSTALL_BINDIR=bin
3539 - -DINSTALL_DOCDIR=share/doc/${PF}
3540 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
3541 - -DINSTALL_INCLUDEDIR=include/mysql
3542 - -DINSTALL_INFODIR=share/info
3543 - -DINSTALL_LIBDIR=$(get_libdir)
3544 - -DINSTALL_MANDIR=share/man
3545 - -DINSTALL_MYSQLSHAREDIR=share/mysql
3546 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
3547 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
3548 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
3549 - -DINSTALL_SBINDIR=sbin
3550 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
3551 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
3552 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
3553 - ### TODO: make this system but issues with UTF-8 prevent it
3554 - -DWITH_EDITLINE=bundled
3555 - -DWITH_ZLIB=system
3556 - -DWITH_LIBWRAP=0
3557 - -DENABLED_LOCAL_INFILE=1
3558 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
3559 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
3560 - -DWITH_DEFAULT_FEATURE_SET=0
3561 - # The build forces this to be defined when cross-compiling. We pass it
3562 - # all the time for simplicity and to make sure it is actually correct.
3563 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
3564 - -DWITH_CURL=system
3565 - -DWITH_BOOST="${WORKDIR}/boost_1_59_0"
3566 - -DWITH_PROTOBUF=system
3567 - )
3568 -
3569 - if use test ; then
3570 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
3571 - else
3572 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
3573 - fi
3574 -
3575 - if ! use yassl ; then
3576 - mycmakeargs+=( -DWITH_SSL=system )
3577 - else
3578 - mycmakeargs+=( -DWITH_SSL=bundled )
3579 - fi
3580 -
3581 - if ! use client-libs ; then
3582 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
3583 - fi
3584 -
3585 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
3586 - # systemtap only works on native ABI, bug 530132
3587 - if multilib_is_native_abi ; then
3588 - mycmakeargs+=(
3589 - -DENABLE_DTRACE=$(usex systemtap)
3590 - )
3591 - else
3592 - mycmakeargs+=(
3593 - -DWITHOUT_TOOLS=1
3594 - -DWITH_READLINE=1
3595 - -DENABLE_DTRACE=0
3596 - )
3597 - fi
3598 -
3599 - if multilib_is_native_abi && use server ; then
3600 - mycmakeargs+=(
3601 - -DWITH_LIBEVENT=system
3602 - -DWITH_LZ4=system
3603 - -DWITH_MECAB=$(usex cjk system OFF)
3604 - -DWITH_NUMA=$(usex numa ON OFF)
3605 - -DWITH_RAPID=$(usex experimental ON OFF)
3606 - )
3607 -
3608 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then
3609 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
3610 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
3611 - ewarn "You MUST file bugs without these variables set."
3612 -
3613 - mycmakeargs+=(
3614 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
3615 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
3616 - )
3617 - elif ! use latin1 ; then
3618 - mycmakeargs+=(
3619 - -DDEFAULT_CHARSET=utf8
3620 - -DDEFAULT_COLLATION=utf8_general_ci
3621 - )
3622 - else
3623 - mycmakeargs+=(
3624 - -DDEFAULT_CHARSET=latin1
3625 - -DDEFAULT_COLLATION=latin1_swedish_ci
3626 - )
3627 - fi
3628 -
3629 - mycmakeargs+=(
3630 - -DEXTRA_CHARSETS=all
3631 - -DDISABLE_SHARED=$(usex static YES NO)
3632 - -DWITH_DEBUG=$(usex debug)
3633 - -DWITH_EMBEDDED_SERVER=OFF
3634 - )
3635 -
3636 - if use profiling ; then
3637 - # Setting to OFF doesn't work: Once set, profiling options will be added
3638 - # to `mysqld --help` output via sql/sys_vars.cc causing
3639 - # "main.mysqld--help-notwin" test to fail
3640 - mycmakeargs+=( -DENABLED_PROFILING=ON )
3641 - fi
3642 -
3643 - if use static ; then
3644 - mycmakeargs+=( -DWITH_PIC=1 )
3645 - fi
3646 -
3647 - # Storage engines
3648 - mycmakeargs+=(
3649 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
3650 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
3651 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
3652 - -DWITH_CSV_STORAGE_ENGINE=1
3653 - -DWITH_FEDERATED_STORAGE_ENGINE=1
3654 - -DWITH_HEAP_STORAGE_ENGINE=1
3655 - -DWITH_INNOBASE_STORAGE_ENGINE=1
3656 - -DWITH_INNODB_MEMCACHED=0
3657 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
3658 - -DWITH_MYISAM_STORAGE_ENGINE=1
3659 - -DWITH_PARTITION_STORAGE_ENGINE=1
3660 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
3661 - $(usex tokudb '' -DWITHOUT_TOKUDB=1)
3662 - )
3663 -
3664 - if use tokudb ; then
3665 - # TokuDB Backup plugin requires valgrind unconditionally
3666 - mycmakeargs+=(
3667 - $(usex tokudb-backup-plugin '' -DTOKUDB_BACKUP_DISABLED=1)
3668 - )
3669 - fi
3670 -
3671 - else
3672 - mycmakeargs+=(
3673 - -DWITHOUT_SERVER=1
3674 - -DWITH_EMBEDDED_SERVER=OFF
3675 - -DEXTRA_CHARSETS=none
3676 - )
3677 - fi
3678 -
3679 - cmake-utils_src_configure
3680 -}
3681 -
3682 -src_compile() {
3683 - if use client-libs ; then
3684 - multilib-minimal_src_compile
3685 - else
3686 - multilib_src_compile
3687 - fi
3688 -}
3689 -
3690 -multilib_src_compile() {
3691 - cmake-utils_src_compile
3692 -}
3693 -
3694 -# Official test instructions:
3695 -# ulimit -n 16500 && \
3696 -# USE='latin1 perl server' \
3697 -# FEATURES='test userpriv -usersandbox' \
3698 -# ebuild percona-server-X.X.XX.ebuild \
3699 -# digest clean package
3700 -src_test() {
3701 - _disable_test() {
3702 - local rawtestname reason
3703 - rawtestname="${1}" ; shift
3704 - reason="${@}"
3705 - ewarn "test '${rawtestname}' disabled: '${reason}'"
3706 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
3707 - }
3708 -
3709 - local TESTDIR="${BUILD_DIR}/mysql-test"
3710 - local retstatus_unit
3711 - local retstatus_tests
3712 -
3713 - if ! use server ; then
3714 - einfo "Skipping server tests due to minimal build."
3715 - return 0
3716 - fi
3717 -
3718 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
3719 - # localhost. Also causes weird failures.
3720 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
3721 -
3722 - if [[ $UID -eq 0 ]] ; then
3723 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
3724 - fi
3725 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
3726 -
3727 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
3728 -
3729 - # Run CTest (test-units)
3730 - cmake-utils_src_test
3731 - retstatus_unit=$?
3732 -
3733 - # Ensure that parallel runs don't die
3734 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
3735 - # Enable parallel testing, auto will try to detect number of cores
3736 - # You may set this by hand.
3737 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
3738 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
3739 -
3740 - # create directories because mysqladmin might run out of order
3741 - mkdir -p "${T}"/var-tests{,/log} || die
3742 -
3743 - # Run mysql tests
3744 - pushd "${TESTDIR}" &>/dev/null || die
3745 -
3746 - touch "${T}/disabled.def"
3747 - # These are failing in Percona-Server 5.7 for now and are believed to be
3748 - # false positives or are known to fail:
3749 - #
3750 - # encryption.innodb_encryption_tables: https://jira.percona.com/browse/PS-5036
3751 - # group_replication.gr_communication_configuration: requires a valid local network address
3752 - # which clashes with FEATURES=network-sandbox
3753 - # main.mysqlshow: https://jira.percona.com/browse/PS-5017
3754 - # main.percona_bug1289599: https://jira.percona.com/browse/PS-2072
3755 - # keyring_vault.keyring_vault_timeout: requires network access to vault.public-ci.percona.com
3756 - # which clashes with FEATURES=network-sandbox
3757 - # perfschema.show_sanity: https://jira.percona.com/browse/PS-5018
3758 - # rocksdb.rocksdb: https://jira.percona.com/browse/PS-5034
3759 - # rocksdb.show_engine: https://jira.percona.com/browse/PS-5033
3760 - # rocksdb.show_table_status: https://jira.percona.com/browse/PS-5035
3761 - # rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223
3762 - # rpl.rpl_multi_source_mts_reset_worker_info: https://jira.percona.com/browse/PS-3786
3763 - # x.crud_insert_cast: https://jira.percona.com/browse/PS-5032
3764 - # x.insert_table_bad_column: https://jira.percona.com/browse/PS-5032
3765 - # x.insert_table_bad_numcolumns: https://jira.percona.com/browse/PS-5032
3766 - # x.insert_table_bad_column_type: https://jira.percona.com/browse/PS-5032
3767 - # x.insert_table: https://jira.percona.com/browse/PS-5032
3768 - # x.update_crud_arrayappend_o: https://jira.percona.com/browse/PS-5032
3769 - # x.update_crud_arrayinsert_o: https://jira.percona.com/browse/PS-5032
3770 - #
3771 - local t
3772 -
3773 - for t in \
3774 - encryption.innodb_encryption_tables \
3775 - group_replication.gr_communication_configuration \
3776 - main.mysqlshow \
3777 - main.percona_bug1289599 \
3778 - keyring_vault.keyring_vault_timeout \
3779 - perfschema.show_sanity \
3780 - rocksdb.rocksdb \
3781 - rocksdb.show_engine \
3782 - rocksdb.show_table_status \
3783 - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \
3784 - rpl.rpl_multi_source_mts_reset_worker_info \
3785 - x.crud_insert_cast \
3786 - x.insert_table_bad_column \
3787 - x.insert_table_bad_numcolumns \
3788 - x.insert_table_bad_column_type \
3789 - x.insert_table \
3790 - x.update_crud_arrayappend_o \
3791 - x.update_crud_arrayinsert_o \
3792 - ; do
3793 - _disable_test "$t" "False positives in Gentoo / Known bug"
3794 - done
3795 -
3796 - if use numa && use kernel_linux ; then
3797 - # bug 584880
3798 - if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then
3799 - for t in sys_vars.innodb_numa_interleave_basic ; do
3800 - _disable_test "$t" "Test $t requires system with NUMA support"
3801 - done
3802 - fi
3803 - fi
3804 -
3805 - if use tokudb ; then
3806 - if [[ -f "/sys/kernel/mm/transparent_hugepage/enabled" ]] ; then
3807 - if grep -q -E "\[always\]" /sys/kernel/mm/transparent_hugepage/enabled &>/dev/null ; then
3808 - # TokuDB refuses to start when transparent hugepages are enabled
3809 - for t in \
3810 - tokudb.rows-32m-rand-insert \
3811 - tokudb.savepoint-2 \
3812 - tokudb.savepoint-3 \
3813 - tokudb.savepoint-4 \
3814 - tokudb.savepoint-1078 \
3815 - tokudb.savepoint-1078-2 \
3816 - tokudb.savepoint-1078-3 \
3817 - tokudb.savepoint-1078-4 \
3818 - ; do
3819 - _disable_test "$t" "TokuDB will not work with transparent hugepages enabled"
3820 - done
3821 - fi
3822 - else
3823 - einfo "Cannot determine transparent hugepage status."
3824 - einfo "Please note that TokuDB refuses to start when transparent hugepages are enabled!"
3825 - fi
3826 - fi
3827 -
3828 - if ! use latin1 ; then
3829 - # The following tests will fail if DEFAULT_CHARSET
3830 - # isn't set to latin1:
3831 - for t in \
3832 - binlog.binlog_mysqlbinlog_filter \
3833 - binlog.binlog_xa_prepared_disconnect \
3834 - funcs_1.is_columns_mysql \
3835 - funcs_1.is_tables_mysql \
3836 - funcs_1.is_triggers \
3837 - innodb.innodb_pagesize_max_recordsize \
3838 - innodb.innodb-system-table-view \
3839 - innodb.mysqldump_max_recordsize \
3840 - main.mysql_client_test \
3841 - main.mysqld--help-notwin \
3842 - main.type_string \
3843 - main.information_schema \
3844 - perfschema.binlog_edge_mix \
3845 - perfschema.binlog_edge_stmt \
3846 - rpl.rpl_xa_survive_disconnect \
3847 - rpl.rpl_xa_survive_disconnect_lsu_off \
3848 - rpl.rpl_xa_survive_disconnect_table \
3849 - ; do
3850 - _disable_test "$t" "requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set"
3851 - done
3852 - fi
3853 -
3854 - # Try to increase file limits to increase test coverage
3855 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
3856 - # Upper limit comes from parts.partition_* tests
3857 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
3858 -
3859 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
3860 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
3861 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
3862 -
3863 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
3864 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
3865 - else
3866 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
3867 - fi
3868 - else
3869 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
3870 - fi
3871 - else
3872 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
3873 - fi
3874 -
3875 - # run mysql-test tests
3876 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
3877 - retstatus_tests=$?
3878 -
3879 - popd &>/dev/null || die
3880 -
3881 - # Cleanup is important for these testcases.
3882 - pkill -9 -f "${S}/ndb" 2>/dev/null
3883 - pkill -9 -f "${S}/sql" 2>/dev/null
3884 -
3885 - local failures=""
3886 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
3887 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
3888 -
3889 - [[ -z "$failures" ]] || die "Test failures: $failures"
3890 - einfo "Tests successfully completed"
3891 -}
3892 -
3893 -src_install() {
3894 - local MULTILIB_WRAPPED_HEADERS
3895 - local MULTILIB_CHOST_TOOLS
3896 - if use client-libs ; then
3897 - # headers with ABI specific data
3898 - MULTILIB_WRAPPED_HEADERS=(
3899 - /usr/include/mysql/server/my_config.h
3900 - /usr/include/mysql/server/mysql_version.h )
3901 -
3902 - # wrap the config scripts
3903 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
3904 - multilib-minimal_src_install
3905 - else
3906 - multilib_src_install
3907 - multilib_src_install_all
3908 - fi
3909 -}
3910 -
3911 -# Intentionally override eclass function
3912 -multilib_src_install() {
3913 -
3914 - cmake-utils_src_install
3915 -
3916 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
3917 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
3918 -}
3919 -
3920 -multilib_src_install_all() {
3921 - # Make sure the vars are correctly initialized
3922 - mysql_init_vars
3923 -
3924 - # Convenience links
3925 - einfo "Making Convenience links for mysqlcheck multi-call binary"
3926 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
3927 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
3928 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
3929 -
3930 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
3931 - if [[ -d "${ED}/usr/data" ]] ; then
3932 - rm -Rf "${ED}/usr/data" || die
3933 - fi
3934 -
3935 - # Unless they explicitly specific USE=test, then do not install the
3936 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
3937 - # validation of your database configuration after tuning it.
3938 - if ! use test ; then
3939 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
3940 - fi
3941 -
3942 - # Configuration stuff
3943 - einfo "Building default configuration ..."
3944 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
3945 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
3946 - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
3947 - eprefixify "${TMPDIR}/my.cnf"
3948 - doins "${TMPDIR}/my.cnf"
3949 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
3950 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
3951 - eprefixify "${TMPDIR}/50-distro-client.cnf"
3952 - doins "${TMPDIR}/50-distro-client.cnf"
3953 -
3954 - if use server ; then
3955 - mycnf_src="my.cnf.distro-server"
3956 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
3957 - "${FILESDIR}/${mycnf_src}" \
3958 - > "${TMPDIR}/my.cnf.ok" || die
3959 -
3960 - if use prefix ; then
3961 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
3962 - "${TMPDIR}/my.cnf.ok" || die
3963 - fi
3964 -
3965 - if use latin1 ; then
3966 - sed -i \
3967 - -e "/character-set/s|utf8|latin1|g" \
3968 - "${TMPDIR}/my.cnf.ok" || die
3969 - fi
3970 -
3971 - eprefixify "${TMPDIR}/my.cnf.ok"
3972 -
3973 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
3974 -
3975 - if use tokudb ; then
3976 - # Remove some unwanted files
3977 - rm -fv \
3978 - "${ED%/}"/usr/COPYING.AGPLv3 \
3979 - "${ED%/}"/usr/COPYING.GPLv2 \
3980 - "${ED%/}"/usr/PATENTS \
3981 - "${ED%/}"/usr/README.md \
3982 - || die
3983 - fi
3984 - fi
3985 -
3986 - #Remove mytop if perl is not selected
3987 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
3988 -}
3989 -
3990 -pkg_config() {
3991 - _getoptval() {
3992 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
3993 - local section="$1"
3994 - local flag="--${2}="
3995 - local extra_options="${3}"
3996 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
3997 - }
3998 - local old_MY_DATADIR="${MY_DATADIR}"
3999 - local old_HOME="${HOME}"
4000 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
4001 - export HOME=${EPREFIX%/}/root
4002 -
4003 - # Make sure the vars are correctly initialized
4004 - mysql_init_vars
4005 -
4006 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
4007 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
4008 - die "Minimal builds do NOT include the MySQL server"
4009 - fi
4010 -
4011 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then
4012 - local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}"
4013 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
4014 - local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}"
4015 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
4016 -
4017 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then
4018 - if [[ -d "${MY_DATADIR_s}" ]] ; then
4019 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
4020 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
4021 - else
4022 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
4023 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
4024 - || die "Moving MY_DATADIR failed"
4025 - fi
4026 - else
4027 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
4028 - if [[ -d "${MY_DATADIR_s}" ]] ; then
4029 - ewarn "Attempting to use ${MY_DATADIR_s}"
4030 - else
4031 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
4032 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
4033 - fi
4034 - fi
4035 - fi
4036 -
4037 - local pwd1="a"
4038 - local pwd2="b"
4039 - local maxtry=15
4040 -
4041 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
4042 - local tmp_mysqld_password_source=
4043 -
4044 - for tmp_mysqld_password_source in mysql client ; do
4045 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
4046 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
4047 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
4048 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
4049 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
4050 - MYSQL_ROOT_PASSWORD=
4051 - continue
4052 - fi
4053 -
4054 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
4055 - break
4056 - fi
4057 - done
4058 -
4059 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
4060 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
4061 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
4062 - fi
4063 -
4064 - unset tmp_mysqld_password_source
4065 - fi
4066 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
4067 - # These are dir+prefix
4068 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
4069 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
4070 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
4071 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
4072 -
4073 - if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then
4074 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
4075 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR"
4076 - fi
4077 -
4078 - if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then
4079 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
4080 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN"
4081 - fi
4082 -
4083 - if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then
4084 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
4085 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG"
4086 - fi
4087 -
4088 - if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then
4089 - ewarn "You have already a MySQL database in place."
4090 - ewarn "(${ROOT%/}/${MY_DATADIR}/*)"
4091 - ewarn "Please rename or delete it if you wish to replace it."
4092 - die "MySQL database already exists!"
4093 - fi
4094 -
4095 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
4096 - # localhost. Also causes weird failures.
4097 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
4098 -
4099 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
4100 -
4101 - einfo "Please provide a password for the mysql 'root' user now"
4102 - einfo "or through the ${HOME}/.my.cnf file."
4103 - ewarn "Avoid [\"'\\_%] characters in the password"
4104 - read -rsp " >" pwd1 ; echo
4105 -
4106 - einfo "Retype the password"
4107 - read -rsp " >" pwd2 ; echo
4108 -
4109 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
4110 - die "Passwords are not the same"
4111 - fi
4112 - MYSQL_ROOT_PASSWORD="${pwd1}"
4113 - unset pwd1 pwd2
4114 - fi
4115 -
4116 - local options
4117 - local sqltmp="$(emktemp)"
4118 -
4119 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
4120 - # see http://bugs.mysql.com/bug.php?id=31312
4121 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
4122 -
4123 - # Figure out which options we need to disable to do the setup
4124 - local helpfile="${TMPDIR%/}/mysqld-help"
4125 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
4126 - for opt in host-cache name-resolve networking slave-start \
4127 - federated ssl log-bin relay-log slow-query-log external-locking \
4128 - log-slave-updates \
4129 - ; do
4130 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
4131 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
4132 - done
4133 -
4134 - einfo "Creating the mysql database and setting proper permissions on it ..."
4135 -
4136 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
4137 - PID_DIR="${EROOT%/}/var/run/mysqld"
4138 - if [[ ! -d "${PID_DIR}" ]] ; then
4139 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
4140 - fi
4141 -
4142 - if [[ ! -d "${MY_DATADIR}" ]] ; then
4143 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
4144 - fi
4145 -
4146 - pushd "${TMPDIR}" &>/dev/null || die
4147 -
4148 - # Filling timezones, see
4149 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
4150 - echo "USE mysql;" >"${sqltmp}"
4151 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
4152 - chown mysql "${sqltmp}" || die
4153 -
4154 - # --initialize-insecure will not set root password
4155 - # --initialize would set a random one in the log which we don't need as we set it ourselves
4156 - local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
4157 - cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
4158 - einfo "Command: ${cmd[*]}"
4159 - su -s /bin/sh -c "${cmd[*]}" mysql \
4160 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
4161 - if [[ $? -ne 0 ]] ; then
4162 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
4163 - die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
4164 - fi
4165 - popd &>/dev/null || die
4166 - [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \
4167 - || die "MySQL databases not installed"
4168 -
4169 - use prefix || options="${options} --user=mysql"
4170 -
4171 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
4172 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
4173 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
4174 - ${options} \
4175 - $(use prefix || echo --user=mysql) \
4176 - --log-warnings=0 \
4177 - --basedir=${EROOT%/}/usr \
4178 - --datadir=${ROOT%/}/${MY_DATADIR} \
4179 - --max_allowed_packet=8M \
4180 - --net_buffer_length=16K \
4181 - --socket=${socket} \
4182 - --pid-file=${pidfile} \
4183 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
4184 - #einfo "About to start mysqld: ${mysqld}"
4185 - ebegin "Starting mysqld"
4186 - einfo "Command ${mysqld}"
4187 - ${mysqld} &
4188 - rc=$?
4189 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
4190 - maxtry=$((${maxtry}-1))
4191 - echo -n "."
4192 - sleep 1
4193 - done
4194 - eend $rc
4195 -
4196 - if ! [[ -S "${socket}" ]] ; then
4197 - die "Completely failed to start up mysqld with: ${mysqld}"
4198 - fi
4199 -
4200 - ebegin "Setting root password"
4201 - # Do this from memory, as we don't want clear text passwords in temp files
4202 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'"
4203 - "${EROOT%/}/usr/bin/mysql" \
4204 - --no-defaults \
4205 - "--socket=${socket}" \
4206 - -hlocalhost \
4207 - -e "${sql}"
4208 - eend $?
4209 -
4210 - # Stop the server and cleanup
4211 - einfo "Stopping the server ..."
4212 - kill $(< "${pidfile}" )
4213 - rm -f "${sqltmp}"
4214 - wait %1
4215 - einfo "Done"
4216 -}
4217
4218 diff --git a/dev-db/percona-server/percona-server-5.7.23.25.ebuild b/dev-db/percona-server/percona-server-5.7.23.25.ebuild
4219 deleted file mode 100644
4220 index 2c75a45d8e3..00000000000
4221 --- a/dev-db/percona-server/percona-server-5.7.23.25.ebuild
4222 +++ /dev/null
4223 @@ -1,1066 +0,0 @@
4224 -# Copyright 1999-2018 Gentoo Authors
4225 -# Distributed under the terms of the GNU General Public License v2
4226 -
4227 -EAPI="6"
4228 -MY_EXTRAS_VER="20181017-2201Z"
4229 -
4230 -CMAKE_MAKEFILE_GENERATOR=emake
4231 -
4232 -# Python2 required for innodb_stress.innodb_stress{,_blob,_crash} test
4233 -PYTHON_COMPAT=( python2_7 )
4234 -
4235 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
4236 -
4237 -inherit eapi7-ver cmake-utils eutils flag-o-matic linux-info \
4238 - prefix python-any-r1 toolchain-funcs user multilib-minimal
4239 -
4240 -MY_PV=$(ver_rs 3 '-')
4241 -MY_PN="Percona-Server"
4242 -MY_P="${PN}-${MY_PV}"
4243 -MY_MAJOR_PV=$(ver_cut 1-2)
4244 -MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/5.7/release-notes/release-notes_index.html"
4245 -
4246 -SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz
4247 - mirror://sourceforge/boost/boost_1_59_0.tar.gz
4248 -"
4249 -
4250 -# Gentoo patches to MySQL
4251 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then
4252 - SRC_URI="${SRC_URI}
4253 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
4254 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
4255 -fi
4256 -
4257 -HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server"
4258 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
4259 -LICENSE="GPL-2"
4260 -SLOT="0/18"
4261 -IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 libressl numa pam +perl profiling rocksdb
4262 - selinux +server static static-libs systemtap tcmalloc test tokudb tokudb-backup-plugin yassl"
4263 -
4264 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
4265 -RESTRICT="libressl? ( test )"
4266 -
4267 -REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
4268 -
4269 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
4270 -
4271 -# Shorten the path because the socket path length must be shorter than 107 chars
4272 -# and we will run a mysql server during test phase
4273 -S="${WORKDIR}/mysql"
4274 -
4275 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
4276 - inherit git-r3
4277 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
4278 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
4279 - EGIT_CLONE_TYPE=shallow
4280 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
4281 -else
4282 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
4283 -fi
4284 -
4285 -PATCHES=(
4286 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch
4287 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch
4288 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch
4289 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-without-clientlibs-tools.patch
4290 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-fix-libressl-support.patch
4291 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-add-missing-gcc-8-fix.patch
4292 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch
4293 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch
4294 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-mips-ASM.patch
4295 - "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-rocksdb-use-system-libs.patch
4296 -)
4297 -
4298 -# Be warned, *DEPEND are version-dependant
4299 -# These are used for both runtime and compiletime
4300 -# MULTILIB_USEDEP only set for libraries used by the client library
4301 -COMMON_DEPEND="net-misc/curl:=
4302 - >=sys-apps/sed-4
4303 - >=sys-apps/texinfo-4.7-r1
4304 - sys-libs/ncurses:0=
4305 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
4306 - !client-libs? (
4307 - dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?]
4308 - >=sys-libs/zlib-1.2.3:0=
4309 - )
4310 - jemalloc? ( dev-libs/jemalloc:0= )
4311 - kernel_linux? (
4312 - dev-libs/libaio:0=
4313 - sys-process/procps:0=
4314 - )
4315 - server? (
4316 - >=app-arch/lz4-0_p131:=
4317 - cjk? ( app-text/mecab:= )
4318 - experimental? (
4319 - dev-libs/libevent:=
4320 - dev-libs/protobuf:=
4321 - net-libs/libtirpc:=
4322 - )
4323 - numa? ( sys-process/numactl )
4324 - pam? ( virtual/pam:0= )
4325 - rocksdb? (
4326 - app-arch/zstd:=
4327 - dev-libs/protobuf:=
4328 - )
4329 - tokudb? (
4330 - app-arch/snappy:=
4331 - app-arch/xz-utils:=
4332 - )
4333 - tokudb-backup-plugin? ( dev-util/valgrind )
4334 - )
4335 - systemtap? ( >=dev-util/systemtap-1.3:0= )
4336 - tcmalloc? ( dev-util/google-perftools:0= )
4337 - !yassl? (
4338 - client-libs? (
4339 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
4340 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
4341 - )
4342 - !client-libs? (
4343 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
4344 - libressl? ( dev-libs/libressl:0= )
4345 - )
4346 - )
4347 -"
4348 -DEPEND="${COMMON_DEPEND}
4349 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
4350 - dev-libs/protobuf
4351 - virtual/yacc
4352 - server? (
4353 - dev-libs/libevent
4354 - experimental? ( net-libs/rpcsvc-proto )
4355 - )
4356 - static? ( sys-libs/ncurses[static-libs] )
4357 - test? (
4358 - $(python_gen_any_dep 'dev-python/mysql-python[${PYTHON_USEDEP}]')
4359 - dev-perl/JSON
4360 - )
4361 -"
4362 -RDEPEND="${COMMON_DEPEND}
4363 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster
4364 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= )
4365 - selinux? ( sec-policy/selinux-mysql )
4366 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
4367 -"
4368 -# For other stuff to bring us in
4369 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
4370 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
4371 -
4372 -python_check_deps() {
4373 - has_version "dev-python/mysql-python[${PYTHON_USEDEP}]"
4374 -}
4375 -
4376 -mysql_init_vars() {
4377 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
4378 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
4379 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
4380 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
4381 -
4382 - if [[ -z "${MY_DATADIR}" ]] ; then
4383 - MY_DATADIR=""
4384 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
4385 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
4386 - | sed -ne '/datadir/s|^--datadir=||p' \
4387 - | tail -n1`
4388 - if [[ -z "${MY_DATADIR}" ]] ; then
4389 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
4390 - | sed -e 's/.*=\s*//' \
4391 - | tail -n1`
4392 - fi
4393 - fi
4394 - if [[ -z "${MY_DATADIR}" ]] ; then
4395 - MY_DATADIR="${MY_LOCALSTATEDIR}"
4396 - einfo "Using default MY_DATADIR"
4397 - fi
4398 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
4399 -
4400 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
4401 - if [[ -e "${MY_DATADIR}" ]] ; then
4402 - # If you get this and you're wondering about it, see bug #207636
4403 - elog "MySQL datadir found in ${MY_DATADIR}"
4404 - elog "A new one will not be created."
4405 - PREVIOUS_DATADIR="yes"
4406 - else
4407 - PREVIOUS_DATADIR="no"
4408 - fi
4409 - export PREVIOUS_DATADIR
4410 - fi
4411 - else
4412 - if [[ ${EBUILD_PHASE} == "config" ]] ; then
4413 - local new_MY_DATADIR
4414 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
4415 - | sed -ne '/datadir/s|^--datadir=||p' \
4416 - | tail -n1`
4417 -
4418 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then
4419 - ewarn "MySQL MY_DATADIR has changed"
4420 - ewarn "from ${MY_DATADIR}"
4421 - ewarn "to ${new_MY_DATADIR}"
4422 - MY_DATADIR="${new_MY_DATADIR}"
4423 - fi
4424 - fi
4425 - fi
4426 -
4427 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
4428 - export MY_LOCALSTATEDIR MY_LOGDIR
4429 - export MY_DATADIR
4430 -}
4431 -
4432 -pkg_pretend() {
4433 - if use numa ; then
4434 - local CONFIG_CHECK="~NUMA"
4435 -
4436 - local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
4437 - WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
4438 -
4439 - check_extra_config
4440 - fi
4441 -}
4442 -
4443 -pkg_setup() {
4444 - if [[ ${MERGE_TYPE} != binary ]] ; then
4445 - local GCC_MAJOR_SET=$(gcc-major-version)
4446 - local GCC_MINOR_SET=$(gcc-minor-version)
4447 - # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on
4448 - # non x86{,_64} arches
4449 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
4450 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
4451 - eerror "${PN} needs to be built with gcc-4.7 or later."
4452 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
4453 - die
4454 - fi
4455 -
4456 - use test && python-any-r1_pkg_setup
4457 - fi
4458 -
4459 - if has test ${FEATURES} && \
4460 - use server && ! has userpriv ${FEATURES} ; then
4461 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
4462 - fi
4463 -
4464 - # This should come after all of the die statements
4465 - enewgroup mysql 60 || die "problem adding 'mysql' group"
4466 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
4467 -}
4468 -
4469 -pkg_preinst() {
4470 - # Here we need to see if the implementation switched client libraries
4471 - # We check if this is a new instance of the package and a client library already exists
4472 - local SHOW_ABI_MESSAGE libpath
4473 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so" ]] ; then
4474 - libpath=$(readlink "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so")
4475 - elog "Due to ABI changes when switching between different client libraries,"
4476 - elog "revdep-rebuild must find and rebuild all packages linking to libperconaserverclient."
4477 - elog "Please run: revdep-rebuild --library ${libpath}"
4478 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
4479 - fi
4480 -}
4481 -
4482 -pkg_postinst() {
4483 - # Make sure the vars are correctly initialized
4484 - mysql_init_vars
4485 -
4486 - # Create log directory securely if it does not exist
4487 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
4488 -
4489 - if use server ; then
4490 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
4491 - einfo
4492 - elog "You might want to run:"
4493 - elog "\"emerge --config =${CATEGORY}/${PF}\""
4494 - elog "if this is a new install."
4495 - elog
4496 - elog "If you are switching server implentations, you should run the"
4497 - elog "mysql_upgrade tool."
4498 - einfo
4499 - else
4500 - einfo
4501 - elog "If you are upgrading major versions, you should run the"
4502 - elog "mysql_upgrade tool."
4503 - einfo
4504 - fi
4505 - fi
4506 -
4507 - # Note about configuration change
4508 - einfo
4509 - elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
4510 - elog "to several files in /etc/mysql/mysql.d."
4511 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
4512 - elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
4513 - elog "You may have as many files as needed and they are read alphabetically."
4514 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
4515 - einfo
4516 -}
4517 -
4518 -src_unpack() {
4519 - unpack ${A}
4520 - # Grab the patches
4521 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
4522 -
4523 - mv -f "${WORKDIR}/${MY_P}" "${S}" || die
4524 -}
4525 -
4526 -src_prepare() {
4527 - cmake-utils_src_prepare
4528 -
4529 - if use jemalloc ; then
4530 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
4531 - fi
4532 -
4533 - if use tcmalloc ; then
4534 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
4535 - fi
4536 -
4537 - # Don't build bundled xz-utils
4538 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
4539 - echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
4540 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
4541 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
4542 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
4543 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
4544 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
4545 - fi
4546 -
4547 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
4548 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
4549 - fi
4550 -
4551 - # Remove bundled libs so we cannot accidentally use them
4552 - # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394
4553 - rm -rv \
4554 - "${S}"/extra/protobuf \
4555 - "${S}"/libevent \
4556 - "${S}"/storage/rocksdb/third_party \
4557 - "${S}"/storage/tokudb/PerconaFT/third_party \
4558 - "${S}"/zlib \
4559 - || die
4560 -
4561 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
4562 - if [[ -d "${S}/support-files/SELinux" ]] ; then
4563 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
4564 - fi
4565 -
4566 - if use libressl ; then
4567 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
4568 - "${S}/cmake/ssl.cmake" || die
4569 - fi
4570 -
4571 - sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
4572 -}
4573 -
4574 -src_configure(){
4575 - # Bug #114895, bug #110149
4576 - filter-flags "-O" "-O[01]"
4577 -
4578 - append-cxxflags -felide-constructors
4579 -
4580 - # bug #283926, with GCC4.4, this is required to get correct behavior.
4581 - append-flags -fno-strict-aliasing
4582 -
4583 - if use tokudb ; then
4584 - # https://jira.percona.com/browse/PS-4399
4585 - append-cxxflags -Wno-error=shadow
4586 - fi
4587 -
4588 - if use client-libs ; then
4589 - multilib-minimal_src_configure
4590 - else
4591 - multilib_src_configure
4592 - fi
4593 -}
4594 -
4595 -multilib_src_configure() {
4596 - debug-print-function ${FUNCNAME} "$@"
4597 -
4598 - if ! multilib_is_native_abi && ! use client-libs ; then
4599 - return
4600 - fi
4601 -
4602 - CMAKE_BUILD_TYPE="RelWithDebInfo"
4603 -
4604 - # debug hack wrt #497532
4605 - mycmakeargs=(
4606 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
4607 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
4608 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
4609 - -DMYSQL_DATADIR="${EPREFIX%/}/var/lib/mysql"
4610 - -DSYSCONFDIR="${EPREFIX%/}/etc/mysql"
4611 - -DINSTALL_BINDIR=bin
4612 - -DINSTALL_DOCDIR=share/doc/${PF}
4613 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
4614 - -DINSTALL_INCLUDEDIR=include/mysql
4615 - -DINSTALL_INFODIR=share/info
4616 - -DINSTALL_LIBDIR=$(get_libdir)
4617 - -DINSTALL_MANDIR=share/man
4618 - -DINSTALL_MYSQLSHAREDIR=share/mysql
4619 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
4620 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
4621 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
4622 - -DINSTALL_SBINDIR=sbin
4623 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
4624 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
4625 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
4626 - ### TODO: make this system but issues with UTF-8 prevent it
4627 - -DWITH_EDITLINE=bundled
4628 - -DWITH_ZLIB=system
4629 - -DWITH_LIBWRAP=0
4630 - -DENABLED_LOCAL_INFILE=1
4631 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
4632 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
4633 - -DWITH_DEFAULT_FEATURE_SET=0
4634 - # The build forces this to be defined when cross-compiling. We pass it
4635 - # all the time for simplicity and to make sure it is actually correct.
4636 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
4637 - -DWITH_CURL=system
4638 - -DWITH_BOOST="${WORKDIR}/boost_1_59_0"
4639 - -DWITH_PROTOBUF=system
4640 - )
4641 -
4642 - if use test ; then
4643 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
4644 - else
4645 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
4646 - fi
4647 -
4648 - if ! use yassl ; then
4649 - mycmakeargs+=( -DWITH_SSL=system )
4650 - else
4651 - mycmakeargs+=( -DWITH_SSL=bundled )
4652 - fi
4653 -
4654 - if ! use client-libs ; then
4655 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
4656 - fi
4657 -
4658 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
4659 - # systemtap only works on native ABI, bug 530132
4660 - if multilib_is_native_abi ; then
4661 - mycmakeargs+=(
4662 - -DENABLE_DTRACE=$(usex systemtap)
4663 - )
4664 - else
4665 - mycmakeargs+=(
4666 - -DWITHOUT_TOOLS=1
4667 - -DWITH_READLINE=1
4668 - -DENABLE_DTRACE=0
4669 - )
4670 - fi
4671 -
4672 - if multilib_is_native_abi && use server ; then
4673 - mycmakeargs+=(
4674 - -DWITH_LIBEVENT=system
4675 - -DWITH_LZ4=system
4676 - -DWITH_MECAB=$(usex cjk system OFF)
4677 - -DWITH_NUMA=$(usex numa ON OFF)
4678 - -DWITH_RAPID=$(usex experimental ON OFF)
4679 - )
4680 -
4681 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then
4682 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
4683 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
4684 - ewarn "You MUST file bugs without these variables set."
4685 -
4686 - mycmakeargs+=(
4687 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
4688 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
4689 - )
4690 - elif ! use latin1 ; then
4691 - mycmakeargs+=(
4692 - -DDEFAULT_CHARSET=utf8
4693 - -DDEFAULT_COLLATION=utf8_general_ci
4694 - )
4695 - else
4696 - mycmakeargs+=(
4697 - -DDEFAULT_CHARSET=latin1
4698 - -DDEFAULT_COLLATION=latin1_swedish_ci
4699 - )
4700 - fi
4701 -
4702 - mycmakeargs+=(
4703 - -DEXTRA_CHARSETS=all
4704 - -DDISABLE_SHARED=$(usex static YES NO)
4705 - -DWITH_DEBUG=$(usex debug)
4706 - -DWITH_EMBEDDED_SERVER=OFF
4707 - )
4708 -
4709 - if use profiling ; then
4710 - # Setting to OFF doesn't work: Once set, profiling options will be added
4711 - # to `mysqld --help` output via sql/sys_vars.cc causing
4712 - # "main.mysqld--help-notwin" test to fail
4713 - mycmakeargs+=( -DENABLED_PROFILING=ON )
4714 - fi
4715 -
4716 - if use static ; then
4717 - mycmakeargs+=( -DWITH_PIC=1 )
4718 - fi
4719 -
4720 - # Storage engines
4721 - mycmakeargs+=(
4722 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
4723 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
4724 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
4725 - -DWITH_CSV_STORAGE_ENGINE=1
4726 - -DWITH_FEDERATED_STORAGE_ENGINE=1
4727 - -DWITH_HEAP_STORAGE_ENGINE=1
4728 - -DWITH_INNOBASE_STORAGE_ENGINE=1
4729 - -DWITH_INNODB_MEMCACHED=0
4730 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
4731 - -DWITH_MYISAM_STORAGE_ENGINE=1
4732 - -DWITH_PARTITION_STORAGE_ENGINE=1
4733 - -DWITH_ROCKSDB=$(usex rocksdb 1 0)
4734 - $(usex tokudb '' -DWITHOUT_TOKUDB=1)
4735 - )
4736 -
4737 - if use tokudb ; then
4738 - # TokuDB Backup plugin requires valgrind unconditionally
4739 - mycmakeargs+=(
4740 - $(usex tokudb-backup-plugin '' -DTOKUDB_BACKUP_DISABLED=1)
4741 - )
4742 - fi
4743 -
4744 - else
4745 - mycmakeargs+=(
4746 - -DWITHOUT_SERVER=1
4747 - -DWITH_EMBEDDED_SERVER=OFF
4748 - -DEXTRA_CHARSETS=none
4749 - )
4750 - fi
4751 -
4752 - cmake-utils_src_configure
4753 -}
4754 -
4755 -src_compile() {
4756 - if use client-libs ; then
4757 - multilib-minimal_src_compile
4758 - else
4759 - multilib_src_compile
4760 - fi
4761 -}
4762 -
4763 -multilib_src_compile() {
4764 - cmake-utils_src_compile
4765 -}
4766 -
4767 -# Official test instructions:
4768 -# ulimit -n 16500 && \
4769 -# USE='latin1 perl server' \
4770 -# FEATURES='test userpriv -usersandbox' \
4771 -# ebuild percona-server-X.X.XX.ebuild \
4772 -# digest clean package
4773 -src_test() {
4774 - _disable_test() {
4775 - local rawtestname reason
4776 - rawtestname="${1}" ; shift
4777 - reason="${@}"
4778 - ewarn "test '${rawtestname}' disabled: '${reason}'"
4779 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
4780 - }
4781 -
4782 - local TESTDIR="${BUILD_DIR}/mysql-test"
4783 - local retstatus_unit
4784 - local retstatus_tests
4785 -
4786 - if ! use server ; then
4787 - einfo "Skipping server tests due to minimal build."
4788 - return 0
4789 - fi
4790 -
4791 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
4792 - # localhost. Also causes weird failures.
4793 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
4794 -
4795 - if [[ $UID -eq 0 ]] ; then
4796 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
4797 - fi
4798 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
4799 -
4800 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
4801 -
4802 - # Run CTest (test-units)
4803 - cmake-utils_src_test
4804 - retstatus_unit=$?
4805 -
4806 - # Ensure that parallel runs don't die
4807 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
4808 - # Enable parallel testing, auto will try to detect number of cores
4809 - # You may set this by hand.
4810 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
4811 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
4812 -
4813 - # create directories because mysqladmin might run out of order
4814 - mkdir -p "${T}"/var-tests{,/log} || die
4815 -
4816 - # Run mysql tests
4817 - pushd "${TESTDIR}" &>/dev/null || die
4818 -
4819 - touch "${T}/disabled.def"
4820 - # These are failing in Percona-Server 5.7 for now and are believed to be
4821 - # false positives or are known to fail:
4822 - #
4823 - # encryption.innodb_encryption_tables: https://jira.percona.com/browse/PS-5036
4824 - # group_replication.gr_communication_configuration: requires a valid local network address
4825 - # which clashes with FEATURES=network-sandbox
4826 - # main.mysqlshow: https://jira.percona.com/browse/PS-5017
4827 - # main.percona_bug1289599: https://jira.percona.com/browse/PS-2072
4828 - # keyring_vault.keyring_vault_timeout: requires network access to vault.public-ci.percona.com
4829 - # which clashes with FEATURES=network-sandbox
4830 - # perfschema.show_sanity: https://jira.percona.com/browse/PS-5018
4831 - # rocksdb.rocksdb: https://jira.percona.com/browse/PS-5034
4832 - # rocksdb.show_engine: https://jira.percona.com/browse/PS-5033
4833 - # rocksdb.show_table_status: https://jira.percona.com/browse/PS-5035
4834 - # rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223
4835 - # rpl.rpl_multi_source_mts_reset_worker_info: https://jira.percona.com/browse/PS-3786
4836 - # x.crud_insert_cast: https://jira.percona.com/browse/PS-5032
4837 - # x.insert_table_bad_column: https://jira.percona.com/browse/PS-5032
4838 - # x.insert_table_bad_numcolumns: https://jira.percona.com/browse/PS-5032
4839 - # x.insert_table_bad_column_type: https://jira.percona.com/browse/PS-5032
4840 - # x.insert_table: https://jira.percona.com/browse/PS-5032
4841 - # x.update_crud_arrayappend_o: https://jira.percona.com/browse/PS-5032
4842 - # x.update_crud_arrayinsert_o: https://jira.percona.com/browse/PS-5032
4843 - #
4844 - local t
4845 -
4846 - for t in \
4847 - encryption.innodb_encryption_tables \
4848 - group_replication.gr_communication_configuration \
4849 - main.mysqlshow \
4850 - main.percona_bug1289599 \
4851 - keyring_vault.keyring_vault_timeout \
4852 - perfschema.show_sanity \
4853 - rocksdb.rocksdb \
4854 - rocksdb.show_engine \
4855 - rocksdb.show_table_status \
4856 - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \
4857 - rpl.rpl_multi_source_mts_reset_worker_info \
4858 - x.crud_insert_cast \
4859 - x.insert_table_bad_column \
4860 - x.insert_table_bad_numcolumns \
4861 - x.insert_table_bad_column_type \
4862 - x.insert_table \
4863 - x.update_crud_arrayappend_o \
4864 - x.update_crud_arrayinsert_o \
4865 - ; do
4866 - _disable_test "$t" "False positives in Gentoo / Known bug"
4867 - done
4868 -
4869 - if use numa && use kernel_linux ; then
4870 - # bug 584880
4871 - if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then
4872 - for t in sys_vars.innodb_numa_interleave_basic ; do
4873 - _disable_test "$t" "Test $t requires system with NUMA support"
4874 - done
4875 - fi
4876 - fi
4877 -
4878 - if use tokudb ; then
4879 - if [[ -f "/sys/kernel/mm/transparent_hugepage/enabled" ]] ; then
4880 - if grep -q -E "\[always\]" /sys/kernel/mm/transparent_hugepage/enabled &>/dev/null ; then
4881 - # TokuDB refuses to start when transparent hugepages are enabled
4882 - for t in \
4883 - tokudb.rows-32m-rand-insert \
4884 - tokudb.savepoint-2 \
4885 - tokudb.savepoint-3 \
4886 - tokudb.savepoint-4 \
4887 - tokudb.savepoint-1078 \
4888 - tokudb.savepoint-1078-2 \
4889 - tokudb.savepoint-1078-3 \
4890 - tokudb.savepoint-1078-4 \
4891 - ; do
4892 - _disable_test "$t" "TokuDB will not work with transparent hugepages enabled"
4893 - done
4894 - fi
4895 - else
4896 - einfo "Cannot determine transparent hugepage status."
4897 - einfo "Please note that TokuDB refuses to start when transparent hugepages are enabled!"
4898 - fi
4899 - fi
4900 -
4901 - if ! use latin1 ; then
4902 - # The following tests will fail if DEFAULT_CHARSET
4903 - # isn't set to latin1:
4904 - for t in \
4905 - binlog.binlog_mysqlbinlog_filter \
4906 - binlog.binlog_xa_prepared_disconnect \
4907 - funcs_1.is_columns_mysql \
4908 - funcs_1.is_tables_mysql \
4909 - funcs_1.is_triggers \
4910 - innodb.innodb_pagesize_max_recordsize \
4911 - innodb.innodb-system-table-view \
4912 - innodb.mysqldump_max_recordsize \
4913 - main.mysql_client_test \
4914 - main.mysqld--help-notwin \
4915 - main.type_string \
4916 - main.information_schema \
4917 - perfschema.binlog_edge_mix \
4918 - perfschema.binlog_edge_stmt \
4919 - rpl.rpl_xa_survive_disconnect \
4920 - rpl.rpl_xa_survive_disconnect_lsu_off \
4921 - rpl.rpl_xa_survive_disconnect_table \
4922 - ; do
4923 - _disable_test "$t" "requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set"
4924 - done
4925 - fi
4926 -
4927 - # Try to increase file limits to increase test coverage
4928 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
4929 - # Upper limit comes from parts.partition_* tests
4930 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
4931 -
4932 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
4933 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
4934 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
4935 -
4936 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
4937 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
4938 - else
4939 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
4940 - fi
4941 - else
4942 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
4943 - fi
4944 - else
4945 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
4946 - fi
4947 -
4948 - # run mysql-test tests
4949 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
4950 - retstatus_tests=$?
4951 -
4952 - popd &>/dev/null || die
4953 -
4954 - # Cleanup is important for these testcases.
4955 - pkill -9 -f "${S}/ndb" 2>/dev/null
4956 - pkill -9 -f "${S}/sql" 2>/dev/null
4957 -
4958 - local failures=""
4959 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
4960 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
4961 -
4962 - [[ -z "$failures" ]] || die "Test failures: $failures"
4963 - einfo "Tests successfully completed"
4964 -}
4965 -
4966 -src_install() {
4967 - local MULTILIB_WRAPPED_HEADERS
4968 - local MULTILIB_CHOST_TOOLS
4969 - if use client-libs ; then
4970 - # headers with ABI specific data
4971 - MULTILIB_WRAPPED_HEADERS=(
4972 - /usr/include/mysql/server/my_config.h
4973 - /usr/include/mysql/server/mysql_version.h )
4974 -
4975 - # wrap the config scripts
4976 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
4977 - multilib-minimal_src_install
4978 - else
4979 - multilib_src_install
4980 - multilib_src_install_all
4981 - fi
4982 -}
4983 -
4984 -# Intentionally override eclass function
4985 -multilib_src_install() {
4986 -
4987 - cmake-utils_src_install
4988 -
4989 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
4990 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
4991 -}
4992 -
4993 -multilib_src_install_all() {
4994 - # Make sure the vars are correctly initialized
4995 - mysql_init_vars
4996 -
4997 - # Convenience links
4998 - einfo "Making Convenience links for mysqlcheck multi-call binary"
4999 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
5000 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
5001 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
5002 -
5003 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
5004 - if [[ -d "${ED}/usr/data" ]] ; then
5005 - rm -Rf "${ED}/usr/data" || die
5006 - fi
5007 -
5008 - # Unless they explicitly specific USE=test, then do not install the
5009 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
5010 - # validation of your database configuration after tuning it.
5011 - if ! use test ; then
5012 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
5013 - fi
5014 -
5015 - # Configuration stuff
5016 - einfo "Building default configuration ..."
5017 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
5018 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
5019 - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
5020 - eprefixify "${TMPDIR}/my.cnf"
5021 - doins "${TMPDIR}/my.cnf"
5022 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
5023 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
5024 - eprefixify "${TMPDIR}/50-distro-client.cnf"
5025 - doins "${TMPDIR}/50-distro-client.cnf"
5026 -
5027 - if use server ; then
5028 - mycnf_src="my.cnf.distro-server"
5029 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
5030 - "${FILESDIR}/${mycnf_src}" \
5031 - > "${TMPDIR}/my.cnf.ok" || die
5032 -
5033 - if use prefix ; then
5034 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
5035 - "${TMPDIR}/my.cnf.ok" || die
5036 - fi
5037 -
5038 - if use latin1 ; then
5039 - sed -i \
5040 - -e "/character-set/s|utf8|latin1|g" \
5041 - "${TMPDIR}/my.cnf.ok" || die
5042 - fi
5043 -
5044 - eprefixify "${TMPDIR}/my.cnf.ok"
5045 -
5046 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
5047 -
5048 - if use tokudb ; then
5049 - # Remove some unwanted files
5050 - rm -fv \
5051 - "${ED%/}"/usr/COPYING.AGPLv3 \
5052 - "${ED%/}"/usr/COPYING.GPLv2 \
5053 - "${ED%/}"/usr/PATENTS \
5054 - "${ED%/}"/usr/README.md \
5055 - || die
5056 - fi
5057 - fi
5058 -
5059 - #Remove mytop if perl is not selected
5060 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
5061 -}
5062 -
5063 -pkg_config() {
5064 - _getoptval() {
5065 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
5066 - local section="$1"
5067 - local flag="--${2}="
5068 - local extra_options="${3}"
5069 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
5070 - }
5071 - local old_MY_DATADIR="${MY_DATADIR}"
5072 - local old_HOME="${HOME}"
5073 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
5074 - export HOME=${EPREFIX%/}/root
5075 -
5076 - # Make sure the vars are correctly initialized
5077 - mysql_init_vars
5078 -
5079 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
5080 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
5081 - die "Minimal builds do NOT include the MySQL server"
5082 - fi
5083 -
5084 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then
5085 - local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}"
5086 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
5087 - local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}"
5088 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
5089 -
5090 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then
5091 - if [[ -d "${MY_DATADIR_s}" ]] ; then
5092 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
5093 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
5094 - else
5095 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
5096 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
5097 - || die "Moving MY_DATADIR failed"
5098 - fi
5099 - else
5100 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
5101 - if [[ -d "${MY_DATADIR_s}" ]] ; then
5102 - ewarn "Attempting to use ${MY_DATADIR_s}"
5103 - else
5104 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
5105 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
5106 - fi
5107 - fi
5108 - fi
5109 -
5110 - local pwd1="a"
5111 - local pwd2="b"
5112 - local maxtry=15
5113 -
5114 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
5115 - local tmp_mysqld_password_source=
5116 -
5117 - for tmp_mysqld_password_source in mysql client ; do
5118 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
5119 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
5120 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
5121 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
5122 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
5123 - MYSQL_ROOT_PASSWORD=
5124 - continue
5125 - fi
5126 -
5127 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
5128 - break
5129 - fi
5130 - done
5131 -
5132 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
5133 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
5134 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
5135 - fi
5136 -
5137 - unset tmp_mysqld_password_source
5138 - fi
5139 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
5140 - # These are dir+prefix
5141 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
5142 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
5143 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
5144 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
5145 -
5146 - if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then
5147 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
5148 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR"
5149 - fi
5150 -
5151 - if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then
5152 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
5153 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN"
5154 - fi
5155 -
5156 - if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then
5157 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
5158 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG"
5159 - fi
5160 -
5161 - if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then
5162 - ewarn "You have already a MySQL database in place."
5163 - ewarn "(${ROOT%/}/${MY_DATADIR}/*)"
5164 - ewarn "Please rename or delete it if you wish to replace it."
5165 - die "MySQL database already exists!"
5166 - fi
5167 -
5168 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
5169 - # localhost. Also causes weird failures.
5170 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
5171 -
5172 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
5173 -
5174 - einfo "Please provide a password for the mysql 'root' user now"
5175 - einfo "or through the ${HOME}/.my.cnf file."
5176 - ewarn "Avoid [\"'\\_%] characters in the password"
5177 - read -rsp " >" pwd1 ; echo
5178 -
5179 - einfo "Retype the password"
5180 - read -rsp " >" pwd2 ; echo
5181 -
5182 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
5183 - die "Passwords are not the same"
5184 - fi
5185 - MYSQL_ROOT_PASSWORD="${pwd1}"
5186 - unset pwd1 pwd2
5187 - fi
5188 -
5189 - local options
5190 - local sqltmp="$(emktemp)"
5191 -
5192 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
5193 - # see http://bugs.mysql.com/bug.php?id=31312
5194 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
5195 -
5196 - # Figure out which options we need to disable to do the setup
5197 - local helpfile="${TMPDIR%/}/mysqld-help"
5198 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
5199 - for opt in host-cache name-resolve networking slave-start \
5200 - federated ssl log-bin relay-log slow-query-log external-locking \
5201 - log-slave-updates \
5202 - ; do
5203 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
5204 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
5205 - done
5206 -
5207 - einfo "Creating the mysql database and setting proper permissions on it ..."
5208 -
5209 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
5210 - PID_DIR="${EROOT%/}/var/run/mysqld"
5211 - if [[ ! -d "${PID_DIR}" ]] ; then
5212 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
5213 - fi
5214 -
5215 - if [[ ! -d "${MY_DATADIR}" ]] ; then
5216 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
5217 - fi
5218 -
5219 - pushd "${TMPDIR}" &>/dev/null || die
5220 -
5221 - # Filling timezones, see
5222 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
5223 - echo "USE mysql;" >"${sqltmp}"
5224 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
5225 - chown mysql "${sqltmp}" || die
5226 -
5227 - # --initialize-insecure will not set root password
5228 - # --initialize would set a random one in the log which we don't need as we set it ourselves
5229 - local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
5230 - cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
5231 - einfo "Command: ${cmd[*]}"
5232 - su -s /bin/sh -c "${cmd[*]}" mysql \
5233 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
5234 - if [[ $? -ne 0 ]] ; then
5235 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
5236 - die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
5237 - fi
5238 - popd &>/dev/null || die
5239 - [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \
5240 - || die "MySQL databases not installed"
5241 -
5242 - use prefix || options="${options} --user=mysql"
5243 -
5244 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
5245 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
5246 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
5247 - ${options} \
5248 - $(use prefix || echo --user=mysql) \
5249 - --log-warnings=0 \
5250 - --basedir=${EROOT%/}/usr \
5251 - --datadir=${ROOT%/}/${MY_DATADIR} \
5252 - --max_allowed_packet=8M \
5253 - --net_buffer_length=16K \
5254 - --socket=${socket} \
5255 - --pid-file=${pidfile} \
5256 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
5257 - #einfo "About to start mysqld: ${mysqld}"
5258 - ebegin "Starting mysqld"
5259 - einfo "Command ${mysqld}"
5260 - ${mysqld} &
5261 - rc=$?
5262 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
5263 - maxtry=$((${maxtry}-1))
5264 - echo -n "."
5265 - sleep 1
5266 - done
5267 - eend $rc
5268 -
5269 - if ! [[ -S "${socket}" ]] ; then
5270 - die "Completely failed to start up mysqld with: ${mysqld}"
5271 - fi
5272 -
5273 - ebegin "Setting root password"
5274 - # Do this from memory, as we don't want clear text passwords in temp files
5275 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'"
5276 - "${EROOT%/}/usr/bin/mysql" \
5277 - --no-defaults \
5278 - "--socket=${socket}" \
5279 - -hlocalhost \
5280 - -e "${sql}"
5281 - eend $?
5282 -
5283 - # Stop the server and cleanup
5284 - einfo "Stopping the server ..."
5285 - kill $(< "${pidfile}" )
5286 - rm -f "${sqltmp}"
5287 - wait %1
5288 - einfo "Done"
5289 -}