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/files/, dev-db/mysql/
Date: Fri, 30 Aug 2019 16:08:25
Message-Id: 1567181203.84cae3b3ad487ca364ea2ce1f7c2139abbe03ed8.grknight@gentoo
1 commit: 84cae3b3ad487ca364ea2ce1f7c2139abbe03ed8
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 30 16:06:43 2019 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 30 16:06:43 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84cae3b3
7
8 dev-db/mysql: Drop old 5.5 version
9
10 Package-Manager: Portage-2.3.73, Repoman-2.3.17
11 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
12
13 dev-db/mysql/Manifest | 2 -
14 dev-db/mysql/files/my.cnf-5.5 | 147 --------
15 dev-db/mysql/metadata.xml | 1 -
16 dev-db/mysql/mysql-5.5.62.ebuild | 797 ---------------------------------------
17 4 files changed, 947 deletions(-)
18
19 diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
20 index 17e28b6146c..ef3ead138dc 100644
21 --- a/dev-db/mysql/Manifest
22 +++ b/dev-db/mysql/Manifest
23 @@ -1,9 +1,7 @@
24 -DIST mysql-5.5.62.tar.gz 21111902 BLAKE2B f1cbb1c6b4dfac11c2c517a57a5c6216ce43766cc247b3c9b387326a7f6446cbc21ddb42bd95afa658c3b0ed2568a29563ceea248c6ec63364ce210119d39cc2 SHA512 1080a3989c20bbbfe98739f99dacd183f2087ceee5147845852144240386808568af4c908ecdbccdcb6114000ab760ed7257492834d50018eff9520260fd91ce
25 DIST mysql-5.6.44.tar.gz 32531507 BLAKE2B 28fbf49f699eb9f43223ffa186671b119d16016274cc7192db232b85c58123a61154e37193b9b7145c6a650b80b5f6cf838529bc2bc5ea9c78c0dbc39de834d3 SHA512 65ace1c803773ca6c8759d171c09bc93c7d61b8e3208ac9905f82e99087622c9dcca602d2da217741dc62fc6eabe9108ebc7f31facd26705072eae65fcc37077
26 DIST mysql-5.6.45.tar.gz 32525559 BLAKE2B 3c629aed1de808acdea6654c7413e6851507c9c5be939ca4b4f5e2796da317e9b518a749bfc03d2b0ef05bd604b39f72e24b751076b9f206b462d21fa5db4f50 SHA512 f9d8bb72e96cc83f1064fe7df2e5fe8317ca9d44c4e776cf7827a61292fbcfccec716806c80d565958383d78fef93a19d61c726687b57680d5f93299291ff168
27 DIST mysql-boost-5.7.26.tar.gz 51098338 BLAKE2B 1263cd75814a7293b26b0f44fd2b7d20d983f3c6a62725df9515ecac2ef252f6644810cb4bf0d6f36b98e55317f1c67ea7541228cb38d896dfedc476a5755f26 SHA512 a5f9871dc5a8e5fffc1467c3dd542533a63fe553c029120475f8fd5530d884c76ab0c33ad260daf317faf318ccef01464f6ac2dc3468efceb6bf2b6c06c54cfd
28 DIST mysql-boost-5.7.27.tar.gz 51436383 BLAKE2B 6db64ab5fa659aae9baa3725a0de9465e48c37618ffd69f34809880c06a00ce55dce77f507810c6fa52d86901facfa42d3d1bd8db1914a779fbc88a69be82497 SHA512 573f4555f3d62bcd3dc2228bcfba023518d462bb6689114a3505ccf7c7c3061d2775a8e7a37ec3c8b9dea6e8fbc56ba599610f237abc38cedff58e75799bdc52
29 DIST mysql-boost-8.0.17.tar.gz 189322239 BLAKE2B f9f46e5fdc3e9869b203626bc09edfbcdbabcd68eba43f9c6a33b9a52cffb3a32f39704c6d22a66899aac16fa2efb271c5dc7af7522768b45542ac8dc615cd8a SHA512 a278ee263670cb1f79d67c4b87c4b88632569c3b20a4297a6e77d550155db20902f22992ea851cf59ea523bb97d5e08707e3457f71a678e9f1ac2fa4ca5b7a2d
30 -DIST mysql-extras-20180804-2323Z.tar.bz2 322215 BLAKE2B cca9e502e375bf43473335868517f6c450fc7bcf03e55de5a294c8bdcfcac2bb783dec09bbb3b6c30a561ba7e3a943543c017e2d42b61d466e699acdef4c0231 SHA512 efd9d416f394cc61b977ab76f05ab3acc5803ff8bdee8e1dbc65cc5b3f07e4f9742140d9586c028908b10fcc44f21c98ebffdebcc5c3578acbe05b07526bcb3d
31 DIST mysql-extras-20190817-0024Z.tar.bz2 337793 BLAKE2B dfd51a708654aff5bdbbaf2acad7ef966869a8e3adcba544ee15f217d2ba942827445841e73981bccc6c1f145b6225bfa7245114219f0cf52f0dfb85494a6830 SHA512 c2ff81be1c55636f0a2700033af030149f312f0383217054a4b8c65aef174626299fcb4539eaae967ea7d096a5bb09f5b5122dce344b44b0a135d886ba0fdf28
32 DIST mysql-extras-20190822-1908Z.tar.bz2 338830 BLAKE2B bc197f8e541206548d8982814e82e028d699ba9c41aec8d5191bcc46581f7880ed2741dbe2206fde44a5e8d8d54bbcf40efbd0709b357636c4c8fdb2ccc3a7bb SHA512 be469e55f7e9966638600d6836a44258c74e5600240fafe2d79eaeebe7d1695b043678184b5d18ee9946f28154bc2529586a7f860b510180a30c82454ed575c8
33
34 diff --git a/dev-db/mysql/files/my.cnf-5.5 b/dev-db/mysql/files/my.cnf-5.5
35 deleted file mode 100644
36 index 83b9aaab2ec..00000000000
37 --- a/dev-db/mysql/files/my.cnf-5.5
38 +++ /dev/null
39 @@ -1,147 +0,0 @@
40 -# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/my.cnf: The global mysql configuration file.
41 -
42 -# The following options will be passed to all MySQL clients
43 -[client]
44 -#password = your_password
45 -port = 3306
46 -socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
47 -
48 -[mysql]
49 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
50 -default-character-set=utf8
51 -
52 -[mysqladmin]
53 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
54 -default-character-set=utf8
55 -
56 -[mysqlcheck]
57 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
58 -default-character-set=utf8
59 -
60 -[mysqldump]
61 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
62 -default-character-set=utf8
63 -
64 -[mysqlimport]
65 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
66 -default-character-set=utf8
67 -
68 -[mysqlshow]
69 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
70 -default-character-set=utf8
71 -
72 -[myisamchk]
73 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
74 -
75 -[myisampack]
76 -character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
77 -
78 -# use [safe_mysqld] with mysql-3
79 -[mysqld_safe]
80 -err-log = @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysql.err
81 -
82 -# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations
83 -[mysqld]
84 -character-set-server = utf8
85 -user = mysql
86 -port = 3306
87 -socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
88 -pid-file = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.pid
89 -log-error = @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err
90 -basedir = @GENTOO_PORTAGE_EPREFIX@/usr
91 -datadir = @DATADIR@
92 -skip-external-locking
93 -key_buffer_size = 16M
94 -max_allowed_packet = 1M
95 -table_open_cache = 64
96 -sort_buffer_size = 512K
97 -net_buffer_length = 8K
98 -read_buffer_size = 256K
99 -read_rnd_buffer_size = 512K
100 -myisam_sort_buffer_size = 8M
101 -lc_messages_dir = @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql
102 -#Set this to your desired error message language
103 -lc_messages = en_US
104 -
105 -# security:
106 -# using "localhost" in connects uses sockets by default
107 -# skip-networking
108 -bind-address = 127.0.0.1
109 -
110 -log-bin
111 -server-id = 1
112 -
113 -# point the following paths to different dedicated disks
114 -tmpdir = @GENTOO_PORTAGE_EPREFIX@/tmp/
115 -#log-update = @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname
116 -
117 -# you need the debug USE flag enabled to use the following directives,
118 -# if needed, uncomment them, start the server and issue
119 -# #tail -f @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.sql @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.trace
120 -# this will show you *exactly* what's happening in your server ;)
121 -
122 -#log = @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.sql
123 -#gdb
124 -#debug = d:t:i:o,/tmp/mysqld.trace
125 -#one-thread
126 -
127 -# the following is the InnoDB configuration
128 -# if you wish to disable innodb instead
129 -# uncomment just the next line
130 -#skip-innodb
131 -#
132 -# the rest of the innodb config follows:
133 -# don't eat too much memory, we're trying to be safe on 64Mb boxes
134 -# you might want to bump this up a bit on boxes with more RAM
135 -innodb_buffer_pool_size = 16M
136 -# this is the default, increase it if you have lots of tables
137 -innodb_additional_mem_pool_size = 2M
138 -#
139 -# i'd like to use @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/innodb, but that is seen as a database :-(
140 -# and upstream wants things to be under @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/, so that's the route
141 -# we have to take for the moment
142 -#innodb_data_home_dir = @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/
143 -#innodb_log_group_home_dir = @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/
144 -# you may wish to change this size to be more suitable for your system
145 -# the max is there to avoid run-away growth on your machine
146 -innodb_data_file_path = ibdata1:10M:autoextend:max:128M
147 -# we keep this at around 25% of of innodb_buffer_pool_size
148 -# sensible values range from 1MB to (1/innodb_log_files_in_group*innodb_buffer_pool_size)
149 -innodb_log_file_size = 5M
150 -# this is the default, increase it if you have very large transactions going on
151 -innodb_log_buffer_size = 8M
152 -# this is the default and won't hurt you
153 -# you shouldn't need to tweak it
154 -innodb_log_files_in_group=2
155 -# see the innodb config docs, the other options are not always safe
156 -innodb_flush_log_at_trx_commit = 1
157 -innodb_lock_wait_timeout = 50
158 -innodb_file_per_table
159 -
160 -# Uncomment this to get FEDERATED engine support
161 -#plugin-load=federated=ha_federated.so
162 -#loose-federated
163 -
164 -[mysqldump]
165 -quick
166 -max_allowed_packet = 16M
167 -
168 -[mysql]
169 -# uncomment the next directive if you are not familiar with SQL
170 -#safe-updates
171 -
172 -[isamchk]
173 -key_buffer_size = 20M
174 -sort_buffer_size = 20M
175 -read_buffer = 2M
176 -write_buffer = 2M
177 -
178 -[myisamchk]
179 -key_buffer_size = 20M
180 -sort_buffer_size = 20M
181 -read_buffer_size = 2M
182 -write_buffer_size = 2M
183 -
184 -[mysqlhotcopy]
185 -interactive-timeout
186 -
187
188 diff --git a/dev-db/mysql/metadata.xml b/dev-db/mysql/metadata.xml
189 index e231245763e..e4197ced880 100644
190 --- a/dev-db/mysql/metadata.xml
191 +++ b/dev-db/mysql/metadata.xml
192 @@ -14,7 +14,6 @@ dev-db/mariadb
193 <flag name="cjk">Add CJK support for InnoDB fulltext search using <pkg>app-text/mecab</pkg></flag>
194 <flag name="client-libs">Build the client libraries from the server package instead of the C Connector packages (not recommended)</flag>
195 <flag name="experimental">Build experimental features aka "rapid" plugins</flag>
196 - <flag name="extraengine">Add support for alternative storage engines (Archive, CSV, Blackhole, Federated(X), Partition)</flag>
197 <flag name="latin1">Use LATIN1 encoding instead of UTF8</flag>
198 <flag name="libressl">Enable SSL connections and crypto functions using <pkg>dev-libs/libressl</pkg></flag>
199 <flag name="numa">Enable NUMA support using <pkg>sys-process/numactl</pkg> (NUMA kernel support is also required)</flag>
200
201 diff --git a/dev-db/mysql/mysql-5.5.62.ebuild b/dev-db/mysql/mysql-5.5.62.ebuild
202 deleted file mode 100644
203 index cb229697802..00000000000
204 --- a/dev-db/mysql/mysql-5.5.62.ebuild
205 +++ /dev/null
206 @@ -1,797 +0,0 @@
207 -# Copyright 1999-2018 Gentoo Authors
208 -# Distributed under the terms of the GNU General Public License v2
209 -
210 -EAPI="6"
211 -MY_EXTRAS_VER="20180804-2323Z"
212 -SUBSLOT="18"
213 -
214 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
215 -
216 -inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build
217 -
218 -SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.5/${P}.tar.gz
219 - https://downloads.mysql.com/archives/MySQL-5.5/${P}.tar.gz"
220 -# Gentoo patches to MySQL
221 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
222 - SRC_URI="${SRC_URI}
223 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
224 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
225 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
226 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
227 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
228 -fi
229 -
230 -HOMEPAGE="https://mysql.com/"
231 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
232 -LICENSE="GPL-2"
233 -SLOT="0/${SUBSLOT:-0}"
234 -IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl
235 - +perl profiling selinux +server static static-libs systemtap tcmalloc
236 - test yassl"
237 -
238 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
239 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
240 -
241 -REQUIRED_USE="?? ( tcmalloc jemalloc )
242 - static? ( yassl )"
243 -
244 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
245 -
246 -# Shorten the path because the socket path length must be shorter than 107 chars
247 -# and we will run a mysql server during test phase
248 -S="${WORKDIR}/mysql"
249 -
250 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
251 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
252 - inherit git-r3
253 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
254 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
255 - EGIT_CLONE_TYPE=shallow
256 -else
257 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
258 -fi
259 -
260 -PATCHES=(
261 - "${MY_PATCH_DIR}/01050_all_mysql_config_cleanup-5.5.patch"
262 - "${MY_PATCH_DIR}/02040_all_embedded-library-shared-5.5.10.patch"
263 - "${MY_PATCH_DIR}/20001_all_fix-minimal-build-cmake-mysql-5.5.41.patch"
264 - "${MY_PATCH_DIR}/20002_all_mysql-va-list.patch"
265 - "${MY_PATCH_DIR}/20006_all_cmake_elib-mysql-5.5.53.patch"
266 - "${MY_PATCH_DIR}/20007_all_cmake-debug-werror-5.6.22.patch"
267 - "${MY_PATCH_DIR}/20008_all_mysql-tzinfo-symlink-5.6.37.patch"
268 - "${MY_PATCH_DIR}/20009_all_mysql_myodbc_symbol_fix-5.5.38.patch"
269 - "${MY_PATCH_DIR}/20018_all_mysql-5.5.60-without-clientlibs-tools.patch"
270 - "${MY_PATCH_DIR}/20027_all_mysql-5.5-perl5.26-includes.patch"
271 -)
272 -
273 -# Be warned, *DEPEND are version-dependant
274 -# These are used for both runtime and compiletime
275 -COMMON_DEPEND="
276 - kernel_linux? (
277 - sys-process/procps:0=
278 - dev-libs/libaio:0=
279 - )
280 - >=sys-apps/sed-4
281 - >=sys-apps/texinfo-4.7-r1
282 - jemalloc? ( dev-libs/jemalloc:0= )
283 - tcmalloc? ( dev-util/google-perftools:0= )
284 - systemtap? ( >=dev-util/systemtap-1.3:0= )
285 - !yassl? (
286 - !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
287 - libressl? ( dev-libs/libressl:0= )
288 - )
289 - >=sys-libs/zlib-1.2.3:0=
290 - sys-libs/ncurses:0=
291 - !bindist? (
292 - >=sys-libs/readline-4.1:0=
293 - )
294 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
295 -"
296 -DEPEND="virtual/yacc
297 - static? ( sys-libs/ncurses[static-libs] )
298 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
299 - ${COMMON_DEPEND}"
300 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
301 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
302 - !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
303 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
304 - ${COMMON_DEPEND}
305 - perl? ( !dev-db/mytop
306 - virtual/perl-Getopt-Long
307 - dev-perl/TermReadKey
308 - virtual/perl-Term-ANSIColor
309 - virtual/perl-Time-HiRes )
310 -"
311 -# For other stuff to bring us in
312 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
313 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
314 -
315 -pkg_setup() {
316 - if [[ ${MERGE_TYPE} != binary ]] ; then
317 - local GCC_MAJOR_SET=$(gcc-major-version)
318 - local GCC_MINOR_SET=$(gcc-minor-version)
319 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
320 - # non x86{,_64} arches
321 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
322 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
323 - eerror "${PN} needs to be built with gcc-4.7 or later."
324 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
325 - die
326 - fi
327 - fi
328 - if has test ${FEATURES} && \
329 - use server && ! has userpriv ${FEATURES} ; then
330 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
331 - fi
332 -
333 - # This should come after all of the die statements
334 - enewgroup mysql 60 || die "problem adding 'mysql' group"
335 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
336 -}
337 -
338 -pkg_postinst() {
339 - # Make sure the vars are correctly initialized
340 - mysql_init_vars
341 -
342 - # Create log directory securely if it does not exist
343 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
344 -
345 - if use server ; then
346 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
347 - einfo
348 - elog "You might want to run:"
349 - elog "\"emerge --config =${CATEGORY}/${PF}\""
350 - elog "if this is a new install."
351 - elog
352 - elog "If you are switching server implentations, you should run the"
353 - elog "mysql_upgrade tool."
354 - einfo
355 - else
356 - einfo
357 - elog "If you are upgrading major versions, you should run the"
358 - elog "mysql_upgrade tool."
359 - einfo
360 - fi
361 -
362 - einfo
363 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
364 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
365 - elog "The first time the cluster is activated, you should add"
366 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
367 - elog "This option should then be removed for subsequent starts."
368 - einfo
369 - fi
370 -}
371 -
372 -src_unpack() {
373 - unpack ${A}
374 - # Grab the patches
375 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
376 -
377 - mv -f "${WORKDIR%/}/${P}" "${S}" || die
378 -}
379 -
380 -src_prepare() {
381 - _disable_engine() {
382 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
383 - }
384 -
385 - _disable_plugin() {
386 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
387 - }
388 -
389 - if use tcmalloc; then
390 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
391 - fi
392 -
393 - if use jemalloc; then
394 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
395 - fi
396 -
397 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
398 - if [[ -d "${S}/support-files/SELinux" ]] ; then
399 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
400 - fi
401 -
402 - if use libressl ; then
403 - sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
404 - "${S}/cmake/ssl.cmake" || die
405 - fi
406 -
407 - local plugin
408 - local server_plugins=( semisync )
409 - local test_plugins=( audit_null daemon_example fulltext )
410 - if ! use server; then # These plugins are for the server
411 - for plugin in "${server_plugins[@]}" ; do
412 - _disable_plugin "${plugin}"
413 - done
414 - fi
415 -
416 - if ! use test; then # These plugins are only used during testing
417 - for plugin in "${test_plugins[@]}" ; do
418 - _disable_plugin "${plugin}"
419 - done
420 - fi
421 -
422 - # Don't build example
423 - _disable_engine example
424 - _disable_engine ndb
425 -
426 - cmake-utils_src_prepare
427 -}
428 -
429 -src_configure(){
430 - # Bug #114895, bug #110149
431 - filter-flags "-O" "-O[01]"
432 -
433 - append-cxxflags -felide-constructors
434 -
435 - # bug #283926, with GCC4.4, this is required to get correct behavior.
436 - append-flags -fno-strict-aliasing
437 -
438 - CMAKE_BUILD_TYPE="RelWithDebInfo"
439 -
440 - # debug hack wrt #497532
441 - mycmakeargs=(
442 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
443 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
444 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
445 - -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql"
446 - -DINSTALL_BINDIR=bin
447 - -DINSTALL_DOCDIR=share/doc/${PF}
448 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
449 - -DINSTALL_INCLUDEDIR=include/mysql
450 - -DINSTALL_INFODIR=share/info
451 - -DINSTALL_LIBDIR=$(get_libdir)
452 - -DINSTALL_MANDIR=share/man
453 - -DINSTALL_MYSQLSHAREDIR=share/mysql
454 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
455 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
456 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
457 - -DINSTALL_SBINDIR=sbin
458 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
459 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
460 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
461 - -DWITH_ZLIB=system
462 - -DENABLED_LOCAL_INFILE=1
463 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
464 - # The build forces this to be defined when cross-compiling. We pass it
465 - # all the time for simplicity and to make sure it is actually correct.
466 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
467 - -DWITHOUT_CLIENTLIBS=YES
468 - -DWITH_READLINE=$(usex bindist 1 0)
469 - -DENABLE_DTRACE=$(usex systemtap)
470 - )
471 - if use test ; then
472 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
473 - else
474 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
475 - fi
476 -
477 - if ! use yassl ; then
478 - mycmakeargs+=( -DWITH_SSL=system )
479 - else
480 - mycmakeargs+=( -DWITH_SSL=bundled )
481 - fi
482 -
483 - if use server ; then
484 -
485 - # Federated{,X} must be treated special otherwise they will not be built as plugins
486 - if ! use extraengine ; then
487 - mycmakeargs+=(
488 - -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
489 - -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 )
490 - fi
491 -
492 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
493 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
494 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
495 - ewarn "You MUST file bugs without these variables set."
496 -
497 - mycmakeargs+=(
498 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
499 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
500 - )
501 -
502 - elif ! use latin1 ; then
503 - mycmakeargs+=(
504 - -DDEFAULT_CHARSET=utf8
505 - -DDEFAULT_COLLATION=utf8_general_ci
506 - )
507 - else
508 - mycmakeargs+=(
509 - -DDEFAULT_CHARSET=latin1
510 - -DDEFAULT_COLLATION=latin1_swedish_ci
511 - )
512 - fi
513 - mycmakeargs+=(
514 - -DINSTALL_SQLBENCHDIR=share/mysql
515 - -DEXTRA_CHARSETS=all
516 - -DDISABLE_SHARED=$(usex static YES NO)
517 - -DWITH_EMBEDDED_SERVER=OFF
518 - )
519 -
520 - if use profiling ; then
521 - # Setting to OFF doesn't work: Once set, profiling options will be added
522 - # to `mysqld --help` output via sql/sys_vars.cc causing
523 - # "main.mysqld--help-notwin" test to fail
524 - mycmakeargs+=( -DENABLED_PROFILING=ON )
525 - fi
526 -
527 - if use static; then
528 - mycmakeargs+=( -DWITH_PIC=1 )
529 - fi
530 -
531 - # Storage engines
532 - mycmakeargs+=(
533 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
534 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
535 - -DWITH_CSV_STORAGE_ENGINE=1
536 - -DWITH_HEAP_STORAGE_ENGINE=1
537 - -DWITH_INNOBASE_STORAGE_ENGINE=1
538 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
539 - -DWITH_MYISAM_STORAGE_ENGINE=1
540 - -DWITH_PARTITION_STORAGE_ENGINE=1
541 - )
542 -
543 - else
544 - mycmakeargs+=(
545 - -DWITHOUT_SERVER=1
546 - -DEXTRA_CHARSETS=none
547 - -DINSTALL_SQLBENCHDIR=
548 - )
549 - fi
550 -
551 - cmake-utils_src_configure
552 -}
553 -
554 -src_compile() {
555 - cmake-utils_src_compile
556 -}
557 -
558 -src_install() {
559 - cmake-utils_src_install
560 -
561 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
562 - if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then
563 - rm "${ED%/}/usr/include/mysql/server/private/config.h" || die
564 - fi
565 -
566 - # Make sure the vars are correctly initialized
567 - mysql_init_vars
568 -
569 - # Convenience links
570 - einfo "Making Convenience links for mysqlcheck multi-call binary"
571 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
572 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
573 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
574 -
575 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
576 - if [[ -d "${ED%/}/usr/data" ]] ; then
577 - rm -Rf "${ED%/}/usr/data" || die
578 - fi
579 -
580 - # Unless they explicitly specific USE=test, then do not install the
581 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
582 - # validation of your database configuration after tuning it.
583 - if ! use test ; then
584 - rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test"
585 - fi
586 -
587 - # Configuration stuff
588 - einfo "Building default configuration ..."
589 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
590 - [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf
591 - local mycnf_src="my.cnf-5.5"
592 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
593 - "${FILESDIR%/}/${mycnf_src}" \
594 - > "${TMPDIR%/}/my.cnf.ok" || die
595 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok"
596 - if use latin1 ; then
597 - sed -i \
598 - -e "/character-set/s|utf8|latin1|g" \
599 - "${TMPDIR%/}/my.cnf.ok" || die
600 - fi
601 - eprefixify "${TMPDIR%/}/my.cnf.ok"
602 - newins "${TMPDIR}/my.cnf.ok" my.cnf
603 -
604 - if use server ; then
605 - einfo "Including support files and sample configurations"
606 - docinto "support-files"
607 - local script
608 - for script in \
609 - "${S%/}"/support-files/magic
610 - do
611 - [[ -f "$script" ]] && dodoc "${script}"
612 - done
613 -
614 - docinto "scripts"
615 - for script in "${S%/}"/scripts/mysql* ; do
616 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
617 - done
618 - fi
619 -
620 - #Remove mytop if perl is not selected
621 - [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop"
622 -}
623 -
624 -# Official test instructions:
625 -# USE='extraengine perl server' \
626 -# FEATURES='test userpriv -usersandbox' \
627 -# ebuild mysql-X.X.XX.ebuild \
628 -# digest clean package
629 -src_test() {
630 -
631 - _disable_test() {
632 - local rawtestname reason
633 - rawtestname="${1}" ; shift
634 - reason="${@}"
635 - ewarn "test '${rawtestname}' disabled: '${reason}'"
636 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
637 - }
638 -
639 - local TESTDIR="${BUILD_DIR}/mysql-test"
640 - local retstatus_unit
641 - local retstatus_tests
642 -
643 - if ! use server ; then
644 - einfo "Skipping server tests due to minimal build."
645 - return 0
646 - fi
647 -
648 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
649 - # localhost. Also causes weird failures.
650 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
651 -
652 - if [[ $UID -eq 0 ]]; then
653 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
654 - fi
655 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
656 -
657 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
658 -
659 - # Run CTest (test-units)
660 - cmake-utils_src_test
661 - retstatus_unit=$?
662 -
663 - # Ensure that parallel runs don't die
664 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
665 - # Enable parallel testing, auto will try to detect number of cores
666 - # You may set this by hand.
667 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
668 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
669 -
670 - # create directories because mysqladmin might run out of order
671 - mkdir -p "${T}"/var-tests{,/log} || die
672 -
673 - # Run mysql tests
674 - pushd "${TESTDIR}" > /dev/null || die
675 -
676 - touch "${T}/disabled.def"
677 - # These are failing in MySQL 5.5 for now and are believed to be
678 - # false positives:
679 - #
680 - # main.mysql_client_test, main.mysql_client_test_nonblock
681 - # main.mysql_client_test_comp:
682 - # segfaults at random under Portage only, suspect resource limits.
683 -
684 - local t
685 - for t in federated.federated_plugin \
686 - main.mysql_client_test main.mysql_client_test_nonblock \
687 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam \
688 - main.mysqlhotcopy_archive main.mysqlhotcopy_myisam main.openssl_1 \
689 - rpl.rpl_semi_sync_uninstall_plugin ; do
690 - _disable_test "$t" "False positives in Gentoo"
691 - done
692 -
693 - if ! use client-libs ; then
694 - _disable_test main.plugin_auth "Needs client libraries built"
695 - fi
696 -
697 - # run mysql-test tests
698 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
699 - retstatus_tests=$?
700 -
701 - popd > /dev/null || die
702 -
703 - # Cleanup is important for these testcases.
704 - pkill -9 -f "${S}/ndb" 2>/dev/null
705 - pkill -9 -f "${S}/sql" 2>/dev/null
706 -
707 - local failures=""
708 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
709 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
710 -
711 - [[ -z "$failures" ]] || die "Test failures: $failures"
712 - einfo "Tests successfully completed"
713 -}
714 -
715 -mysql_init_vars() {
716 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
717 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
718 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
719 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
720 -
721 - if [[ -z "${MY_DATADIR}" ]] ; then
722 - MY_DATADIR=""
723 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
724 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
725 - | sed -ne '/datadir/s|^--datadir=||p' \
726 - | tail -n1`
727 - if [[ -z "${MY_DATADIR}" ]] ; then
728 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
729 - | sed -e 's/.*=\s*//' \
730 - | tail -n1`
731 - fi
732 - fi
733 - if [[ -z "${MY_DATADIR}" ]] ; then
734 - MY_DATADIR="${MY_LOCALSTATEDIR}"
735 - einfo "Using default MY_DATADIR"
736 - fi
737 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
738 -
739 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
740 - if [[ -e "${MY_DATADIR}" ]] ; then
741 - # If you get this and you're wondering about it, see bug #207636
742 - elog "MySQL datadir found in ${MY_DATADIR}"
743 - elog "A new one will not be created."
744 - PREVIOUS_DATADIR="yes"
745 - else
746 - PREVIOUS_DATADIR="no"
747 - fi
748 - export PREVIOUS_DATADIR
749 - fi
750 - else
751 - if [[ ${EBUILD_PHASE} == "config" ]]; then
752 - local new_MY_DATADIR
753 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
754 - | sed -ne '/datadir/s|^--datadir=||p' \
755 - | tail -n1`
756 -
757 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
758 - ewarn "MySQL MY_DATADIR has changed"
759 - ewarn "from ${MY_DATADIR}"
760 - ewarn "to ${new_MY_DATADIR}"
761 - MY_DATADIR="${new_MY_DATADIR}"
762 - fi
763 - fi
764 - fi
765 -
766 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
767 - export MY_LOCALSTATEDIR MY_LOGDIR
768 - export MY_DATADIR
769 -}
770 -
771 -pkg_config() {
772 - _getoptval() {
773 - local mypd="${EROOT}"/usr/bin/my_print_defaults
774 - local section="$1"
775 - local flag="--${2}="
776 - local extra_options="${3}"
777 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
778 - }
779 - local old_MY_DATADIR="${MY_DATADIR}"
780 - local old_HOME="${HOME}"
781 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
782 - export HOME=${EPREFIX}/root
783 -
784 - # Make sure the vars are correctly initialized
785 - mysql_init_vars
786 -
787 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
788 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
789 - die "Minimal builds do NOT include the MySQL server"
790 - fi
791 -
792 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
793 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
794 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
795 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
796 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
797 -
798 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
799 - if [[ -d "${MY_DATADIR_s}" ]]; then
800 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
801 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
802 - else
803 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
804 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
805 - || die "Moving MY_DATADIR failed"
806 - fi
807 - else
808 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
809 - if [[ -d "${MY_DATADIR_s}" ]]; then
810 - ewarn "Attempting to use ${MY_DATADIR_s}"
811 - else
812 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
813 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
814 - fi
815 - fi
816 - fi
817 -
818 - local pwd1="a"
819 - local pwd2="b"
820 - local maxtry=15
821 -
822 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
823 - local tmp_mysqld_password_source=
824 -
825 - for tmp_mysqld_password_source in mysql client; do
826 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
827 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
828 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
829 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
830 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
831 - MYSQL_ROOT_PASSWORD=
832 - continue
833 - fi
834 -
835 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
836 - break
837 - fi
838 - done
839 -
840 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
841 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
842 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
843 - fi
844 -
845 - unset tmp_mysqld_password_source
846 - fi
847 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
848 - # These are dir+prefix
849 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
850 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
851 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
852 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
853 -
854 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
855 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
856 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
857 - fi
858 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
859 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
860 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
861 - fi
862 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
863 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
864 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
865 - fi
866 -
867 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
868 - ewarn "You have already a MySQL database in place."
869 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
870 - ewarn "Please rename or delete it if you wish to replace it."
871 - die "MySQL database already exists!"
872 - fi
873 -
874 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
875 - # localhost. Also causes weird failures.
876 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
877 -
878 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
879 -
880 - einfo "Please provide a password for the mysql 'root' user now"
881 - einfo "or through the ${HOME}/.my.cnf file."
882 - ewarn "Avoid [\"'\\_%] characters in the password"
883 - read -rsp " >" pwd1 ; echo
884 -
885 - einfo "Retype the password"
886 - read -rsp " >" pwd2 ; echo
887 -
888 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
889 - die "Passwords are not the same"
890 - fi
891 - MYSQL_ROOT_PASSWORD="${pwd1}"
892 - unset pwd1 pwd2
893 - fi
894 -
895 - local options
896 - local sqltmp="$(emktemp)"
897 -
898 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
899 - # see http://bugs.mysql.com/bug.php?id=31312
900 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
901 -
902 - # Figure out which options we need to disable to do the setup
903 - local helpfile="${TMPDIR}/mysqld-help"
904 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
905 - for opt in grant-tables host-cache name-resolve networking slave-start \
906 - federated ssl log-bin relay-log slow-query-log external-locking \
907 - log-slave-updates \
908 - ; do
909 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
910 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
911 - done
912 -
913 - einfo "Creating the mysql database and setting proper permissions on it ..."
914 -
915 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
916 - PID_DIR="${EROOT}/var/run/mysqld"
917 - if [[ ! -d "${PID_DIR}" ]]; then
918 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
919 - fi
920 -
921 - if [[ ! -d "${MY_DATADIR}" ]]; then
922 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
923 - fi
924 -
925 - pushd "${TMPDIR}" &>/dev/null || die
926 -
927 - # Filling timezones, see
928 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
929 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
930 -
931 - local cmd=( "${EROOT}usr/share/mysql/scripts/mysql_install_db" )
932 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
933 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
934 - einfo "Command: ${cmd[*]}"
935 - su -s /bin/sh -c "${cmd[*]}" mysql \
936 - >"${TMPDIR}"/mysql_install_db.log 2>&1
937 - if [ $? -ne 0 ]; then
938 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
939 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
940 - fi
941 - popd &>/dev/null || die
942 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
943 - || die "MySQL databases not installed"
944 -
945 - use prefix || options="${options} --user=mysql"
946 -
947 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
948 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
949 - local mysqld="${EROOT}/usr/sbin/mysqld \
950 - ${options} \
951 - --log-warnings=0 \
952 - --basedir=${EROOT}/usr \
953 - --datadir=${ROOT}/${MY_DATADIR} \
954 - --max_allowed_packet=8M \
955 - --net_buffer_length=16K \
956 - --socket=${socket} \
957 - --pid-file=${pidfile} \
958 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
959 - #einfo "About to start mysqld: ${mysqld}"
960 - ebegin "Starting mysqld"
961 - einfo "Command ${mysqld}"
962 - ${mysqld} &
963 - rc=$?
964 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
965 - maxtry=$((${maxtry}-1))
966 - echo -n "."
967 - sleep 1
968 - done
969 - eend $rc
970 -
971 - if ! [[ -S "${socket}" ]]; then
972 - die "Completely failed to start up mysqld with: ${mysqld}"
973 - fi
974 -
975 - ebegin "Setting root password"
976 - # Do this from memory, as we don't want clear text passwords in temp files
977 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
978 - "${EROOT}/usr/bin/mysql" \
979 - "--socket=${socket}" \
980 - -hlocalhost \
981 - -e "${sql}"
982 - eend $?
983 -
984 - if [[ -n "${sqltmp}" ]] ; then
985 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
986 - "${EROOT}/usr/bin/mysql" \
987 - "--socket=${socket}" \
988 - -hlocalhost \
989 - -uroot \
990 - --password="${MYSQL_ROOT_PASSWORD}" \
991 - mysql < "${sqltmp}"
992 - rc=$?
993 - eend $?
994 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
995 - fi
996 -
997 - # Stop the server and cleanup
998 - einfo "Stopping the server ..."
999 - kill $(< "${pidfile}" )
1000 - rm -f "${sqltmp}"
1001 - wait %1
1002 - einfo "Done"
1003 -}