1 |
commit: 09dd2664e1953e4e54b793f009e861c0219b076d |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 20 19:26:09 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 20 19:26:31 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09dd2664 |
7 |
|
8 |
dev-db/mysql: drop old |
9 |
|
10 |
Package-Manager: Portage-2.3.84, Repoman-2.3.20 |
11 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
12 |
|
13 |
dev-db/mysql/Manifest | 2 - |
14 |
dev-db/mysql/mysql-8.0.18.ebuild | 1117 -------------------------------------- |
15 |
2 files changed, 1119 deletions(-) |
16 |
|
17 |
diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest |
18 |
index 8291d03804b..d60979723ac 100644 |
19 |
--- a/dev-db/mysql/Manifest |
20 |
+++ b/dev-db/mysql/Manifest |
21 |
@@ -2,9 +2,7 @@ DIST mysql-5.6.44.tar.gz 32531507 BLAKE2B 28fbf49f699eb9f43223ffa186671b119d1601 |
22 |
DIST mysql-5.6.45.tar.gz 32525559 BLAKE2B 3c629aed1de808acdea6654c7413e6851507c9c5be939ca4b4f5e2796da317e9b518a749bfc03d2b0ef05bd604b39f72e24b751076b9f206b462d21fa5db4f50 SHA512 f9d8bb72e96cc83f1064fe7df2e5fe8317ca9d44c4e776cf7827a61292fbcfccec716806c80d565958383d78fef93a19d61c726687b57680d5f93299291ff168 |
23 |
DIST mysql-boost-5.7.26.tar.gz 51098338 BLAKE2B 1263cd75814a7293b26b0f44fd2b7d20d983f3c6a62725df9515ecac2ef252f6644810cb4bf0d6f36b98e55317f1c67ea7541228cb38d896dfedc476a5755f26 SHA512 a5f9871dc5a8e5fffc1467c3dd542533a63fe553c029120475f8fd5530d884c76ab0c33ad260daf317faf318ccef01464f6ac2dc3468efceb6bf2b6c06c54cfd |
24 |
DIST mysql-boost-5.7.27.tar.gz 51436383 BLAKE2B 6db64ab5fa659aae9baa3725a0de9465e48c37618ffd69f34809880c06a00ce55dce77f507810c6fa52d86901facfa42d3d1bd8db1914a779fbc88a69be82497 SHA512 573f4555f3d62bcd3dc2228bcfba023518d462bb6689114a3505ccf7c7c3061d2775a8e7a37ec3c8b9dea6e8fbc56ba599610f237abc38cedff58e75799bdc52 |
25 |
-DIST mysql-boost-8.0.18.tar.gz 194953221 BLAKE2B e3622cccd8f60487a5e643e522e9cdc763d63ad2a5eda86a7a7db37f48a4e1288fea88ef7097c6c4b51bd5e8fd8ba26a5b8aea3501ae847180066e2d0aa2b5dc SHA512 180091ad3e74e2afa28ecb914850e6b4e8c92b8981f32b161f53381b92120d87dbd2c2fc073feb2543bb71702bac7368e9fb992821cfd3e3ca888019423b89f5 |
26 |
DIST mysql-boost-8.0.19.tar.gz 264147972 BLAKE2B 61a5ccbef1a7a675c85e4e6bda8e5285bdb931e6ee14d4710bf13dfd9157d1095200db2886dc93ea7251d3d59245f35c0bef5ba88ba6aac209b1e080f3b07dc4 SHA512 5ffc03f005ab2585694902e926b6cb2b10059b2b030549eccd3949f9c3b2f02626d02529f940dec003f2d69683856fd1c720ff12f89dfbdc48befaf24a9c4d01 |
27 |
DIST mysql-extras-20190817-0024Z.tar.bz2 337793 BLAKE2B dfd51a708654aff5bdbbaf2acad7ef966869a8e3adcba544ee15f217d2ba942827445841e73981bccc6c1f145b6225bfa7245114219f0cf52f0dfb85494a6830 SHA512 c2ff81be1c55636f0a2700033af030149f312f0383217054a4b8c65aef174626299fcb4539eaae967ea7d096a5bb09f5b5122dce344b44b0a135d886ba0fdf28 |
28 |
DIST mysql-extras-20190822-1908Z.tar.bz2 338830 BLAKE2B bc197f8e541206548d8982814e82e028d699ba9c41aec8d5191bcc46581f7880ed2741dbe2206fde44a5e8d8d54bbcf40efbd0709b357636c4c8fdb2ccc3a7bb SHA512 be469e55f7e9966638600d6836a44258c74e5600240fafe2d79eaeebe7d1695b043678184b5d18ee9946f28154bc2529586a7f860b510180a30c82454ed575c8 |
29 |
-DIST mysql-extras-20191016-1722Z.tar.bz2 340442 BLAKE2B fa38fc455693b940cfb96f69a35c190f7edb3fdfa7bf0e3f4e444032843ca1ad1d4767fecaf3b080f7f8885335ffe81f2355e9fe0fdebe77ac90d7fb1a0d2121 SHA512 1b4d3fb1cda63471807e37ecdd6a663672149a9eac9497d6b864a9ecdd57d179950176da2db0668892567994bd2fc1e98ea499f16dc689738331a1e319c9131c |
30 |
DIST mysql-extras-20200120-1919Z.tar.bz2 342474 BLAKE2B 9c75ec0cb05fc8f86d46bc9308f07c4105c3ab228ef94c0e9e2ab9b83d03362e4ef07c4dac866350ea012c03c111e7012e0b12270b30304a988b9b54bad74864 SHA512 2739c193e9595781b742af9fdb6e0f9c9a5fde87ca652c355d3f630c8c0b45b45967e5c8cf7635fb8615174775e34ae3270b149de7ba8a9d778979c2c66069ef |
31 |
|
32 |
diff --git a/dev-db/mysql/mysql-8.0.18.ebuild b/dev-db/mysql/mysql-8.0.18.ebuild |
33 |
deleted file mode 100644 |
34 |
index 6b067a6f004..00000000000 |
35 |
--- a/dev-db/mysql/mysql-8.0.18.ebuild |
36 |
+++ /dev/null |
37 |
@@ -1,1117 +0,0 @@ |
38 |
-# Copyright 1999-2019 Gentoo Authors |
39 |
-# Distributed under the terms of the GNU General Public License v2 |
40 |
- |
41 |
-EAPI="7" |
42 |
-MY_EXTRAS_VER="20191016-1722Z" |
43 |
- |
44 |
-CMAKE_MAKEFILE_GENERATOR=emake |
45 |
- |
46 |
-inherit cmake-utils flag-o-matic linux-info \ |
47 |
- multiprocessing prefix toolchain-funcs check-reqs |
48 |
- |
49 |
-MY_PV="${PV//_pre*}" |
50 |
-MY_P="${PN}-${MY_PV}" |
51 |
- |
52 |
-S="${WORKDIR}/${PN}-${MY_PV}" |
53 |
- |
54 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-${MY_PV}.tar.gz |
55 |
- https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-${MY_PV}.tar.gz |
56 |
- http://downloads.mysql.com/archives/MySQL-8.0/${PN}-boost-${MY_PV}.tar.gz" |
57 |
- |
58 |
-# Gentoo patches to MySQL |
59 |
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then |
60 |
- SRC_URI="${SRC_URI} |
61 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
62 |
- https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
63 |
-fi |
64 |
- |
65 |
-HOMEPAGE="https://www.mysql.com/" |
66 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
67 |
-LICENSE="GPL-2" |
68 |
-SLOT="0" |
69 |
-IUSE="cjk cracklib debug jemalloc latin1 libressl numa +perl profiling |
70 |
- router selinux +server tcmalloc test" |
71 |
- |
72 |
-# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
73 |
-RESTRICT="!test? ( test ) libressl? ( test )" |
74 |
- |
75 |
-REQUIRED_USE="?? ( tcmalloc jemalloc )" |
76 |
- |
77 |
-KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~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 |
- inherit git-r3 |
85 |
- EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
86 |
- EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
87 |
- EGIT_CLONE_TYPE=shallow |
88 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
89 |
-else |
90 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
91 |
-fi |
92 |
- |
93 |
-PATCHES=( |
94 |
- "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-8.0.17.patch |
95 |
- "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-8.0.18.patch |
96 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch |
97 |
- "${MY_PATCH_DIR}"/20018_all_mysql-8.0.18-without-clientlibs-tools.patch |
98 |
- "${MY_PATCH_DIR}"/20018_all_mysql-8.0.17-add-protobuf-3.8+-support.patch |
99 |
- "${MY_PATCH_DIR}"/20018_all_mysql-8.0.18-fix-libressl-support.patch |
100 |
-) |
101 |
- |
102 |
-# Be warned, *DEPEND are version-dependant |
103 |
-# These are used for both runtime and compiletime |
104 |
-COMMON_DEPEND=" |
105 |
- >=app-arch/lz4-0_p131:= |
106 |
- dev-libs/icu:= |
107 |
- dev-libs/libedit |
108 |
- >=dev-libs/protobuf-3.8:= |
109 |
- dev-libs/libevent:= |
110 |
- net-libs/libtirpc:= |
111 |
- >=sys-libs/zlib-1.2.3:0= |
112 |
- cjk? ( app-text/mecab:= ) |
113 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
114 |
- kernel_linux? ( |
115 |
- dev-libs/libaio:0= |
116 |
- sys-process/procps:0= |
117 |
- ) |
118 |
- libressl? ( dev-libs/libressl:0= ) |
119 |
- !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
120 |
- numa? ( sys-process/numactl ) |
121 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
122 |
-" |
123 |
-DEPEND="${COMMON_DEPEND} |
124 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
125 |
- net-libs/rpcsvc-proto |
126 |
- virtual/yacc |
127 |
- test? ( |
128 |
- acct-group/mysql acct-user/mysql |
129 |
- dev-perl/JSON |
130 |
- ) |
131 |
-" |
132 |
-RDEPEND="${COMMON_DEPEND} |
133 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
134 |
- selinux? ( sec-policy/selinux-mysql ) |
135 |
- !prefix? ( |
136 |
- acct-group/mysql acct-user/mysql |
137 |
- dev-db/mysql-init-scripts |
138 |
- ) |
139 |
-" |
140 |
-# For other stuff to bring us in |
141 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
142 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
143 |
- |
144 |
-CHECKREQS_DISK_BUILD="8G" |
145 |
- |
146 |
-mysql_init_vars() { |
147 |
- : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
148 |
- : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
149 |
- : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
150 |
- : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
151 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
152 |
- |
153 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
154 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
155 |
- export MY_DATADIR |
156 |
-} |
157 |
- |
158 |
-pkg_pretend() { |
159 |
- [[ ${MERGE_TYPE} == binary ]] && return |
160 |
- use server && check-reqs_pkg_pretend |
161 |
-} |
162 |
- |
163 |
-pkg_setup() { |
164 |
- [[ ${MERGE_TYPE} == binary ]] && return |
165 |
- |
166 |
- if has test ${FEATURES} ; then |
167 |
- # Bug #213475 - MySQL _will_ object strenuously if your machine is named |
168 |
- # localhost. Also causes weird failures. |
169 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
170 |
- |
171 |
- if ! has userpriv ${FEATURES} ; then |
172 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
173 |
- fi |
174 |
- |
175 |
- local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) |
176 |
- [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] \ |
177 |
- && die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!" |
178 |
- |
179 |
- if use latin1 ; then |
180 |
- # Upstream only supports tests with default charset |
181 |
- die "Testing with USE=latin1 is not supported." |
182 |
- fi |
183 |
- fi |
184 |
- |
185 |
- if use kernel_linux ; then |
186 |
- if use numa ; then |
187 |
- linux-info_get_any_version |
188 |
- |
189 |
- local CONFIG_CHECK="~NUMA" |
190 |
- |
191 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
192 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
193 |
- |
194 |
- check_extra_config |
195 |
- fi |
196 |
- fi |
197 |
- |
198 |
- use server && check-reqs_pkg_setup |
199 |
-} |
200 |
- |
201 |
-src_unpack() { |
202 |
- unpack ${A} |
203 |
- |
204 |
- # Grab the patches |
205 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
206 |
- |
207 |
- mv -f "${WORKDIR}/${MY_P}" "${S}" || die |
208 |
-} |
209 |
- |
210 |
-src_prepare() { |
211 |
- # Avoid rpm call which would trigger sandbox, #692368 |
212 |
- sed -i \ |
213 |
- -e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \ |
214 |
- CMakeLists.txt || die |
215 |
- |
216 |
- if use jemalloc ; then |
217 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
218 |
- fi |
219 |
- |
220 |
- if use tcmalloc ; then |
221 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
222 |
- fi |
223 |
- |
224 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
225 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
226 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
227 |
- fi |
228 |
- |
229 |
- # Remove man pages for client-lib tools we don't install |
230 |
- rm \ |
231 |
- man/my_print_defaults.1 \ |
232 |
- man/perror.1 \ |
233 |
- man/zlib_decompress.1 \ |
234 |
- || die |
235 |
- |
236 |
- cmake-utils_src_prepare |
237 |
-} |
238 |
- |
239 |
-src_configure(){ |
240 |
- # Bug #114895, bug #110149 |
241 |
- filter-flags "-O" "-O[01]" |
242 |
- |
243 |
- append-cxxflags -felide-constructors |
244 |
- |
245 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
246 |
- append-flags -fno-strict-aliasing |
247 |
- |
248 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
249 |
- |
250 |
- # debug hack wrt #497532 |
251 |
- mycmakeargs=( |
252 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
253 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
254 |
- -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" |
255 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
256 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
257 |
- -DINSTALL_BINDIR=bin |
258 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
259 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
260 |
- -DINSTALL_INCLUDEDIR=include/mysql |
261 |
- -DINSTALL_INFODIR=share/info |
262 |
- -DINSTALL_LIBDIR=$(get_libdir) |
263 |
- -DINSTALL_MANDIR=share/man |
264 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
265 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
266 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
267 |
- -DINSTALL_SBINDIR=sbin |
268 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
269 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
270 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
271 |
- -DWITH_EDITLINE=system |
272 |
- -DWITH_ZLIB=system |
273 |
- -DWITH_SSL=system |
274 |
- -DWITH_LIBWRAP=0 |
275 |
- -DENABLED_LOCAL_INFILE=1 |
276 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
277 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
278 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
279 |
- # The build forces this to be defined when cross-compiling. We pass it |
280 |
- # all the time for simplicity and to make sure it is actually correct. |
281 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
282 |
- -DCMAKE_POSITION_INDEPENDENT_CODE=ON |
283 |
- -DWITH_CURL=system |
284 |
- -DWITH_BOOST="${S}/boost" |
285 |
- -DWITH_ROUTER=$(usex router ON OFF) |
286 |
- ) |
287 |
- if use test ; then |
288 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
289 |
- else |
290 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
291 |
- fi |
292 |
- |
293 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
294 |
- |
295 |
- # client/mysql.cc:1131:16: error: redefinition of ‘struct _hist_entry’ |
296 |
- mycmakeargs+=( |
297 |
- -DUSE_LIBEDIT_INTERFACE=0 |
298 |
- -DUSE_NEW_EDITLINE_INTERFACE=1 |
299 |
- -DHAVE_HIST_ENTRY=1 |
300 |
- ) |
301 |
- |
302 |
- mycmakeargs+=( |
303 |
- -DWITH_ICU=system |
304 |
- -DWITH_LIBEVENT=system |
305 |
- -DWITH_LZ4=system |
306 |
- -DWITH_PROTOBUF=system |
307 |
- -DWITH_MECAB=$(usex cjk system OFF) |
308 |
- -DWITH_NUMA=$(usex numa ON OFF) |
309 |
- # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex |
310 |
- -DWITH_RAPIDJSON=bundled |
311 |
- ) |
312 |
- |
313 |
- if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then |
314 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
315 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
316 |
- ewarn "You MUST file bugs without these variables set." |
317 |
- ewarn "Tests will probably fail!" |
318 |
- |
319 |
- mycmakeargs+=( |
320 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
321 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
322 |
- ) |
323 |
- elif use latin1 ; then |
324 |
- mycmakeargs+=( |
325 |
- -DDEFAULT_CHARSET=latin1 |
326 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
327 |
- ) |
328 |
- else |
329 |
- mycmakeargs+=( |
330 |
- -DDEFAULT_CHARSET=utf8mb4 |
331 |
- -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci |
332 |
- ) |
333 |
- fi |
334 |
- |
335 |
- if use server ; then |
336 |
- mycmakeargs+=( |
337 |
- -DWITH_EXTRA_CHARSETS=all |
338 |
- -DWITH_DEBUG=$(usex debug) |
339 |
- ) |
340 |
- |
341 |
- if use profiling ; then |
342 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
343 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
344 |
- # "main.mysqld--help-notwin" test to fail |
345 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
346 |
- fi |
347 |
- |
348 |
- # Storage engines |
349 |
- mycmakeargs+=( |
350 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
351 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
352 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
353 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
354 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
355 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
356 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
357 |
- -DWITH_INNODB_MEMCACHED=0 |
358 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
359 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
360 |
- ) |
361 |
- else |
362 |
- mycmakeargs+=( |
363 |
- -DWITHOUT_SERVER=1 |
364 |
- -DWITH_SYSTEMD=no |
365 |
- ) |
366 |
- fi |
367 |
- |
368 |
- cmake-utils_src_configure |
369 |
-} |
370 |
- |
371 |
-# Official test instructions: |
372 |
-# ulimit -n 16500 && \ |
373 |
-# USE='perl server' \ |
374 |
-# FEATURES='test userpriv' \ |
375 |
-# ebuild mysql-X.X.XX.ebuild \ |
376 |
-# digest clean package |
377 |
-src_test() { |
378 |
- _disable_test() { |
379 |
- local rawtestname bug reason |
380 |
- rawtestname="${1}" ; shift |
381 |
- bug="${1}" ; shift |
382 |
- reason="${@}" |
383 |
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" |
384 |
- echo ${rawtestname} : BUG#${bug} ${reason} >> "${T}/disabled.def" |
385 |
- } |
386 |
- |
387 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
388 |
- local retstatus_unit |
389 |
- local retstatus_tests |
390 |
- |
391 |
- # Run CTest (test-units) |
392 |
- cmake-utils_src_test |
393 |
- retstatus_unit=$? |
394 |
- |
395 |
- # Ensure that parallel runs don't die |
396 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
397 |
- |
398 |
- if [[ -z "${MTR_PARALLEL}" ]] ; then |
399 |
- local -x MTR_PARALLEL=$(makeopts_jobs) |
400 |
- |
401 |
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then |
402 |
- # Running multiple tests in parallel usually require higher ulimit |
403 |
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update |
404 |
- # are known to hit timeout when system is busy. |
405 |
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of |
406 |
- # using "auto". |
407 |
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" |
408 |
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" |
409 |
- einfo "${info_msg}" |
410 |
- unset info_msg |
411 |
- MTR_PARALLEL=4 |
412 |
- fi |
413 |
- else |
414 |
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" |
415 |
- fi |
416 |
- |
417 |
- # create directories because mysqladmin might run out of order |
418 |
- mkdir -p "${T}"/var-tests{,/log} || die |
419 |
- |
420 |
- # Run mysql tests |
421 |
- pushd "${TESTDIR}" &>/dev/null || die |
422 |
- |
423 |
- touch "${T}/disabled.def" |
424 |
- |
425 |
- local -a disabled_tests |
426 |
- disabled_tests+=( "auth_sec.keyring_file_data_qa;0;Won't work with user privileges") |
427 |
- disabled_tests+=( "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)") |
428 |
- disabled_tests+=( "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)") |
429 |
- disabled_tests+=( "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)") |
430 |
- disabled_tests+=( "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)") |
431 |
- disabled_tests+=( "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)") |
432 |
- disabled_tests+=( "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)") |
433 |
- disabled_tests+=( "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)") |
434 |
- disabled_tests+=( "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)") |
435 |
- disabled_tests+=( "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)") |
436 |
- disabled_tests+=( "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)") |
437 |
- disabled_tests+=( "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet") |
438 |
- disabled_tests+=( "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet") |
439 |
- disabled_tests+=( "rpl_gtid.rpl_gtid_stm_drop_table;90612;Known test failure" ) |
440 |
- disabled_tests+=( "rpl_gtid.rpl_multi_source_mtr_includes;0;Known failure - no upstream bug yet" ) |
441 |
- disabled_tests+=( "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware") |
442 |
- disabled_tests+=( "x.connection;0;Known failure - no upstream bug yet" ) |
443 |
- disabled_tests+=( "main.mysqlpump_basic_lz4;0;Extra tool output causes false positive" ) |
444 |
- |
445 |
- local test_ds |
446 |
- for test_infos_str in "${disabled_tests[@]}" ; do |
447 |
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" |
448 |
- |
449 |
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then |
450 |
- die "Invalid test data set, not matching format: ${test_infos_str}" |
451 |
- fi |
452 |
- |
453 |
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" |
454 |
- done |
455 |
- unset test_ds test_infos_str test_infos_arr |
456 |
- |
457 |
- # Try to increase file limits to increase test coverage |
458 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
459 |
- # Upper limit comes from parts.partition_* tests |
460 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
461 |
- |
462 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
463 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
464 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
465 |
- |
466 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
467 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
468 |
- else |
469 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
470 |
- fi |
471 |
- else |
472 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
473 |
- fi |
474 |
- else |
475 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
476 |
- fi |
477 |
- |
478 |
- # run mysql-test tests |
479 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
480 |
- retstatus_tests=$? |
481 |
- |
482 |
- popd &>/dev/null || die |
483 |
- |
484 |
- # Cleanup is important for these testcases. |
485 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
486 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
487 |
- |
488 |
- local failures="" |
489 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
490 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
491 |
- |
492 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
493 |
- einfo "Tests successfully completed" |
494 |
-} |
495 |
- |
496 |
-src_install() { |
497 |
- cmake-utils_src_install |
498 |
- |
499 |
- # Make sure the vars are correctly initialized |
500 |
- mysql_init_vars |
501 |
- |
502 |
- # Convenience links |
503 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
504 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
505 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
506 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
507 |
- |
508 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
509 |
- if [[ -d "${ED}/usr/data" ]] ; then |
510 |
- rm -Rf "${ED}/usr/data" || die |
511 |
- fi |
512 |
- |
513 |
- # Unless they explicitly specific USE=test, then do not install the |
514 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
515 |
- # validation of your database configuration after tuning it. |
516 |
- if ! use test ; then |
517 |
- rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test" |
518 |
- fi |
519 |
- |
520 |
- # Configuration stuff |
521 |
- einfo "Building default configuration ..." |
522 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
523 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
524 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
525 |
- eprefixify "${TMPDIR}/my.cnf" |
526 |
- doins "${TMPDIR}/my.cnf" |
527 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
528 |
- cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
529 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
530 |
- doins "${TMPDIR}/50-distro-client.cnf" |
531 |
- |
532 |
- mycnf_src="my.cnf-8.0.distro-server" |
533 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
534 |
- "${FILESDIR}/${mycnf_src}" \ |
535 |
- > "${TMPDIR}/my.cnf.ok" || die |
536 |
- |
537 |
- if use prefix ; then |
538 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
539 |
- "${TMPDIR}/my.cnf.ok" || die |
540 |
- fi |
541 |
- |
542 |
- if use latin1 ; then |
543 |
- sed -i \ |
544 |
- -e "/character-set/s|utf8mb4|latin1|g" \ |
545 |
- "${TMPDIR}/my.cnf.ok" || die |
546 |
- fi |
547 |
- |
548 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
549 |
- |
550 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
551 |
- |
552 |
- #Remove mytop if perl is not selected |
553 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
554 |
- |
555 |
- if use router ; then |
556 |
- rm -rf \ |
557 |
- "${ED}/usr/LICENSE.router" \ |
558 |
- "${ED}/usr/README.router" \ |
559 |
- "${ED}/usr/run" \ |
560 |
- "${ED}/usr/var" \ |
561 |
- || die |
562 |
- fi |
563 |
- |
564 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
565 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
566 |
-} |
567 |
- |
568 |
-pkg_postinst() { |
569 |
- # Make sure the vars are correctly initialized |
570 |
- mysql_init_vars |
571 |
- |
572 |
- # Create log directory securely if it does not exist |
573 |
- # NOTE: $MY_LOGDIR contains $EPREFIX by default |
574 |
- [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" |
575 |
- |
576 |
- # Note about configuration change |
577 |
- einfo |
578 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
579 |
- elog "to several files in /etc/mysql/mysql.d." |
580 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
581 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
582 |
- elog "You may have as many files as needed and they are read alphabetically." |
583 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
584 |
- einfo |
585 |
- |
586 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
587 |
- einfo |
588 |
- elog "You might want to run:" |
589 |
- elog " \"emerge --config =${CATEGORY}/${PF}\"" |
590 |
- elog "if this is a new install." |
591 |
- einfo |
592 |
- else |
593 |
- einfo |
594 |
- elog "Upgrade process for ${PN}-8.x has changed. Please read" |
595 |
- elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html" |
596 |
- einfo |
597 |
- fi |
598 |
-} |
599 |
- |
600 |
-pkg_config() { |
601 |
- local mysqld_binary="${EROOT}/usr/sbin/mysqld" |
602 |
- if [[ ! -x "${mysqld_binary}" ]] ; then |
603 |
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
604 |
- fi |
605 |
- |
606 |
- local mysql_binary="${EROOT}/usr/bin/mysql" |
607 |
- if [[ ! -x "${mysql_binary}" ]] ; then |
608 |
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
609 |
- fi |
610 |
- |
611 |
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" |
612 |
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then |
613 |
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" |
614 |
- fi |
615 |
- |
616 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
617 |
- MYSQL_USER=mysql |
618 |
- if use prefix ; then |
619 |
- MYSQL_USER=$(id -u -n 2>/dev/null) |
620 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
621 |
- die "Failed to determine current username!" |
622 |
- fi |
623 |
- fi |
624 |
- fi |
625 |
- |
626 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
627 |
- MYSQL_GROUP=mysql |
628 |
- if use prefix ; then |
629 |
- MYSQL_GROUP=$(id -g -n 2>/dev/null) |
630 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
631 |
- die "Failed to determine current user groupname!" |
632 |
- fi |
633 |
- fi |
634 |
- fi |
635 |
- |
636 |
- einfo "Will use username '${MYSQL_USER}' and group '${MYSQL_GROUP}' ..." |
637 |
- |
638 |
- _getoptval() { |
639 |
- local section="$1" |
640 |
- local flag="--${2}=" |
641 |
- local extra_options="${3}" |
642 |
- local cmd=( |
643 |
- "${my_print_defaults_binary}" |
644 |
- "${extra_options}" |
645 |
- "${section}" |
646 |
- ) |
647 |
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) |
648 |
- |
649 |
- if [[ ${#results[@]} -gt 0 ]] ; then |
650 |
- # When option is set multiple times only return last value |
651 |
- echo "${results[-1]}" |
652 |
- fi |
653 |
- } |
654 |
- |
655 |
- _mktemp_dry() { |
656 |
- # emktemp has no --dry-run option |
657 |
- local template="${1}" |
658 |
- |
659 |
- if [[ -z "${template}" ]] ; then |
660 |
- if [[ -z "${T}" ]] ; then |
661 |
- template="/tmp/XXXXXXX" |
662 |
- else |
663 |
- template="${T}/XXXXXXX" |
664 |
- fi |
665 |
- fi |
666 |
- |
667 |
- local template_wo_X=${template//X/} |
668 |
- local n_X |
669 |
- let n_X=${#template}-${#template_wo_X} |
670 |
- if [[ ${n_X} -lt 3 ]] ; then |
671 |
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 |
672 |
- return |
673 |
- fi |
674 |
- |
675 |
- local attempts=0 |
676 |
- local character tmpfile |
677 |
- while [[ true ]] ; do |
678 |
- let attempts=attempts+1 |
679 |
- |
680 |
- new_file= |
681 |
- while read -n1 character ; do |
682 |
- if [[ "${character}" == "X" ]] ; then |
683 |
- tmpfile+="${RANDOM:0:1}" |
684 |
- else |
685 |
- tmpfile+="${character}" |
686 |
- fi |
687 |
- done < <(echo -n "${template}") |
688 |
- |
689 |
- if [[ ! -f "${tmpfile}" ]] |
690 |
- then |
691 |
- echo "${tmpfile}" |
692 |
- return |
693 |
- fi |
694 |
- |
695 |
- if [[ ${attempts} -ge 100 ]] ; then |
696 |
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 |
697 |
- return |
698 |
- fi |
699 |
- done |
700 |
- } |
701 |
- |
702 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
703 |
- local -x HOME="${EROOT}/root" |
704 |
- |
705 |
- # Make sure the vars are correctly initialized |
706 |
- mysql_init_vars |
707 |
- |
708 |
- # Read currently set data directory |
709 |
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
710 |
- |
711 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
712 |
- # localhost. Also causes weird failures. |
713 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
714 |
- |
715 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
716 |
- die "Sorry, unable to find MY_DATADIR!" |
717 |
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then |
718 |
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" |
719 |
- ewarn "Please rename or delete its content if you wish to initialize a new data directory." |
720 |
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" |
721 |
- else |
722 |
- einfo "${PN} data directory detected as '${MY_DATADIR}' ..." |
723 |
- fi |
724 |
- |
725 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
726 |
- # These are dir+prefix |
727 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
728 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
729 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
730 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
731 |
- |
732 |
- # Create missing directories. |
733 |
- # Always check if mysql user can write to directory even if we just |
734 |
- # created directory because a parent directory might be not |
735 |
- # accessible for that user. |
736 |
- PID_DIR="${EROOT}/run/mysqld" |
737 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
738 |
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..." |
739 |
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ |
740 |
- || die "Failed to create PID directory '${PID_DIR}'!" |
741 |
- fi |
742 |
- |
743 |
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" |
744 |
- [[ -z "${_pid_dir_testfile}" ]] \ |
745 |
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
746 |
- |
747 |
- if use prefix ; then |
748 |
- touch "${_pid_dir_testfile}" &>/dev/null |
749 |
- else |
750 |
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null |
751 |
- fi |
752 |
- |
753 |
- if [[ $? -ne 0 ]] ; then |
754 |
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" |
755 |
- else |
756 |
- rm "${_pid_dir_testfile}" || die |
757 |
- unset _pid_dir_testfile |
758 |
- fi |
759 |
- |
760 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
761 |
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." |
762 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ |
763 |
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" |
764 |
- fi |
765 |
- |
766 |
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" |
767 |
- [[ -z "${_my_datadir_testfile}" ]] \ |
768 |
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
769 |
- |
770 |
- if use prefix ; then |
771 |
- touch "${_my_datadir_testfile}" &>/dev/null |
772 |
- else |
773 |
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null |
774 |
- fi |
775 |
- |
776 |
- if [[ $? -ne 0 ]]; then |
777 |
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" |
778 |
- else |
779 |
- rm "${_my_datadir_testfile}" || die |
780 |
- unset _my_datadir_testfile |
781 |
- fi |
782 |
- |
783 |
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then |
784 |
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." |
785 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ |
786 |
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" |
787 |
- fi |
788 |
- |
789 |
- if [[ -n "${MYSQL_TMPDIR}" ]] ; then |
790 |
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" |
791 |
- [[ -z "${_my_tmpdir_testfile}" ]] \ |
792 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
793 |
- |
794 |
- if use prefix ; then |
795 |
- touch "${_my_tmpdir_testfile}" &>/dev/null |
796 |
- else |
797 |
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null |
798 |
- fi |
799 |
- |
800 |
- if [[ $? -ne 0 ]]; then |
801 |
- die "${MYSQL_USER} user cannot write into data directory '${MYSQL_TMPDIR}'!" |
802 |
- else |
803 |
- rm "${_my_tmpdir_testfile}" || die |
804 |
- unset _my_tmpdir_testfile |
805 |
- fi |
806 |
- else |
807 |
- # If no tmpdir is set, mysqld will use default system tmpdir. |
808 |
- # However, we are using tmpdir from package manager at the |
809 |
- # moment which maybe isn't writeable for $MYSQL_USER... |
810 |
- MYSQL_TMPDIR="$(_mktemp_dry "${T}/mysqld-tmp.XXXXXXXXX")" |
811 |
- [[ -z "${MYSQL_TMPDIR}" ]] \ |
812 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" |
813 |
- |
814 |
- mkdir "${MYSQL_TMPDIR}" || die |
815 |
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die |
816 |
- fi |
817 |
- |
818 |
- if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then |
819 |
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." |
820 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ |
821 |
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" |
822 |
- fi |
823 |
- |
824 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
825 |
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" |
826 |
- [[ -z "${_my_logbin_testfile}" ]] \ |
827 |
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" |
828 |
- |
829 |
- if use prefix ; then |
830 |
- touch "${_my_logbin_testfile}" &>/dev/null |
831 |
- else |
832 |
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null |
833 |
- fi |
834 |
- |
835 |
- if [[ $? -ne 0 ]]; then |
836 |
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" |
837 |
- else |
838 |
- rm "${_my_logbin_testfile}" || die |
839 |
- unset _my_logbin_testfile |
840 |
- fi |
841 |
- fi |
842 |
- |
843 |
- if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then |
844 |
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." |
845 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ |
846 |
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" |
847 |
- fi |
848 |
- |
849 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
850 |
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" |
851 |
- [[ -z "${_my_relaylog_testfile}" ]] \ |
852 |
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" |
853 |
- |
854 |
- if use prefix ; then |
855 |
- touch "${_my_relaylog_testfile}" &>/dev/null |
856 |
- else |
857 |
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null |
858 |
- fi |
859 |
- |
860 |
- if [[ $? -ne 0 ]]; then |
861 |
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" |
862 |
- else |
863 |
- rm "${_my_relaylog_testfile}" || die |
864 |
- unset _my_relaylog_testfile |
865 |
- fi |
866 |
- fi |
867 |
- |
868 |
- local -a config_files |
869 |
- |
870 |
- local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" |
871 |
- if [[ -f "${config_file}" ]] ; then |
872 |
- config_files+=( "${config_file}" ) |
873 |
- else |
874 |
- ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..." |
875 |
- fi |
876 |
- |
877 |
- config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" |
878 |
- if [[ -f "${config_file}" ]] ; then |
879 |
- config_files+=( "${config_file}" ) |
880 |
- else |
881 |
- ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..." |
882 |
- fi |
883 |
- |
884 |
- if [[ ${#config_files[@]} -gt 0 ]] ; then |
885 |
- if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then |
886 |
- local user_answer |
887 |
- |
888 |
- echo |
889 |
- einfo "Please select default authentication plugin (enter number or plugin name):" |
890 |
- einfo "1) caching_sha2_password [MySQL 8.0 default]" |
891 |
- einfo "2) mysql_native_password [MySQL 5.7 default]" |
892 |
- einfo |
893 |
- einfo "For details see:" |
894 |
- einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" |
895 |
- read -p " >" user_answer |
896 |
- echo |
897 |
- |
898 |
- case "${user_answer}" in |
899 |
- 1|caching_sha2_password) |
900 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password |
901 |
- ;; |
902 |
- 2|mysql_native_password) |
903 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password |
904 |
- ;; |
905 |
- '') |
906 |
- die "No authentication plugin selected!" |
907 |
- ;; |
908 |
- *) |
909 |
- die "Authentication plugin '${user_answer}' is unknown/unsupported!" |
910 |
- ;; |
911 |
- esac |
912 |
- |
913 |
- unset user_answer |
914 |
- fi |
915 |
- |
916 |
- local cfg_option cfg_option_tabs cfg_section |
917 |
- for config_file in "${config_files[@]}" ; do |
918 |
- cfg_option="default-authentication-plugin" |
919 |
- cfg_section="mysqld" |
920 |
- cfg_option_tabs="\t\t" |
921 |
- if [[ "${config_file}" == *client.cnf ]] ; then |
922 |
- cfg_option="default-auth" |
923 |
- cfg_section="client" |
924 |
- cfg_option_tabs="\t\t\t\t" |
925 |
- fi |
926 |
- |
927 |
- if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then |
928 |
- einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
929 |
- sed -i \ |
930 |
- -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ |
931 |
- "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" |
932 |
- else |
933 |
- einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
934 |
- sed -i \ |
935 |
- -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ |
936 |
- "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" |
937 |
- fi |
938 |
- done |
939 |
- unset cfg_option cfg_option_tabs cfg_section |
940 |
- fi |
941 |
- unset config_files config_file |
942 |
- |
943 |
- echo |
944 |
- |
945 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
946 |
- local tmp_mysqld_password_source= |
947 |
- |
948 |
- for tmp_mysqld_password_source in mysql client ; do |
949 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
950 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
951 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
952 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
953 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
954 |
- MYSQL_ROOT_PASSWORD= |
955 |
- continue |
956 |
- fi |
957 |
- |
958 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
959 |
- break |
960 |
- fi |
961 |
- done |
962 |
- |
963 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
964 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
965 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
966 |
- fi |
967 |
- |
968 |
- unset tmp_mysqld_password_source |
969 |
- fi |
970 |
- |
971 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
972 |
- local pwd1="a" |
973 |
- local pwd2="b" |
974 |
- |
975 |
- echo |
976 |
- einfo "No password for mysql 'root' user was specified via environment" |
977 |
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" |
978 |
- einfo "file like '${HOME}/.my.cnf'." |
979 |
- einfo "To continue please provide a password for the mysql 'root' user" |
980 |
- einfo "now on console:" |
981 |
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" |
982 |
- read -rsp " >" pwd1 ; echo |
983 |
- |
984 |
- einfo "Retype the password" |
985 |
- read -rsp " >" pwd2 ; echo |
986 |
- |
987 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
988 |
- die "Passwords are not the same!" |
989 |
- fi |
990 |
- |
991 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
992 |
- unset pwd1 pwd2 |
993 |
- |
994 |
- echo |
995 |
- fi |
996 |
- |
997 |
- local -a mysqld_options |
998 |
- |
999 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
1000 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
1001 |
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) |
1002 |
- |
1003 |
- # Figure out which options we need to disable to do the setup |
1004 |
- local helpfile="${TMPDIR}/mysqld-help" |
1005 |
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
1006 |
- |
1007 |
- local opt optexp optfull |
1008 |
- for opt in host-cache name-resolve networking slave-start \ |
1009 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
1010 |
- log-slave-updates \ |
1011 |
- ; do |
1012 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
1013 |
- egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) |
1014 |
- done |
1015 |
- |
1016 |
- # Prepare timezones, see |
1017 |
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
1018 |
- local tz_sql="${TMPDIR}/tz.sql" |
1019 |
- echo "USE mysql;" >"${tz_sql}" |
1020 |
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null |
1021 |
- if [[ $? -ne 0 ]] ; then |
1022 |
- die "mysql_tzinfo_to_sql failed!" |
1023 |
- fi |
1024 |
- |
1025 |
- chown ${MYSQL_USER} "${tz_sql}" || die |
1026 |
- |
1027 |
- local mysql_install_log="${TMPDIR}/mysql_install_db.log" |
1028 |
- touch "${mysql_install_log}" || die |
1029 |
- chown ${MYSQL_USER} "${mysql_install_log}" || die |
1030 |
- |
1031 |
- # --initialize-insecure will not set root password |
1032 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
1033 |
- local cmd=( |
1034 |
- "${mysqld_binary}" |
1035 |
- "${mysqld_options[@]}" |
1036 |
- "--initialize-insecure" |
1037 |
- "--init-file='${tz_sql}'" |
1038 |
- "--basedir='${EROOT}/usr'" |
1039 |
- "--datadir='${MY_DATADIR}'" |
1040 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
1041 |
- "--log-error='${mysql_install_log}'" |
1042 |
- "--user=${MYSQL_USER}" |
1043 |
- ) |
1044 |
- |
1045 |
- einfo "Initializing ${PN} data directory: ${cmd[@]}" |
1046 |
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 |
1047 |
- |
1048 |
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then |
1049 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 |
1050 |
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" |
1051 |
- fi |
1052 |
- |
1053 |
- local x=${RANDOM} |
1054 |
- local socket="${EROOT}/run/mysqld/mysqld${x}.sock" |
1055 |
- local pidfile="${EROOT}/run/mysqld/mysqld${x}.pid" |
1056 |
- unset x |
1057 |
- |
1058 |
- local mysqld_logfile="${TMPDIR}/mysqld.log" |
1059 |
- touch "${mysqld_logfile}" || die |
1060 |
- chown ${MYSQL_USER} "${mysqld_logfile}" || die |
1061 |
- |
1062 |
- cmd=( |
1063 |
- "${mysqld_binary}" |
1064 |
- "${mysqld_options[@]}" |
1065 |
- "--basedir='${EROOT}/usr'" |
1066 |
- "--datadir='${MY_DATADIR}'" |
1067 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
1068 |
- --max_allowed_packet=8M |
1069 |
- --net_buffer_length=16K |
1070 |
- "--socket='${socket}'" |
1071 |
- "--pid-file='${pidfile}'" |
1072 |
- "--log-error='${mysqld_logfile}'" |
1073 |
- "--user=${MYSQL_USER}" |
1074 |
- ) |
1075 |
- |
1076 |
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}" |
1077 |
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & |
1078 |
- |
1079 |
- echo -n "Waiting for mysqld to accept connections " |
1080 |
- local maxtry=15 |
1081 |
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
1082 |
- maxtry=$((${maxtry}-1)) |
1083 |
- echo -n "." |
1084 |
- sleep 1 |
1085 |
- done |
1086 |
- |
1087 |
- if [[ -S "${socket}" ]] ; then |
1088 |
- # Even with a socket we don't know if mysqld will abort |
1089 |
- # start due to an error so just wait a little bit more... |
1090 |
- maxtry=5 |
1091 |
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
1092 |
- maxtry=$((${maxtry}-1)) |
1093 |
- echo -n "." |
1094 |
- sleep 1 |
1095 |
- done |
1096 |
- fi |
1097 |
- |
1098 |
- echo |
1099 |
- |
1100 |
- if [[ ! -S "${socket}" ]] ; then |
1101 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 |
1102 |
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" |
1103 |
- fi |
1104 |
- |
1105 |
- local mysql_logfile="${TMPDIR}/set_root_pw.log" |
1106 |
- touch "${mysql_logfile}" || die |
1107 |
- |
1108 |
- ebegin "Setting root password" |
1109 |
- # Do this from memory, as we don't want clear text passwords in temp files |
1110 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" |
1111 |
- cmd=( |
1112 |
- "${mysql_binary}" |
1113 |
- --no-defaults |
1114 |
- "--socket='${socket}'" |
1115 |
- -hlocalhost |
1116 |
- "-e \"${sql}\"" |
1117 |
- ) |
1118 |
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 |
1119 |
- local rc=$? |
1120 |
- eend ${rc} |
1121 |
- |
1122 |
- if [[ ${rc} -ne 0 ]] ; then |
1123 |
- # Poor man's solution which tries to avoid having password |
1124 |
- # in log. NOTE: sed can fail if user didn't follow advice |
1125 |
- # and included character which will require escaping... |
1126 |
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null |
1127 |
- |
1128 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" |
1129 |
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" |
1130 |
- fi |
1131 |
- |
1132 |
- # Stop the server |
1133 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
1134 |
- echo -n "Stopping the server " |
1135 |
- pkill -F "${pidfile}" &>/dev/null |
1136 |
- |
1137 |
- maxtry=10 |
1138 |
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do |
1139 |
- maxtry=$((${maxtry}-1)) |
1140 |
- echo -n "." |
1141 |
- sleep 1 |
1142 |
- done |
1143 |
- |
1144 |
- echo |
1145 |
- |
1146 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
1147 |
- # We somehow failed to stop server. |
1148 |
- # However, not a fatal error. Just warn the user. |
1149 |
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" |
1150 |
- fi |
1151 |
- fi |
1152 |
- |
1153 |
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" |
1154 |
-} |