1 |
commit: 692c6d4087ab8d3c0eb7cf178388aba0a01a9304 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 30 21:28:27 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 30 21:42:17 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=692c6d40 |
7 |
|
8 |
dev-db/mysql: drop old |
9 |
|
10 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
11 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
12 |
|
13 |
dev-db/mysql/Manifest | 2 - |
14 |
dev-db/mysql/mysql-5.6.44-r1.ebuild | 837 ------------------------------ |
15 |
dev-db/mysql/mysql-5.7.26-r1.ebuild | 991 ------------------------------------ |
16 |
3 files changed, 1830 deletions(-) |
17 |
|
18 |
diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest |
19 |
index 9cf53ff8307..c02e67dea28 100644 |
20 |
--- a/dev-db/mysql/Manifest |
21 |
+++ b/dev-db/mysql/Manifest |
22 |
@@ -1,4 +1,3 @@ |
23 |
-DIST mysql-5.6.44.tar.gz 32531507 BLAKE2B 28fbf49f699eb9f43223ffa186671b119d16016274cc7192db232b85c58123a61154e37193b9b7145c6a650b80b5f6cf838529bc2bc5ea9c78c0dbc39de834d3 SHA512 65ace1c803773ca6c8759d171c09bc93c7d61b8e3208ac9905f82e99087622c9dcca602d2da217741dc62fc6eabe9108ebc7f31facd26705072eae65fcc37077 |
24 |
DIST mysql-5.6.45.tar.gz 32525559 BLAKE2B 3c629aed1de808acdea6654c7413e6851507c9c5be939ca4b4f5e2796da317e9b518a749bfc03d2b0ef05bd604b39f72e24b751076b9f206b462d21fa5db4f50 SHA512 f9d8bb72e96cc83f1064fe7df2e5fe8317ca9d44c4e776cf7827a61292fbcfccec716806c80d565958383d78fef93a19d61c726687b57680d5f93299291ff168 |
25 |
DIST mysql-5.7.30-patches-01.tar.xz 6684 BLAKE2B 9350280094619fda0d91eacae573396198954fceb5dc039669d236b1dad98eef306702550b517ef30ee3d0e6721667b6f5549df91e3c15cef68888079c00d9ba SHA512 74e8e8794fe54b73776b38296aa42c65547311b80bfe65c88b2f961bd44083e9628eb47da4ebcf4c20e2d7c694f514223bcbf29cce27853cca500710ae97778d |
26 |
DIST mysql-8.0.20-patches-01.tar.xz 7176 BLAKE2B 2fc51986c0a4da60521d0e64b9f8705caf8ec3869af930c9729359c3710059fc78aae176523fdf17d10173b404431f31f9bb23ee5c82fba7cbbb4cb39881c005 SHA512 bf8211cf3873f8672b9d3d1dc42b68a1c635690ffdc2d3393eafa83f060ada9f2eaa63f859bf8eecc24976a733d8c7c3b9632ac70f28b5facf48eae921c7ceeb |
27 |
@@ -8,7 +7,6 @@ DIST mysql-boost-5.7.29.tar.gz 51417554 BLAKE2B 652ce9f99419387e9bcc37afeb1b4643 |
28 |
DIST mysql-boost-5.7.30.tar.gz 51363998 BLAKE2B 7897ad74b685c3b30e7ecdf132fdfa72f3416c05e8d0086cb8f7674b6c4f377fff9abc51ed258cc4dfeab50a2cb393af9076d9c1f9a83a26521facbaf223afa1 SHA512 b75d41d0c72d16c6f8d5393dab6e476b7993d296eb5683c12417ce2da3db2052fdab2a152f6e7c545315d21bfa35f26a247cb6cdab83d3418b5d34ed7f5f9560 |
29 |
DIST mysql-boost-8.0.19.tar.gz 264147972 BLAKE2B 61a5ccbef1a7a675c85e4e6bda8e5285bdb931e6ee14d4710bf13dfd9157d1095200db2886dc93ea7251d3d59245f35c0bef5ba88ba6aac209b1e080f3b07dc4 SHA512 5ffc03f005ab2585694902e926b6cb2b10059b2b030549eccd3949f9c3b2f02626d02529f940dec003f2d69683856fd1c720ff12f89dfbdc48befaf24a9c4d01 |
30 |
DIST mysql-boost-8.0.20.tar.gz 266282970 BLAKE2B 2aeb9d6c575ed9dc2d00d3e51e6391c59ffa39156491d9ed2c07e19bb2efb88a14d5a9d4b537c137d71854e39fa3a7fc2b93618118d4fd062e92ba2d83783c6f SHA512 7a962e9ddec7069008c5ab6ac2801515e2661ca2875afc6141541c03e2f941f4255b3c0d806a4df2fd2f2f1d12323aeb1e456c1d364777a18ccebefad7b22a99 |
31 |
-DIST mysql-extras-20190817-0024Z.tar.bz2 337793 BLAKE2B dfd51a708654aff5bdbbaf2acad7ef966869a8e3adcba544ee15f217d2ba942827445841e73981bccc6c1f145b6225bfa7245114219f0cf52f0dfb85494a6830 SHA512 c2ff81be1c55636f0a2700033af030149f312f0383217054a4b8c65aef174626299fcb4539eaae967ea7d096a5bb09f5b5122dce344b44b0a135d886ba0fdf28 |
32 |
DIST mysql-extras-20190822-1908Z.tar.bz2 338830 BLAKE2B bc197f8e541206548d8982814e82e028d699ba9c41aec8d5191bcc46581f7880ed2741dbe2206fde44a5e8d8d54bbcf40efbd0709b357636c4c8fdb2ccc3a7bb SHA512 be469e55f7e9966638600d6836a44258c74e5600240fafe2d79eaeebe7d1695b043678184b5d18ee9946f28154bc2529586a7f860b510180a30c82454ed575c8 |
33 |
DIST mysql-extras-20200125-1945Z.tar.bz2 344906 BLAKE2B 0e87875efbc221ded43d6f080dc7dce4277b676b538950120c94b962e51d054093286486e5d83ea3e38e1b2d0b12cf81873df50e1cebbe4cff33b54297e6a17a SHA512 5fcc5d372998db2b8aef32661ff71290791c20c1195a6210ca79c0fda12008906e665f9dc878d3df5a38a95e23ff05b910daa861002c17a1b6de71ef0520bee1 |
34 |
DIST mysql-extras-20200317-0103Z.tar.bz2 344905 BLAKE2B c4c8bb2acea16663ab32cf291d0a2d52af04448a507ad3a6dc22dfdef4d6ba427582d66e5923d05cd51565286f85c8df5ccabef9a67a4a500574d21e1f708f27 SHA512 d1d34817faf0a1271f906213eea9081c204d745b14f96166f17d5c60a29ec58c05926e7216f135b6e9d5df2ceab373f10fc4e6a652514d99ba34a336571dce1f |
35 |
|
36 |
diff --git a/dev-db/mysql/mysql-5.6.44-r1.ebuild b/dev-db/mysql/mysql-5.6.44-r1.ebuild |
37 |
deleted file mode 100644 |
38 |
index dd4f1b213a7..00000000000 |
39 |
--- a/dev-db/mysql/mysql-5.6.44-r1.ebuild |
40 |
+++ /dev/null |
41 |
@@ -1,837 +0,0 @@ |
42 |
-# Copyright 1999-2020 Gentoo Authors |
43 |
-# Distributed under the terms of the GNU General Public License v2 |
44 |
- |
45 |
-EAPI="6" |
46 |
-MY_EXTRAS_VER="20190817-0024Z" |
47 |
- |
48 |
-CMAKE_MAKEFILE_GENERATOR=emake |
49 |
- |
50 |
-# Keeping eutils in EAPI=6 for emktemp in pkg_config |
51 |
- |
52 |
-inherit eutils flag-o-matic prefix toolchain-funcs \ |
53 |
- user cmake-utils multilib-build |
54 |
- |
55 |
-SRC_URI="http://cdn.mysql.com/Downloads/MySQL-5.6/${P}.tar.gz |
56 |
- https://cdn.mysql.com/archives/mysql-5.6/${P}.tar.gz |
57 |
- http://downloads.mysql.com/archives/MySQL-5.6/${P}.tar.gz" |
58 |
- |
59 |
-# Gentoo patches to MySQL |
60 |
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
61 |
- SRC_URI="${SRC_URI} |
62 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
63 |
- https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
64 |
- https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
65 |
- https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
66 |
- https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
67 |
-fi |
68 |
- |
69 |
-HOMEPAGE="https://www.mysql.com/" |
70 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
71 |
-LICENSE="GPL-2" |
72 |
-SLOT="0/18" |
73 |
-IUSE="client-libs cracklib debug jemalloc latin1 libressl numa +perl profiling selinux |
74 |
- +server static static-libs systemtap tcmalloc test yassl" |
75 |
- |
76 |
-# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
77 |
-RESTRICT="!test? ( test ) libressl? ( test )" |
78 |
- |
79 |
-REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )" |
80 |
- |
81 |
-KEYWORDS="amd64 arm ~hppa ~ia64 ~mips ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
82 |
- |
83 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
84 |
-# and we will run a mysql server during test phase |
85 |
-S="${WORKDIR}/mysql" |
86 |
- |
87 |
-if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
88 |
- inherit git-r3 |
89 |
- EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
90 |
- EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
91 |
- EGIT_CLONE_TYPE=shallow |
92 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
93 |
-else |
94 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
95 |
-fi |
96 |
- |
97 |
-PATCHES=( |
98 |
- "${MY_PATCH_DIR}"/01050_all_mysql_config_cleanup-5.6.patch |
99 |
- "${MY_PATCH_DIR}"/02040_all_embedded-library-shared-5.5.10.patch |
100 |
- "${MY_PATCH_DIR}"/20006_all_cmake_elib-mysql-5.6.35.patch |
101 |
- "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.6.22.patch |
102 |
- "${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.6.37.patch |
103 |
- "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.6.patch |
104 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.6.25-without-clientlibs-tools.patch |
105 |
- "${MY_PATCH_DIR}"/20027_all_mysql-5.5-perl5.26-includes.patch |
106 |
- "${MY_PATCH_DIR}"/20028_all_mysql-5.6-gcc7.patch |
107 |
- "${MY_PATCH_DIR}"/20031_all_mysql-5.6-fix-monitor.test.patch |
108 |
- "${MY_PATCH_DIR}"/20036_all_mysql-5.6-fix-rpl_semi_sync_shutdown_hang.test.patch |
109 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.6.44-fix-libressl-support.patch |
110 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.6.44-add-openssl-1.1-support.patch |
111 |
-) |
112 |
- |
113 |
-# Be warned, *DEPEND are version-dependant |
114 |
-# These are used for both runtime and compiletime |
115 |
-COMMON_DEPEND=" |
116 |
- kernel_linux? ( |
117 |
- sys-process/procps:0= |
118 |
- dev-libs/libaio:0= |
119 |
- ) |
120 |
- net-misc/curl |
121 |
- >=sys-apps/sed-4 |
122 |
- >=sys-apps/texinfo-4.7-r1 |
123 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
124 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
125 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
126 |
- !yassl? ( |
127 |
- !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
128 |
- libressl? ( =dev-libs/libressl-2.6.5*:0= ) |
129 |
- ) |
130 |
- >=sys-libs/zlib-1.2.3:0= |
131 |
- sys-libs/ncurses:0= |
132 |
- server? ( |
133 |
- numa? ( sys-process/numactl ) |
134 |
- ) |
135 |
- !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) |
136 |
-" |
137 |
-DEPEND="virtual/yacc |
138 |
- static? ( sys-libs/ncurses[static-libs] ) |
139 |
- test? ( dev-perl/JSON ) |
140 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
141 |
- ${COMMON_DEPEND}" |
142 |
-RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
143 |
- client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) |
144 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
145 |
- server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
146 |
- ${COMMON_DEPEND} |
147 |
-" |
148 |
-# For other stuff to bring us in |
149 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
150 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
151 |
- |
152 |
-pkg_setup() { |
153 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
154 |
- local GCC_MAJOR_SET=$(gcc-major-version) |
155 |
- local GCC_MINOR_SET=$(gcc-minor-version) |
156 |
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
157 |
- # non x86{,_64} arches |
158 |
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
159 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
160 |
- eerror "${PN} needs to be built with gcc-4.7 or later." |
161 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
162 |
- die |
163 |
- fi |
164 |
- fi |
165 |
- if has test ${FEATURES} && \ |
166 |
- use server && ! has userpriv ${FEATURES} ; then |
167 |
- eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
168 |
- fi |
169 |
- |
170 |
- # This should come after all of the die statements |
171 |
- enewgroup mysql 60 || die "problem adding 'mysql' group" |
172 |
- enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
173 |
-} |
174 |
- |
175 |
-pkg_preinst() { |
176 |
- # Here we need to see if the implementation switched client libraries |
177 |
- # We check if this is a new instance of the package and a client library already exists |
178 |
- local SHOW_ABI_MESSAGE libpath |
179 |
- if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
180 |
- libpath=$(readlink "${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so") |
181 |
- elog "Due to ABI changes when switching between different client libraries," |
182 |
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
183 |
- elog "Please run: revdep-rebuild --library ${libpath}" |
184 |
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
185 |
- fi |
186 |
-} |
187 |
- |
188 |
-pkg_postinst() { |
189 |
- # Make sure the vars are correctly initialized |
190 |
- mysql_init_vars |
191 |
- |
192 |
- # Create log directory securely if it does not exist |
193 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
194 |
- |
195 |
- if use server ; then |
196 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
197 |
- einfo |
198 |
- elog "You might want to run:" |
199 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
200 |
- elog "if this is a new install." |
201 |
- elog |
202 |
- elog "If you are switching server implentations, you should run the" |
203 |
- elog "mysql_upgrade tool." |
204 |
- einfo |
205 |
- else |
206 |
- einfo |
207 |
- elog "If you are upgrading major versions, you should run the" |
208 |
- elog "mysql_upgrade tool." |
209 |
- einfo |
210 |
- fi |
211 |
- fi |
212 |
-} |
213 |
- |
214 |
-src_unpack() { |
215 |
- unpack ${A} |
216 |
- # Grab the patches |
217 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
218 |
- |
219 |
- mv -f "${WORKDIR}/${P}" "${S}" || die |
220 |
-} |
221 |
- |
222 |
-src_prepare() { |
223 |
- _disable_engine() { |
224 |
- echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
225 |
- } |
226 |
- |
227 |
- _disable_plugin() { |
228 |
- echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
229 |
- } |
230 |
- |
231 |
- if use jemalloc ; then |
232 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
233 |
- fi |
234 |
- if use tcmalloc; then |
235 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
236 |
- fi |
237 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
238 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
239 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
240 |
- fi |
241 |
- |
242 |
- if use libressl ; then |
243 |
- sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \ |
244 |
- "${S}/cmake/ssl.cmake" || die |
245 |
- fi |
246 |
- |
247 |
- sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
248 |
- |
249 |
- local plugin |
250 |
- local server_plugins=( semisync ) |
251 |
- local test_plugins=( audit_null daemon_example fulltext ) |
252 |
- if ! use server; then # These plugins are for the server |
253 |
- for plugin in "${server_plugins[@]}" ; do |
254 |
- _disable_plugin "${plugin}" |
255 |
- done |
256 |
- fi |
257 |
- |
258 |
- if ! use test; then # These plugins are only used during testing |
259 |
- for plugin in "${test_plugins[@]}" ; do |
260 |
- _disable_plugin "${plugin}" |
261 |
- done |
262 |
- fi |
263 |
- |
264 |
- # Don't build example |
265 |
- _disable_engine example |
266 |
- _disable_engine ndb |
267 |
- _disable_plugin innodb_memcached |
268 |
- |
269 |
- cmake-utils_src_prepare |
270 |
-} |
271 |
- |
272 |
-src_configure() { |
273 |
- # bug 508724 mariadb cannot use ld.gold |
274 |
- tc-ld-disable-gold |
275 |
- # Bug #114895, bug #110149 |
276 |
- filter-flags "-O" "-O[01]" |
277 |
- |
278 |
- append-cxxflags -felide-constructors |
279 |
- |
280 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
281 |
- append-flags -fno-strict-aliasing |
282 |
- |
283 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
284 |
- |
285 |
- # debug hack wrt #497532 |
286 |
- mycmakeargs=( |
287 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
288 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
289 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
290 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
291 |
- -DINSTALL_BINDIR=bin |
292 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
293 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
294 |
- -DINSTALL_INCLUDEDIR=include/mysql |
295 |
- -DINSTALL_INFODIR=share/info |
296 |
- -DINSTALL_LIBDIR=$(get_libdir) |
297 |
- -DINSTALL_MANDIR=share/man |
298 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
299 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
300 |
- -DINSTALL_SCRIPTDIR=share/mysql/scripts |
301 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
302 |
- -DINSTALL_SBINDIR=sbin |
303 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
304 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
305 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
306 |
- ### TODO: make this system but issues with UTF-8 prevent it |
307 |
- -DWITH_EDITLINE=bundled |
308 |
- -DWITH_ZLIB=system |
309 |
- -DWITH_LIBWRAP=0 |
310 |
- -DENABLED_LOCAL_INFILE=1 |
311 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
312 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
313 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
314 |
- # The build forces this to be defined when cross-compiling. We pass it |
315 |
- # all the time for simplicity and to make sure it is actually correct. |
316 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
317 |
- -DWITH_LIBEVENT=NO |
318 |
- -DWITHOUT_CLIENTLIBS=YES |
319 |
- -DENABLE_DTRACE=$(usex systemtap) |
320 |
- -DWITH_SSL=$(usex yassl bundled system) |
321 |
- -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mysql/mysql-test' '') |
322 |
- -DWITHOUT_VALIDATE_PASSWORD=1 |
323 |
- ) |
324 |
- |
325 |
- if use server ; then |
326 |
- |
327 |
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
328 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
329 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
330 |
- ewarn "You MUST file bugs without these variables set." |
331 |
- |
332 |
- mycmakeargs+=( |
333 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
334 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
335 |
- ) |
336 |
- |
337 |
- elif ! use latin1 ; then |
338 |
- mycmakeargs+=( |
339 |
- -DDEFAULT_CHARSET=utf8 |
340 |
- -DDEFAULT_COLLATION=utf8_general_ci |
341 |
- ) |
342 |
- else |
343 |
- mycmakeargs+=( |
344 |
- -DDEFAULT_CHARSET=latin1 |
345 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
346 |
- ) |
347 |
- fi |
348 |
- mycmakeargs+=( |
349 |
- -DWITH_NUMA=$(usex numa ON OFF) |
350 |
- -DEXTRA_CHARSETS=all |
351 |
- -DDISABLE_SHARED=$(usex static YES NO) |
352 |
- -DWITH_DEBUG=$(usex debug) |
353 |
- -DWITH_EMBEDDED_SERVER=OFF |
354 |
- ) |
355 |
- |
356 |
- if use profiling ; then |
357 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
358 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
359 |
- # "main.mysqld--help-notwin" test to fail |
360 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
361 |
- fi |
362 |
- |
363 |
- if use static; then |
364 |
- mycmakeargs+=( -DWITH_PIC=1 ) |
365 |
- fi |
366 |
- |
367 |
- # Storage engines |
368 |
- mycmakeargs+=( |
369 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
370 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
371 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
372 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
373 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
374 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
375 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
376 |
- -DWITH_PARTITION_STORAGE_ENGINE=1 |
377 |
- -DWITH_INNODB_MEMCACHED=0 |
378 |
- ) |
379 |
- |
380 |
- else |
381 |
- mycmakeargs+=( |
382 |
- -DWITHOUT_SERVER=1 |
383 |
- -DWITH_EMBEDDED_SERVER=OFF |
384 |
- -DEXTRA_CHARSETS=none |
385 |
- ) |
386 |
- fi |
387 |
- |
388 |
- cmake-utils_src_configure |
389 |
-} |
390 |
- |
391 |
-src_compile() { |
392 |
- cmake-utils_src_compile |
393 |
-} |
394 |
- |
395 |
-src_install() { |
396 |
- cmake-utils_src_install |
397 |
- |
398 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
399 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
400 |
- # Make sure the vars are correctly initialized |
401 |
- mysql_init_vars |
402 |
- |
403 |
- # Convenience links |
404 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
405 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
406 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
407 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
408 |
- |
409 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
410 |
- if [[ -d "${ED}/usr/data" ]] ; then |
411 |
- rm -Rf "${ED}/usr/data" || die |
412 |
- fi |
413 |
- |
414 |
- if [[ -d "${ED%/}/usr/sql-bench" ]] ; then |
415 |
- mv "${ED%/}/usr/sql-bench" "${ED%/}/usr/share/mysql/" || die |
416 |
- fi |
417 |
- |
418 |
- # Unless they explicitly specific USE=test, then do not install the |
419 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
420 |
- # validation of your database configuration after tuning it. |
421 |
- if ! use test ; then |
422 |
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
423 |
- fi |
424 |
- |
425 |
- # Configuration stuff |
426 |
- einfo "Building default configuration ..." |
427 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
428 |
- [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf |
429 |
- local mycnf_src="my.cnf-5.6" |
430 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
431 |
- "${FILESDIR%/}/${mycnf_src}" \ |
432 |
- > "${TMPDIR%/}/my.cnf.ok" || die |
433 |
- use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok" |
434 |
- if use latin1 ; then |
435 |
- sed -i \ |
436 |
- -e "/character-set/s|utf8|latin1|g" \ |
437 |
- "${TMPDIR%/}/my.cnf.ok" || die |
438 |
- fi |
439 |
- eprefixify "${TMPDIR%/}/my.cnf.ok" |
440 |
- newins "${TMPDIR}/my.cnf.ok" my.cnf |
441 |
- |
442 |
- if use server ; then |
443 |
- einfo "Including support files and sample configurations" |
444 |
- docinto "support-files" |
445 |
- local script |
446 |
- for script in \ |
447 |
- "${S}"/support-files/magic |
448 |
- do |
449 |
- [[ -f "$script" ]] && dodoc "${script}" |
450 |
- done |
451 |
- |
452 |
- docinto "scripts" |
453 |
- for script in "${S}"/scripts/mysql* ; do |
454 |
- [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
455 |
- done |
456 |
- fi |
457 |
- |
458 |
- #Remove mytop if perl is not selected |
459 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
460 |
-} |
461 |
- |
462 |
-# Official test instructions: |
463 |
-# USE='perl server static-libs' \ |
464 |
-# FEATURES='test userpriv -usersandbox' \ |
465 |
-# ebuild mysql-X.X.XX.ebuild \ |
466 |
-# digest clean package |
467 |
-src_test() { |
468 |
- |
469 |
- _disable_test() { |
470 |
- local rawtestname reason |
471 |
- rawtestname="${1}" ; shift |
472 |
- reason="${@}" |
473 |
- ewarn "test '${rawtestname}' disabled: '${reason}'" |
474 |
- echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
475 |
- } |
476 |
- |
477 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
478 |
- local retstatus_unit |
479 |
- local retstatus_tests |
480 |
- |
481 |
- if ! use server ; then |
482 |
- einfo "Skipping server tests due to minimal build." |
483 |
- return 0 |
484 |
- fi |
485 |
- |
486 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
487 |
- # localhost. Also causes weird failures. |
488 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
489 |
- |
490 |
- if [[ $UID -eq 0 ]]; then |
491 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
492 |
- fi |
493 |
- has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
494 |
- |
495 |
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
496 |
- |
497 |
- # Run CTest (test-units) |
498 |
- cmake-utils_src_test |
499 |
- retstatus_unit=$? |
500 |
- |
501 |
- # Ensure that parallel runs don't die |
502 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
503 |
- # Enable parallel testing, auto will try to detect number of cores |
504 |
- # You may set this by hand. |
505 |
- # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
506 |
- export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
507 |
- |
508 |
- # create directories because mysqladmin might run out of order |
509 |
- mkdir -p "${T}"/var-tests{,/log} || die |
510 |
- |
511 |
- # Run mysql tests |
512 |
- pushd "${TESTDIR}" > /dev/null || die |
513 |
- |
514 |
- touch "${T}/disabled.def" |
515 |
- # These are failing in MySQL 5.6 for now and are believed to be |
516 |
- # false positives: |
517 |
- # |
518 |
- local t |
519 |
- |
520 |
- for t in auth_sec.keyring_udf federated.federated_plugin ; do |
521 |
- _disable_test "$t" "False positives in Gentoo" |
522 |
- done |
523 |
- |
524 |
- if ! use latin1 ; then |
525 |
- for t in \ |
526 |
- binlog.binlog_mysqlbinlog_filter \ |
527 |
- binlog.binlog_statement_insert_delayed \ |
528 |
- funcs_1.is_columns_mysql \ |
529 |
- funcs_1.is_tables_mysql \ |
530 |
- funcs_1.is_triggers \ |
531 |
- main.information_schema \ |
532 |
- main.mysql_client_test \ |
533 |
- main.mysqld--help-notwin \ |
534 |
- perfschema.binlog_edge_mix \ |
535 |
- perfschema.binlog_edge_stmt \ |
536 |
- ; do |
537 |
- _disable_test "$t" "Requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set" |
538 |
- done |
539 |
- fi |
540 |
- |
541 |
- if has_version '>=dev-libs/openssl-1.1.0' ; then |
542 |
- # Tests are expecting <openssl-1.1 default cipher |
543 |
- for t in \ |
544 |
- main.openssl_1 \ |
545 |
- main.plugin_auth_sha256_tls \ |
546 |
- main.ssl \ |
547 |
- main.ssl_8k_key \ |
548 |
- main.ssl_ca \ |
549 |
- main.ssl_cipher\ |
550 |
- main.ssl_compress \ |
551 |
- main.ssl_crl \ |
552 |
- main.ssl-sha512 \ |
553 |
- ; do |
554 |
- _disable_test "$t" "Requires <dev-libs/openssl-1.1.0" |
555 |
- done |
556 |
- fi |
557 |
- |
558 |
- _disable_test main.gis-precise "Known rounding error with latest AMD processors" |
559 |
- |
560 |
- # run mysql-test tests |
561 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
562 |
- retstatus_tests=$? |
563 |
- |
564 |
- popd > /dev/null || die |
565 |
- |
566 |
- # Cleanup is important for these testcases. |
567 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
568 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
569 |
- |
570 |
- local failures="" |
571 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
572 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
573 |
- |
574 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
575 |
- einfo "Tests successfully completed" |
576 |
-} |
577 |
- |
578 |
-mysql_init_vars() { |
579 |
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
580 |
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
581 |
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
582 |
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
583 |
- |
584 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
585 |
- MY_DATADIR="" |
586 |
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
587 |
- MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
588 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
589 |
- | tail -n1` |
590 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
591 |
- MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
592 |
- | sed -e 's/.*=\s*//' \ |
593 |
- | tail -n1` |
594 |
- fi |
595 |
- fi |
596 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
597 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
598 |
- einfo "Using default MY_DATADIR" |
599 |
- fi |
600 |
- elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
601 |
- |
602 |
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
603 |
- if [[ -e "${MY_DATADIR}" ]] ; then |
604 |
- # If you get this and you're wondering about it, see bug #207636 |
605 |
- elog "MySQL datadir found in ${MY_DATADIR}" |
606 |
- elog "A new one will not be created." |
607 |
- PREVIOUS_DATADIR="yes" |
608 |
- else |
609 |
- PREVIOUS_DATADIR="no" |
610 |
- fi |
611 |
- export PREVIOUS_DATADIR |
612 |
- fi |
613 |
- else |
614 |
- if [[ ${EBUILD_PHASE} == "config" ]]; then |
615 |
- local new_MY_DATADIR |
616 |
- new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
617 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
618 |
- | tail -n1` |
619 |
- |
620 |
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
621 |
- ewarn "MySQL MY_DATADIR has changed" |
622 |
- ewarn "from ${MY_DATADIR}" |
623 |
- ewarn "to ${new_MY_DATADIR}" |
624 |
- MY_DATADIR="${new_MY_DATADIR}" |
625 |
- fi |
626 |
- fi |
627 |
- fi |
628 |
- |
629 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
630 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
631 |
- export MY_DATADIR |
632 |
-} |
633 |
- |
634 |
-pkg_config() { |
635 |
- _getoptval() { |
636 |
- local mypd="${EROOT%/}"/usr/bin/my_print_defaults |
637 |
- local section="$1" |
638 |
- local flag="--${2}=" |
639 |
- local extra_options="${3}" |
640 |
- "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
641 |
- } |
642 |
- local old_MY_DATADIR="${MY_DATADIR}" |
643 |
- local old_HOME="${HOME}" |
644 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
645 |
- export HOME=${EPREFIX}/root |
646 |
- |
647 |
- # Make sure the vars are correctly initialized |
648 |
- mysql_init_vars |
649 |
- |
650 |
- [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
651 |
- if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then |
652 |
- die "Minimal builds do NOT include the MySQL server" |
653 |
- fi |
654 |
- |
655 |
- if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
656 |
- local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}" |
657 |
- MY_DATADIR_s="${MY_DATADIR_s%%/}" |
658 |
- local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}" |
659 |
- old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
660 |
- |
661 |
- if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
662 |
- if [[ -d "${MY_DATADIR_s}" ]]; then |
663 |
- ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
664 |
- ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
665 |
- else |
666 |
- elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
667 |
- mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
668 |
- || die "Moving MY_DATADIR failed" |
669 |
- fi |
670 |
- else |
671 |
- ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
672 |
- if [[ -d "${MY_DATADIR_s}" ]]; then |
673 |
- ewarn "Attempting to use ${MY_DATADIR_s}" |
674 |
- else |
675 |
- eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
676 |
- die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
677 |
- fi |
678 |
- fi |
679 |
- fi |
680 |
- |
681 |
- local pwd1="a" |
682 |
- local pwd2="b" |
683 |
- local maxtry=15 |
684 |
- |
685 |
- if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
686 |
- local tmp_mysqld_password_source= |
687 |
- |
688 |
- for tmp_mysqld_password_source in mysql client; do |
689 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
690 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
691 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
692 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
693 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
694 |
- MYSQL_ROOT_PASSWORD= |
695 |
- continue |
696 |
- fi |
697 |
- |
698 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
699 |
- break |
700 |
- fi |
701 |
- done |
702 |
- |
703 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
704 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
705 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
706 |
- fi |
707 |
- |
708 |
- unset tmp_mysqld_password_source |
709 |
- fi |
710 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
711 |
- # These are dir+prefix |
712 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
713 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
714 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
715 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
716 |
- |
717 |
- if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]]; then |
718 |
- einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
719 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR" |
720 |
- fi |
721 |
- if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]]; then |
722 |
- einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
723 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN" |
724 |
- fi |
725 |
- if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]]; then |
726 |
- einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
727 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG" |
728 |
- fi |
729 |
- |
730 |
- if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then |
731 |
- ewarn "You have already a MySQL database in place." |
732 |
- ewarn "(${ROOT%/}/${MY_DATADIR}/*)" |
733 |
- ewarn "Please rename or delete it if you wish to replace it." |
734 |
- die "MySQL database already exists!" |
735 |
- fi |
736 |
- |
737 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
738 |
- # localhost. Also causes weird failures. |
739 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
740 |
- |
741 |
- if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
742 |
- |
743 |
- einfo "Please provide a password for the mysql 'root' user now" |
744 |
- einfo "or through the ${HOME}/.my.cnf file." |
745 |
- ewarn "Avoid [\"'\\_%] characters in the password" |
746 |
- read -rsp " >" pwd1 ; echo |
747 |
- |
748 |
- einfo "Retype the password" |
749 |
- read -rsp " >" pwd2 ; echo |
750 |
- |
751 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
752 |
- die "Passwords are not the same" |
753 |
- fi |
754 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
755 |
- unset pwd1 pwd2 |
756 |
- fi |
757 |
- |
758 |
- local options |
759 |
- local sqltmp="$(emktemp)" |
760 |
- |
761 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
762 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
763 |
- use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
764 |
- |
765 |
- local help_tables="${EROOT%/}${MY_SHAREDSTATEDIR}/fill_help_tables.sql" |
766 |
- [[ -r "${help_tables}" ]] \ |
767 |
- && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ |
768 |
- || touch "${TMPDIR}/fill_help_tables.sql" |
769 |
- help_tables="${TMPDIR}/fill_help_tables.sql" |
770 |
- |
771 |
- # Figure out which options we need to disable to do the setup |
772 |
- local helpfile="${TMPDIR%/}/mysqld-help" |
773 |
- "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
774 |
- for opt in host-cache name-resolve networking slave-start \ |
775 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
776 |
- log-slave-updates \ |
777 |
- ; do |
778 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
779 |
- egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
780 |
- done |
781 |
- |
782 |
- einfo "Creating the mysql database and setting proper permissions on it ..." |
783 |
- |
784 |
- # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
785 |
- PID_DIR="${EROOT%/}/var/run/mysqld" |
786 |
- if [[ ! -d "${PID_DIR}" ]]; then |
787 |
- install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
788 |
- fi |
789 |
- |
790 |
- if [[ ! -d "${MY_DATADIR}" ]]; then |
791 |
- install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
792 |
- fi |
793 |
- |
794 |
- pushd "${TMPDIR}" &>/dev/null || die |
795 |
- |
796 |
- # Filling timezones, see |
797 |
- # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
798 |
- "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null |
799 |
- chown mysql "${sqltmp}" || die |
800 |
- |
801 |
- local cmd=( "${EROOT%/}/usr/share/mysql/scripts/mysql_install_db" ) |
802 |
- [[ -f "${cmd}" ]] || cmd=( "${EROOT%/}/usr/bin/mysql_install_db" ) |
803 |
- if [[ -r "${help_tables}" ]] ; then |
804 |
- cat "${help_tables}" >> "${sqltmp}" |
805 |
- fi |
806 |
- cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" ) |
807 |
- einfo "Command: ${cmd[*]}" |
808 |
- su -s /bin/sh -c "${cmd[*]}" mysql \ |
809 |
- >"${TMPDIR%/}"/mysql_install_db.log 2>&1 |
810 |
- if [ $? -ne 0 ]; then |
811 |
- grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2 |
812 |
- die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log" |
813 |
- fi |
814 |
- popd &>/dev/null || die |
815 |
- [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \ |
816 |
- || die "MySQL databases not installed" |
817 |
- |
818 |
- use prefix || options="${options} --user=mysql" |
819 |
- |
820 |
- local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock" |
821 |
- local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid" |
822 |
- local mysqld="${EROOT%/}/usr/sbin/mysqld \ |
823 |
- ${options} \ |
824 |
- $(use prefix || echo --user=mysql) \ |
825 |
- --log-warnings=0 \ |
826 |
- --basedir=${EROOT%/}/usr \ |
827 |
- --datadir=${ROOT%/}/${MY_DATADIR} \ |
828 |
- --max_allowed_packet=8M \ |
829 |
- --net_buffer_length=16K \ |
830 |
- --socket=${socket} \ |
831 |
- --pid-file=${pidfile} \ |
832 |
- --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
833 |
- #einfo "About to start mysqld: ${mysqld}" |
834 |
- ebegin "Starting mysqld" |
835 |
- einfo "Command ${mysqld}" |
836 |
- ${mysqld} & |
837 |
- rc=$? |
838 |
- while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
839 |
- maxtry=$((${maxtry}-1)) |
840 |
- echo -n "." |
841 |
- sleep 1 |
842 |
- done |
843 |
- eend $rc |
844 |
- |
845 |
- if ! [[ -S "${socket}" ]]; then |
846 |
- die "Completely failed to start up mysqld with: ${mysqld}" |
847 |
- fi |
848 |
- |
849 |
- ebegin "Setting root password" |
850 |
- # Do this from memory, as we don't want clear text passwords in temp files |
851 |
- local sql="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MYSQL_ROOT_PASSWORD}');" |
852 |
- "${EROOT%/}/usr/bin/mysql" \ |
853 |
- --no-defaults \ |
854 |
- "--socket=${socket}" \ |
855 |
- -hlocalhost \ |
856 |
- -e "${sql}" |
857 |
- eend $? |
858 |
- |
859 |
- if [[ -n "${sqltmp}" ]] ; then |
860 |
- ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
861 |
- "${EROOT%/}/usr/bin/mysql" \ |
862 |
- --socket="${socket}" \ |
863 |
- -hlocalhost \ |
864 |
- -uroot \ |
865 |
- --password="${MYSQL_ROOT_PASSWORD}" \ |
866 |
- mysql < "${sqltmp}" |
867 |
- rc=$? |
868 |
- eend $? |
869 |
- [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
870 |
- fi |
871 |
- |
872 |
- # Stop the server and cleanup |
873 |
- einfo "Stopping the server ..." |
874 |
- kill $(< "${pidfile}" ) |
875 |
- rm -f "${sqltmp}" |
876 |
- wait %1 |
877 |
- einfo "Done" |
878 |
-} |
879 |
|
880 |
diff --git a/dev-db/mysql/mysql-5.7.26-r1.ebuild b/dev-db/mysql/mysql-5.7.26-r1.ebuild |
881 |
deleted file mode 100644 |
882 |
index bdb8fac5396..00000000000 |
883 |
--- a/dev-db/mysql/mysql-5.7.26-r1.ebuild |
884 |
+++ /dev/null |
885 |
@@ -1,991 +0,0 @@ |
886 |
-# Copyright 1999-2020 Gentoo Authors |
887 |
-# Distributed under the terms of the GNU General Public License v2 |
888 |
- |
889 |
-EAPI="6" |
890 |
-MY_EXTRAS_VER="20190822-1908Z" |
891 |
- |
892 |
-CMAKE_MAKEFILE_GENERATOR=emake |
893 |
- |
894 |
-# Keeping eutils in EAPI=6 for emktemp in pkg_config |
895 |
- |
896 |
-inherit cmake-utils eutils flag-o-matic linux-info \ |
897 |
- prefix toolchain-funcs user multilib-minimal |
898 |
- |
899 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz |
900 |
- https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz |
901 |
- http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz" |
902 |
- |
903 |
-# Gentoo patches to MySQL |
904 |
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then |
905 |
- SRC_URI="${SRC_URI} |
906 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
907 |
- https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
908 |
-fi |
909 |
- |
910 |
-HOMEPAGE="https://www.mysql.com/" |
911 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
912 |
-LICENSE="GPL-2" |
913 |
-SLOT="0/18" |
914 |
-IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 libressl numa +perl profiling |
915 |
- selinux +server static static-libs systemtap tcmalloc test yassl" |
916 |
- |
917 |
-# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
918 |
-RESTRICT="!test? ( test ) libressl? ( test )" |
919 |
- |
920 |
-REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )" |
921 |
- |
922 |
-KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
923 |
- |
924 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
925 |
-# and we will run a mysql server during test phase |
926 |
-S="${WORKDIR}/mysql" |
927 |
- |
928 |
-if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
929 |
- inherit git-r3 |
930 |
- EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
931 |
- EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
932 |
- EGIT_CLONE_TYPE=shallow |
933 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
934 |
-else |
935 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
936 |
-fi |
937 |
- |
938 |
-PATCHES=( |
939 |
- "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.23.patch |
940 |
- "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch |
941 |
- "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch |
942 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.26-without-clientlibs-tools.patch |
943 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.25-fix-libressl-support.patch |
944 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-add-missing-gcc-8-fix.patch |
945 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch |
946 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch |
947 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-mips-ASM.patch |
948 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.25-fix-build-without-server.patch |
949 |
-) |
950 |
- |
951 |
-# Be warned, *DEPEND are version-dependant |
952 |
-# These are used for both runtime and compiletime |
953 |
-# MULTILIB_USEDEP only set for libraries used by the client library |
954 |
-COMMON_DEPEND="net-misc/curl:= |
955 |
- >=sys-apps/sed-4 |
956 |
- >=sys-apps/texinfo-4.7-r1 |
957 |
- sys-libs/ncurses:0= |
958 |
- client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] ) |
959 |
- !client-libs? ( |
960 |
- dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] |
961 |
- >=sys-libs/zlib-1.2.3:0= |
962 |
- ) |
963 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
964 |
- kernel_linux? ( |
965 |
- dev-libs/libaio:0= |
966 |
- sys-process/procps:0= |
967 |
- ) |
968 |
- server? ( |
969 |
- >=app-arch/lz4-0_p131:= |
970 |
- cjk? ( app-text/mecab:= ) |
971 |
- experimental? ( |
972 |
- dev-libs/libevent:= |
973 |
- dev-libs/protobuf:= |
974 |
- net-libs/libtirpc:= |
975 |
- ) |
976 |
- numa? ( sys-process/numactl ) |
977 |
- ) |
978 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
979 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
980 |
- !yassl? ( |
981 |
- client-libs? ( |
982 |
- !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] ) |
983 |
- libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] ) |
984 |
- ) |
985 |
- !client-libs? ( |
986 |
- !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
987 |
- libressl? ( dev-libs/libressl:0= ) |
988 |
- ) |
989 |
- ) |
990 |
-" |
991 |
-DEPEND="${COMMON_DEPEND} |
992 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
993 |
- dev-libs/protobuf |
994 |
- virtual/yacc |
995 |
- server? ( |
996 |
- dev-libs/libevent |
997 |
- experimental? ( net-libs/rpcsvc-proto ) |
998 |
- ) |
999 |
- static? ( sys-libs/ncurses[static-libs] ) |
1000 |
- test? ( dev-perl/JSON ) |
1001 |
-" |
1002 |
-RDEPEND="${COMMON_DEPEND} |
1003 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
1004 |
- client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= ) |
1005 |
- selinux? ( sec-policy/selinux-mysql ) |
1006 |
- server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
1007 |
-" |
1008 |
-# For other stuff to bring us in |
1009 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
1010 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
1011 |
- |
1012 |
-mysql_init_vars() { |
1013 |
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
1014 |
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
1015 |
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
1016 |
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
1017 |
- |
1018 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
1019 |
- MY_DATADIR="" |
1020 |
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
1021 |
- MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
1022 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
1023 |
- | tail -n1` |
1024 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
1025 |
- MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
1026 |
- | sed -e 's/.*=\s*//' \ |
1027 |
- | tail -n1` |
1028 |
- fi |
1029 |
- fi |
1030 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
1031 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
1032 |
- einfo "Using default MY_DATADIR" |
1033 |
- fi |
1034 |
- elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
1035 |
- |
1036 |
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
1037 |
- if [[ -e "${MY_DATADIR}" ]] ; then |
1038 |
- # If you get this and you're wondering about it, see bug #207636 |
1039 |
- elog "MySQL datadir found in ${MY_DATADIR}" |
1040 |
- elog "A new one will not be created." |
1041 |
- PREVIOUS_DATADIR="yes" |
1042 |
- else |
1043 |
- PREVIOUS_DATADIR="no" |
1044 |
- fi |
1045 |
- export PREVIOUS_DATADIR |
1046 |
- fi |
1047 |
- else |
1048 |
- if [[ ${EBUILD_PHASE} == "config" ]] ; then |
1049 |
- local new_MY_DATADIR |
1050 |
- new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
1051 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
1052 |
- | tail -n1` |
1053 |
- |
1054 |
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then |
1055 |
- ewarn "MySQL MY_DATADIR has changed" |
1056 |
- ewarn "from ${MY_DATADIR}" |
1057 |
- ewarn "to ${new_MY_DATADIR}" |
1058 |
- MY_DATADIR="${new_MY_DATADIR}" |
1059 |
- fi |
1060 |
- fi |
1061 |
- fi |
1062 |
- |
1063 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
1064 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
1065 |
- export MY_DATADIR |
1066 |
-} |
1067 |
- |
1068 |
-pkg_pretend() { |
1069 |
- if use numa ; then |
1070 |
- local CONFIG_CHECK="~NUMA" |
1071 |
- |
1072 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
1073 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
1074 |
- |
1075 |
- check_extra_config |
1076 |
- fi |
1077 |
-} |
1078 |
- |
1079 |
-pkg_setup() { |
1080 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
1081 |
- local GCC_MAJOR_SET=$(gcc-major-version) |
1082 |
- local GCC_MINOR_SET=$(gcc-minor-version) |
1083 |
- # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on |
1084 |
- # non x86{,_64} arches |
1085 |
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
1086 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
1087 |
- eerror "${PN} needs to be built with gcc-4.7 or later." |
1088 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
1089 |
- die |
1090 |
- fi |
1091 |
- fi |
1092 |
- |
1093 |
- if has test ${FEATURES} && \ |
1094 |
- use server && ! has userpriv ${FEATURES} ; then |
1095 |
- eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
1096 |
- fi |
1097 |
- |
1098 |
- # This should come after all of the die statements |
1099 |
- enewgroup mysql 60 || die "problem adding 'mysql' group" |
1100 |
- enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
1101 |
-} |
1102 |
- |
1103 |
-pkg_preinst() { |
1104 |
- # Here we need to see if the implementation switched client libraries |
1105 |
- # We check if this is a new instance of the package and a client library already exists |
1106 |
- local SHOW_ABI_MESSAGE libpath |
1107 |
- if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
1108 |
- libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
1109 |
- elog "Due to ABI changes when switching between different client libraries," |
1110 |
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
1111 |
- elog "Please run: revdep-rebuild --library ${libpath}" |
1112 |
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
1113 |
- fi |
1114 |
-} |
1115 |
- |
1116 |
-pkg_postinst() { |
1117 |
- # Make sure the vars are correctly initialized |
1118 |
- mysql_init_vars |
1119 |
- |
1120 |
- # Create log directory securely if it does not exist |
1121 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
1122 |
- |
1123 |
- if use server ; then |
1124 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
1125 |
- einfo |
1126 |
- elog "You might want to run:" |
1127 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
1128 |
- elog "if this is a new install." |
1129 |
- elog |
1130 |
- elog "If you are switching server implentations, you should run the" |
1131 |
- elog "mysql_upgrade tool." |
1132 |
- einfo |
1133 |
- else |
1134 |
- einfo |
1135 |
- elog "If you are upgrading major versions, you should run the" |
1136 |
- elog "mysql_upgrade tool." |
1137 |
- einfo |
1138 |
- fi |
1139 |
- fi |
1140 |
- |
1141 |
- # Note about configuration change |
1142 |
- einfo |
1143 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
1144 |
- elog "to several files in /etc/mysql/mysql.d." |
1145 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
1146 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
1147 |
- elog "You may have as many files as needed and they are read alphabetically." |
1148 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
1149 |
- einfo |
1150 |
-} |
1151 |
- |
1152 |
-src_unpack() { |
1153 |
- unpack ${A} |
1154 |
- # Grab the patches |
1155 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
1156 |
- |
1157 |
- mv -f "${WORKDIR}/${P}" "${S}" || die |
1158 |
-} |
1159 |
- |
1160 |
-src_prepare() { |
1161 |
- cmake-utils_src_prepare |
1162 |
- |
1163 |
- if use jemalloc ; then |
1164 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
1165 |
- fi |
1166 |
- |
1167 |
- if use tcmalloc ; then |
1168 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
1169 |
- fi |
1170 |
- |
1171 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
1172 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
1173 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
1174 |
- fi |
1175 |
- |
1176 |
- # Remove bundled libs so we cannot accidentally use them |
1177 |
- # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394 |
1178 |
- rm -rv \ |
1179 |
- "${S}"/extra/protobuf \ |
1180 |
- "${S}"/extra/libevent \ |
1181 |
- "${S}"/zlib \ |
1182 |
- || die |
1183 |
- |
1184 |
- if use libressl ; then |
1185 |
- sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \ |
1186 |
- "${S}/cmake/ssl.cmake" || die |
1187 |
- fi |
1188 |
- |
1189 |
- sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
1190 |
-} |
1191 |
- |
1192 |
-src_configure() { |
1193 |
- # Bug #114895, bug #110149 |
1194 |
- filter-flags "-O" "-O[01]" |
1195 |
- |
1196 |
- append-cxxflags -felide-constructors |
1197 |
- |
1198 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
1199 |
- append-flags -fno-strict-aliasing |
1200 |
- |
1201 |
- if use client-libs ; then |
1202 |
- multilib-minimal_src_configure |
1203 |
- else |
1204 |
- multilib_src_configure |
1205 |
- fi |
1206 |
-} |
1207 |
- |
1208 |
-multilib_src_configure() { |
1209 |
- debug-print-function ${FUNCNAME} "$@" |
1210 |
- |
1211 |
- if ! multilib_is_native_abi && ! use client-libs ; then |
1212 |
- return |
1213 |
- fi |
1214 |
- |
1215 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
1216 |
- |
1217 |
- # debug hack wrt #497532 |
1218 |
- mycmakeargs=( |
1219 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
1220 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
1221 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
1222 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
1223 |
- -DINSTALL_BINDIR=bin |
1224 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
1225 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
1226 |
- -DINSTALL_INCLUDEDIR=include/mysql |
1227 |
- -DINSTALL_INFODIR=share/info |
1228 |
- -DINSTALL_LIBDIR=$(get_libdir) |
1229 |
- -DINSTALL_MANDIR=share/man |
1230 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
1231 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
1232 |
- -DINSTALL_SCRIPTDIR=share/mysql/scripts |
1233 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
1234 |
- -DINSTALL_SBINDIR=sbin |
1235 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
1236 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
1237 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
1238 |
- ### TODO: make this system but issues with UTF-8 prevent it |
1239 |
- -DWITH_EDITLINE=bundled |
1240 |
- -DWITH_ZLIB=system |
1241 |
- -DWITH_LIBWRAP=0 |
1242 |
- -DENABLED_LOCAL_INFILE=1 |
1243 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
1244 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
1245 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
1246 |
- # The build forces this to be defined when cross-compiling. We pass it |
1247 |
- # all the time for simplicity and to make sure it is actually correct. |
1248 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
1249 |
- -DWITH_CURL=system |
1250 |
- -DWITH_BOOST="${S}/boost" |
1251 |
- ) |
1252 |
- if use test ; then |
1253 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
1254 |
- else |
1255 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
1256 |
- fi |
1257 |
- |
1258 |
- if ! use yassl ; then |
1259 |
- mycmakeargs+=( -DWITH_SSL=system ) |
1260 |
- else |
1261 |
- mycmakeargs+=( -DWITH_SSL=bundled ) |
1262 |
- fi |
1263 |
- |
1264 |
- if ! use client-libs ; then |
1265 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
1266 |
- fi |
1267 |
- |
1268 |
- # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
1269 |
- # systemtap only works on native ABI, bug 530132 |
1270 |
- if multilib_is_native_abi ; then |
1271 |
- mycmakeargs+=( |
1272 |
- -DENABLE_DTRACE=$(usex systemtap) |
1273 |
- ) |
1274 |
- else |
1275 |
- mycmakeargs+=( |
1276 |
- -DWITHOUT_TOOLS=1 |
1277 |
- -DWITH_READLINE=1 |
1278 |
- -DENABLE_DTRACE=0 |
1279 |
- ) |
1280 |
- fi |
1281 |
- |
1282 |
- if multilib_is_native_abi && use server ; then |
1283 |
- mycmakeargs+=( |
1284 |
- -DWITH_LIBEVENT=system |
1285 |
- -DWITH_LZ4=system |
1286 |
- -DWITH_PROTOBUF=system |
1287 |
- -DWITH_MECAB=$(usex cjk system OFF) |
1288 |
- -DWITH_NUMA=$(usex numa ON OFF) |
1289 |
- -DWITH_RAPID=$(usex experimental ON OFF) |
1290 |
- ) |
1291 |
- |
1292 |
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then |
1293 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
1294 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
1295 |
- ewarn "You MUST file bugs without these variables set." |
1296 |
- |
1297 |
- mycmakeargs+=( |
1298 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
1299 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
1300 |
- ) |
1301 |
- elif ! use latin1 ; then |
1302 |
- mycmakeargs+=( |
1303 |
- -DDEFAULT_CHARSET=utf8 |
1304 |
- -DDEFAULT_COLLATION=utf8_general_ci |
1305 |
- ) |
1306 |
- else |
1307 |
- mycmakeargs+=( |
1308 |
- -DDEFAULT_CHARSET=latin1 |
1309 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
1310 |
- ) |
1311 |
- fi |
1312 |
- |
1313 |
- mycmakeargs+=( |
1314 |
- -DEXTRA_CHARSETS=all |
1315 |
- -DDISABLE_SHARED=$(usex static YES NO) |
1316 |
- -DWITH_DEBUG=$(usex debug) |
1317 |
- -DWITH_EMBEDDED_SERVER=OFF |
1318 |
- ) |
1319 |
- |
1320 |
- if use profiling ; then |
1321 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
1322 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
1323 |
- # "main.mysqld--help-notwin" test to fail |
1324 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
1325 |
- fi |
1326 |
- |
1327 |
- if use static ; then |
1328 |
- mycmakeargs+=( -DWITH_PIC=1 ) |
1329 |
- fi |
1330 |
- |
1331 |
- # Storage engines |
1332 |
- mycmakeargs+=( |
1333 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
1334 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
1335 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
1336 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
1337 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
1338 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
1339 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
1340 |
- -DWITH_INNODB_MEMCACHED=0 |
1341 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
1342 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
1343 |
- -DWITH_PARTITION_STORAGE_ENGINE=1 |
1344 |
- ) |
1345 |
- |
1346 |
- else |
1347 |
- mycmakeargs+=( |
1348 |
- -DWITHOUT_SERVER=1 |
1349 |
- -DWITH_EMBEDDED_SERVER=OFF |
1350 |
- -DEXTRA_CHARSETS=none |
1351 |
- ) |
1352 |
- fi |
1353 |
- |
1354 |
- cmake-utils_src_configure |
1355 |
-} |
1356 |
- |
1357 |
-src_compile() { |
1358 |
- if use client-libs ; then |
1359 |
- multilib-minimal_src_compile |
1360 |
- else |
1361 |
- multilib_src_compile |
1362 |
- fi |
1363 |
-} |
1364 |
- |
1365 |
-multilib_src_compile() { |
1366 |
- cmake-utils_src_compile |
1367 |
-} |
1368 |
- |
1369 |
-# Official test instructions: |
1370 |
-# ulimit -n 16500 && \ |
1371 |
-# USE='latin1 perl server' \ |
1372 |
-# FEATURES='test userpriv -usersandbox' \ |
1373 |
-# ebuild mysql-X.X.XX.ebuild \ |
1374 |
-# digest clean package |
1375 |
-src_test() { |
1376 |
- _disable_test() { |
1377 |
- local rawtestname reason |
1378 |
- rawtestname="${1}" ; shift |
1379 |
- reason="${@}" |
1380 |
- ewarn "test '${rawtestname}' disabled: '${reason}'" |
1381 |
- echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
1382 |
- } |
1383 |
- |
1384 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
1385 |
- local retstatus_unit |
1386 |
- local retstatus_tests |
1387 |
- |
1388 |
- if ! use server ; then |
1389 |
- einfo "Skipping server tests due to minimal build." |
1390 |
- return 0 |
1391 |
- fi |
1392 |
- |
1393 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1394 |
- # localhost. Also causes weird failures. |
1395 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1396 |
- |
1397 |
- if [[ $UID -eq 0 ]] ; then |
1398 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
1399 |
- fi |
1400 |
- has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
1401 |
- |
1402 |
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
1403 |
- |
1404 |
- # Run CTest (test-units) |
1405 |
- cmake-utils_src_test |
1406 |
- retstatus_unit=$? |
1407 |
- |
1408 |
- # Ensure that parallel runs don't die |
1409 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
1410 |
- # Enable parallel testing, auto will try to detect number of cores |
1411 |
- # You may set this by hand. |
1412 |
- # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
1413 |
- export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
1414 |
- |
1415 |
- # create directories because mysqladmin might run out of order |
1416 |
- mkdir -p "${T}"/var-tests{,/log} || die |
1417 |
- |
1418 |
- # Run mysql tests |
1419 |
- pushd "${TESTDIR}" &>/dev/null || die |
1420 |
- |
1421 |
- touch "${T}/disabled.def" |
1422 |
- # These are failing in MySQL 5.7 for now and are believed to be |
1423 |
- # false positives: |
1424 |
- # |
1425 |
- local t |
1426 |
- |
1427 |
- for t in auth_sec.keyring_udf ; do |
1428 |
- _disable_test "$t" "False positives in Gentoo" |
1429 |
- done |
1430 |
- |
1431 |
- # Unstable tests |
1432 |
- # - main.xa_prepared_binlog_off: https://bugs.mysql.com/bug.php?id=83340 |
1433 |
- # - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223 |
1434 |
- # - rpl.rpl_non_direct_stm_mixing_engines: MDEV-14489 |
1435 |
- for t in \ |
1436 |
- main.xa_prepared_binlog_off \ |
1437 |
- rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \ |
1438 |
- rpl.rpl_non_direct_stm_mixing_engines \ |
1439 |
- ; do |
1440 |
- _disable_test "$t" "Unstable test" |
1441 |
- done |
1442 |
- |
1443 |
- for t in \ |
1444 |
- gis.geometry_class_attri_prop \ |
1445 |
- gis.geometry_property_function_issimple \ |
1446 |
- gis.gis_bugs_crashes \ |
1447 |
- gis.spatial_op_testingfunc_mix \ |
1448 |
- gis.spatial_analysis_functions_buffer \ |
1449 |
- gis.spatial_analysis_functions_distance \ |
1450 |
- gis.spatial_utility_function_distance_sphere \ |
1451 |
- gis.spatial_utility_function_simplify \ |
1452 |
- gis.spatial_analysis_functions_centroid \ |
1453 |
- ; do |
1454 |
- _disable_test "$t" "Known rounding error with latest AMD processors" |
1455 |
- done |
1456 |
- |
1457 |
- if use numa && use kernel_linux ; then |
1458 |
- # bug 584880 |
1459 |
- if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then |
1460 |
- for t in sys_vars.innodb_numa_interleave_basic ; do |
1461 |
- _disable_test "$t" "Test $t requires system with NUMA support" |
1462 |
- done |
1463 |
- fi |
1464 |
- fi |
1465 |
- |
1466 |
- if ! use latin1 ; then |
1467 |
- # The following tests will fail if DEFAULT_CHARSET |
1468 |
- # isn't set to latin1: |
1469 |
- for t in \ |
1470 |
- binlog.binlog_mysqlbinlog_filter \ |
1471 |
- binlog.binlog_xa_prepared_disconnect \ |
1472 |
- funcs_1.is_columns_mysql \ |
1473 |
- funcs_1.is_tables_mysql \ |
1474 |
- funcs_1.is_triggers \ |
1475 |
- innodb.innodb_pagesize_max_recordsize \ |
1476 |
- innodb.innodb-system-table-view \ |
1477 |
- innodb.mysqldump_max_recordsize \ |
1478 |
- main.mysql_client_test \ |
1479 |
- main.mysqld--help-notwin \ |
1480 |
- main.type_string \ |
1481 |
- main.information_schema \ |
1482 |
- perfschema.binlog_edge_mix \ |
1483 |
- perfschema.binlog_edge_stmt \ |
1484 |
- rpl.rpl_xa_survive_disconnect \ |
1485 |
- rpl.rpl_xa_survive_disconnect_lsu_off \ |
1486 |
- rpl.rpl_xa_survive_disconnect_table \ |
1487 |
- ; do |
1488 |
- _disable_test "$t" "Requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set" |
1489 |
- done |
1490 |
- fi |
1491 |
- |
1492 |
- if has_version '>=dev-libs/openssl-1.1.1' ; then |
1493 |
- # Tests are expecting <openssl-1.1.1 default cipher |
1494 |
- for t in \ |
1495 |
- auth_sec.cert_verify \ |
1496 |
- auth_sec.mysql_ssl_connection \ |
1497 |
- auth_sec.openssl_cert_generation \ |
1498 |
- auth_sec.ssl_auto_detect \ |
1499 |
- auth_sec.ssl_mode \ |
1500 |
- auth_sec.tls \ |
1501 |
- binlog.binlog_grant_alter_user \ |
1502 |
- encryption.innodb_onlinealter_encryption \ |
1503 |
- main.grant_alter_user_qa \ |
1504 |
- main.grant_user_lock_qa \ |
1505 |
- main.mysql_ssl_default \ |
1506 |
- main.openssl_1 \ |
1507 |
- main.plugin_auth_sha256_tls \ |
1508 |
- main.ssl \ |
1509 |
- main.ssl_8k_key \ |
1510 |
- main.ssl_bug75311 \ |
1511 |
- main.ssl_ca \ |
1512 |
- main.ssl_cipher \ |
1513 |
- main.ssl_compress \ |
1514 |
- main.ssl_crl \ |
1515 |
- main.ssl_ecdh \ |
1516 |
- main.ssl_verify_identity \ |
1517 |
- x.connection_tls_version \ |
1518 |
- x.connection_openssl \ |
1519 |
- ; do |
1520 |
- _disable_test "$t" "Requires <dev-libs/openssl-1.1.1" |
1521 |
- done |
1522 |
- fi |
1523 |
- |
1524 |
- # Try to increase file limits to increase test coverage |
1525 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
1526 |
- # Upper limit comes from parts.partition_* tests |
1527 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
1528 |
- |
1529 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
1530 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
1531 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
1532 |
- |
1533 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
1534 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
1535 |
- else |
1536 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
1537 |
- fi |
1538 |
- else |
1539 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
1540 |
- fi |
1541 |
- else |
1542 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
1543 |
- fi |
1544 |
- |
1545 |
- # run mysql-test tests |
1546 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
1547 |
- retstatus_tests=$? |
1548 |
- |
1549 |
- popd &>/dev/null || die |
1550 |
- |
1551 |
- # Cleanup is important for these testcases. |
1552 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
1553 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
1554 |
- |
1555 |
- local failures="" |
1556 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
1557 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
1558 |
- |
1559 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
1560 |
- einfo "Tests successfully completed" |
1561 |
-} |
1562 |
- |
1563 |
-src_install() { |
1564 |
- local MULTILIB_WRAPPED_HEADERS |
1565 |
- local MULTILIB_CHOST_TOOLS |
1566 |
- if use client-libs ; then |
1567 |
- # headers with ABI specific data |
1568 |
- MULTILIB_WRAPPED_HEADERS=( |
1569 |
- /usr/include/mysql/server/my_config.h |
1570 |
- /usr/include/mysql/server/mysql_version.h ) |
1571 |
- |
1572 |
- # wrap the config scripts |
1573 |
- MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config ) |
1574 |
- multilib-minimal_src_install |
1575 |
- else |
1576 |
- multilib_src_install |
1577 |
- multilib_src_install_all |
1578 |
- fi |
1579 |
-} |
1580 |
- |
1581 |
-# Intentionally override eclass function |
1582 |
-multilib_src_install() { |
1583 |
- |
1584 |
- cmake-utils_src_install |
1585 |
- |
1586 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
1587 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
1588 |
-} |
1589 |
- |
1590 |
-multilib_src_install_all() { |
1591 |
- # Make sure the vars are correctly initialized |
1592 |
- mysql_init_vars |
1593 |
- |
1594 |
- # Convenience links |
1595 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
1596 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
1597 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
1598 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
1599 |
- |
1600 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
1601 |
- if [[ -d "${ED}/usr/data" ]] ; then |
1602 |
- rm -Rf "${ED}/usr/data" || die |
1603 |
- fi |
1604 |
- |
1605 |
- # Unless they explicitly specific USE=test, then do not install the |
1606 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
1607 |
- # validation of your database configuration after tuning it. |
1608 |
- if ! use test ; then |
1609 |
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
1610 |
- fi |
1611 |
- |
1612 |
- # Configuration stuff |
1613 |
- einfo "Building default configuration ..." |
1614 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
1615 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
1616 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
1617 |
- eprefixify "${TMPDIR}/my.cnf" |
1618 |
- doins "${TMPDIR}/my.cnf" |
1619 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
1620 |
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
1621 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
1622 |
- doins "${TMPDIR}/50-distro-client.cnf" |
1623 |
- |
1624 |
- if use server ; then |
1625 |
- mycnf_src="my.cnf.distro-server" |
1626 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
1627 |
- "${FILESDIR}/${mycnf_src}" \ |
1628 |
- > "${TMPDIR}/my.cnf.ok" || die |
1629 |
- |
1630 |
- if use prefix ; then |
1631 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
1632 |
- "${TMPDIR}/my.cnf.ok" || die |
1633 |
- fi |
1634 |
- |
1635 |
- if use latin1 ; then |
1636 |
- sed -i \ |
1637 |
- -e "/character-set/s|utf8|latin1|g" \ |
1638 |
- "${TMPDIR}/my.cnf.ok" || die |
1639 |
- fi |
1640 |
- |
1641 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
1642 |
- |
1643 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
1644 |
- fi |
1645 |
- |
1646 |
- #Remove mytop if perl is not selected |
1647 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
1648 |
-} |
1649 |
- |
1650 |
-pkg_config() { |
1651 |
- _getoptval() { |
1652 |
- local mypd="${EROOT%/}"/usr/bin/my_print_defaults |
1653 |
- local section="$1" |
1654 |
- local flag="--${2}=" |
1655 |
- local extra_options="${3}" |
1656 |
- "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
1657 |
- } |
1658 |
- local old_MY_DATADIR="${MY_DATADIR}" |
1659 |
- local old_HOME="${HOME}" |
1660 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
1661 |
- export HOME=${EPREFIX}/root |
1662 |
- |
1663 |
- # Make sure the vars are correctly initialized |
1664 |
- mysql_init_vars |
1665 |
- |
1666 |
- [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
1667 |
- if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then |
1668 |
- die "Minimal builds do NOT include the MySQL server" |
1669 |
- fi |
1670 |
- |
1671 |
- if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then |
1672 |
- local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}" |
1673 |
- MY_DATADIR_s="${MY_DATADIR_s%%/}" |
1674 |
- local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}" |
1675 |
- old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
1676 |
- |
1677 |
- if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then |
1678 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
1679 |
- ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
1680 |
- ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
1681 |
- else |
1682 |
- elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
1683 |
- mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
1684 |
- || die "Moving MY_DATADIR failed" |
1685 |
- fi |
1686 |
- else |
1687 |
- ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
1688 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
1689 |
- ewarn "Attempting to use ${MY_DATADIR_s}" |
1690 |
- else |
1691 |
- eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
1692 |
- die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
1693 |
- fi |
1694 |
- fi |
1695 |
- fi |
1696 |
- |
1697 |
- local pwd1="a" |
1698 |
- local pwd2="b" |
1699 |
- local maxtry=15 |
1700 |
- |
1701 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1702 |
- local tmp_mysqld_password_source= |
1703 |
- |
1704 |
- for tmp_mysqld_password_source in mysql client ; do |
1705 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
1706 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
1707 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1708 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
1709 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
1710 |
- MYSQL_ROOT_PASSWORD= |
1711 |
- continue |
1712 |
- fi |
1713 |
- |
1714 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
1715 |
- break |
1716 |
- fi |
1717 |
- done |
1718 |
- |
1719 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
1720 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
1721 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
1722 |
- fi |
1723 |
- |
1724 |
- unset tmp_mysqld_password_source |
1725 |
- fi |
1726 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
1727 |
- # These are dir+prefix |
1728 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
1729 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
1730 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
1731 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
1732 |
- |
1733 |
- if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then |
1734 |
- einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
1735 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR" |
1736 |
- fi |
1737 |
- |
1738 |
- if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then |
1739 |
- einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
1740 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN" |
1741 |
- fi |
1742 |
- |
1743 |
- if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then |
1744 |
- einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
1745 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG" |
1746 |
- fi |
1747 |
- |
1748 |
- if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then |
1749 |
- ewarn "You have already a MySQL database in place." |
1750 |
- ewarn "(${ROOT%/}/${MY_DATADIR}/*)" |
1751 |
- ewarn "Please rename or delete it if you wish to replace it." |
1752 |
- die "MySQL database already exists!" |
1753 |
- fi |
1754 |
- |
1755 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1756 |
- # localhost. Also causes weird failures. |
1757 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1758 |
- |
1759 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1760 |
- |
1761 |
- einfo "Please provide a password for the mysql 'root' user now" |
1762 |
- einfo "or through the ${HOME}/.my.cnf file." |
1763 |
- ewarn "Avoid [\"'\\_%] characters in the password" |
1764 |
- read -rsp " >" pwd1 ; echo |
1765 |
- |
1766 |
- einfo "Retype the password" |
1767 |
- read -rsp " >" pwd2 ; echo |
1768 |
- |
1769 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
1770 |
- die "Passwords are not the same" |
1771 |
- fi |
1772 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
1773 |
- unset pwd1 pwd2 |
1774 |
- fi |
1775 |
- |
1776 |
- local options |
1777 |
- local sqltmp="$(emktemp)" |
1778 |
- |
1779 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
1780 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
1781 |
- use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
1782 |
- |
1783 |
- # Figure out which options we need to disable to do the setup |
1784 |
- local helpfile="${TMPDIR%/}/mysqld-help" |
1785 |
- "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
1786 |
- for opt in host-cache name-resolve networking slave-start \ |
1787 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
1788 |
- log-slave-updates \ |
1789 |
- ; do |
1790 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
1791 |
- egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
1792 |
- done |
1793 |
- |
1794 |
- einfo "Creating the mysql database and setting proper permissions on it ..." |
1795 |
- |
1796 |
- # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
1797 |
- PID_DIR="${EROOT%/}/var/run/mysqld" |
1798 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
1799 |
- install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
1800 |
- fi |
1801 |
- |
1802 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
1803 |
- install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
1804 |
- fi |
1805 |
- |
1806 |
- pushd "${TMPDIR}" &>/dev/null || die |
1807 |
- |
1808 |
- # Filling timezones, see |
1809 |
- # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
1810 |
- echo "USE mysql;" >"${sqltmp}" |
1811 |
- "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null |
1812 |
- chown mysql "${sqltmp}" || die |
1813 |
- |
1814 |
- # --initialize-insecure will not set root password |
1815 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
1816 |
- local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" ) |
1817 |
- cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" ) |
1818 |
- einfo "Command: ${cmd[*]}" |
1819 |
- su -s /bin/sh -c "${cmd[*]}" mysql \ |
1820 |
- >"${TMPDIR%/}"/mysql_install_db.log 2>&1 |
1821 |
- if [[ $? -ne 0 ]] ; then |
1822 |
- grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2 |
1823 |
- die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log" |
1824 |
- fi |
1825 |
- popd &>/dev/null || die |
1826 |
- [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \ |
1827 |
- || die "MySQL databases not installed" |
1828 |
- |
1829 |
- use prefix || options="${options} --user=mysql" |
1830 |
- |
1831 |
- local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock" |
1832 |
- local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid" |
1833 |
- local mysqld="${EROOT%/}/usr/sbin/mysqld \ |
1834 |
- ${options} \ |
1835 |
- $(use prefix || echo --user=mysql) \ |
1836 |
- --log-warnings=0 \ |
1837 |
- --basedir=${EROOT%/}/usr \ |
1838 |
- --datadir=${ROOT%/}/${MY_DATADIR} \ |
1839 |
- --max_allowed_packet=8M \ |
1840 |
- --net_buffer_length=16K \ |
1841 |
- --socket=${socket} \ |
1842 |
- --pid-file=${pidfile} \ |
1843 |
- --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
1844 |
- #einfo "About to start mysqld: ${mysqld}" |
1845 |
- ebegin "Starting mysqld" |
1846 |
- einfo "Command ${mysqld}" |
1847 |
- ${mysqld} & |
1848 |
- rc=$? |
1849 |
- while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
1850 |
- maxtry=$((${maxtry}-1)) |
1851 |
- echo -n "." |
1852 |
- sleep 1 |
1853 |
- done |
1854 |
- eend $rc |
1855 |
- |
1856 |
- if ! [[ -S "${socket}" ]] ; then |
1857 |
- die "Completely failed to start up mysqld with: ${mysqld}" |
1858 |
- fi |
1859 |
- |
1860 |
- ebegin "Setting root password" |
1861 |
- # Do this from memory, as we don't want clear text passwords in temp files |
1862 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'" |
1863 |
- "${EROOT%/}/usr/bin/mysql" \ |
1864 |
- --no-defaults \ |
1865 |
- "--socket=${socket}" \ |
1866 |
- -hlocalhost \ |
1867 |
- -e "${sql}" |
1868 |
- eend $? |
1869 |
- |
1870 |
- # Stop the server and cleanup |
1871 |
- einfo "Stopping the server ..." |
1872 |
- kill $(< "${pidfile}" ) |
1873 |
- rm -f "${sqltmp}" |
1874 |
- wait %1 |
1875 |
- einfo "Done" |
1876 |
-} |