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