1 |
commit: ab9bd9d38d16f125b7b3f3b443e89589e42e1933 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 15 01:17:06 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 15 01:29:43 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab9bd9d3 |
7 |
|
8 |
dev-db/percona-server: bump to v5.7.23-23 |
9 |
|
10 |
- Add CJK support for InnoDB full-text search via USE=cjk |
11 |
|
12 |
- Beginning with {mysql,percona-server}-5.7, we are moving configuration |
13 |
from a single my.cnf to several files in /etc/mysql/mysql.d. |
14 |
|
15 |
Closes: https://bugs.gentoo.org/611060 |
16 |
Package-Manager: Portage-2.3.50, Repoman-2.3.11 |
17 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
18 |
|
19 |
dev-db/percona-server/Manifest | 3 + |
20 |
dev-db/percona-server/files/my.cnf-5.7 | 3 + |
21 |
dev-db/percona-server/files/my.cnf.distro-client | 21 + |
22 |
dev-db/percona-server/files/my.cnf.distro-server | 28 + |
23 |
dev-db/percona-server/metadata.xml | 2 + |
24 |
.../percona-server/percona-server-5.7.23.23.ebuild | 1049 ++++++++++++++++++++ |
25 |
6 files changed, 1106 insertions(+) |
26 |
|
27 |
diff --git a/dev-db/percona-server/Manifest b/dev-db/percona-server/Manifest |
28 |
index a46d86613b8..7d72c5c2537 100644 |
29 |
--- a/dev-db/percona-server/Manifest |
30 |
+++ b/dev-db/percona-server/Manifest |
31 |
@@ -1,3 +1,6 @@ |
32 |
+DIST boost_1_59_0.tar.gz 83709983 BLAKE2B 8c6676fa05fa401a6ecb3b890d95aceb4421ec48dd0eab38ce8d170c618e177c82dc67a165938f6be1a01daab24ce41888f5442dbc19ad3dd41368a01a6f89e4 SHA512 05fdbe5637543defdbc630b921515425885593d16db14534ed7b9aa60925ade8fb598d50cb894aed6dae688e789047216daa1bf03fa1aeb6b531060d9dae52ae |
33 |
DIST mysql-extras-20180628-0201Z.tar.bz2 322141 BLAKE2B fce35cfea4ffa9860908fcdf440cd0d714c402c42ee2afb22cec9e727971c216310c7db561ca1b37deebb2cea5137fe24f19b491ad500949e3170ccec3de0b13 SHA512 71a3800ec091b41e41d25536199149eb714c0bbfc0f6fc478e8e4dcaf4cf87a7e4d49c513da3c9badc0de810d7d78c05ad91dd898e45005b42136346237de42a |
34 |
+DIST mysql-extras-20181014-2320Z.tar.bz2 327547 BLAKE2B 8d7d77de0fb92ca4b9a980eec5e2e6a2a68427da67d67e734509f96e05d9dd29daa1a702b3bf2d4313c0a4ff8318a69a70cb24cbd9bb0f3cfb15811e06b25d76 SHA512 5b97aa3c1fc42e3c87aa458a43bdeb1c86194026c7ee5ff7ad64c140e97a77685836971b7f2b3fb02fac440680e62507f96b428d8dc96c75f6358191a3e3084a |
35 |
DIST percona-server-5.6.40-84.0.tar.gz 52684007 BLAKE2B 11658be2319880f7e8815c7b620b7d460dd7a559316ca96905573b0fa2d7180b084ed425f76f6d850f06862e424b5a8d6ced8356f9075826b77e89e86095eb40 SHA512 b1075933bdf1afb726acd799e834cb45a1d2a15d3f37f313da71f8da03a7b9480d7ccfb4cb6a820fb6ccf58851d8c9473bce975203cd6bc007a2b74b36a1127f |
36 |
DIST percona-server-5.6.41-84.1.tar.gz 52736448 BLAKE2B 1ec5e17f08274caa3882f829f25bbf74a3b37d2ba208f62376106f0d89e5470f461f7852e365d5da9503d5500702e28f08461e5aa0c5ae6b1a30a0e98dbb426b SHA512 60783154f9ab097083a484c34e584b396eeba4aa53dc8616c467ca9c85cc626be08e3165740703453cc4fb35f3af94ac34260f1e2bb133d60f832661251cbb3c |
37 |
+DIST percona-server-5.7.23-23.tar.gz 79165468 BLAKE2B a460ac88886fa2be65abb0520d541db54413274599e02d8de3a01a68f8c3da431bfe819eb32bf80518fdff69bbcfae90ee089d2a096ee6210f9e4efe60dbab25 SHA512 351d40d3f7c3fe72f733443a6ef3902e1455390835e52e73d7eb48698ac6f2363e07811d40b22af5b1c7607622017d613279581940522c5e99660fac89d4d4c6 |
38 |
|
39 |
diff --git a/dev-db/percona-server/files/my.cnf-5.7 b/dev-db/percona-server/files/my.cnf-5.7 |
40 |
new file mode 100644 |
41 |
index 00000000000..571ebf07a76 |
42 |
--- /dev/null |
43 |
+++ b/dev-db/percona-server/files/my.cnf-5.7 |
44 |
@@ -0,0 +1,3 @@ |
45 |
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/my.cnf: The global mysql configuration file. |
46 |
+ |
47 |
+!includedir @GENTOO_PORTAGE_EPREFIX@/etc/mysql/mysql.d |
48 |
|
49 |
diff --git a/dev-db/percona-server/files/my.cnf.distro-client b/dev-db/percona-server/files/my.cnf.distro-client |
50 |
new file mode 100644 |
51 |
index 00000000000..8bf18363430 |
52 |
--- /dev/null |
53 |
+++ b/dev-db/percona-server/files/my.cnf.distro-client |
54 |
@@ -0,0 +1,21 @@ |
55 |
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-client.cnf: The global mysql configuration file. |
56 |
+ |
57 |
+# The following options will be passed to all MySQL clients |
58 |
+[client] |
59 |
+socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock |
60 |
+character-sets-dir = @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets |
61 |
+default-character-set=utf8 |
62 |
+ |
63 |
+[mysql] |
64 |
+# uncomment the next directive if you are not familiar with SQL |
65 |
+#safe-updates |
66 |
+ |
67 |
+[mysqldump] |
68 |
+quick |
69 |
+max_allowed_packet = 16M |
70 |
+ |
71 |
+[myisamchk] |
72 |
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets |
73 |
+ |
74 |
+[myisampack] |
75 |
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets |
76 |
|
77 |
diff --git a/dev-db/percona-server/files/my.cnf.distro-server b/dev-db/percona-server/files/my.cnf.distro-server |
78 |
new file mode 100644 |
79 |
index 00000000000..d4ed30c1f08 |
80 |
--- /dev/null |
81 |
+++ b/dev-db/percona-server/files/my.cnf.distro-server |
82 |
@@ -0,0 +1,28 @@ |
83 |
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-server.cnf: The global mysql configuration file. |
84 |
+ |
85 |
+# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations |
86 |
+[mysqld] |
87 |
+character-set-server = utf8 |
88 |
+user = mysql |
89 |
+port = 3306 |
90 |
+socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock |
91 |
+pid-file = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysql.pid |
92 |
+log-error = @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err |
93 |
+basedir = @GENTOO_PORTAGE_EPREFIX@/usr |
94 |
+datadir = @DATADIR@ |
95 |
+skip-external-locking |
96 |
+lc_messages_dir = @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql |
97 |
+#Set this to your desired error message language |
98 |
+lc_messages = en_US |
99 |
+ |
100 |
+# security: |
101 |
+# using "localhost" in connects uses sockets by default |
102 |
+# skip-networking |
103 |
+bind-address = 127.0.0.1 |
104 |
+ |
105 |
+log-bin |
106 |
+server-id = 1 |
107 |
+ |
108 |
+# point the following paths to different dedicated disks |
109 |
+tmpdir = @GENTOO_PORTAGE_EPREFIX@/tmp/ |
110 |
+#log-update = @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname |
111 |
|
112 |
diff --git a/dev-db/percona-server/metadata.xml b/dev-db/percona-server/metadata.xml |
113 |
index f3ddb7484a2..622134f1058 100644 |
114 |
--- a/dev-db/percona-server/metadata.xml |
115 |
+++ b/dev-db/percona-server/metadata.xml |
116 |
@@ -6,7 +6,9 @@ |
117 |
<name>MySQL</name> |
118 |
</maintainer> |
119 |
<use> |
120 |
+ <flag name="cjk">Add CJK support for InnoDB fulltext search using <pkg>app-text/mecab</pkg></flag> |
121 |
<flag name="client-libs">Build the libmysqlclient libraries</flag> |
122 |
+ <flag name="experimental">Build experimental features aka "rapid" plugins</flag> |
123 |
<flag name="jemalloc">Use <pkg>dev-libs/jemalloc</pkg> for allocations.</flag> |
124 |
<flag name="latin1">Use LATIN1 encoding instead of UTF8</flag> |
125 |
<flag name="libressl">Enable SSL connections and crypto functions using <pkg>dev-libs/libressl</pkg></flag> |
126 |
|
127 |
diff --git a/dev-db/percona-server/percona-server-5.7.23.23.ebuild b/dev-db/percona-server/percona-server-5.7.23.23.ebuild |
128 |
new file mode 100644 |
129 |
index 00000000000..d87397f9aea |
130 |
--- /dev/null |
131 |
+++ b/dev-db/percona-server/percona-server-5.7.23.23.ebuild |
132 |
@@ -0,0 +1,1049 @@ |
133 |
+# Copyright 1999-2018 Gentoo Authors |
134 |
+# Distributed under the terms of the GNU General Public License v2 |
135 |
+ |
136 |
+EAPI="6" |
137 |
+MY_EXTRAS_VER="20181014-2320Z" |
138 |
+ |
139 |
+CMAKE_MAKEFILE_GENERATOR=emake |
140 |
+ |
141 |
+# Python2 required for innodb_stress.innodb_stress{,_blob,_crash} test |
142 |
+PYTHON_COMPAT=( python2_7 ) |
143 |
+ |
144 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
145 |
+ |
146 |
+inherit eapi7-ver cmake-utils eutils flag-o-matic linux-info \ |
147 |
+ prefix python-any-r1 toolchain-funcs user multilib-minimal |
148 |
+ |
149 |
+MY_PV=$(ver_rs 3 '-') |
150 |
+MY_PN="Percona-Server" |
151 |
+MY_P="${PN}-${MY_PV}" |
152 |
+MY_MAJOR_PV=$(ver_cut 1-2) |
153 |
+MY_RELEASE_NOTES_URI="https://www.percona.com/doc/percona-server/5.7/release-notes/release-notes_index.html" |
154 |
+ |
155 |
+SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz |
156 |
+ mirror://sourceforge/boost/boost_1_59_0.tar.gz |
157 |
+" |
158 |
+ |
159 |
+# Gentoo patches to MySQL |
160 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then |
161 |
+ SRC_URI="${SRC_URI} |
162 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
163 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
164 |
+fi |
165 |
+ |
166 |
+HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server" |
167 |
+DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
168 |
+LICENSE="GPL-2" |
169 |
+SLOT="0/18" |
170 |
+IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 libressl numa pam +perl profiling rocksdb |
171 |
+ selinux +server static static-libs systemtap tcmalloc test tokudb tokudb-backup-plugin yassl" |
172 |
+ |
173 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
174 |
+RESTRICT="libressl? ( test )" |
175 |
+ |
176 |
+REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )" |
177 |
+ |
178 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
179 |
+ |
180 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
181 |
+# and we will run a mysql server during test phase |
182 |
+S="${WORKDIR}/mysql" |
183 |
+ |
184 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
185 |
+ inherit git-r3 |
186 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
187 |
+ EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
188 |
+ EGIT_CLONE_TYPE=shallow |
189 |
+ MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
190 |
+else |
191 |
+ MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
192 |
+fi |
193 |
+ |
194 |
+PATCHES=( |
195 |
+ "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch |
196 |
+ "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch |
197 |
+ "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch |
198 |
+ "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-without-clientlibs-tools.patch |
199 |
+ "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-libressl-support.patch |
200 |
+ "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-add-missing-gcc-8-fix.patch |
201 |
+ "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch |
202 |
+ "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch |
203 |
+ "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-mips-ASM.patch |
204 |
+ "${MY_PATCH_DIR}"/20018_all_percona-server-5.7.23-rocksdb-use-system-libs.patch |
205 |
+) |
206 |
+ |
207 |
+# Be warned, *DEPEND are version-dependant |
208 |
+# These are used for both runtime and compiletime |
209 |
+# MULTILIB_USEDEP only set for libraries used by the client library |
210 |
+COMMON_DEPEND="net-misc/curl:= |
211 |
+ >=sys-apps/sed-4 |
212 |
+ >=sys-apps/texinfo-4.7-r1 |
213 |
+ sys-libs/ncurses:0= |
214 |
+ client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] ) |
215 |
+ !client-libs? ( |
216 |
+ dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] |
217 |
+ >=sys-libs/zlib-1.2.3:0= |
218 |
+ ) |
219 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
220 |
+ kernel_linux? ( |
221 |
+ dev-libs/libaio:0= |
222 |
+ sys-process/procps:0= |
223 |
+ ) |
224 |
+ server? ( |
225 |
+ >=app-arch/lz4-0_p131:= |
226 |
+ cjk? ( app-text/mecab:= ) |
227 |
+ numa? ( sys-process/numactl ) |
228 |
+ pam? ( virtual/pam:0= ) |
229 |
+ experimental? ( |
230 |
+ dev-libs/libevent:= |
231 |
+ dev-libs/protobuf:= |
232 |
+ net-libs/libtirpc:= |
233 |
+ ) |
234 |
+ rocksdb? ( app-arch/zstd:= ) |
235 |
+ tokudb? ( |
236 |
+ app-arch/snappy:= |
237 |
+ app-arch/xz-utils:= |
238 |
+ ) |
239 |
+ tokudb-backup-plugin? ( dev-util/valgrind ) |
240 |
+ ) |
241 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
242 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
243 |
+ !yassl? ( |
244 |
+ client-libs? ( |
245 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] ) |
246 |
+ libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] ) |
247 |
+ ) |
248 |
+ !client-libs? ( |
249 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
250 |
+ libressl? ( dev-libs/libressl:0= ) |
251 |
+ ) |
252 |
+ ) |
253 |
+" |
254 |
+DEPEND="${COMMON_DEPEND} |
255 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
256 |
+ virtual/yacc |
257 |
+ server? ( |
258 |
+ experimental? ( net-libs/rpcsvc-proto ) |
259 |
+ ) |
260 |
+ static? ( sys-libs/ncurses[static-libs] ) |
261 |
+ test? ( |
262 |
+ $(python_gen_any_dep 'dev-python/mysql-python[${PYTHON_USEDEP}]') |
263 |
+ dev-perl/JSON |
264 |
+ ) |
265 |
+" |
266 |
+RDEPEND="${COMMON_DEPEND} |
267 |
+ !dev-db/mariadb !dev-db/mariadb-galera !dev-db/mysql !dev-db/mysql-cluster |
268 |
+ client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= ) |
269 |
+ selinux? ( sec-policy/selinux-mysql ) |
270 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
271 |
+" |
272 |
+# For other stuff to bring us in |
273 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
274 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
275 |
+ |
276 |
+python_check_deps() { |
277 |
+ has_version "dev-python/mysql-python[${PYTHON_USEDEP}]" |
278 |
+} |
279 |
+ |
280 |
+mysql_init_vars() { |
281 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"} |
282 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"} |
283 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"} |
284 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"} |
285 |
+ |
286 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
287 |
+ MY_DATADIR="" |
288 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
289 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
290 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
291 |
+ | tail -n1` |
292 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
293 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
294 |
+ | sed -e 's/.*=\s*//' \ |
295 |
+ | tail -n1` |
296 |
+ fi |
297 |
+ fi |
298 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
299 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
300 |
+ einfo "Using default MY_DATADIR" |
301 |
+ fi |
302 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
303 |
+ |
304 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
305 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
306 |
+ # If you get this and you're wondering about it, see bug #207636 |
307 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
308 |
+ elog "A new one will not be created." |
309 |
+ PREVIOUS_DATADIR="yes" |
310 |
+ else |
311 |
+ PREVIOUS_DATADIR="no" |
312 |
+ fi |
313 |
+ export PREVIOUS_DATADIR |
314 |
+ fi |
315 |
+ else |
316 |
+ if [[ ${EBUILD_PHASE} == "config" ]] ; then |
317 |
+ local new_MY_DATADIR |
318 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
319 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
320 |
+ | tail -n1` |
321 |
+ |
322 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then |
323 |
+ ewarn "MySQL MY_DATADIR has changed" |
324 |
+ ewarn "from ${MY_DATADIR}" |
325 |
+ ewarn "to ${new_MY_DATADIR}" |
326 |
+ MY_DATADIR="${new_MY_DATADIR}" |
327 |
+ fi |
328 |
+ fi |
329 |
+ fi |
330 |
+ |
331 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
332 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
333 |
+ export MY_DATADIR |
334 |
+} |
335 |
+ |
336 |
+pkg_pretend() { |
337 |
+ if use numa ; then |
338 |
+ local CONFIG_CHECK="~NUMA" |
339 |
+ |
340 |
+ local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
341 |
+ WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
342 |
+ |
343 |
+ check_extra_config |
344 |
+ fi |
345 |
+} |
346 |
+ |
347 |
+pkg_setup() { |
348 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
349 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
350 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
351 |
+ # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on |
352 |
+ # non x86{,_64} arches |
353 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
354 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
355 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
356 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
357 |
+ die |
358 |
+ fi |
359 |
+ |
360 |
+ use test && python-any-r1_pkg_setup |
361 |
+ fi |
362 |
+ |
363 |
+ if has test ${FEATURES} && \ |
364 |
+ use server && ! has userpriv ${FEATURES} ; then |
365 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
366 |
+ fi |
367 |
+ |
368 |
+ # This should come after all of the die statements |
369 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
370 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
371 |
+} |
372 |
+ |
373 |
+pkg_preinst() { |
374 |
+ # Here we need to see if the implementation switched client libraries |
375 |
+ # We check if this is a new instance of the package and a client library already exists |
376 |
+ local SHOW_ABI_MESSAGE libpath |
377 |
+ if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so" ]] ; then |
378 |
+ libpath=$(readlink "${EROOT%/}/usr/$(get_libdir)/libperconaserverclient.so") |
379 |
+ elog "Due to ABI changes when switching between different client libraries," |
380 |
+ elog "revdep-rebuild must find and rebuild all packages linking to libperconaserverclient." |
381 |
+ elog "Please run: revdep-rebuild --library ${libpath}" |
382 |
+ ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
383 |
+ fi |
384 |
+} |
385 |
+ |
386 |
+pkg_postinst() { |
387 |
+ # Make sure the vars are correctly initialized |
388 |
+ mysql_init_vars |
389 |
+ |
390 |
+ # Create log directory securely if it does not exist |
391 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
392 |
+ |
393 |
+ if use server ; then |
394 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
395 |
+ einfo |
396 |
+ elog "You might want to run:" |
397 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
398 |
+ elog "if this is a new install." |
399 |
+ elog |
400 |
+ elog "If you are switching server implentations, you should run the" |
401 |
+ elog "mysql_upgrade tool." |
402 |
+ einfo |
403 |
+ else |
404 |
+ einfo |
405 |
+ elog "If you are upgrading major versions, you should run the" |
406 |
+ elog "mysql_upgrade tool." |
407 |
+ einfo |
408 |
+ fi |
409 |
+ fi |
410 |
+ |
411 |
+ # Note about configuration change |
412 |
+ einfo |
413 |
+ elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
414 |
+ elog "to several files in /etc/mysql/${PN}.d." |
415 |
+ elog "Please backup any changes you made to /etc/mysql/my.cnf" |
416 |
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." |
417 |
+ elog "You may have as many files as needed and they are read alphabetically." |
418 |
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
419 |
+ einfo |
420 |
+} |
421 |
+ |
422 |
+src_unpack() { |
423 |
+ unpack ${A} |
424 |
+ # Grab the patches |
425 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
426 |
+ |
427 |
+ mv -f "${WORKDIR}/${MY_P}" "${S}" || die |
428 |
+} |
429 |
+ |
430 |
+src_prepare() { |
431 |
+ cmake-utils_src_prepare |
432 |
+ |
433 |
+ if use jemalloc ; then |
434 |
+ echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
435 |
+ fi |
436 |
+ |
437 |
+ if use tcmalloc ; then |
438 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
439 |
+ fi |
440 |
+ |
441 |
+ # Don't build bundled xz-utils |
442 |
+ if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then |
443 |
+ echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die |
444 |
+ sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die |
445 |
+ elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then |
446 |
+ echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
447 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
448 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
449 |
+ fi |
450 |
+ |
451 |
+ if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then |
452 |
+ rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die |
453 |
+ fi |
454 |
+ |
455 |
+ # Remove bundled libs so we cannot accidentally use them |
456 |
+ # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394 |
457 |
+ rm -rv \ |
458 |
+ "${S}"/libevent \ |
459 |
+ "${S}"/zlib \ |
460 |
+ "${S}"/extra/protobuf \ |
461 |
+ "${S}"/storage/rocksdb/third_party \ |
462 |
+ "${S}"/storage/tokudb/PerconaFT/third_party \ |
463 |
+ || die |
464 |
+ |
465 |
+ # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
466 |
+ if [[ -d "${S}/support-files/SELinux" ]] ; then |
467 |
+ echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
468 |
+ fi |
469 |
+ |
470 |
+ if use libressl ; then |
471 |
+ sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \ |
472 |
+ "${S}/cmake/ssl.cmake" || die |
473 |
+ fi |
474 |
+ |
475 |
+ sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
476 |
+} |
477 |
+ |
478 |
+src_configure(){ |
479 |
+ # Bug #114895, bug #110149 |
480 |
+ filter-flags "-O" "-O[01]" |
481 |
+ |
482 |
+ append-cxxflags -felide-constructors |
483 |
+ |
484 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
485 |
+ append-flags -fno-strict-aliasing |
486 |
+ |
487 |
+ if use tokudb ; then |
488 |
+ # https://jira.percona.com/browse/PS-4399 |
489 |
+ append-cxxflags -Wno-error=shadow |
490 |
+ fi |
491 |
+ |
492 |
+ if use client-libs ; then |
493 |
+ multilib-minimal_src_configure |
494 |
+ else |
495 |
+ multilib_src_configure |
496 |
+ fi |
497 |
+} |
498 |
+ |
499 |
+multilib_src_configure() { |
500 |
+ debug-print-function ${FUNCNAME} "$@" |
501 |
+ |
502 |
+ if ! multilib_is_native_abi && ! use client-libs ; then |
503 |
+ return |
504 |
+ fi |
505 |
+ |
506 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
507 |
+ |
508 |
+ # debug hack wrt #497532 |
509 |
+ mycmakeargs=( |
510 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
511 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
512 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" |
513 |
+ -DMYSQL_DATADIR="${EPREFIX%/}/var/lib/mysql" |
514 |
+ -DSYSCONFDIR="${EPREFIX%/}/etc/mysql" |
515 |
+ -DINSTALL_BINDIR=bin |
516 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
517 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
518 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
519 |
+ -DINSTALL_INFODIR=share/info |
520 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
521 |
+ -DINSTALL_MANDIR=share/man |
522 |
+ -DINSTALL_MYSQLSHAREDIR=share/mysql |
523 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
524 |
+ -DINSTALL_SCRIPTDIR=share/mysql/scripts |
525 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" |
526 |
+ -DINSTALL_SBINDIR=sbin |
527 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql" |
528 |
+ -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
529 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
530 |
+ ### TODO: make this system but issues with UTF-8 prevent it |
531 |
+ -DWITH_EDITLINE=bundled |
532 |
+ -DWITH_ZLIB=system |
533 |
+ -DWITH_LIBWRAP=0 |
534 |
+ -DENABLED_LOCAL_INFILE=1 |
535 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
536 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
537 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
538 |
+ # The build forces this to be defined when cross-compiling. We pass it |
539 |
+ # all the time for simplicity and to make sure it is actually correct. |
540 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
541 |
+ -DWITH_CURL=system |
542 |
+ -DWITH_BOOST="${WORKDIR}/boost_1_59_0" |
543 |
+ -DWITH_PROTOBUF=system |
544 |
+ ) |
545 |
+ |
546 |
+ if use test ; then |
547 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
548 |
+ else |
549 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
550 |
+ fi |
551 |
+ |
552 |
+ if ! use yassl ; then |
553 |
+ mycmakeargs+=( -DWITH_SSL=system ) |
554 |
+ else |
555 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
556 |
+ fi |
557 |
+ |
558 |
+ if ! use client-libs ; then |
559 |
+ mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
560 |
+ fi |
561 |
+ |
562 |
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
563 |
+ # systemtap only works on native ABI, bug 530132 |
564 |
+ if multilib_is_native_abi ; then |
565 |
+ mycmakeargs+=( |
566 |
+ -DENABLE_DTRACE=$(usex systemtap) |
567 |
+ ) |
568 |
+ else |
569 |
+ mycmakeargs+=( |
570 |
+ -DWITHOUT_TOOLS=1 |
571 |
+ -DWITH_READLINE=1 |
572 |
+ -DENABLE_DTRACE=0 |
573 |
+ ) |
574 |
+ fi |
575 |
+ |
576 |
+ if multilib_is_native_abi && use server ; then |
577 |
+ mycmakeargs+=( |
578 |
+ -DWITH_LIBEVENT=system |
579 |
+ -DWITH_LZ4=system |
580 |
+ -DWITH_MECAB=$(usex cjk system OFF) |
581 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
582 |
+ -DWITH_RAPID=$(usex experimental ON OFF) |
583 |
+ ) |
584 |
+ |
585 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then |
586 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
587 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
588 |
+ ewarn "You MUST file bugs without these variables set." |
589 |
+ |
590 |
+ mycmakeargs+=( |
591 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
592 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
593 |
+ ) |
594 |
+ elif ! use latin1 ; then |
595 |
+ mycmakeargs+=( |
596 |
+ -DDEFAULT_CHARSET=utf8 |
597 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
598 |
+ ) |
599 |
+ else |
600 |
+ mycmakeargs+=( |
601 |
+ -DDEFAULT_CHARSET=latin1 |
602 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
603 |
+ ) |
604 |
+ fi |
605 |
+ |
606 |
+ mycmakeargs+=( |
607 |
+ -DEXTRA_CHARSETS=all |
608 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
609 |
+ -DWITH_DEBUG=$(usex debug) |
610 |
+ -DWITH_EMBEDDED_SERVER=OFF |
611 |
+ ) |
612 |
+ |
613 |
+ if use profiling ; then |
614 |
+ # Setting to OFF doesn't work: Once set, profiling options will be added |
615 |
+ # to `mysqld --help` output via sql/sys_vars.cc causing |
616 |
+ # "main.mysqld--help-notwin" test to fail |
617 |
+ mycmakeargs+=( -DENABLED_PROFILING=ON ) |
618 |
+ fi |
619 |
+ |
620 |
+ if use static ; then |
621 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
622 |
+ fi |
623 |
+ |
624 |
+ # Storage engines |
625 |
+ mycmakeargs+=( |
626 |
+ -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
627 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
628 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
629 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
630 |
+ -DWITH_FEDERATED_STORAGE_ENGINE=1 |
631 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
632 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
633 |
+ -DWITH_INNODB_MEMCACHED=0 |
634 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
635 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
636 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
637 |
+ -DWITH_ROCKSDB=$(usex rocksdb 1 0) |
638 |
+ $(usex tokudb '' -DWITHOUT_TOKUDB=1) |
639 |
+ ) |
640 |
+ |
641 |
+ if use tokudb ; then |
642 |
+ # TokuDB Backup plugin requires valgrind unconditionally |
643 |
+ mycmakeargs+=( |
644 |
+ $(usex tokudb-backup-plugin '' -DTOKUDB_BACKUP_DISABLED=1) |
645 |
+ ) |
646 |
+ fi |
647 |
+ |
648 |
+ else |
649 |
+ mycmakeargs+=( |
650 |
+ -DWITHOUT_SERVER=1 |
651 |
+ -DWITH_EMBEDDED_SERVER=OFF |
652 |
+ -DEXTRA_CHARSETS=none |
653 |
+ ) |
654 |
+ fi |
655 |
+ |
656 |
+ cmake-utils_src_configure |
657 |
+} |
658 |
+ |
659 |
+src_compile() { |
660 |
+ if use client-libs ; then |
661 |
+ multilib-minimal_src_compile |
662 |
+ else |
663 |
+ multilib_src_compile |
664 |
+ fi |
665 |
+} |
666 |
+ |
667 |
+multilib_src_compile() { |
668 |
+ cmake-utils_src_compile |
669 |
+} |
670 |
+ |
671 |
+# Official test instructions: |
672 |
+# ulimit -n 16500 && \ |
673 |
+# USE='latin1 perl server' \ |
674 |
+# FEATURES='test userpriv -usersandbox' \ |
675 |
+# ebuild percona-server-X.X.XX.ebuild \ |
676 |
+# digest clean package |
677 |
+src_test() { |
678 |
+ _disable_test() { |
679 |
+ local rawtestname reason |
680 |
+ rawtestname="${1}" ; shift |
681 |
+ reason="${@}" |
682 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
683 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
684 |
+ } |
685 |
+ |
686 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
687 |
+ local retstatus_unit |
688 |
+ local retstatus_tests |
689 |
+ |
690 |
+ if ! use server ; then |
691 |
+ einfo "Skipping server tests due to minimal build." |
692 |
+ return 0 |
693 |
+ fi |
694 |
+ |
695 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
696 |
+ # localhost. Also causes weird failures. |
697 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
698 |
+ |
699 |
+ if [[ $UID -eq 0 ]] ; then |
700 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
701 |
+ fi |
702 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
703 |
+ |
704 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
705 |
+ |
706 |
+ # Run CTest (test-units) |
707 |
+ cmake-utils_src_test |
708 |
+ retstatus_unit=$? |
709 |
+ |
710 |
+ # Ensure that parallel runs don't die |
711 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
712 |
+ # Enable parallel testing, auto will try to detect number of cores |
713 |
+ # You may set this by hand. |
714 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
715 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
716 |
+ |
717 |
+ # create directories because mysqladmin might run out of order |
718 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
719 |
+ |
720 |
+ # Run mysql tests |
721 |
+ pushd "${TESTDIR}" &>/dev/null || die |
722 |
+ |
723 |
+ touch "${T}/disabled.def" |
724 |
+ # These are failing in Percona-Server 5.7 for now and are believed to be |
725 |
+ # false positives or are known to fail: |
726 |
+ # |
727 |
+ # group_replication.gr_communication_configuration: requires a valid local network address |
728 |
+ # which clashes with FEATURES=network-sandbox |
729 |
+ # main.percona_bug1289599: https://jira.percona.com/browse/PS-2072 |
730 |
+ # main.percona_log_slow_innodb: https://jira.percona.com/browse/PS-4930 |
731 |
+ # keyring_vault.keyring_vault_timeout: requires network access to vault.public-ci.percona.com |
732 |
+ # which clashes with FEATURES=network-sandbox |
733 |
+ # |
734 |
+ local t |
735 |
+ |
736 |
+ for t in \ |
737 |
+ group_replication.gr_communication_configuration \ |
738 |
+ main.percona_bug1289599 \ |
739 |
+ main.percona_log_slow_innodb \ |
740 |
+ keyring_vault.keyring_vault_timeout \ |
741 |
+ ; do |
742 |
+ _disable_test "$t" "False positives in Gentoo / Known bug" |
743 |
+ done |
744 |
+ |
745 |
+ if use numa && use kernel_linux ; then |
746 |
+ # bug 584880 |
747 |
+ if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then |
748 |
+ for t in sys_vars.innodb_numa_interleave_basic ; do |
749 |
+ _disable_test "$t" "Test $t requires system with NUMA support" |
750 |
+ done |
751 |
+ fi |
752 |
+ fi |
753 |
+ |
754 |
+ if use tokudb ; then |
755 |
+ if [[ -f "/sys/kernel/mm/transparent_hugepage/enabled" ]] ; then |
756 |
+ if grep -q -E "\[always\]" /sys/kernel/mm/transparent_hugepage/enabled &>/dev/null ; then |
757 |
+ # TokuDB refuses to start when transparent hugepages are enabled |
758 |
+ for t in \ |
759 |
+ tokudb.rows-32m-rand-insert \ |
760 |
+ tokudb.savepoint-2 \ |
761 |
+ tokudb.savepoint-3 \ |
762 |
+ tokudb.savepoint-4 \ |
763 |
+ tokudb.savepoint-1078 \ |
764 |
+ tokudb.savepoint-1078-2 \ |
765 |
+ tokudb.savepoint-1078-3 \ |
766 |
+ tokudb.savepoint-1078-4 \ |
767 |
+ ; do |
768 |
+ _disable_test "$t" "TokuDB will not work with transparent hugepages enabled" |
769 |
+ done |
770 |
+ fi |
771 |
+ else |
772 |
+ einfo "Cannot determine transparent hugepage status." |
773 |
+ einfo "Please note that TokuDB refuses to start when transparent hugepages are enabled!" |
774 |
+ fi |
775 |
+ fi |
776 |
+ |
777 |
+ if ! use latin1 ; then |
778 |
+ # The following tests will fail if DEFAULT_CHARSET |
779 |
+ # isn't set to latin1: |
780 |
+ for t in \ |
781 |
+ binlog.binlog_mysqlbinlog_filter \ |
782 |
+ binlog.binlog_xa_prepared_disconnect \ |
783 |
+ funcs_1.is_columns_mysql \ |
784 |
+ funcs_1.is_tables_mysql \ |
785 |
+ funcs_1.is_triggers \ |
786 |
+ innodb.innodb_pagesize_max_recordsize \ |
787 |
+ innodb.innodb-system-table-view \ |
788 |
+ innodb.mysqldump_max_recordsize \ |
789 |
+ main.mysql_client_test \ |
790 |
+ main.mysqld--help-notwin \ |
791 |
+ main.type_string \ |
792 |
+ main.information_schema \ |
793 |
+ perfschema.binlog_edge_mix \ |
794 |
+ perfschema.binlog_edge_stmt \ |
795 |
+ rpl.rpl_xa_survive_disconnect \ |
796 |
+ rpl.rpl_xa_survive_disconnect_lsu_off \ |
797 |
+ rpl.rpl_xa_survive_disconnect_table \ |
798 |
+ ; do |
799 |
+ _disable_test "$t" "requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set" |
800 |
+ done |
801 |
+ fi |
802 |
+ |
803 |
+ # Try to increase file limits to increase test coverage |
804 |
+ if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
805 |
+ # Upper limit comes from parts.partition_* tests |
806 |
+ ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
807 |
+ |
808 |
+ if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
809 |
+ # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
810 |
+ ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
811 |
+ |
812 |
+ if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
813 |
+ ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
814 |
+ else |
815 |
+ einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
816 |
+ fi |
817 |
+ else |
818 |
+ einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
819 |
+ fi |
820 |
+ else |
821 |
+ einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
822 |
+ fi |
823 |
+ |
824 |
+ # run mysql-test tests |
825 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
826 |
+ retstatus_tests=$? |
827 |
+ |
828 |
+ popd &>/dev/null || die |
829 |
+ |
830 |
+ # Cleanup is important for these testcases. |
831 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
832 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
833 |
+ |
834 |
+ local failures="" |
835 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
836 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
837 |
+ |
838 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
839 |
+ einfo "Tests successfully completed" |
840 |
+} |
841 |
+ |
842 |
+src_install() { |
843 |
+ local MULTILIB_WRAPPED_HEADERS |
844 |
+ local MULTILIB_CHOST_TOOLS |
845 |
+ if use client-libs ; then |
846 |
+ # headers with ABI specific data |
847 |
+ MULTILIB_WRAPPED_HEADERS=( |
848 |
+ /usr/include/mysql/server/my_config.h |
849 |
+ /usr/include/mysql/server/mysql_version.h ) |
850 |
+ |
851 |
+ # wrap the config scripts |
852 |
+ MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config ) |
853 |
+ multilib-minimal_src_install |
854 |
+ else |
855 |
+ multilib_src_install |
856 |
+ multilib_src_install_all |
857 |
+ fi |
858 |
+} |
859 |
+ |
860 |
+# Intentionally override eclass function |
861 |
+multilib_src_install() { |
862 |
+ |
863 |
+ cmake-utils_src_install |
864 |
+ |
865 |
+ # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
866 |
+ find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
867 |
+} |
868 |
+ |
869 |
+multilib_src_install_all() { |
870 |
+ # Make sure the vars are correctly initialized |
871 |
+ mysql_init_vars |
872 |
+ |
873 |
+ # Convenience links |
874 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
875 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
876 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
877 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
878 |
+ |
879 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
880 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
881 |
+ rm -Rf "${ED}/usr/data" || die |
882 |
+ fi |
883 |
+ |
884 |
+ # Unless they explicitly specific USE=test, then do not install the |
885 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
886 |
+ # validation of your database configuration after tuning it. |
887 |
+ if ! use test ; then |
888 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
889 |
+ fi |
890 |
+ |
891 |
+ # Configuration stuff |
892 |
+ einfo "Building default configuration ..." |
893 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
894 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
895 |
+ cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
896 |
+ eprefixify "${TMPDIR}/my.cnf" |
897 |
+ doins "${TMPDIR}/my.cnf" |
898 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
899 |
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
900 |
+ eprefixify "${TMPDIR}/50-distro-client.cnf" |
901 |
+ doins "${TMPDIR}/50-distro-client.cnf" |
902 |
+ |
903 |
+ if use server ; then |
904 |
+ mycnf_src="my.cnf.distro-server" |
905 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
906 |
+ "${FILESDIR}/${mycnf_src}" \ |
907 |
+ > "${TMPDIR}/my.cnf.ok" || die |
908 |
+ if use prefix ; then |
909 |
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
910 |
+ "${TMPDIR}/my.cnf.ok" || die |
911 |
+ fi |
912 |
+ if use latin1 ; then |
913 |
+ sed -i \ |
914 |
+ -e "/character-set/s|utf8|latin1|g" \ |
915 |
+ "${TMPDIR}/my.cnf.ok" || die |
916 |
+ fi |
917 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
918 |
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
919 |
+ |
920 |
+ einfo "Including support files and sample configurations" |
921 |
+ docinto "support-files" |
922 |
+ local script |
923 |
+ for script in \ |
924 |
+ "${S}"/support-files/magic |
925 |
+ do |
926 |
+ [[ -f "$script" ]] && dodoc "${script}" |
927 |
+ done |
928 |
+ |
929 |
+ docinto "scripts" |
930 |
+ for script in "${S}"/scripts/mysql* ; do |
931 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
932 |
+ done |
933 |
+ |
934 |
+ if use tokudb ; then |
935 |
+ # Remove some unwanted files |
936 |
+ rm -fv \ |
937 |
+ "${ED%/}"/usr/COPYING.AGPLv3 \ |
938 |
+ "${ED%/}"/usr/COPYING.GPLv2 \ |
939 |
+ "${ED%/}"/usr/PATENTS \ |
940 |
+ "${ED%/}"/usr/README.md \ |
941 |
+ || die |
942 |
+ fi |
943 |
+ fi |
944 |
+ |
945 |
+ if ! use client-libs ; then |
946 |
+ rm -rv \ |
947 |
+ "${ED%/}"/usr/$(get_libdir)/pkgconfig \ |
948 |
+ || die |
949 |
+ fi |
950 |
+ |
951 |
+ #Remove mytop if perl is not selected |
952 |
+ [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
953 |
+} |
954 |
+ |
955 |
+pkg_config() { |
956 |
+ _getoptval() { |
957 |
+ local mypd="${EROOT%/}"/usr/bin/my_print_defaults |
958 |
+ local section="$1" |
959 |
+ local flag="--${2}=" |
960 |
+ local extra_options="${3}" |
961 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
962 |
+ } |
963 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
964 |
+ local old_HOME="${HOME}" |
965 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
966 |
+ export HOME=${EPREFIX%/}/root |
967 |
+ |
968 |
+ # Make sure the vars are correctly initialized |
969 |
+ mysql_init_vars |
970 |
+ |
971 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
972 |
+ if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then |
973 |
+ die "Minimal builds do NOT include the MySQL server" |
974 |
+ fi |
975 |
+ |
976 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then |
977 |
+ local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}" |
978 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
979 |
+ local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}" |
980 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
981 |
+ |
982 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then |
983 |
+ if [[ -d "${MY_DATADIR_s}" ]] ; then |
984 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
985 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
986 |
+ else |
987 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
988 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
989 |
+ || die "Moving MY_DATADIR failed" |
990 |
+ fi |
991 |
+ else |
992 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
993 |
+ if [[ -d "${MY_DATADIR_s}" ]] ; then |
994 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
995 |
+ else |
996 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
997 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
998 |
+ fi |
999 |
+ fi |
1000 |
+ fi |
1001 |
+ |
1002 |
+ local pwd1="a" |
1003 |
+ local pwd2="b" |
1004 |
+ local maxtry=15 |
1005 |
+ |
1006 |
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1007 |
+ local tmp_mysqld_password_source= |
1008 |
+ |
1009 |
+ for tmp_mysqld_password_source in mysql client ; do |
1010 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
1011 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
1012 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1013 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
1014 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
1015 |
+ MYSQL_ROOT_PASSWORD= |
1016 |
+ continue |
1017 |
+ fi |
1018 |
+ |
1019 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
1020 |
+ break |
1021 |
+ fi |
1022 |
+ done |
1023 |
+ |
1024 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
1025 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
1026 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
1027 |
+ fi |
1028 |
+ |
1029 |
+ unset tmp_mysqld_password_source |
1030 |
+ fi |
1031 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
1032 |
+ # These are dir+prefix |
1033 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
1034 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
1035 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
1036 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
1037 |
+ |
1038 |
+ if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then |
1039 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
1040 |
+ install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR" |
1041 |
+ fi |
1042 |
+ |
1043 |
+ if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then |
1044 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
1045 |
+ install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN" |
1046 |
+ fi |
1047 |
+ |
1048 |
+ if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then |
1049 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
1050 |
+ install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG" |
1051 |
+ fi |
1052 |
+ |
1053 |
+ if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then |
1054 |
+ ewarn "You have already a MySQL database in place." |
1055 |
+ ewarn "(${ROOT%/}/${MY_DATADIR}/*)" |
1056 |
+ ewarn "Please rename or delete it if you wish to replace it." |
1057 |
+ die "MySQL database already exists!" |
1058 |
+ fi |
1059 |
+ |
1060 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1061 |
+ # localhost. Also causes weird failures. |
1062 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1063 |
+ |
1064 |
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1065 |
+ |
1066 |
+ einfo "Please provide a password for the mysql 'root' user now" |
1067 |
+ einfo "or through the ${HOME}/.my.cnf file." |
1068 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
1069 |
+ read -rsp " >" pwd1 ; echo |
1070 |
+ |
1071 |
+ einfo "Retype the password" |
1072 |
+ read -rsp " >" pwd2 ; echo |
1073 |
+ |
1074 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
1075 |
+ die "Passwords are not the same" |
1076 |
+ fi |
1077 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
1078 |
+ unset pwd1 pwd2 |
1079 |
+ fi |
1080 |
+ |
1081 |
+ local options |
1082 |
+ local sqltmp="$(emktemp)" |
1083 |
+ |
1084 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
1085 |
+ # see http://bugs.mysql.com/bug.php?id=31312 |
1086 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
1087 |
+ |
1088 |
+ # Figure out which options we need to disable to do the setup |
1089 |
+ local helpfile="${TMPDIR%/}/mysqld-help" |
1090 |
+ "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
1091 |
+ for opt in host-cache name-resolve networking slave-start \ |
1092 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
1093 |
+ log-slave-updates \ |
1094 |
+ ; do |
1095 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
1096 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
1097 |
+ done |
1098 |
+ |
1099 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
1100 |
+ |
1101 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
1102 |
+ PID_DIR="${EROOT%/}/var/run/mysqld" |
1103 |
+ if [[ ! -d "${PID_DIR}" ]] ; then |
1104 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
1105 |
+ fi |
1106 |
+ |
1107 |
+ if [[ ! -d "${MY_DATADIR}" ]] ; then |
1108 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
1109 |
+ fi |
1110 |
+ |
1111 |
+ pushd "${TMPDIR}" &>/dev/null || die |
1112 |
+ |
1113 |
+ # Filling timezones, see |
1114 |
+ # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
1115 |
+ echo "USE mysql;" >"${sqltmp}" |
1116 |
+ "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null |
1117 |
+ chown mysql "${sqltmp}" || die |
1118 |
+ |
1119 |
+ # --initialize-insecure will not set root password |
1120 |
+ # --initialize would set a random one in the log which we don't need as we set it ourselves |
1121 |
+ local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" ) |
1122 |
+ cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" ) |
1123 |
+ einfo "Command: ${cmd[*]}" |
1124 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
1125 |
+ >"${TMPDIR%/}"/mysql_install_db.log 2>&1 |
1126 |
+ if [[ $? -ne 0 ]] ; then |
1127 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2 |
1128 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log" |
1129 |
+ fi |
1130 |
+ popd &>/dev/null || die |
1131 |
+ [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \ |
1132 |
+ || die "MySQL databases not installed" |
1133 |
+ |
1134 |
+ use prefix || options="${options} --user=mysql" |
1135 |
+ |
1136 |
+ local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock" |
1137 |
+ local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid" |
1138 |
+ local mysqld="${EROOT%/}/usr/sbin/mysqld \ |
1139 |
+ ${options} \ |
1140 |
+ $(use prefix || echo --user=mysql) \ |
1141 |
+ --log-warnings=0 \ |
1142 |
+ --basedir=${EROOT%/}/usr \ |
1143 |
+ --datadir=${ROOT%/}/${MY_DATADIR} \ |
1144 |
+ --max_allowed_packet=8M \ |
1145 |
+ --net_buffer_length=16K \ |
1146 |
+ --socket=${socket} \ |
1147 |
+ --pid-file=${pidfile} |
1148 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
1149 |
+ #einfo "About to start mysqld: ${mysqld}" |
1150 |
+ ebegin "Starting mysqld" |
1151 |
+ einfo "Command ${mysqld}" |
1152 |
+ ${mysqld} & |
1153 |
+ rc=$? |
1154 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
1155 |
+ maxtry=$((${maxtry}-1)) |
1156 |
+ echo -n "." |
1157 |
+ sleep 1 |
1158 |
+ done |
1159 |
+ eend $rc |
1160 |
+ |
1161 |
+ if ! [[ -S "${socket}" ]] ; then |
1162 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
1163 |
+ fi |
1164 |
+ |
1165 |
+ ebegin "Setting root password" |
1166 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
1167 |
+ local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'" |
1168 |
+ "${EROOT%/}/usr/bin/mysql" \ |
1169 |
+ --no-defaults \ |
1170 |
+ "--socket=${socket}" \ |
1171 |
+ -hlocalhost \ |
1172 |
+ -e "${sql}" |
1173 |
+ eend $? |
1174 |
+ |
1175 |
+ # Stop the server and cleanup |
1176 |
+ einfo "Stopping the server ..." |
1177 |
+ kill $(< "${pidfile}" ) |
1178 |
+ rm -f "${sqltmp}" |
1179 |
+ wait %1 |
1180 |
+ einfo "Done" |
1181 |
+} |