Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql/
Date: Sun, 05 Aug 2018 01:15:23
Message-Id: 1533431709.272254cc6f95fba3edb40d6228d2f74bd01e46b5.grknight@gentoo
1 commit: 272254cc6f95fba3edb40d6228d2f74bd01e46b5
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Sun Aug 5 01:14:43 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 5 01:15:09 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=272254cc
7
8 dev-db/mysql: Drop old
9
10 Package-Manager: Portage-2.3.44, Repoman-2.3.10
11
12 dev-db/mysql/Manifest | 3 -
13 dev-db/mysql/mysql-5.5.60-r1.ebuild | 791 ---------------------------------
14 dev-db/mysql/mysql-5.6.40-r1.ebuild | 768 --------------------------------
15 dev-db/mysql/mysql-5.7.22.ebuild | 843 ------------------------------------
16 4 files changed, 2405 deletions(-)
17
18 diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
19 index 94021f19b0e..07571be616a 100644
20 --- a/dev-db/mysql/Manifest
21 +++ b/dev-db/mysql/Manifest
22 @@ -4,10 +4,7 @@ DIST mysql-5.6.38.tar.gz 32197625 BLAKE2B 5edd6d05e562568d2418edd81c6822b3971030
23 DIST mysql-5.6.39.tar.gz 32110958 BLAKE2B 2f279c6745bc995c860bb4f2868409136e112cc8b9fb0c04fa7673bb6d5612f3ef6d3462666de736d6e7fe5439275ab49908a6609175d1cb8c096d5db5ecb59c SHA512 e1e60854c82d71f9600bf611df964f441815d9d0f896134110a749b29fe340fa216d7c89f4da63d492929565f19a2502463549b8c8c038c658e0be8409a3ffb5
24 DIST mysql-5.6.40.tar.gz 32083035 BLAKE2B efcc078341bae239df28ac0504111aa34926885ae47edb5011352b56552a5a3abd1f824f8cbdc23d8d667592b8f5510946ef18c3efa61865dbbc7f4bb8a2d4a0 SHA512 c8e458b4cd34cae87f1b088ed2188bd00de8cdc42709d5964e82fa2e4aaecfc12a75ae006c54ffa0d3d286fbdef9704d0cbb83436437d5705fb8921d960e758c
25 DIST mysql-5.6.41.tar.gz 32111985 BLAKE2B 5ccad59333525b354db4fa892857e237cddf8fe1a4d289c6e410c31d6142a71d3ce4dab8d954fa9932ec1f83b50e8eccd5845e082deaaa56f1c0c5e21b2ce6c0 SHA512 a62d7a68c6bb49de33f8c9e634bce53cb453a87238e92967115e8e928fa9ed291727b8bd5a5271a0b5b634d957eb310c745edfb14b6be1deb9099bb757aa2cff
26 -DIST mysql-boost-5.7.22.tar.gz 48985783 BLAKE2B 208d684e038366824de4bfbe87b6761f91d05fc5cd46cfa89eb627025fb726efe2d7a08a8ce252fed369e399d2d4921bb93c446a296b617320c53ce351fc17c2 SHA512 186c9e9735114e312c65531c70e6b0b9b48b0fe14384b7a6ebfac2c1f91c3f4ac223d06e27a424fc75f57e0aaf2f74d6a8411a8ab9c6fed45c499068d0f1dc2a
27 DIST mysql-boost-5.7.23.tar.gz 49025014 BLAKE2B 669f10779bc2cda866d6bd876b4efe55fb4b0c796f596f66513a3ca85f322e2a03e9879eecd72a69729a0cb71d408c46cdd9086ae456712b4adff6ae7c584c97 SHA512 e4317f89d108a68652cd95e41ffd670c37b6663aabd6af3985d18052fb7e8d8879b5822399caf9091cecc0a949ec588c121c87cfd60d69941f68d0ecbedd0953
28 DIST mysql-extras-20171121-1518Z.tar.bz2 313539 BLAKE2B c397fdf7ffb3fcbcecda20933e18234062a9500dcf4031e9b17131e2a1f23dca7535ed33ff541fc075eb9995c67a9a8fd7261d7524dd42d8d333543c368b4c15 SHA512 dd0d4a00c0ed710e786d157a73f02c6f555ab7a68e57014d958627096a4245a0b45d22ec860dc5389002d106554e80166661c0b6ddcadff1f737e3fa195badda
29 DIST mysql-extras-20180214-0024Z.tar.bz2 316686 BLAKE2B a893e2975a8062ab236f642d158a7833656942adb31d467b784a9224e7dd87872c3784bb29e93b620a58cd9a835d65248f1a817cdbafa574b5949e2b4262108a SHA512 ad0e81695a70954ad107fe104f9140be24e53d499aed6c123e68e1a062ec5cc90c70f6272fdc014e567794e331301e656ba01b22c2c7a1afaf11e14a9190fb0b
30 -DIST mysql-extras-20180312-2011Z.tar.bz2 319047 BLAKE2B 1da22a0c763a85a6350122c0c56aef4999279c1ef7cf99bcec28348acc83964eb257bb4340c1a21bdcd3b1eb024b23fa62879bed8679c410d847324cb7e24b82 SHA512 b0aa9fc8fbc050451ef147cee99b00cf10d34a71641837821e78655241f7d79a94fe2efb4cef9a23fe9741e08ada2fc0b58ef3b3663752bc567babfbcaa547c8
31 -DIST mysql-extras-20180628-0201Z.tar.bz2 322141 BLAKE2B fce35cfea4ffa9860908fcdf440cd0d714c402c42ee2afb22cec9e727971c216310c7db561ca1b37deebb2cea5137fe24f19b491ad500949e3170ccec3de0b13 SHA512 71a3800ec091b41e41d25536199149eb714c0bbfc0f6fc478e8e4dcaf4cf87a7e4d49c513da3c9badc0de810d7d78c05ad91dd898e45005b42136346237de42a
32 DIST mysql-extras-20180804-2323Z.tar.bz2 322215 BLAKE2B cca9e502e375bf43473335868517f6c450fc7bcf03e55de5a294c8bdcfcac2bb783dec09bbb3b6c30a561ba7e3a943543c017e2d42b61d466e699acdef4c0231 SHA512 efd9d416f394cc61b977ab76f05ab3acc5803ff8bdee8e1dbc65cc5b3f07e4f9742140d9586c028908b10fcc44f21c98ebffdebcc5c3578acbe05b07526bcb3d
33
34 diff --git a/dev-db/mysql/mysql-5.5.60-r1.ebuild b/dev-db/mysql/mysql-5.5.60-r1.ebuild
35 deleted file mode 100644
36 index 36a1e5f70c4..00000000000
37 --- a/dev-db/mysql/mysql-5.5.60-r1.ebuild
38 +++ /dev/null
39 @@ -1,791 +0,0 @@
40 -# Copyright 1999-2018 Gentoo Foundation
41 -# Distributed under the terms of the GNU General Public License v2
42 -
43 -EAPI="6"
44 -MY_EXTRAS_VER="20180628-0201Z"
45 -SUBSLOT="18"
46 -
47 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
48 -
49 -inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build
50 -
51 -SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.5/${P}.tar.gz
52 - https://downloads.mysql.com/archives/MySQL-5.5/${P}.tar.gz"
53 -# Gentoo patches to MySQL
54 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
55 - SRC_URI="${SRC_URI}
56 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
57 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
58 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
59 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
60 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
61 -fi
62 -
63 -HOMEPAGE="https://mysql.com/"
64 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
65 -LICENSE="GPL-2"
66 -SLOT="0/${SUBSLOT:-0}"
67 -IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl
68 - +perl profiling selinux +server static static-libs systemtap tcmalloc
69 - test yassl"
70 -
71 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
72 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
73 -
74 -REQUIRED_USE="?? ( tcmalloc jemalloc )
75 - static? ( yassl )"
76 -
77 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
78 -
79 -# Shorten the path because the socket path length must be shorter than 107 chars
80 -# and we will run a mysql server during test phase
81 -S="${WORKDIR}/mysql"
82 -
83 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
84 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
85 - inherit git-r3
86 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
87 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
88 - EGIT_CLONE_TYPE=shallow
89 -else
90 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
91 -fi
92 -
93 -PATCHES=(
94 - "${MY_PATCH_DIR}/01050_all_mysql_config_cleanup-5.5.patch"
95 - "${MY_PATCH_DIR}/02040_all_embedded-library-shared-5.5.10.patch"
96 - "${MY_PATCH_DIR}/20001_all_fix-minimal-build-cmake-mysql-5.5.41.patch"
97 - "${MY_PATCH_DIR}/20002_all_mysql-va-list.patch"
98 - "${MY_PATCH_DIR}/20006_all_cmake_elib-mysql-5.5.53.patch"
99 - "${MY_PATCH_DIR}/20007_all_cmake-debug-werror-5.6.22.patch"
100 - "${MY_PATCH_DIR}/20008_all_mysql-tzinfo-symlink-5.6.37.patch"
101 - "${MY_PATCH_DIR}/20009_all_mysql_myodbc_symbol_fix-5.5.38.patch"
102 - "${MY_PATCH_DIR}/20018_all_mysql-5.5.60-without-clientlibs-tools.patch"
103 - "${MY_PATCH_DIR}/20027_all_mysql-5.5-perl5.26-includes.patch"
104 - "${MY_PATCH_DIR}/20030_all_mysql-5.5-fix-client-mysql-type.patch"
105 -)
106 -
107 -# Be warned, *DEPEND are version-dependant
108 -# These are used for both runtime and compiletime
109 -COMMON_DEPEND="
110 - kernel_linux? (
111 - sys-process/procps:0=
112 - dev-libs/libaio:0=
113 - )
114 - >=sys-apps/sed-4
115 - >=sys-apps/texinfo-4.7-r1
116 - jemalloc? ( dev-libs/jemalloc:0= )
117 - tcmalloc? ( dev-util/google-perftools:0= )
118 - systemtap? ( >=dev-util/systemtap-1.3:0= )
119 - !yassl? (
120 - !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
121 - libressl? ( dev-libs/libressl:0= )
122 - )
123 - >=sys-libs/zlib-1.2.3:0=
124 - sys-libs/ncurses:0=
125 - !bindist? (
126 - >=sys-libs/readline-4.1:0=
127 - )
128 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
129 -"
130 -DEPEND="virtual/yacc
131 - static? ( sys-libs/ncurses[static-libs] )
132 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
133 - ${COMMON_DEPEND}"
134 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
135 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
136 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
137 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
138 - ${COMMON_DEPEND}
139 - perl? ( !dev-db/mytop
140 - virtual/perl-Getopt-Long
141 - dev-perl/TermReadKey
142 - virtual/perl-Term-ANSIColor
143 - virtual/perl-Time-HiRes )
144 -"
145 -# For other stuff to bring us in
146 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
147 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
148 -
149 -pkg_setup() {
150 - if [[ ${MERGE_TYPE} != binary ]] ; then
151 - local GCC_MAJOR_SET=$(gcc-major-version)
152 - local GCC_MINOR_SET=$(gcc-minor-version)
153 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
154 - # non x86{,_64} arches
155 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
156 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
157 - eerror "${PN} needs to be built with gcc-4.7 or later."
158 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
159 - die
160 - fi
161 - fi
162 - if has test ${FEATURES} && \
163 - use server && ! has userpriv ${FEATURES} ; then
164 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
165 - fi
166 -
167 - # This should come after all of the die statements
168 - enewgroup mysql 60 || die "problem adding 'mysql' group"
169 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
170 -}
171 -
172 -pkg_postinst() {
173 - # Make sure the vars are correctly initialized
174 - mysql_init_vars
175 -
176 - # Create log directory securely if it does not exist
177 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
178 -
179 - if use server ; then
180 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
181 - einfo
182 - elog "You might want to run:"
183 - elog "\"emerge --config =${CATEGORY}/${PF}\""
184 - elog "if this is a new install."
185 - elog
186 - elog "If you are switching server implentations, you should run the"
187 - elog "mysql_upgrade tool."
188 - einfo
189 - else
190 - einfo
191 - elog "If you are upgrading major versions, you should run the"
192 - elog "mysql_upgrade tool."
193 - einfo
194 - fi
195 -
196 - einfo
197 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
198 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
199 - elog "The first time the cluster is activated, you should add"
200 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
201 - elog "This option should then be removed for subsequent starts."
202 - einfo
203 - fi
204 -}
205 -
206 -src_unpack() {
207 - unpack ${A}
208 - # Grab the patches
209 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
210 -
211 - mv -f "${WORKDIR%/}/${P}" "${S}" || die
212 -}
213 -
214 -src_prepare() {
215 - _disable_engine() {
216 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
217 - }
218 -
219 - _disable_plugin() {
220 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
221 - }
222 -
223 - if use tcmalloc; then
224 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
225 - fi
226 -
227 - if use jemalloc; then
228 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
229 - fi
230 -
231 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
232 - if [[ -d "${S}/support-files/SELinux" ]] ; then
233 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
234 - fi
235 -
236 - if use libressl ; then
237 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
238 - "${S}/cmake/ssl.cmake" || die
239 - fi
240 -
241 - local plugin
242 - local server_plugins=( semisync )
243 - local test_plugins=( audit_null daemon_example fulltext )
244 - if ! use server; then # These plugins are for the server
245 - for plugin in "${server_plugins[@]}" ; do
246 - _disable_plugin "${plugin}"
247 - done
248 - fi
249 -
250 - if ! use test; then # These plugins are only used during testing
251 - for plugin in "${test_plugins[@]}" ; do
252 - _disable_plugin "${plugin}"
253 - done
254 - fi
255 -
256 - # Don't build example
257 - _disable_engine example
258 - _disable_engine ndb
259 -
260 - cmake-utils_src_prepare
261 -}
262 -
263 -src_configure(){
264 - # Bug #114895, bug #110149
265 - filter-flags "-O" "-O[01]"
266 -
267 - append-cxxflags -felide-constructors
268 -
269 - # bug #283926, with GCC4.4, this is required to get correct behavior.
270 - append-flags -fno-strict-aliasing
271 -
272 - CMAKE_BUILD_TYPE="RelWithDebInfo"
273 -
274 - # debug hack wrt #497532
275 - mycmakeargs=(
276 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
277 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
278 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
279 - -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql"
280 - -DINSTALL_BINDIR=bin
281 - -DINSTALL_DOCDIR=share/doc/${PF}
282 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
283 - -DINSTALL_INCLUDEDIR=include/mysql
284 - -DINSTALL_INFODIR=share/info
285 - -DINSTALL_LIBDIR=$(get_libdir)
286 - -DINSTALL_MANDIR=share/man
287 - -DINSTALL_MYSQLSHAREDIR=share/mysql
288 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
289 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
290 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
291 - -DINSTALL_SBINDIR=sbin
292 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
293 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
294 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
295 - -DWITH_ZLIB=system
296 - -DENABLED_LOCAL_INFILE=1
297 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
298 - # The build forces this to be defined when cross-compiling. We pass it
299 - # all the time for simplicity and to make sure it is actually correct.
300 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
301 - -DWITHOUT_CLIENTLIBS=YES
302 - -DWITH_READLINE=$(usex bindist 1 0)
303 - -DENABLE_DTRACE=$(usex systemtap)
304 - )
305 - if use test ; then
306 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
307 - else
308 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
309 - fi
310 -
311 - if ! use yassl ; then
312 - mycmakeargs+=( -DWITH_SSL=system )
313 - else
314 - mycmakeargs+=( -DWITH_SSL=bundled )
315 - fi
316 -
317 - if use server ; then
318 -
319 - # Federated{,X} must be treated special otherwise they will not be built as plugins
320 - if ! use extraengine ; then
321 - mycmakeargs+=(
322 - -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
323 - -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 )
324 - fi
325 -
326 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
327 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
328 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
329 - ewarn "You MUST file bugs without these variables set."
330 -
331 - mycmakeargs+=(
332 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
333 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
334 - )
335 -
336 - elif ! use latin1 ; then
337 - mycmakeargs+=(
338 - -DDEFAULT_CHARSET=utf8
339 - -DDEFAULT_COLLATION=utf8_general_ci
340 - )
341 - else
342 - mycmakeargs+=(
343 - -DDEFAULT_CHARSET=latin1
344 - -DDEFAULT_COLLATION=latin1_swedish_ci
345 - )
346 - fi
347 - mycmakeargs+=(
348 - -DINSTALL_SQLBENCHDIR=share/mysql
349 - -DEXTRA_CHARSETS=all
350 - -DDISABLE_SHARED=$(usex static YES NO)
351 - -DWITH_EMBEDDED_SERVER=OFF
352 - -DENABLED_PROFILING=$(usex profiling)
353 - )
354 -
355 - if use static; then
356 - mycmakeargs+=( -DWITH_PIC=1 )
357 - fi
358 -
359 - # Storage engines
360 - mycmakeargs+=(
361 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
362 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
363 - -DWITH_CSV_STORAGE_ENGINE=1
364 - -DWITH_HEAP_STORAGE_ENGINE=1
365 - -DWITH_INNOBASE_STORAGE_ENGINE=1
366 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
367 - -DWITH_MYISAM_STORAGE_ENGINE=1
368 - -DWITH_PARTITION_STORAGE_ENGINE=1
369 - )
370 -
371 - else
372 - mycmakeargs+=(
373 - -DWITHOUT_SERVER=1
374 - -DEXTRA_CHARSETS=none
375 - -DINSTALL_SQLBENCHDIR=
376 - )
377 - fi
378 -
379 - cmake-utils_src_configure
380 -}
381 -
382 -src_compile() {
383 - cmake-utils_src_compile
384 -}
385 -
386 -src_install() {
387 - cmake-utils_src_install
388 -
389 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
390 - if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then
391 - rm "${ED%/}/usr/include/mysql/server/private/config.h" || die
392 - fi
393 -
394 - # Make sure the vars are correctly initialized
395 - mysql_init_vars
396 -
397 - # Convenience links
398 - einfo "Making Convenience links for mysqlcheck multi-call binary"
399 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
400 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
401 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
402 -
403 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
404 - if [[ -d "${ED%/}/usr/data" ]] ; then
405 - rm -Rf "${ED%/}/usr/data" || die
406 - fi
407 -
408 - # Unless they explicitly specific USE=test, then do not install the
409 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
410 - # validation of your database configuration after tuning it.
411 - if ! use test ; then
412 - rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test"
413 - fi
414 -
415 - # Configuration stuff
416 - einfo "Building default configuration ..."
417 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
418 - [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf
419 - local mycnf_src="my.cnf-5.5"
420 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
421 - "${FILESDIR%/}/${mycnf_src}" \
422 - > "${TMPDIR%/}/my.cnf.ok" || die
423 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok"
424 - if use latin1 ; then
425 - sed -i \
426 - -e "/character-set/s|utf8|latin1|g" \
427 - "${TMPDIR%/}/my.cnf.ok" || die
428 - fi
429 - eprefixify "${TMPDIR%/}/my.cnf.ok"
430 - newins "${TMPDIR}/my.cnf.ok" my.cnf
431 -
432 - if use server ; then
433 - einfo "Including support files and sample configurations"
434 - docinto "support-files"
435 - local script
436 - for script in \
437 - "${S%/}"/support-files/magic
438 - do
439 - [[ -f "$script" ]] && dodoc "${script}"
440 - done
441 -
442 - docinto "scripts"
443 - for script in "${S%/}"/scripts/mysql* ; do
444 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
445 - done
446 - fi
447 -
448 - #Remove mytop if perl is not selected
449 - [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop"
450 -}
451 -
452 -# Official test instructions:
453 -# USE='extraengine perl server' \
454 -# FEATURES='test userpriv -usersandbox' \
455 -# ebuild mysql-X.X.XX.ebuild \
456 -# digest clean package
457 -src_test() {
458 -
459 - _disable_test() {
460 - local rawtestname reason
461 - rawtestname="${1}" ; shift
462 - reason="${@}"
463 - ewarn "test '${rawtestname}' disabled: '${reason}'"
464 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
465 - }
466 -
467 - local TESTDIR="${BUILD_DIR}/mysql-test"
468 - local retstatus_unit
469 - local retstatus_tests
470 -
471 - if ! use server ; then
472 - einfo "Skipping server tests due to minimal build."
473 - return 0
474 - fi
475 -
476 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
477 - # localhost. Also causes weird failures.
478 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
479 -
480 - if [[ $UID -eq 0 ]]; then
481 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
482 - fi
483 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
484 -
485 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
486 -
487 - # Run CTest (test-units)
488 - cmake-utils_src_test
489 - retstatus_unit=$?
490 -
491 - # Ensure that parallel runs don't die
492 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
493 - # Enable parallel testing, auto will try to detect number of cores
494 - # You may set this by hand.
495 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
496 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
497 -
498 - # create directories because mysqladmin might run out of order
499 - mkdir -p "${T}"/var-tests{,/log} || die
500 -
501 - # Run mysql tests
502 - pushd "${TESTDIR}" > /dev/null || die
503 -
504 - touch "${T}/disabled.def"
505 - # These are failing in MySQL 5.5 for now and are believed to be
506 - # false positives:
507 - #
508 - # main.mysql_client_test, main.mysql_client_test_nonblock
509 - # main.mysql_client_test_comp:
510 - # segfaults at random under Portage only, suspect resource limits.
511 -
512 - local t
513 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
514 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam \
515 - main.mysqlhotcopy_archive main.mysqlhotcopy_myisam main.openssl_1 \
516 - rpl.rpl_semi_sync_uninstall_plugin ; do
517 - _disable_test "$t" "False positives in Gentoo"
518 - done
519 -
520 - if ! use client-libs ; then
521 - _disable_test main.plugin_auth "Needs client libraries built"
522 - fi
523 -
524 - # run mysql-test tests
525 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
526 - retstatus_tests=$?
527 -
528 - popd > /dev/null || die
529 -
530 - # Cleanup is important for these testcases.
531 - pkill -9 -f "${S}/ndb" 2>/dev/null
532 - pkill -9 -f "${S}/sql" 2>/dev/null
533 -
534 - local failures=""
535 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
536 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
537 -
538 - [[ -z "$failures" ]] || die "Test failures: $failures"
539 - einfo "Tests successfully completed"
540 -}
541 -
542 -mysql_init_vars() {
543 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
544 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
545 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
546 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
547 -
548 - if [[ -z "${MY_DATADIR}" ]] ; then
549 - MY_DATADIR=""
550 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
551 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
552 - | sed -ne '/datadir/s|^--datadir=||p' \
553 - | tail -n1`
554 - if [[ -z "${MY_DATADIR}" ]] ; then
555 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
556 - | sed -e 's/.*=\s*//' \
557 - | tail -n1`
558 - fi
559 - fi
560 - if [[ -z "${MY_DATADIR}" ]] ; then
561 - MY_DATADIR="${MY_LOCALSTATEDIR}"
562 - einfo "Using default MY_DATADIR"
563 - fi
564 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
565 -
566 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
567 - if [[ -e "${MY_DATADIR}" ]] ; then
568 - # If you get this and you're wondering about it, see bug #207636
569 - elog "MySQL datadir found in ${MY_DATADIR}"
570 - elog "A new one will not be created."
571 - PREVIOUS_DATADIR="yes"
572 - else
573 - PREVIOUS_DATADIR="no"
574 - fi
575 - export PREVIOUS_DATADIR
576 - fi
577 - else
578 - if [[ ${EBUILD_PHASE} == "config" ]]; then
579 - local new_MY_DATADIR
580 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
581 - | sed -ne '/datadir/s|^--datadir=||p' \
582 - | tail -n1`
583 -
584 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
585 - ewarn "MySQL MY_DATADIR has changed"
586 - ewarn "from ${MY_DATADIR}"
587 - ewarn "to ${new_MY_DATADIR}"
588 - MY_DATADIR="${new_MY_DATADIR}"
589 - fi
590 - fi
591 - fi
592 -
593 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
594 - export MY_LOCALSTATEDIR MY_LOGDIR
595 - export MY_DATADIR
596 -}
597 -
598 -pkg_config() {
599 - _getoptval() {
600 - local mypd="${EROOT}"/usr/bin/my_print_defaults
601 - local section="$1"
602 - local flag="--${2}="
603 - local extra_options="${3}"
604 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
605 - }
606 - local old_MY_DATADIR="${MY_DATADIR}"
607 - local old_HOME="${HOME}"
608 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
609 - export HOME=${EPREFIX}/root
610 -
611 - # Make sure the vars are correctly initialized
612 - mysql_init_vars
613 -
614 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
615 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
616 - die "Minimal builds do NOT include the MySQL server"
617 - fi
618 -
619 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
620 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
621 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
622 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
623 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
624 -
625 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
626 - if [[ -d "${MY_DATADIR_s}" ]]; then
627 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
628 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
629 - else
630 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
631 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
632 - || die "Moving MY_DATADIR failed"
633 - fi
634 - else
635 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
636 - if [[ -d "${MY_DATADIR_s}" ]]; then
637 - ewarn "Attempting to use ${MY_DATADIR_s}"
638 - else
639 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
640 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
641 - fi
642 - fi
643 - fi
644 -
645 - local pwd1="a"
646 - local pwd2="b"
647 - local maxtry=15
648 -
649 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
650 - local tmp_mysqld_password_source=
651 -
652 - for tmp_mysqld_password_source in mysql client; do
653 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
654 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
655 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
656 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
657 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
658 - MYSQL_ROOT_PASSWORD=
659 - continue
660 - fi
661 -
662 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
663 - break
664 - fi
665 - done
666 -
667 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
668 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
669 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
670 - fi
671 -
672 - unset tmp_mysqld_password_source
673 - fi
674 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
675 - # These are dir+prefix
676 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
677 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
678 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
679 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
680 -
681 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
682 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
683 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
684 - fi
685 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
686 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
687 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
688 - fi
689 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
690 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
691 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
692 - fi
693 -
694 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
695 - ewarn "You have already a MySQL database in place."
696 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
697 - ewarn "Please rename or delete it if you wish to replace it."
698 - die "MySQL database already exists!"
699 - fi
700 -
701 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
702 - # localhost. Also causes weird failures.
703 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
704 -
705 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
706 -
707 - einfo "Please provide a password for the mysql 'root' user now"
708 - einfo "or through the ${HOME}/.my.cnf file."
709 - ewarn "Avoid [\"'\\_%] characters in the password"
710 - read -rsp " >" pwd1 ; echo
711 -
712 - einfo "Retype the password"
713 - read -rsp " >" pwd2 ; echo
714 -
715 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
716 - die "Passwords are not the same"
717 - fi
718 - MYSQL_ROOT_PASSWORD="${pwd1}"
719 - unset pwd1 pwd2
720 - fi
721 -
722 - local options
723 - local sqltmp="$(emktemp)"
724 -
725 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
726 - # see http://bugs.mysql.com/bug.php?id=31312
727 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
728 -
729 - # Figure out which options we need to disable to do the setup
730 - local helpfile="${TMPDIR}/mysqld-help"
731 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
732 - for opt in grant-tables host-cache name-resolve networking slave-start \
733 - federated ssl log-bin relay-log slow-query-log external-locking \
734 - log-slave-updates \
735 - ; do
736 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
737 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
738 - done
739 -
740 - einfo "Creating the mysql database and setting proper permissions on it ..."
741 -
742 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
743 - PID_DIR="${EROOT}/var/run/mysqld"
744 - if [[ ! -d "${PID_DIR}" ]]; then
745 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
746 - fi
747 -
748 - if [[ ! -d "${MY_DATADIR}" ]]; then
749 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
750 - fi
751 -
752 - pushd "${TMPDIR}" &>/dev/null || die
753 -
754 - # Filling timezones, see
755 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
756 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
757 -
758 - local cmd=( "${EROOT}usr/share/mysql/scripts/mysql_install_db" )
759 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
760 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
761 - einfo "Command: ${cmd[*]}"
762 - su -s /bin/sh -c "${cmd[*]}" mysql \
763 - >"${TMPDIR}"/mysql_install_db.log 2>&1
764 - if [ $? -ne 0 ]; then
765 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
766 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
767 - fi
768 - popd &>/dev/null || die
769 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
770 - || die "MySQL databases not installed"
771 -
772 - use prefix || options="${options} --user=mysql"
773 -
774 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
775 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
776 - local mysqld="${EROOT}/usr/sbin/mysqld \
777 - ${options} \
778 - --log-warnings=0 \
779 - --basedir=${EROOT}/usr \
780 - --datadir=${ROOT}/${MY_DATADIR} \
781 - --max_allowed_packet=8M \
782 - --net_buffer_length=16K \
783 - --socket=${socket} \
784 - --pid-file=${pidfile}
785 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
786 - #einfo "About to start mysqld: ${mysqld}"
787 - ebegin "Starting mysqld"
788 - einfo "Command ${mysqld}"
789 - ${mysqld} &
790 - rc=$?
791 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
792 - maxtry=$((${maxtry}-1))
793 - echo -n "."
794 - sleep 1
795 - done
796 - eend $rc
797 -
798 - if ! [[ -S "${socket}" ]]; then
799 - die "Completely failed to start up mysqld with: ${mysqld}"
800 - fi
801 -
802 - ebegin "Setting root password"
803 - # Do this from memory, as we don't want clear text passwords in temp files
804 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
805 - "${EROOT}/usr/bin/mysql" \
806 - "--socket=${socket}" \
807 - -hlocalhost \
808 - -e "${sql}"
809 - eend $?
810 -
811 - if [[ -n "${sqltmp}" ]] ; then
812 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
813 - "${EROOT}/usr/bin/mysql" \
814 - "--socket=${socket}" \
815 - -hlocalhost \
816 - -uroot \
817 - --password="${MYSQL_ROOT_PASSWORD}" \
818 - mysql < "${sqltmp}"
819 - rc=$?
820 - eend $?
821 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
822 - fi
823 -
824 - # Stop the server and cleanup
825 - einfo "Stopping the server ..."
826 - kill $(< "${pidfile}" )
827 - rm -f "${sqltmp}"
828 - wait %1
829 - einfo "Done"
830 -}
831
832 diff --git a/dev-db/mysql/mysql-5.6.40-r1.ebuild b/dev-db/mysql/mysql-5.6.40-r1.ebuild
833 deleted file mode 100644
834 index 38515733ba7..00000000000
835 --- a/dev-db/mysql/mysql-5.6.40-r1.ebuild
836 +++ /dev/null
837 @@ -1,768 +0,0 @@
838 -# Copyright 1999-2018 Gentoo Foundation
839 -# Distributed under the terms of the GNU General Public License v2
840 -
841 -EAPI="6"
842 -MY_EXTRAS_VER="20180628-0201Z"
843 -
844 -CMAKE_MAKEFILE_GENERATOR=emake
845 -
846 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
847 -
848 -inherit eutils flag-o-matic prefix toolchain-funcs \
849 - user cmake-utils multilib-build
850 -
851 -SRC_URI="http://cdn.mysql.com/Downloads/MySQL-5.6/${P}.tar.gz
852 - https://cdn.mysql.com/archives/mysql-5.6/${P}.tar.gz
853 - http://downloads.mysql.com/archives/MySQL-5.6/${P}.tar.gz"
854 -
855 -# Gentoo patches to MySQL
856 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
857 - SRC_URI="${SRC_URI}
858 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
859 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
860 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
861 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
862 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
863 -fi
864 -
865 -HOMEPAGE="https://www.mysql.com/"
866 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
867 -LICENSE="GPL-2"
868 -SLOT="0/18"
869 -IUSE="client-libs cracklib debug jemalloc latin1 libressl numa +perl profiling selinux
870 - +server static static-libs systemtap tcmalloc test yassl"
871 -
872 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
873 -RESTRICT="libressl? ( test )"
874 -
875 -REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
876 -
877 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
878 -
879 -# Shorten the path because the socket path length must be shorter than 107 chars
880 -# and we will run a mysql server during test phase
881 -S="${WORKDIR}/mysql"
882 -
883 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
884 - inherit git-r3
885 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
886 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
887 - EGIT_CLONE_TYPE=shallow
888 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
889 -else
890 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
891 -fi
892 -
893 -PATCHES=(
894 - "${MY_PATCH_DIR}"/01050_all_mysql_config_cleanup-5.6.patch
895 - "${MY_PATCH_DIR}"/02040_all_embedded-library-shared-5.5.10.patch
896 - "${MY_PATCH_DIR}"/20006_all_cmake_elib-mysql-5.6.35.patch
897 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.6.22.patch
898 - "${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.6.37.patch
899 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.6.patch
900 - "${MY_PATCH_DIR}"/20018_all_mysql-5.6.25-without-clientlibs-tools.patch
901 - "${MY_PATCH_DIR}"/20027_all_mysql-5.5-perl5.26-includes.patch
902 - "${MY_PATCH_DIR}"/20028_all_mysql-5.6-gcc7.patch
903 - "${MY_PATCH_DIR}"/20031_all_mysql-5.6-fix-monitor.test.patch
904 -)
905 -
906 -# Be warned, *DEPEND are version-dependant
907 -# These are used for both runtime and compiletime
908 -COMMON_DEPEND="
909 - kernel_linux? (
910 - sys-process/procps:0=
911 - dev-libs/libaio:0=
912 - )
913 - net-misc/curl
914 - >=sys-apps/sed-4
915 - >=sys-apps/texinfo-4.7-r1
916 - jemalloc? ( dev-libs/jemalloc:0= )
917 - tcmalloc? ( dev-util/google-perftools:0= )
918 - systemtap? ( >=dev-util/systemtap-1.3:0= )
919 - !yassl? (
920 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
921 - libressl? ( dev-libs/libressl:0= )
922 - )
923 - >=sys-libs/zlib-1.2.3:0=
924 - sys-libs/ncurses:0=
925 - server? (
926 - numa? ( sys-process/numactl )
927 - )
928 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
929 -"
930 -DEPEND="virtual/yacc
931 - static? ( sys-libs/ncurses[static-libs] )
932 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
933 - ${COMMON_DEPEND}"
934 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
935 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
936 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
937 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
938 - ${COMMON_DEPEND}
939 -"
940 -# For other stuff to bring us in
941 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
942 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
943 -
944 -pkg_setup() {
945 - if [[ ${MERGE_TYPE} != binary ]] ; then
946 - local GCC_MAJOR_SET=$(gcc-major-version)
947 - local GCC_MINOR_SET=$(gcc-minor-version)
948 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
949 - # non x86{,_64} arches
950 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
951 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
952 - eerror "${PN} needs to be built with gcc-4.7 or later."
953 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
954 - die
955 - fi
956 - fi
957 - if has test ${FEATURES} && \
958 - use server && ! has userpriv ${FEATURES} ; then
959 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
960 - fi
961 -
962 - # This should come after all of the die statements
963 - enewgroup mysql 60 || die "problem adding 'mysql' group"
964 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
965 -}
966 -
967 -pkg_preinst() {
968 - # Here we need to see if the implementation switched client libraries
969 - # We check if this is a new instance of the package and a client library already exists
970 - local SHOW_ABI_MESSAGE libpath
971 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
972 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
973 - elog "Due to ABI changes when switching between different client libraries,"
974 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
975 - elog "Please run: revdep-rebuild --library ${libpath}"
976 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
977 - fi
978 -}
979 -
980 -pkg_postinst() {
981 - # Make sure the vars are correctly initialized
982 - mysql_init_vars
983 -
984 - # Create log directory securely if it does not exist
985 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
986 -
987 - if use server ; then
988 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
989 - einfo
990 - elog "You might want to run:"
991 - elog "\"emerge --config =${CATEGORY}/${PF}\""
992 - elog "if this is a new install."
993 - elog
994 - elog "If you are switching server implentations, you should run the"
995 - elog "mysql_upgrade tool."
996 - einfo
997 - else
998 - einfo
999 - elog "If you are upgrading major versions, you should run the"
1000 - elog "mysql_upgrade tool."
1001 - einfo
1002 - fi
1003 - fi
1004 -}
1005 -
1006 -src_unpack() {
1007 - unpack ${A}
1008 - # Grab the patches
1009 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
1010 -
1011 - mv -f "${WORKDIR}/${P}" "${S}" || die
1012 -}
1013 -
1014 -src_prepare() {
1015 - _disable_engine() {
1016 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
1017 - }
1018 -
1019 - _disable_plugin() {
1020 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
1021 - }
1022 -
1023 - if use jemalloc ; then
1024 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
1025 - fi
1026 - if use tcmalloc; then
1027 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
1028 - fi
1029 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
1030 - if [[ -d "${S}/support-files/SELinux" ]] ; then
1031 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
1032 - fi
1033 -
1034 - if use libressl ; then
1035 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
1036 - "${S}/cmake/ssl.cmake" || die
1037 - fi
1038 -
1039 - sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
1040 -
1041 - local plugin
1042 - local server_plugins=( semisync )
1043 - local test_plugins=( audit_null daemon_example fulltext )
1044 - if ! use server; then # These plugins are for the server
1045 - for plugin in "${server_plugins[@]}" ; do
1046 - _disable_plugin "${plugin}"
1047 - done
1048 - fi
1049 -
1050 - if ! use test; then # These plugins are only used during testing
1051 - for plugin in "${test_plugins[@]}" ; do
1052 - _disable_plugin "${plugin}"
1053 - done
1054 - fi
1055 -
1056 - # Don't build example
1057 - _disable_engine example
1058 - _disable_engine ndb
1059 - _disable_plugin innodb_memcached
1060 -
1061 - cmake-utils_src_prepare
1062 -}
1063 -
1064 -src_configure(){
1065 - # bug 508724 mariadb cannot use ld.gold
1066 - tc-ld-disable-gold
1067 - # Bug #114895, bug #110149
1068 - filter-flags "-O" "-O[01]"
1069 -
1070 - append-cxxflags -felide-constructors
1071 -
1072 - # bug #283926, with GCC4.4, this is required to get correct behavior.
1073 - append-flags -fno-strict-aliasing
1074 -
1075 - CMAKE_BUILD_TYPE="RelWithDebInfo"
1076 -
1077 - # debug hack wrt #497532
1078 - mycmakeargs=(
1079 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1080 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1081 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
1082 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
1083 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
1084 - -DINSTALL_BINDIR=bin
1085 - -DINSTALL_DOCDIR=share/doc/${PF}
1086 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
1087 - -DINSTALL_INCLUDEDIR=include/mysql
1088 - -DINSTALL_INFODIR=share/info
1089 - -DINSTALL_LIBDIR=$(get_libdir)
1090 - -DINSTALL_MANDIR=share/man
1091 - -DINSTALL_MYSQLSHAREDIR=share/mysql
1092 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
1093 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
1094 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
1095 - -DINSTALL_SBINDIR=sbin
1096 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
1097 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
1098 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
1099 - ### TODO: make this system but issues with UTF-8 prevent it
1100 - -DWITH_EDITLINE=bundled
1101 - -DWITH_ZLIB=system
1102 - -DWITH_LIBWRAP=0
1103 - -DENABLED_LOCAL_INFILE=1
1104 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1105 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
1106 - -DWITH_DEFAULT_FEATURE_SET=0
1107 - # The build forces this to be defined when cross-compiling. We pass it
1108 - # all the time for simplicity and to make sure it is actually correct.
1109 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
1110 - -DWITH_LIBEVENT=NO
1111 - -DWITHOUT_CLIENTLIBS=YES
1112 - -DENABLE_DTRACE=$(usex systemtap)
1113 - -DWITH_SSL=$(usex yassl bundled system)
1114 - -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mysql/mysql-test' '')
1115 - -DWITHOUT_VALIDATE_PASSWORD=1
1116 - )
1117 -
1118 - if use server ; then
1119 -
1120 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
1121 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1122 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1123 - ewarn "You MUST file bugs without these variables set."
1124 -
1125 - mycmakeargs+=(
1126 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1127 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1128 - )
1129 -
1130 - elif ! use latin1 ; then
1131 - mycmakeargs+=(
1132 - -DDEFAULT_CHARSET=utf8
1133 - -DDEFAULT_COLLATION=utf8_general_ci
1134 - )
1135 - else
1136 - mycmakeargs+=(
1137 - -DDEFAULT_CHARSET=latin1
1138 - -DDEFAULT_COLLATION=latin1_swedish_ci
1139 - )
1140 - fi
1141 - mycmakeargs+=(
1142 - -DWITH_NUMA=$(usex numa ON OFF)
1143 - -DEXTRA_CHARSETS=all
1144 - -DDISABLE_SHARED=$(usex static YES NO)
1145 - -DWITH_DEBUG=$(usex debug)
1146 - -DWITH_EMBEDDED_SERVER=OFF
1147 - -DENABLED_PROFILING=$(usex profiling)
1148 - )
1149 -
1150 - if use static; then
1151 - mycmakeargs+=( -DWITH_PIC=1 )
1152 - fi
1153 -
1154 - # Storage engines
1155 - mycmakeargs+=(
1156 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1157 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1158 - -DWITH_CSV_STORAGE_ENGINE=1
1159 - -DWITH_HEAP_STORAGE_ENGINE=1
1160 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1161 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1162 - -DWITH_MYISAM_STORAGE_ENGINE=1
1163 - -DWITH_PARTITION_STORAGE_ENGINE=1
1164 - -DWITH_INNODB_MEMCACHED=0
1165 - )
1166 -
1167 - else
1168 - mycmakeargs+=(
1169 - -DWITHOUT_SERVER=1
1170 - -DWITH_EMBEDDED_SERVER=OFF
1171 - -DEXTRA_CHARSETS=none
1172 - )
1173 - fi
1174 -
1175 - cmake-utils_src_configure
1176 -}
1177 -
1178 -src_compile() {
1179 - cmake-utils_src_compile
1180 -}
1181 -
1182 -src_install() {
1183 - cmake-utils_src_install
1184 -
1185 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
1186 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
1187 - # Make sure the vars are correctly initialized
1188 - mysql_init_vars
1189 -
1190 - # Convenience links
1191 - einfo "Making Convenience links for mysqlcheck multi-call binary"
1192 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
1193 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
1194 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
1195 -
1196 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
1197 - if [[ -d "${ED}/usr/data" ]] ; then
1198 - rm -Rf "${ED}/usr/data" || die
1199 - fi
1200 -
1201 - # Unless they explicitly specific USE=test, then do not install the
1202 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
1203 - # validation of your database configuration after tuning it.
1204 - if ! use test ; then
1205 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
1206 - fi
1207 -
1208 - # Configuration stuff
1209 - einfo "Building default configuration ..."
1210 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
1211 - [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf
1212 - local mycnf_src="my.cnf-5.6"
1213 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
1214 - "${FILESDIR%/}/${mycnf_src}" \
1215 - > "${TMPDIR%/}/my.cnf.ok" || die
1216 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok"
1217 - if use latin1 ; then
1218 - sed -i \
1219 - -e "/character-set/s|utf8|latin1|g" \
1220 - "${TMPDIR%/}/my.cnf.ok" || die
1221 - fi
1222 - eprefixify "${TMPDIR%/}/my.cnf.ok"
1223 - newins "${TMPDIR}/my.cnf.ok" my.cnf
1224 -
1225 - if use server ; then
1226 - einfo "Including support files and sample configurations"
1227 - docinto "support-files"
1228 - local script
1229 - for script in \
1230 - "${S}"/support-files/magic
1231 - do
1232 - [[ -f "$script" ]] && dodoc "${script}"
1233 - done
1234 -
1235 - docinto "scripts"
1236 - for script in "${S}"/scripts/mysql* ; do
1237 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
1238 - done
1239 - fi
1240 -
1241 - #Remove mytop if perl is not selected
1242 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
1243 -}
1244 -
1245 -# Official test instructions:
1246 -# USE='perl server static-libs' \
1247 -# FEATURES='test userpriv -usersandbox' \
1248 -# ebuild mysql-X.X.XX.ebuild \
1249 -# digest clean package
1250 -src_test() {
1251 -
1252 - _disable_test() {
1253 - local rawtestname reason
1254 - rawtestname="${1}" ; shift
1255 - reason="${@}"
1256 - ewarn "test '${rawtestname}' disabled: '${reason}'"
1257 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
1258 - }
1259 -
1260 - local TESTDIR="${BUILD_DIR}/mysql-test"
1261 - local retstatus_unit
1262 - local retstatus_tests
1263 -
1264 - if ! use server ; then
1265 - einfo "Skipping server tests due to minimal build."
1266 - return 0
1267 - fi
1268 -
1269 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1270 - # localhost. Also causes weird failures.
1271 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1272 -
1273 - if [[ $UID -eq 0 ]]; then
1274 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1275 - fi
1276 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
1277 -
1278 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1279 -
1280 - # Run CTest (test-units)
1281 - cmake-utils_src_test
1282 - retstatus_unit=$?
1283 -
1284 - # Ensure that parallel runs don't die
1285 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
1286 - # Enable parallel testing, auto will try to detect number of cores
1287 - # You may set this by hand.
1288 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
1289 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
1290 -
1291 - # create directories because mysqladmin might run out of order
1292 - mkdir -p "${T}"/var-tests{,/log} || die
1293 -
1294 - # Run mysql tests
1295 - pushd "${TESTDIR}" > /dev/null || die
1296 -
1297 - touch "${T}/disabled.def"
1298 - # These are failing in MySQL 5.7 for now and are believed to be
1299 - # false positives:
1300 - #
1301 - local t
1302 -
1303 - for t in auth_sec.keyring_udf federated.federated_plugin ; do
1304 - _disable_test "$t" "False positives in Gentoo"
1305 - done
1306 -
1307 - # run mysql-test tests
1308 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
1309 - retstatus_tests=$?
1310 -
1311 - popd > /dev/null || die
1312 -
1313 - # Cleanup is important for these testcases.
1314 - pkill -9 -f "${S}/ndb" 2>/dev/null
1315 - pkill -9 -f "${S}/sql" 2>/dev/null
1316 -
1317 - local failures=""
1318 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
1319 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
1320 -
1321 - [[ -z "$failures" ]] || die "Test failures: $failures"
1322 - einfo "Tests successfully completed"
1323 -}
1324 -
1325 -mysql_init_vars() {
1326 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
1327 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
1328 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
1329 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
1330 -
1331 - if [[ -z "${MY_DATADIR}" ]] ; then
1332 - MY_DATADIR=""
1333 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
1334 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1335 - | sed -ne '/datadir/s|^--datadir=||p' \
1336 - | tail -n1`
1337 - if [[ -z "${MY_DATADIR}" ]] ; then
1338 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
1339 - | sed -e 's/.*=\s*//' \
1340 - | tail -n1`
1341 - fi
1342 - fi
1343 - if [[ -z "${MY_DATADIR}" ]] ; then
1344 - MY_DATADIR="${MY_LOCALSTATEDIR}"
1345 - einfo "Using default MY_DATADIR"
1346 - fi
1347 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
1348 -
1349 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
1350 - if [[ -e "${MY_DATADIR}" ]] ; then
1351 - # If you get this and you're wondering about it, see bug #207636
1352 - elog "MySQL datadir found in ${MY_DATADIR}"
1353 - elog "A new one will not be created."
1354 - PREVIOUS_DATADIR="yes"
1355 - else
1356 - PREVIOUS_DATADIR="no"
1357 - fi
1358 - export PREVIOUS_DATADIR
1359 - fi
1360 - else
1361 - if [[ ${EBUILD_PHASE} == "config" ]]; then
1362 - local new_MY_DATADIR
1363 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1364 - | sed -ne '/datadir/s|^--datadir=||p' \
1365 - | tail -n1`
1366 -
1367 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
1368 - ewarn "MySQL MY_DATADIR has changed"
1369 - ewarn "from ${MY_DATADIR}"
1370 - ewarn "to ${new_MY_DATADIR}"
1371 - MY_DATADIR="${new_MY_DATADIR}"
1372 - fi
1373 - fi
1374 - fi
1375 -
1376 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
1377 - export MY_LOCALSTATEDIR MY_LOGDIR
1378 - export MY_DATADIR
1379 -}
1380 -
1381 -pkg_config() {
1382 - _getoptval() {
1383 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
1384 - local section="$1"
1385 - local flag="--${2}="
1386 - local extra_options="${3}"
1387 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
1388 - }
1389 - local old_MY_DATADIR="${MY_DATADIR}"
1390 - local old_HOME="${HOME}"
1391 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
1392 - export HOME=${EPREFIX%/}/root
1393 -
1394 - # Make sure the vars are correctly initialized
1395 - mysql_init_vars
1396 -
1397 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
1398 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
1399 - die "Minimal builds do NOT include the MySQL server"
1400 - fi
1401 -
1402 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
1403 - local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}"
1404 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
1405 - local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}"
1406 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
1407 -
1408 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
1409 - if [[ -d "${MY_DATADIR_s}" ]]; then
1410 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
1411 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
1412 - else
1413 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
1414 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
1415 - || die "Moving MY_DATADIR failed"
1416 - fi
1417 - else
1418 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
1419 - if [[ -d "${MY_DATADIR_s}" ]]; then
1420 - ewarn "Attempting to use ${MY_DATADIR_s}"
1421 - else
1422 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
1423 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
1424 - fi
1425 - fi
1426 - fi
1427 -
1428 - local pwd1="a"
1429 - local pwd2="b"
1430 - local maxtry=15
1431 -
1432 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1433 - local tmp_mysqld_password_source=
1434 -
1435 - for tmp_mysqld_password_source in mysql client; do
1436 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1437 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
1438 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
1439 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
1440 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1441 - MYSQL_ROOT_PASSWORD=
1442 - continue
1443 - fi
1444 -
1445 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1446 - break
1447 - fi
1448 - done
1449 -
1450 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1451 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
1452 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
1453 - fi
1454 -
1455 - unset tmp_mysqld_password_source
1456 - fi
1457 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
1458 - # These are dir+prefix
1459 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
1460 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1461 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
1462 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1463 -
1464 - if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]]; then
1465 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
1466 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR"
1467 - fi
1468 - if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]]; then
1469 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
1470 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN"
1471 - fi
1472 - if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]]; then
1473 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
1474 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG"
1475 - fi
1476 -
1477 - if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then
1478 - ewarn "You have already a MySQL database in place."
1479 - ewarn "(${ROOT%/}/${MY_DATADIR}/*)"
1480 - ewarn "Please rename or delete it if you wish to replace it."
1481 - die "MySQL database already exists!"
1482 - fi
1483 -
1484 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1485 - # localhost. Also causes weird failures.
1486 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1487 -
1488 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1489 -
1490 - einfo "Please provide a password for the mysql 'root' user now"
1491 - einfo "or through the ${HOME}/.my.cnf file."
1492 - ewarn "Avoid [\"'\\_%] characters in the password"
1493 - read -rsp " >" pwd1 ; echo
1494 -
1495 - einfo "Retype the password"
1496 - read -rsp " >" pwd2 ; echo
1497 -
1498 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1499 - die "Passwords are not the same"
1500 - fi
1501 - MYSQL_ROOT_PASSWORD="${pwd1}"
1502 - unset pwd1 pwd2
1503 - fi
1504 -
1505 - local options
1506 - local sqltmp="$(emktemp)"
1507 -
1508 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1509 - # see http://bugs.mysql.com/bug.php?id=31312
1510 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
1511 -
1512 - # Figure out which options we need to disable to do the setup
1513 - local helpfile="${TMPDIR%/}/mysqld-help"
1514 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
1515 - for opt in host-cache name-resolve networking slave-start \
1516 - federated ssl log-bin relay-log slow-query-log external-locking \
1517 - log-slave-updates \
1518 - ; do
1519 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1520 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1521 - done
1522 -
1523 - einfo "Creating the mysql database and setting proper permissions on it ..."
1524 -
1525 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
1526 - PID_DIR="${EROOT%/}/var/run/mysqld"
1527 - if [[ ! -d "${PID_DIR}" ]]; then
1528 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
1529 - fi
1530 -
1531 - if [[ ! -d "${MY_DATADIR}" ]]; then
1532 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
1533 - fi
1534 -
1535 - pushd "${TMPDIR}" &>/dev/null || die
1536 -
1537 - # Filling timezones, see
1538 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
1539 - echo "USE mysql;" >"${sqltmp}"
1540 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
1541 - chown mysql "${sqltmp}" || die
1542 -
1543 - # --initialize-insecure will not set root password
1544 - # --initialize would set a random one in the log which we don't need as we set it ourselves
1545 - local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
1546 - cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
1547 - einfo "Command: ${cmd[*]}"
1548 - su -s /bin/sh -c "${cmd[*]}" mysql \
1549 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
1550 - if [ $? -ne 0 ]; then
1551 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
1552 - die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
1553 - fi
1554 - popd &>/dev/null || die
1555 - [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \
1556 - || die "MySQL databases not installed"
1557 -
1558 - use prefix || options="${options} --user=mysql"
1559 -
1560 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
1561 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
1562 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
1563 - ${options} \
1564 - $(use prefix || echo --user=mysql) \
1565 - --log-warnings=0 \
1566 - --basedir=${EROOT%/}/usr \
1567 - --datadir=${ROOT%/}/${MY_DATADIR} \
1568 - --max_allowed_packet=8M \
1569 - --net_buffer_length=16K \
1570 - --socket=${socket} \
1571 - --pid-file=${pidfile}
1572 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
1573 - #einfo "About to start mysqld: ${mysqld}"
1574 - ebegin "Starting mysqld"
1575 - einfo "Command ${mysqld}"
1576 - ${mysqld} &
1577 - rc=$?
1578 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1579 - maxtry=$((${maxtry}-1))
1580 - echo -n "."
1581 - sleep 1
1582 - done
1583 - eend $rc
1584 -
1585 - if ! [[ -S "${socket}" ]]; then
1586 - die "Completely failed to start up mysqld with: ${mysqld}"
1587 - fi
1588 -
1589 - ebegin "Setting root password"
1590 - # Do this from memory, as we don't want clear text passwords in temp files
1591 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'"
1592 - "${EROOT%/}/usr/bin/mysql" \
1593 - --no-defaults \
1594 - "--socket=${socket}" \
1595 - -hlocalhost \
1596 - -e "${sql}"
1597 - eend $?
1598 -
1599 - # Stop the server and cleanup
1600 - einfo "Stopping the server ..."
1601 - kill $(< "${pidfile}" )
1602 - rm -f "${sqltmp}"
1603 - wait %1
1604 - einfo "Done"
1605 -}
1606
1607 diff --git a/dev-db/mysql/mysql-5.7.22.ebuild b/dev-db/mysql/mysql-5.7.22.ebuild
1608 deleted file mode 100644
1609 index 3c0a0ac7c38..00000000000
1610 --- a/dev-db/mysql/mysql-5.7.22.ebuild
1611 +++ /dev/null
1612 @@ -1,843 +0,0 @@
1613 -# Copyright 1999-2018 Gentoo Foundation
1614 -# Distributed under the terms of the GNU General Public License v2
1615 -
1616 -EAPI="6"
1617 -MY_EXTRAS_VER="20180312-2011Z"
1618 -
1619 -CMAKE_MAKEFILE_GENERATOR=emake
1620 -
1621 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
1622 -
1623 -inherit eutils flag-o-matic prefix toolchain-funcs \
1624 - user cmake-utils multilib-minimal
1625 -
1626 -SRC_URI="http://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz
1627 - https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz
1628 - http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz"
1629 -
1630 -# Gentoo patches to MySQL
1631 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
1632 - SRC_URI="${SRC_URI}
1633 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1634 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1635 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1636 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1637 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
1638 -fi
1639 -
1640 -HOMEPAGE="https://www.mysql.com/"
1641 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
1642 -LICENSE="GPL-2"
1643 -SLOT="0/18"
1644 -IUSE="client-libs cracklib debug jemalloc latin1 libressl numa +perl profiling selinux
1645 - +server static static-libs systemtap tcmalloc test yassl"
1646 -
1647 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
1648 -RESTRICT="libressl? ( test )"
1649 -
1650 -REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
1651 -
1652 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
1653 -
1654 -# Shorten the path because the socket path length must be shorter than 107 chars
1655 -# and we will run a mysql server during test phase
1656 -S="${WORKDIR}/mysql"
1657 -
1658 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
1659 - inherit git-r3
1660 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
1661 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
1662 - EGIT_CLONE_TYPE=shallow
1663 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
1664 -else
1665 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
1666 -fi
1667 -
1668 -PATCHES=(
1669 - "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch
1670 - "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch
1671 -# "${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.7.6.patch
1672 - "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch
1673 - "${MY_PATCH_DIR}"/20018_all_mysql-5.7.21-without-clientlibs-tools.patch
1674 -)
1675 -
1676 -# Be warned, *DEPEND are version-dependant
1677 -# These are used for both runtime and compiletime
1678 -# MULTILIB_USEDEP only set for libraries used by the client library
1679 -COMMON_DEPEND="
1680 - kernel_linux? (
1681 - sys-process/procps:0=
1682 - dev-libs/libaio:0=
1683 - )
1684 - net-misc/curl
1685 - >=sys-apps/sed-4
1686 - >=sys-apps/texinfo-4.7-r1
1687 - jemalloc? ( dev-libs/jemalloc:0= )
1688 - tcmalloc? ( dev-util/google-perftools:0= )
1689 - systemtap? ( >=dev-util/systemtap-1.3:0= )
1690 - !yassl? (
1691 - client-libs? (
1692 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
1693 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
1694 - )
1695 - !client-libs? (
1696 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
1697 - libressl? ( dev-libs/libressl:0= )
1698 - )
1699 - )
1700 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
1701 - !client-libs? ( >=sys-libs/zlib-1.2.3:0= )
1702 - sys-libs/ncurses:0=
1703 - server? (
1704 - >=app-arch/lz4-0_p131:=
1705 - >=dev-libs/boost-1.65.0:=
1706 - numa? ( sys-process/numactl )
1707 - )
1708 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
1709 -"
1710 -DEPEND="virtual/yacc
1711 - static? ( sys-libs/ncurses[static-libs] )
1712 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
1713 - ${COMMON_DEPEND}"
1714 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
1715 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
1716 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
1717 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
1718 - ${COMMON_DEPEND}
1719 -"
1720 -# For other stuff to bring us in
1721 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
1722 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
1723 -
1724 -pkg_setup() {
1725 - if [[ ${MERGE_TYPE} != binary ]] ; then
1726 - local GCC_MAJOR_SET=$(gcc-major-version)
1727 - local GCC_MINOR_SET=$(gcc-minor-version)
1728 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
1729 - # non x86{,_64} arches
1730 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
1731 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1732 - eerror "${PN} needs to be built with gcc-4.7 or later."
1733 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1734 - die
1735 - fi
1736 - fi
1737 - if has test ${FEATURES} && \
1738 - use server && ! has userpriv ${FEATURES} ; then
1739 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1740 - fi
1741 -
1742 - # This should come after all of the die statements
1743 - enewgroup mysql 60 || die "problem adding 'mysql' group"
1744 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
1745 -}
1746 -
1747 -pkg_preinst() {
1748 - # Here we need to see if the implementation switched client libraries
1749 - # We check if this is a new instance of the package and a client library already exists
1750 - local SHOW_ABI_MESSAGE libpath
1751 - if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
1752 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
1753 - elog "Due to ABI changes when switching between different client libraries,"
1754 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
1755 - elog "Please run: revdep-rebuild --library ${libpath}"
1756 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
1757 - fi
1758 -}
1759 -
1760 -pkg_postinst() {
1761 - # Make sure the vars are correctly initialized
1762 - mysql_init_vars
1763 -
1764 - # Create log directory securely if it does not exist
1765 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
1766 -
1767 - if use server ; then
1768 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1769 - einfo
1770 - elog "You might want to run:"
1771 - elog "\"emerge --config =${CATEGORY}/${PF}\""
1772 - elog "if this is a new install."
1773 - elog
1774 - elog "If you are switching server implentations, you should run the"
1775 - elog "mysql_upgrade tool."
1776 - einfo
1777 - else
1778 - einfo
1779 - elog "If you are upgrading major versions, you should run the"
1780 - elog "mysql_upgrade tool."
1781 - einfo
1782 - fi
1783 - fi
1784 -
1785 - # Note about configuration change
1786 - einfo
1787 - elog "This version of mysql reorganizes the configuration from a single my.cnf"
1788 - elog "to several files in /etc/mysql/${PN}.d."
1789 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
1790 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
1791 - elog "You may have as many files as needed and they are read alphabetically."
1792 - elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
1793 - einfo
1794 -}
1795 -
1796 -src_unpack() {
1797 - unpack ${A}
1798 - # Grab the patches
1799 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
1800 -
1801 - mv -f "${WORKDIR}/${P}" "${S}" || die
1802 -}
1803 -
1804 -src_prepare() {
1805 - if use jemalloc ; then
1806 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
1807 - fi
1808 - if use tcmalloc; then
1809 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
1810 - fi
1811 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
1812 - if [[ -d "${S}/support-files/SELinux" ]] ; then
1813 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
1814 - fi
1815 -
1816 - if use libressl ; then
1817 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
1818 - "${S}/cmake/ssl.cmake" || die
1819 - fi
1820 -
1821 - sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
1822 -
1823 - cmake-utils_src_prepare
1824 -}
1825 -
1826 -src_configure(){
1827 - # bug 508724 mariadb cannot use ld.gold
1828 - tc-ld-disable-gold
1829 - # Bug #114895, bug #110149
1830 - filter-flags "-O" "-O[01]"
1831 -
1832 - append-cxxflags -felide-constructors
1833 -
1834 - # bug #283926, with GCC4.4, this is required to get correct behavior.
1835 - append-flags -fno-strict-aliasing
1836 -
1837 - if use client-libs ; then
1838 - multilib-minimal_src_configure
1839 - else
1840 - multilib_src_configure
1841 - fi
1842 -}
1843 -
1844 -multilib_src_configure() {
1845 - debug-print-function ${FUNCNAME} "$@"
1846 -
1847 - if ! multilib_is_native_abi && ! use client-libs ; then
1848 - return
1849 - fi
1850 -
1851 - CMAKE_BUILD_TYPE="RelWithDebInfo"
1852 -
1853 - # debug hack wrt #497532
1854 - mycmakeargs=(
1855 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1856 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1857 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
1858 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
1859 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
1860 - -DINSTALL_BINDIR=bin
1861 - -DINSTALL_DOCDIR=share/doc/${PF}
1862 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
1863 - -DINSTALL_INCLUDEDIR=include/mysql
1864 - -DINSTALL_INFODIR=share/info
1865 - -DINSTALL_LIBDIR=$(get_libdir)
1866 - -DINSTALL_MANDIR=share/man
1867 - -DINSTALL_MYSQLSHAREDIR=share/mysql
1868 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
1869 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
1870 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
1871 - -DINSTALL_SBINDIR=sbin
1872 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
1873 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
1874 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
1875 - ### TODO: make this system but issues with UTF-8 prevent it
1876 - -DWITH_EDITLINE=bundled
1877 - -DWITH_ZLIB=system
1878 - -DWITH_LIBWRAP=0
1879 - -DENABLED_LOCAL_INFILE=1
1880 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1881 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
1882 - -DWITH_DEFAULT_FEATURE_SET=0
1883 - # The build forces this to be defined when cross-compiling. We pass it
1884 - # all the time for simplicity and to make sure it is actually correct.
1885 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
1886 - -DWITH_RAPID=OFF
1887 - -DWITH_LIBEVENT=NO
1888 - -DWITH_CURL=system
1889 - -DWITH_BOOST="${S}/boost"
1890 - )
1891 - if use test ; then
1892 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
1893 - else
1894 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
1895 - fi
1896 -
1897 - if ! use yassl ; then
1898 - mycmakeargs+=( -DWITH_SSL=system )
1899 - else
1900 - mycmakeargs+=( -DWITH_SSL=bundled )
1901 - fi
1902 -
1903 - if ! use client-libs ; then
1904 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
1905 - fi
1906 -
1907 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
1908 - # systemtap only works on native ABI bug 530132
1909 - if multilib_is_native_abi; then
1910 - mycmakeargs+=(
1911 - -DENABLE_DTRACE=$(usex systemtap)
1912 - )
1913 - else
1914 - mycmakeargs+=(
1915 - -DWITHOUT_TOOLS=1
1916 - -DWITH_READLINE=1
1917 - -DENABLE_DTRACE=0
1918 - )
1919 - fi
1920 -
1921 - if multilib_is_native_abi && use server ; then
1922 -
1923 - mycmakeargs+=(
1924 - -DWITH_LZ4=system
1925 - -DWITH_NUMA=$(usex numa ON OFF)
1926 - )
1927 -
1928 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
1929 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1930 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1931 - ewarn "You MUST file bugs without these variables set."
1932 -
1933 - mycmakeargs+=(
1934 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1935 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1936 - )
1937 -
1938 - elif ! use latin1 ; then
1939 - mycmakeargs+=(
1940 - -DDEFAULT_CHARSET=utf8
1941 - -DDEFAULT_COLLATION=utf8_general_ci
1942 - )
1943 - else
1944 - mycmakeargs+=(
1945 - -DDEFAULT_CHARSET=latin1
1946 - -DDEFAULT_COLLATION=latin1_swedish_ci
1947 - )
1948 - fi
1949 - mycmakeargs+=(
1950 - -DEXTRA_CHARSETS=all
1951 - -DDISABLE_SHARED=$(usex static YES NO)
1952 - -DWITH_DEBUG=$(usex debug)
1953 - -DWITH_EMBEDDED_SERVER=OFF
1954 - -DENABLED_PROFILING=$(usex profiling)
1955 - )
1956 -
1957 - if use static; then
1958 - mycmakeargs+=( -DWITH_PIC=1 )
1959 - fi
1960 -
1961 - # Storage engines
1962 - mycmakeargs+=(
1963 - -DWITH_EXAMPLE_STORAGE_ENGINE=0
1964 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1965 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1966 - -DWITH_CSV_STORAGE_ENGINE=1
1967 - -DWITH_HEAP_STORAGE_ENGINE=1
1968 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1969 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1970 - -DWITH_MYISAM_STORAGE_ENGINE=1
1971 - -DWITH_PARTITION_STORAGE_ENGINE=1
1972 - -DWITH_INNODB_MEMCACHED=0
1973 - )
1974 -
1975 - else
1976 - mycmakeargs+=(
1977 - -DWITHOUT_SERVER=1
1978 - -DWITH_EMBEDDED_SERVER=OFF
1979 - -DEXTRA_CHARSETS=none
1980 - )
1981 - fi
1982 -
1983 - cmake-utils_src_configure
1984 -}
1985 -
1986 -src_compile() {
1987 - if use client-libs ; then
1988 - multilib-minimal_src_compile
1989 - else
1990 - multilib_src_compile
1991 - fi
1992 -}
1993 -
1994 -multilib_src_compile() {
1995 - cmake-utils_src_compile
1996 -}
1997 -
1998 -src_install() {
1999 - local MULTILIB_WRAPPED_HEADERS
2000 - local MULTILIB_CHOST_TOOLS
2001 - if use client-libs ; then
2002 - # headers with ABI specific data
2003 - MULTILIB_WRAPPED_HEADERS=(
2004 - /usr/include/mysql/server/my_config.h
2005 - /usr/include/mysql/server/mysql_version.h )
2006 -
2007 - # wrap the config scripts
2008 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
2009 - multilib-minimal_src_install
2010 - else
2011 - multilib_src_install
2012 - multilib_src_install_all
2013 - fi
2014 -}
2015 -
2016 -# Intentionally override eclass function
2017 -multilib_src_install() {
2018 -
2019 - cmake-utils_src_install
2020 -
2021 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
2022 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
2023 -}
2024 -
2025 -multilib_src_install_all() {
2026 - # Make sure the vars are correctly initialized
2027 - mysql_init_vars
2028 -
2029 - # Convenience links
2030 - einfo "Making Convenience links for mysqlcheck multi-call binary"
2031 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
2032 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
2033 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
2034 -
2035 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
2036 - if [[ -d "${ED}/usr/data" ]] ; then
2037 - rm -Rf "${ED}/usr/data" || die
2038 - fi
2039 -
2040 - # Unless they explicitly specific USE=test, then do not install the
2041 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
2042 - # validation of your database configuration after tuning it.
2043 - if ! use test ; then
2044 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
2045 - fi
2046 -
2047 - # Configuration stuff
2048 - einfo "Building default configuration ..."
2049 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
2050 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
2051 - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
2052 - eprefixify "${TMPDIR}/my.cnf"
2053 - doins "${TMPDIR}/my.cnf"
2054 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
2055 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
2056 - eprefixify "${TMPDIR}/50-distro-client.cnf"
2057 - doins "${TMPDIR}/50-distro-client.cnf"
2058 -
2059 - if use server ; then
2060 - mycnf_src="my.cnf.distro-server"
2061 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
2062 - "${FILESDIR}/${mycnf_src}" \
2063 - > "${TMPDIR}/my.cnf.ok" || die
2064 - if use prefix ; then
2065 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
2066 - "${TMPDIR}/my.cnf.ok" || die
2067 - fi
2068 - if use latin1 ; then
2069 - sed -i \
2070 - -e "/character-set/s|utf8|latin1|g" \
2071 - "${TMPDIR}/my.cnf.ok" || die
2072 - fi
2073 - eprefixify "${TMPDIR}/my.cnf.ok"
2074 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
2075 -
2076 - einfo "Including support files and sample configurations"
2077 - docinto "support-files"
2078 - local script
2079 - for script in \
2080 - "${S}"/support-files/magic
2081 - do
2082 - [[ -f "$script" ]] && dodoc "${script}"
2083 - done
2084 -
2085 - docinto "scripts"
2086 - for script in "${S}"/scripts/mysql* ; do
2087 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
2088 - done
2089 - fi
2090 -
2091 - #Remove mytop if perl is not selected
2092 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
2093 -}
2094 -
2095 -# Official test instructions:
2096 -# USE='perl server static-libs' \
2097 -# FEATURES='test userpriv -usersandbox' \
2098 -# ebuild mysql-X.X.XX.ebuild \
2099 -# digest clean package
2100 -src_test() {
2101 -
2102 - _disable_test() {
2103 - local rawtestname reason
2104 - rawtestname="${1}" ; shift
2105 - reason="${@}"
2106 - ewarn "test '${rawtestname}' disabled: '${reason}'"
2107 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
2108 - }
2109 -
2110 - local TESTDIR="${BUILD_DIR}/mysql-test"
2111 - local retstatus_unit
2112 - local retstatus_tests
2113 -
2114 - if ! use server ; then
2115 - einfo "Skipping server tests due to minimal build."
2116 - return 0
2117 - fi
2118 -
2119 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2120 - # localhost. Also causes weird failures.
2121 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2122 -
2123 - if [[ $UID -eq 0 ]]; then
2124 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2125 - fi
2126 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
2127 -
2128 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
2129 -
2130 - # Run CTest (test-units)
2131 - cmake-utils_src_test
2132 - retstatus_unit=$?
2133 -
2134 - # Ensure that parallel runs don't die
2135 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
2136 - # Enable parallel testing, auto will try to detect number of cores
2137 - # You may set this by hand.
2138 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
2139 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
2140 -
2141 - # create directories because mysqladmin might run out of order
2142 - mkdir -p "${T}"/var-tests{,/log} || die
2143 -
2144 - # Run mysql tests
2145 - pushd "${TESTDIR}" > /dev/null || die
2146 -
2147 - touch "${T}/disabled.def"
2148 - # These are failing in MySQL 5.7 for now and are believed to be
2149 - # false positives:
2150 - #
2151 - local t
2152 -
2153 - for t in auth_sec.keyring_udf federated.federated_plugin ; do
2154 - _disable_test "$t" "False positives in Gentoo"
2155 - done
2156 -
2157 - # run mysql-test tests
2158 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
2159 - retstatus_tests=$?
2160 -
2161 - popd > /dev/null || die
2162 -
2163 - # Cleanup is important for these testcases.
2164 - pkill -9 -f "${S}/ndb" 2>/dev/null
2165 - pkill -9 -f "${S}/sql" 2>/dev/null
2166 -
2167 - local failures=""
2168 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
2169 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
2170 -
2171 - [[ -z "$failures" ]] || die "Test failures: $failures"
2172 - einfo "Tests successfully completed"
2173 -}
2174 -
2175 -mysql_init_vars() {
2176 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
2177 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
2178 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
2179 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
2180 -
2181 - if [[ -z "${MY_DATADIR}" ]] ; then
2182 - MY_DATADIR=""
2183 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
2184 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2185 - | sed -ne '/datadir/s|^--datadir=||p' \
2186 - | tail -n1`
2187 - if [[ -z "${MY_DATADIR}" ]] ; then
2188 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
2189 - | sed -e 's/.*=\s*//' \
2190 - | tail -n1`
2191 - fi
2192 - fi
2193 - if [[ -z "${MY_DATADIR}" ]] ; then
2194 - MY_DATADIR="${MY_LOCALSTATEDIR}"
2195 - einfo "Using default MY_DATADIR"
2196 - fi
2197 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
2198 -
2199 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
2200 - if [[ -e "${MY_DATADIR}" ]] ; then
2201 - # If you get this and you're wondering about it, see bug #207636
2202 - elog "MySQL datadir found in ${MY_DATADIR}"
2203 - elog "A new one will not be created."
2204 - PREVIOUS_DATADIR="yes"
2205 - else
2206 - PREVIOUS_DATADIR="no"
2207 - fi
2208 - export PREVIOUS_DATADIR
2209 - fi
2210 - else
2211 - if [[ ${EBUILD_PHASE} == "config" ]]; then
2212 - local new_MY_DATADIR
2213 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2214 - | sed -ne '/datadir/s|^--datadir=||p' \
2215 - | tail -n1`
2216 -
2217 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
2218 - ewarn "MySQL MY_DATADIR has changed"
2219 - ewarn "from ${MY_DATADIR}"
2220 - ewarn "to ${new_MY_DATADIR}"
2221 - MY_DATADIR="${new_MY_DATADIR}"
2222 - fi
2223 - fi
2224 - fi
2225 -
2226 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
2227 - export MY_LOCALSTATEDIR MY_LOGDIR
2228 - export MY_DATADIR
2229 -}
2230 -
2231 -pkg_config() {
2232 - _getoptval() {
2233 - local mypd="${EROOT%/}"/usr/bin/my_print_defaults
2234 - local section="$1"
2235 - local flag="--${2}="
2236 - local extra_options="${3}"
2237 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
2238 - }
2239 - local old_MY_DATADIR="${MY_DATADIR}"
2240 - local old_HOME="${HOME}"
2241 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
2242 - export HOME=${EPREFIX%/}/root
2243 -
2244 - # Make sure the vars are correctly initialized
2245 - mysql_init_vars
2246 -
2247 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
2248 - if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
2249 - die "Minimal builds do NOT include the MySQL server"
2250 - fi
2251 -
2252 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
2253 - local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}"
2254 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
2255 - local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}"
2256 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
2257 -
2258 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
2259 - if [[ -d "${MY_DATADIR_s}" ]]; then
2260 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
2261 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
2262 - else
2263 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
2264 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
2265 - || die "Moving MY_DATADIR failed"
2266 - fi
2267 - else
2268 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
2269 - if [[ -d "${MY_DATADIR_s}" ]]; then
2270 - ewarn "Attempting to use ${MY_DATADIR_s}"
2271 - else
2272 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
2273 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
2274 - fi
2275 - fi
2276 - fi
2277 -
2278 - local pwd1="a"
2279 - local pwd2="b"
2280 - local maxtry=15
2281 -
2282 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2283 - local tmp_mysqld_password_source=
2284 -
2285 - for tmp_mysqld_password_source in mysql client; do
2286 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
2287 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
2288 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
2289 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
2290 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
2291 - MYSQL_ROOT_PASSWORD=
2292 - continue
2293 - fi
2294 -
2295 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
2296 - break
2297 - fi
2298 - done
2299 -
2300 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
2301 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
2302 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
2303 - fi
2304 -
2305 - unset tmp_mysqld_password_source
2306 - fi
2307 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
2308 - # These are dir+prefix
2309 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
2310 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
2311 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
2312 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
2313 -
2314 - if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]]; then
2315 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
2316 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR"
2317 - fi
2318 - if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]]; then
2319 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
2320 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN"
2321 - fi
2322 - if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]]; then
2323 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
2324 - install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG"
2325 - fi
2326 -
2327 - if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then
2328 - ewarn "You have already a MySQL database in place."
2329 - ewarn "(${ROOT%/}/${MY_DATADIR}/*)"
2330 - ewarn "Please rename or delete it if you wish to replace it."
2331 - die "MySQL database already exists!"
2332 - fi
2333 -
2334 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2335 - # localhost. Also causes weird failures.
2336 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2337 -
2338 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2339 -
2340 - einfo "Please provide a password for the mysql 'root' user now"
2341 - einfo "or through the ${HOME}/.my.cnf file."
2342 - ewarn "Avoid [\"'\\_%] characters in the password"
2343 - read -rsp " >" pwd1 ; echo
2344 -
2345 - einfo "Retype the password"
2346 - read -rsp " >" pwd2 ; echo
2347 -
2348 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
2349 - die "Passwords are not the same"
2350 - fi
2351 - MYSQL_ROOT_PASSWORD="${pwd1}"
2352 - unset pwd1 pwd2
2353 - fi
2354 -
2355 - local options
2356 - local sqltmp="$(emktemp)"
2357 -
2358 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
2359 - # see http://bugs.mysql.com/bug.php?id=31312
2360 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
2361 -
2362 - # Figure out which options we need to disable to do the setup
2363 - local helpfile="${TMPDIR%/}/mysqld-help"
2364 - "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
2365 - for opt in host-cache name-resolve networking slave-start \
2366 - federated ssl log-bin relay-log slow-query-log external-locking \
2367 - log-slave-updates \
2368 - ; do
2369 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
2370 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
2371 - done
2372 -
2373 - einfo "Creating the mysql database and setting proper permissions on it ..."
2374 -
2375 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
2376 - PID_DIR="${EROOT%/}/var/run/mysqld"
2377 - if [[ ! -d "${PID_DIR}" ]]; then
2378 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
2379 - fi
2380 -
2381 - if [[ ! -d "${MY_DATADIR}" ]]; then
2382 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
2383 - fi
2384 -
2385 - pushd "${TMPDIR}" &>/dev/null || die
2386 -
2387 - # Filling timezones, see
2388 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
2389 - echo "USE mysql;" >"${sqltmp}"
2390 - "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
2391 - chown mysql "${sqltmp}" || die
2392 -
2393 - # --initialize-insecure will not set root password
2394 - # --initialize would set a random one in the log which we don't need as we set it ourselves
2395 - local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
2396 - cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
2397 - einfo "Command: ${cmd[*]}"
2398 - su -s /bin/sh -c "${cmd[*]}" mysql \
2399 - >"${TMPDIR%/}"/mysql_install_db.log 2>&1
2400 - if [ $? -ne 0 ]; then
2401 - grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
2402 - die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
2403 - fi
2404 - popd &>/dev/null || die
2405 - [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \
2406 - || die "MySQL databases not installed"
2407 -
2408 - use prefix || options="${options} --user=mysql"
2409 -
2410 - local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
2411 - local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
2412 - local mysqld="${EROOT%/}/usr/sbin/mysqld \
2413 - ${options} \
2414 - $(use prefix || echo --user=mysql) \
2415 - --log-warnings=0 \
2416 - --basedir=${EROOT%/}/usr \
2417 - --datadir=${ROOT%/}/${MY_DATADIR} \
2418 - --max_allowed_packet=8M \
2419 - --net_buffer_length=16K \
2420 - --socket=${socket} \
2421 - --pid-file=${pidfile}
2422 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
2423 - #einfo "About to start mysqld: ${mysqld}"
2424 - ebegin "Starting mysqld"
2425 - einfo "Command ${mysqld}"
2426 - ${mysqld} &
2427 - rc=$?
2428 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
2429 - maxtry=$((${maxtry}-1))
2430 - echo -n "."
2431 - sleep 1
2432 - done
2433 - eend $rc
2434 -
2435 - if ! [[ -S "${socket}" ]]; then
2436 - die "Completely failed to start up mysqld with: ${mysqld}"
2437 - fi
2438 -
2439 - ebegin "Setting root password"
2440 - # Do this from memory, as we don't want clear text passwords in temp files
2441 - local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'"
2442 - "${EROOT%/}/usr/bin/mysql" \
2443 - --no-defaults \
2444 - "--socket=${socket}" \
2445 - -hlocalhost \
2446 - -e "${sql}"
2447 - eend $?
2448 -
2449 - # Stop the server and cleanup
2450 - einfo "Stopping the server ..."
2451 - kill $(< "${pidfile}" )
2452 - rm -f "${sqltmp}"
2453 - wait %1
2454 - einfo "Done"
2455 -}