1 |
commit: 341071a88d534733a4747688c9bc18c2a65fe2bc |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jun 4 11:36:26 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 4 11:36:44 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=341071a8 |
7 |
|
8 |
dev-db/mysql: bump to v5.6.44 |
9 |
|
10 |
Package-Manager: Portage-2.3.67, Repoman-2.3.14 |
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.ebuild | 800 +++++++++++++++++++++++++++++++++++++++ |
15 |
2 files changed, 802 insertions(+) |
16 |
|
17 |
diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest |
18 |
index 0830d5f2d70..953647867d1 100644 |
19 |
--- a/dev-db/mysql/Manifest |
20 |
+++ b/dev-db/mysql/Manifest |
21 |
@@ -3,6 +3,7 @@ DIST mysql-5.5.62.tar.gz 21111902 BLAKE2B f1cbb1c6b4dfac11c2c517a57a5c6216ce4376 |
22 |
DIST mysql-5.6.40.tar.gz 32083035 BLAKE2B efcc078341bae239df28ac0504111aa34926885ae47edb5011352b56552a5a3abd1f824f8cbdc23d8d667592b8f5510946ef18c3efa61865dbbc7f4bb8a2d4a0 SHA512 c8e458b4cd34cae87f1b088ed2188bd00de8cdc42709d5964e82fa2e4aaecfc12a75ae006c54ffa0d3d286fbdef9704d0cbb83436437d5705fb8921d960e758c |
23 |
DIST mysql-5.6.42.tar.gz 32201731 BLAKE2B c573328b37225dac090c32178f90e1419fc1848612e304bddc11eafdd48228981a846857be680978b72ef76edbd5d2422a98b5d20b4d082fabcc2b072e2b8fde SHA512 3104e6a3145a119f2b012de6af2a92fc37134aa402b889a562f5fc2391705d0bc2f718166c5fa8387d973fff5ecd9544c8b389b6d0c81d98bdcaf2acfb9b55e8 |
24 |
DIST mysql-5.6.43.tar.gz 32200219 BLAKE2B 2aa1397ff5f011a169ae47650be8db7a097a62f53ff06d63760a419906841f0540db19449c1d71d60be7d684e49b4436e1d6e72e7a1cf99057a3f98fad11557f SHA512 8820aee9b34cfebc841d756b12713517c9dafed7bee7b09c8e82c8f359e2e12b25da47c4e49e0aa4afc26193b774e0fa0dfd422c2aa09c3112b6d6e4b62b9a68 |
25 |
+DIST mysql-5.6.44.tar.gz 32531507 BLAKE2B 28fbf49f699eb9f43223ffa186671b119d16016274cc7192db232b85c58123a61154e37193b9b7145c6a650b80b5f6cf838529bc2bc5ea9c78c0dbc39de834d3 SHA512 65ace1c803773ca6c8759d171c09bc93c7d61b8e3208ac9905f82e99087622c9dcca602d2da217741dc62fc6eabe9108ebc7f31facd26705072eae65fcc37077 |
26 |
DIST mysql-boost-5.7.23.tar.gz 49025014 BLAKE2B 669f10779bc2cda866d6bd876b4efe55fb4b0c796f596f66513a3ca85f322e2a03e9879eecd72a69729a0cb71d408c46cdd9086ae456712b4adff6ae7c584c97 SHA512 e4317f89d108a68652cd95e41ffd670c37b6663aabd6af3985d18052fb7e8d8879b5822399caf9091cecc0a949ec588c121c87cfd60d69941f68d0ecbedd0953 |
27 |
DIST mysql-boost-5.7.24.tar.gz 49110448 BLAKE2B 1cf64712d84cbb2dfd31f2a530470b6f7cbf5ae9107106d86705575ea9739fa582e1f079447d9a58c4762fffc636d69e448ebdec9172ee15dc09245bc39c3525 SHA512 bbd411e15cd9e6053a353146808b74881d2d950f09e94794a699e7604dadf767b58b661a8321fbe1424f2c2e6cfc3adaa388242183e759082eae47b64cbfbcde |
28 |
DIST mysql-boost-5.7.25.tar.gz 49107578 BLAKE2B 8a43479c496ce45e71df905b0cb6da442340b691caa15f9862a8c981e7189c50e73b1701c393fe46ab580c508f785d5f15259c2331c77e0790191f3d41bb385c SHA512 b111c64bfcd49dba584bed71a0c7ce33b2b0654654d8f4eaa1a2b7a5daed9674ebfd4a0dfb93c20ffee028feead4709eaf600bb5469f81c86b743d395dfe27a9 |
29 |
@@ -12,3 +13,4 @@ DIST mysql-extras-20181023-0012Z.tar.bz2 327834 BLAKE2B 91a82cbcecbbbe94933da0d8 |
30 |
DIST mysql-extras-20181111-2314Z.tar.bz2 329013 BLAKE2B fa928b699ef0e6f092e028fc1331cc33953d9855e784998fb2f8c1f1712e9424567b2d2b6b7c5ca375f178309522b3596fcba7babdbed7c85b87ae4b85e5db22 SHA512 5cc4d16c5c6b0491fb9532469ec0b9c65e27e1514d561ea4180845a1578fc8e7ba00fca479b9a784646846f5147e4f676340f639b78c3f5ee140dda26bd5bff2 |
31 |
DIST mysql-extras-20190303-1852Z.tar.bz2 331026 BLAKE2B ee033fce8f1b6a58f1f690710fb9709a585cd45564b35e71d4f840a3a7f83a5d80f53c24236c9976319abd89c68c62c74a7111517f1b9721d3cbd0898bf0dd8d SHA512 30361a0b848ed27f9170b1116458a9bc13b1b585c5fa1933c99927541c31e9bda4008b0563f2fc7db286f998089ebebf1fe3f18fce7a45e62acbf769ac62d8c1 |
32 |
DIST mysql-extras-20190524-1046Z.tar.bz2 331517 BLAKE2B e6d48e34b0a7f7176de8740971f8151923beb20a520df73c22d44005059ef6779ad5aa8437e30018b9bbfe1d6d69043cbd8522b6f3662746205193b44372a6b3 SHA512 2f7238578f3aabd1701e1c54da36bc0100c9479871e3c77b22131fd6cde865037307f93b3343ea5e52251c45ef35cdc52cc2dec5a26d44fd41700598282c5c2c |
33 |
+DIST mysql-extras-20190604-1109Z.tar.bz2 331780 BLAKE2B 48b6f6ff36818ba3d1d9c0580b0ff5e2343d92a42ee78b6804841d7c4f511adcdc3d5cd0590f769f308ca52e271c07cb34219450f9b86e918ddcd0a4b956e18e SHA512 19a85ba5a4c2de1688f39feb6ce1c1802e4d886436dc02afe1ba508b91365a0ac67d668cf7126588145ee55641992ad71b0d094246a94c89065876b9bb897425 |
34 |
|
35 |
diff --git a/dev-db/mysql/mysql-5.6.44.ebuild b/dev-db/mysql/mysql-5.6.44.ebuild |
36 |
new file mode 100644 |
37 |
index 00000000000..a05fea40118 |
38 |
--- /dev/null |
39 |
+++ b/dev-db/mysql/mysql-5.6.44.ebuild |
40 |
@@ -0,0 +1,800 @@ |
41 |
+# Copyright 1999-2019 Gentoo Authors |
42 |
+# Distributed under the terms of the GNU General Public License v2 |
43 |
+ |
44 |
+EAPI="6" |
45 |
+MY_EXTRAS_VER="20190604-1109Z" |
46 |
+ |
47 |
+CMAKE_MAKEFILE_GENERATOR=emake |
48 |
+ |
49 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
50 |
+ |
51 |
+inherit eutils flag-o-matic prefix toolchain-funcs \ |
52 |
+ user cmake-utils multilib-build |
53 |
+ |
54 |
+SRC_URI="http://cdn.mysql.com/Downloads/MySQL-5.6/${P}.tar.gz |
55 |
+ https://cdn.mysql.com/archives/mysql-5.6/${P}.tar.gz |
56 |
+ http://downloads.mysql.com/archives/MySQL-5.6/${P}.tar.gz" |
57 |
+ |
58 |
+# Gentoo patches to MySQL |
59 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
60 |
+ SRC_URI="${SRC_URI} |
61 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
62 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
63 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
64 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
65 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
66 |
+fi |
67 |
+ |
68 |
+HOMEPAGE="https://www.mysql.com/" |
69 |
+DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
70 |
+LICENSE="GPL-2" |
71 |
+SLOT="0/18" |
72 |
+IUSE="client-libs cracklib debug jemalloc latin1 libressl numa +perl profiling selinux |
73 |
+ +server static static-libs systemtap tcmalloc test yassl" |
74 |
+ |
75 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
76 |
+RESTRICT="libressl? ( test )" |
77 |
+ |
78 |
+REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )" |
79 |
+ |
80 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
81 |
+ |
82 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
83 |
+# and we will run a mysql server during test phase |
84 |
+S="${WORKDIR}/mysql" |
85 |
+ |
86 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
87 |
+ inherit git-r3 |
88 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
89 |
+ EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
90 |
+ EGIT_CLONE_TYPE=shallow |
91 |
+ MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
92 |
+else |
93 |
+ MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
94 |
+fi |
95 |
+ |
96 |
+PATCHES=( |
97 |
+ "${MY_PATCH_DIR}"/01050_all_mysql_config_cleanup-5.6.patch |
98 |
+ "${MY_PATCH_DIR}"/02040_all_embedded-library-shared-5.5.10.patch |
99 |
+ "${MY_PATCH_DIR}"/20006_all_cmake_elib-mysql-5.6.35.patch |
100 |
+ "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.6.22.patch |
101 |
+ "${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.6.37.patch |
102 |
+ "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.6.patch |
103 |
+ "${MY_PATCH_DIR}"/20018_all_mysql-5.6.25-without-clientlibs-tools.patch |
104 |
+ "${MY_PATCH_DIR}"/20027_all_mysql-5.5-perl5.26-includes.patch |
105 |
+ "${MY_PATCH_DIR}"/20028_all_mysql-5.6-gcc7.patch |
106 |
+ "${MY_PATCH_DIR}"/20031_all_mysql-5.6-fix-monitor.test.patch |
107 |
+ "${MY_PATCH_DIR}"/20036_all_mysql-5.6-fix-rpl_semi_sync_shutdown_hang.test.patch |
108 |
+ "${MY_PATCH_DIR}"/20018_all_mysql-5.6.44-fix-libressl-support.patch |
109 |
+) |
110 |
+ |
111 |
+# Be warned, *DEPEND are version-dependant |
112 |
+# These are used for both runtime and compiletime |
113 |
+COMMON_DEPEND=" |
114 |
+ kernel_linux? ( |
115 |
+ sys-process/procps:0= |
116 |
+ dev-libs/libaio:0= |
117 |
+ ) |
118 |
+ net-misc/curl |
119 |
+ >=sys-apps/sed-4 |
120 |
+ >=sys-apps/texinfo-4.7-r1 |
121 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
122 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
123 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
124 |
+ !yassl? ( |
125 |
+ !libressl? ( =dev-libs/openssl-1.0.2*:0= ) |
126 |
+ libressl? ( =dev-libs/libressl-2.6.5*:0= ) |
127 |
+ ) |
128 |
+ >=sys-libs/zlib-1.2.3:0= |
129 |
+ sys-libs/ncurses:0= |
130 |
+ server? ( |
131 |
+ numa? ( sys-process/numactl ) |
132 |
+ ) |
133 |
+ !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) |
134 |
+" |
135 |
+DEPEND="virtual/yacc |
136 |
+ static? ( sys-libs/ncurses[static-libs] ) |
137 |
+ test? ( dev-perl/JSON ) |
138 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
139 |
+ ${COMMON_DEPEND}" |
140 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
141 |
+ client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) |
142 |
+ !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
143 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
144 |
+ ${COMMON_DEPEND} |
145 |
+" |
146 |
+# For other stuff to bring us in |
147 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
148 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
149 |
+ |
150 |
+pkg_setup() { |
151 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
152 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
153 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
154 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
155 |
+ # non x86{,_64} arches |
156 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
157 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
158 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
159 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
160 |
+ die |
161 |
+ fi |
162 |
+ fi |
163 |
+ if has test ${FEATURES} && \ |
164 |
+ use server && ! has userpriv ${FEATURES} ; then |
165 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
166 |
+ fi |
167 |
+ |
168 |
+ # This should come after all of the die statements |
169 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
170 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
171 |
+} |
172 |
+ |
173 |
+pkg_preinst() { |
174 |
+ # Here we need to see if the implementation switched client libraries |
175 |
+ # We check if this is a new instance of the package and a client library already exists |
176 |
+ local SHOW_ABI_MESSAGE libpath |
177 |
+ if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
178 |
+ libpath=$(readlink "${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so") |
179 |
+ elog "Due to ABI changes when switching between different client libraries," |
180 |
+ elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
181 |
+ elog "Please run: revdep-rebuild --library ${libpath}" |
182 |
+ ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
183 |
+ fi |
184 |
+} |
185 |
+ |
186 |
+pkg_postinst() { |
187 |
+ # Make sure the vars are correctly initialized |
188 |
+ mysql_init_vars |
189 |
+ |
190 |
+ # Create log directory securely if it does not exist |
191 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
192 |
+ |
193 |
+ if use server ; then |
194 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
195 |
+ einfo |
196 |
+ elog "You might want to run:" |
197 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
198 |
+ elog "if this is a new install." |
199 |
+ elog |
200 |
+ elog "If you are switching server implentations, you should run the" |
201 |
+ elog "mysql_upgrade tool." |
202 |
+ einfo |
203 |
+ else |
204 |
+ einfo |
205 |
+ elog "If you are upgrading major versions, you should run the" |
206 |
+ elog "mysql_upgrade tool." |
207 |
+ einfo |
208 |
+ fi |
209 |
+ fi |
210 |
+} |
211 |
+ |
212 |
+src_unpack() { |
213 |
+ unpack ${A} |
214 |
+ # Grab the patches |
215 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
216 |
+ |
217 |
+ mv -f "${WORKDIR}/${P}" "${S}" || die |
218 |
+} |
219 |
+ |
220 |
+src_prepare() { |
221 |
+ _disable_engine() { |
222 |
+ echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
223 |
+ } |
224 |
+ |
225 |
+ _disable_plugin() { |
226 |
+ echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
227 |
+ } |
228 |
+ |
229 |
+ if use jemalloc ; then |
230 |
+ echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
231 |
+ fi |
232 |
+ if use tcmalloc; then |
233 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
234 |
+ fi |
235 |
+ # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
236 |
+ if [[ -d "${S}/support-files/SELinux" ]] ; then |
237 |
+ echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
238 |
+ fi |
239 |
+ |
240 |
+ if use libressl ; then |
241 |
+ sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \ |
242 |
+ "${S}/cmake/ssl.cmake" || die |
243 |
+ fi |
244 |
+ |
245 |
+ sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
246 |
+ |
247 |
+ local plugin |
248 |
+ local server_plugins=( semisync ) |
249 |
+ local test_plugins=( audit_null daemon_example fulltext ) |
250 |
+ if ! use server; then # These plugins are for the server |
251 |
+ for plugin in "${server_plugins[@]}" ; do |
252 |
+ _disable_plugin "${plugin}" |
253 |
+ done |
254 |
+ fi |
255 |
+ |
256 |
+ if ! use test; then # These plugins are only used during testing |
257 |
+ for plugin in "${test_plugins[@]}" ; do |
258 |
+ _disable_plugin "${plugin}" |
259 |
+ done |
260 |
+ fi |
261 |
+ |
262 |
+ # Don't build example |
263 |
+ _disable_engine example |
264 |
+ _disable_engine ndb |
265 |
+ _disable_plugin innodb_memcached |
266 |
+ |
267 |
+ cmake-utils_src_prepare |
268 |
+} |
269 |
+ |
270 |
+src_configure(){ |
271 |
+ # bug 508724 mariadb cannot use ld.gold |
272 |
+ tc-ld-disable-gold |
273 |
+ # Bug #114895, bug #110149 |
274 |
+ filter-flags "-O" "-O[01]" |
275 |
+ |
276 |
+ append-cxxflags -felide-constructors |
277 |
+ |
278 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
279 |
+ append-flags -fno-strict-aliasing |
280 |
+ |
281 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
282 |
+ |
283 |
+ # debug hack wrt #497532 |
284 |
+ mycmakeargs=( |
285 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
286 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
287 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" |
288 |
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
289 |
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
290 |
+ -DINSTALL_BINDIR=bin |
291 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
292 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
293 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
294 |
+ -DINSTALL_INFODIR=share/info |
295 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
296 |
+ -DINSTALL_MANDIR=share/man |
297 |
+ -DINSTALL_MYSQLSHAREDIR=share/mysql |
298 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
299 |
+ -DINSTALL_SCRIPTDIR=share/mysql/scripts |
300 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
301 |
+ -DINSTALL_SBINDIR=sbin |
302 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
303 |
+ -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
304 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
305 |
+ ### TODO: make this system but issues with UTF-8 prevent it |
306 |
+ -DWITH_EDITLINE=bundled |
307 |
+ -DWITH_ZLIB=system |
308 |
+ -DWITH_LIBWRAP=0 |
309 |
+ -DENABLED_LOCAL_INFILE=1 |
310 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
311 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
312 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
313 |
+ # The build forces this to be defined when cross-compiling. We pass it |
314 |
+ # all the time for simplicity and to make sure it is actually correct. |
315 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
316 |
+ -DWITH_LIBEVENT=NO |
317 |
+ -DWITHOUT_CLIENTLIBS=YES |
318 |
+ -DENABLE_DTRACE=$(usex systemtap) |
319 |
+ -DWITH_SSL=$(usex yassl bundled system) |
320 |
+ -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mysql/mysql-test' '') |
321 |
+ -DWITHOUT_VALIDATE_PASSWORD=1 |
322 |
+ ) |
323 |
+ |
324 |
+ if use server ; then |
325 |
+ |
326 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
327 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
328 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
329 |
+ ewarn "You MUST file bugs without these variables set." |
330 |
+ |
331 |
+ mycmakeargs+=( |
332 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
333 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
334 |
+ ) |
335 |
+ |
336 |
+ elif ! use latin1 ; then |
337 |
+ mycmakeargs+=( |
338 |
+ -DDEFAULT_CHARSET=utf8 |
339 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
340 |
+ ) |
341 |
+ else |
342 |
+ mycmakeargs+=( |
343 |
+ -DDEFAULT_CHARSET=latin1 |
344 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
345 |
+ ) |
346 |
+ fi |
347 |
+ mycmakeargs+=( |
348 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
349 |
+ -DEXTRA_CHARSETS=all |
350 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
351 |
+ -DWITH_DEBUG=$(usex debug) |
352 |
+ -DWITH_EMBEDDED_SERVER=OFF |
353 |
+ ) |
354 |
+ |
355 |
+ if use profiling ; then |
356 |
+ # Setting to OFF doesn't work: Once set, profiling options will be added |
357 |
+ # to `mysqld --help` output via sql/sys_vars.cc causing |
358 |
+ # "main.mysqld--help-notwin" test to fail |
359 |
+ mycmakeargs+=( -DENABLED_PROFILING=ON ) |
360 |
+ fi |
361 |
+ |
362 |
+ if use static; then |
363 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
364 |
+ fi |
365 |
+ |
366 |
+ # Storage engines |
367 |
+ mycmakeargs+=( |
368 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
369 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
370 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
371 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
372 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
373 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
374 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
375 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
376 |
+ -DWITH_INNODB_MEMCACHED=0 |
377 |
+ ) |
378 |
+ |
379 |
+ else |
380 |
+ mycmakeargs+=( |
381 |
+ -DWITHOUT_SERVER=1 |
382 |
+ -DWITH_EMBEDDED_SERVER=OFF |
383 |
+ -DEXTRA_CHARSETS=none |
384 |
+ ) |
385 |
+ fi |
386 |
+ |
387 |
+ cmake-utils_src_configure |
388 |
+} |
389 |
+ |
390 |
+src_compile() { |
391 |
+ cmake-utils_src_compile |
392 |
+} |
393 |
+ |
394 |
+src_install() { |
395 |
+ cmake-utils_src_install |
396 |
+ |
397 |
+ # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
398 |
+ find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
399 |
+ # Make sure the vars are correctly initialized |
400 |
+ mysql_init_vars |
401 |
+ |
402 |
+ # Convenience links |
403 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
404 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
405 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
406 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
407 |
+ |
408 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
409 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
410 |
+ rm -Rf "${ED}/usr/data" || die |
411 |
+ fi |
412 |
+ |
413 |
+ # Unless they explicitly specific USE=test, then do not install the |
414 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
415 |
+ # validation of your database configuration after tuning it. |
416 |
+ if ! use test ; then |
417 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
418 |
+ fi |
419 |
+ |
420 |
+ # Configuration stuff |
421 |
+ einfo "Building default configuration ..." |
422 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
423 |
+ [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf |
424 |
+ local mycnf_src="my.cnf-5.6" |
425 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
426 |
+ "${FILESDIR%/}/${mycnf_src}" \ |
427 |
+ > "${TMPDIR%/}/my.cnf.ok" || die |
428 |
+ use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok" |
429 |
+ if use latin1 ; then |
430 |
+ sed -i \ |
431 |
+ -e "/character-set/s|utf8|latin1|g" \ |
432 |
+ "${TMPDIR%/}/my.cnf.ok" || die |
433 |
+ fi |
434 |
+ eprefixify "${TMPDIR%/}/my.cnf.ok" |
435 |
+ newins "${TMPDIR}/my.cnf.ok" my.cnf |
436 |
+ |
437 |
+ if use server ; then |
438 |
+ einfo "Including support files and sample configurations" |
439 |
+ docinto "support-files" |
440 |
+ local script |
441 |
+ for script in \ |
442 |
+ "${S}"/support-files/magic |
443 |
+ do |
444 |
+ [[ -f "$script" ]] && dodoc "${script}" |
445 |
+ done |
446 |
+ |
447 |
+ docinto "scripts" |
448 |
+ for script in "${S}"/scripts/mysql* ; do |
449 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
450 |
+ done |
451 |
+ fi |
452 |
+ |
453 |
+ #Remove mytop if perl is not selected |
454 |
+ [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
455 |
+} |
456 |
+ |
457 |
+# Official test instructions: |
458 |
+# USE='perl server static-libs' \ |
459 |
+# FEATURES='test userpriv -usersandbox' \ |
460 |
+# ebuild mysql-X.X.XX.ebuild \ |
461 |
+# digest clean package |
462 |
+src_test() { |
463 |
+ |
464 |
+ _disable_test() { |
465 |
+ local rawtestname reason |
466 |
+ rawtestname="${1}" ; shift |
467 |
+ reason="${@}" |
468 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
469 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
470 |
+ } |
471 |
+ |
472 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
473 |
+ local retstatus_unit |
474 |
+ local retstatus_tests |
475 |
+ |
476 |
+ if ! use server ; then |
477 |
+ einfo "Skipping server tests due to minimal build." |
478 |
+ return 0 |
479 |
+ fi |
480 |
+ |
481 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
482 |
+ # localhost. Also causes weird failures. |
483 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
484 |
+ |
485 |
+ if [[ $UID -eq 0 ]]; then |
486 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
487 |
+ fi |
488 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
489 |
+ |
490 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
491 |
+ |
492 |
+ # Run CTest (test-units) |
493 |
+ cmake-utils_src_test |
494 |
+ retstatus_unit=$? |
495 |
+ |
496 |
+ # Ensure that parallel runs don't die |
497 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
498 |
+ # Enable parallel testing, auto will try to detect number of cores |
499 |
+ # You may set this by hand. |
500 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
501 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
502 |
+ |
503 |
+ # create directories because mysqladmin might run out of order |
504 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
505 |
+ |
506 |
+ # Run mysql tests |
507 |
+ pushd "${TESTDIR}" > /dev/null || die |
508 |
+ |
509 |
+ touch "${T}/disabled.def" |
510 |
+ # These are failing in MySQL 5.6 for now and are believed to be |
511 |
+ # false positives: |
512 |
+ # |
513 |
+ local t |
514 |
+ |
515 |
+ for t in auth_sec.keyring_udf federated.federated_plugin ; do |
516 |
+ _disable_test "$t" "False positives in Gentoo" |
517 |
+ done |
518 |
+ |
519 |
+ # Bad test definition |
520 |
+ _disable_test main.mysqldump "Test fails after 2018-12-31 with new warnings" |
521 |
+ |
522 |
+ # run mysql-test tests |
523 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
524 |
+ retstatus_tests=$? |
525 |
+ |
526 |
+ popd > /dev/null || die |
527 |
+ |
528 |
+ # Cleanup is important for these testcases. |
529 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
530 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
531 |
+ |
532 |
+ local failures="" |
533 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
534 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
535 |
+ |
536 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
537 |
+ einfo "Tests successfully completed" |
538 |
+} |
539 |
+ |
540 |
+mysql_init_vars() { |
541 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"} |
542 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"} |
543 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"} |
544 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"} |
545 |
+ |
546 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
547 |
+ MY_DATADIR="" |
548 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
549 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
550 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
551 |
+ | tail -n1` |
552 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
553 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
554 |
+ | sed -e 's/.*=\s*//' \ |
555 |
+ | tail -n1` |
556 |
+ fi |
557 |
+ fi |
558 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
559 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
560 |
+ einfo "Using default MY_DATADIR" |
561 |
+ fi |
562 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
563 |
+ |
564 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
565 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
566 |
+ # If you get this and you're wondering about it, see bug #207636 |
567 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
568 |
+ elog "A new one will not be created." |
569 |
+ PREVIOUS_DATADIR="yes" |
570 |
+ else |
571 |
+ PREVIOUS_DATADIR="no" |
572 |
+ fi |
573 |
+ export PREVIOUS_DATADIR |
574 |
+ fi |
575 |
+ else |
576 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
577 |
+ local new_MY_DATADIR |
578 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
579 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
580 |
+ | tail -n1` |
581 |
+ |
582 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
583 |
+ ewarn "MySQL MY_DATADIR has changed" |
584 |
+ ewarn "from ${MY_DATADIR}" |
585 |
+ ewarn "to ${new_MY_DATADIR}" |
586 |
+ MY_DATADIR="${new_MY_DATADIR}" |
587 |
+ fi |
588 |
+ fi |
589 |
+ fi |
590 |
+ |
591 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
592 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
593 |
+ export MY_DATADIR |
594 |
+} |
595 |
+ |
596 |
+pkg_config() { |
597 |
+ _getoptval() { |
598 |
+ local mypd="${EROOT%/}"/usr/bin/my_print_defaults |
599 |
+ local section="$1" |
600 |
+ local flag="--${2}=" |
601 |
+ local extra_options="${3}" |
602 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
603 |
+ } |
604 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
605 |
+ local old_HOME="${HOME}" |
606 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
607 |
+ export HOME=${EPREFIX%/}/root |
608 |
+ |
609 |
+ # Make sure the vars are correctly initialized |
610 |
+ mysql_init_vars |
611 |
+ |
612 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
613 |
+ if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then |
614 |
+ die "Minimal builds do NOT include the MySQL server" |
615 |
+ fi |
616 |
+ |
617 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
618 |
+ local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}" |
619 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
620 |
+ local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}" |
621 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
622 |
+ |
623 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
624 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
625 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
626 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
627 |
+ else |
628 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
629 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
630 |
+ || die "Moving MY_DATADIR failed" |
631 |
+ fi |
632 |
+ else |
633 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
634 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
635 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
636 |
+ else |
637 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
638 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
639 |
+ fi |
640 |
+ fi |
641 |
+ fi |
642 |
+ |
643 |
+ local pwd1="a" |
644 |
+ local pwd2="b" |
645 |
+ local maxtry=15 |
646 |
+ |
647 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
648 |
+ local tmp_mysqld_password_source= |
649 |
+ |
650 |
+ for tmp_mysqld_password_source in mysql client; do |
651 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
652 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
653 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
654 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
655 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
656 |
+ MYSQL_ROOT_PASSWORD= |
657 |
+ continue |
658 |
+ fi |
659 |
+ |
660 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
661 |
+ break |
662 |
+ fi |
663 |
+ done |
664 |
+ |
665 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
666 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
667 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
668 |
+ fi |
669 |
+ |
670 |
+ unset tmp_mysqld_password_source |
671 |
+ fi |
672 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
673 |
+ # These are dir+prefix |
674 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
675 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
676 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
677 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
678 |
+ |
679 |
+ if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]]; then |
680 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
681 |
+ install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR" |
682 |
+ fi |
683 |
+ if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]]; then |
684 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
685 |
+ install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN" |
686 |
+ fi |
687 |
+ if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]]; then |
688 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
689 |
+ install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG" |
690 |
+ fi |
691 |
+ |
692 |
+ if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then |
693 |
+ ewarn "You have already a MySQL database in place." |
694 |
+ ewarn "(${ROOT%/}/${MY_DATADIR}/*)" |
695 |
+ ewarn "Please rename or delete it if you wish to replace it." |
696 |
+ die "MySQL database already exists!" |
697 |
+ fi |
698 |
+ |
699 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
700 |
+ # localhost. Also causes weird failures. |
701 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
702 |
+ |
703 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
704 |
+ |
705 |
+ einfo "Please provide a password for the mysql 'root' user now" |
706 |
+ einfo "or through the ${HOME}/.my.cnf file." |
707 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
708 |
+ read -rsp " >" pwd1 ; echo |
709 |
+ |
710 |
+ einfo "Retype the password" |
711 |
+ read -rsp " >" pwd2 ; echo |
712 |
+ |
713 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
714 |
+ die "Passwords are not the same" |
715 |
+ fi |
716 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
717 |
+ unset pwd1 pwd2 |
718 |
+ fi |
719 |
+ |
720 |
+ local options |
721 |
+ local sqltmp="$(emktemp)" |
722 |
+ |
723 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
724 |
+ # see http://bugs.mysql.com/bug.php?id=31312 |
725 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
726 |
+ |
727 |
+ local help_tables="${EROOT%/}${MY_SHAREDSTATEDIR}/fill_help_tables.sql" |
728 |
+ [[ -r "${help_tables}" ]] \ |
729 |
+ && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ |
730 |
+ || touch "${TMPDIR}/fill_help_tables.sql" |
731 |
+ help_tables="${TMPDIR}/fill_help_tables.sql" |
732 |
+ |
733 |
+ # Figure out which options we need to disable to do the setup |
734 |
+ local helpfile="${TMPDIR%/}/mysqld-help" |
735 |
+ "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
736 |
+ for opt in host-cache name-resolve networking slave-start \ |
737 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
738 |
+ log-slave-updates \ |
739 |
+ ; do |
740 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
741 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
742 |
+ done |
743 |
+ |
744 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
745 |
+ |
746 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
747 |
+ PID_DIR="${EROOT%/}/var/run/mysqld" |
748 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
749 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
750 |
+ fi |
751 |
+ |
752 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
753 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
754 |
+ fi |
755 |
+ |
756 |
+ pushd "${TMPDIR}" &>/dev/null || die |
757 |
+ |
758 |
+ # Filling timezones, see |
759 |
+ # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
760 |
+ "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null |
761 |
+ chown mysql "${sqltmp}" || die |
762 |
+ |
763 |
+ local cmd=( "${EROOT%/}/usr/share/mysql/scripts/mysql_install_db" ) |
764 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT%/}/usr/bin/mysql_install_db" ) |
765 |
+ if [[ -r "${help_tables}" ]] ; then |
766 |
+ cat "${help_tables}" >> "${sqltmp}" |
767 |
+ fi |
768 |
+ cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" ) |
769 |
+ einfo "Command: ${cmd[*]}" |
770 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
771 |
+ >"${TMPDIR%/}"/mysql_install_db.log 2>&1 |
772 |
+ if [ $? -ne 0 ]; then |
773 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2 |
774 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log" |
775 |
+ fi |
776 |
+ popd &>/dev/null || die |
777 |
+ [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \ |
778 |
+ || die "MySQL databases not installed" |
779 |
+ |
780 |
+ use prefix || options="${options} --user=mysql" |
781 |
+ |
782 |
+ local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock" |
783 |
+ local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid" |
784 |
+ local mysqld="${EROOT%/}/usr/sbin/mysqld \ |
785 |
+ ${options} \ |
786 |
+ $(use prefix || echo --user=mysql) \ |
787 |
+ --log-warnings=0 \ |
788 |
+ --basedir=${EROOT%/}/usr \ |
789 |
+ --datadir=${ROOT%/}/${MY_DATADIR} \ |
790 |
+ --max_allowed_packet=8M \ |
791 |
+ --net_buffer_length=16K \ |
792 |
+ --socket=${socket} \ |
793 |
+ --pid-file=${pidfile} \ |
794 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
795 |
+ #einfo "About to start mysqld: ${mysqld}" |
796 |
+ ebegin "Starting mysqld" |
797 |
+ einfo "Command ${mysqld}" |
798 |
+ ${mysqld} & |
799 |
+ rc=$? |
800 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
801 |
+ maxtry=$((${maxtry}-1)) |
802 |
+ echo -n "." |
803 |
+ sleep 1 |
804 |
+ done |
805 |
+ eend $rc |
806 |
+ |
807 |
+ if ! [[ -S "${socket}" ]]; then |
808 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
809 |
+ fi |
810 |
+ |
811 |
+ ebegin "Setting root password" |
812 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
813 |
+ local sql="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MYSQL_ROOT_PASSWORD}');" |
814 |
+ "${EROOT%/}/usr/bin/mysql" \ |
815 |
+ --no-defaults \ |
816 |
+ "--socket=${socket}" \ |
817 |
+ -hlocalhost \ |
818 |
+ -e "${sql}" |
819 |
+ eend $? |
820 |
+ |
821 |
+ if [[ -n "${sqltmp}" ]] ; then |
822 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
823 |
+ "${EROOT%/}/usr/bin/mysql" \ |
824 |
+ --socket="${socket}" \ |
825 |
+ -hlocalhost \ |
826 |
+ -uroot \ |
827 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
828 |
+ mysql < "${sqltmp}" |
829 |
+ rc=$? |
830 |
+ eend $? |
831 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
832 |
+ fi |
833 |
+ |
834 |
+ # Stop the server and cleanup |
835 |
+ einfo "Stopping the server ..." |
836 |
+ kill $(< "${pidfile}" ) |
837 |
+ rm -f "${sqltmp}" |
838 |
+ wait %1 |
839 |
+ einfo "Done" |
840 |
+} |