1 |
commit: 175e6fdd7360475c5cc48e71fe05e1a00e7492e1 |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 14 01:34:24 2019 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 14 02:34:33 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=175e6fdd |
7 |
|
8 |
dev-db/mariadb: Version bump for 10.0.38 |
9 |
|
10 |
Package-Manager: Portage-2.3.59, Repoman-2.3.12 |
11 |
Signed-off-by: Brian Evans <grknight <AT> gentoo.org> |
12 |
|
13 |
dev-db/mariadb/Manifest | 1 + |
14 |
dev-db/mariadb/mariadb-10.0.38.ebuild | 848 ++++++++++++++++++++++++++++++++++ |
15 |
2 files changed, 849 insertions(+) |
16 |
|
17 |
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest |
18 |
index 3b9e8e358c3..35c85abe964 100644 |
19 |
--- a/dev-db/mariadb/Manifest |
20 |
+++ b/dev-db/mariadb/Manifest |
21 |
@@ -1,5 +1,6 @@ |
22 |
DIST mariadb-10.0.35.tar.gz 66551252 BLAKE2B 69cc9c78f7c47a4b1760940cb0f395b4053fcc47c1087a0c2af873d4a998ee60915e1f4e64f7fe6474c7c1fa3dabe48a3b6621c67893b20526f01e56b0542e7a SHA512 01fc8d48be3f3847bb222835436ab938c6c5b5ac8ba6cc87b3b6d2a2201b7ab4b152dc1f7d9749c89de90097d50052714ac08aafbbb117fffac32bfb47e74779 |
23 |
DIST mariadb-10.0.37.tar.gz 64728382 BLAKE2B 3d794633cc400013be05c326681f11f8b27c7d6758b43f357ca93976a75ff931f6f6d205510b5df305c6f487485864d346e4fa14383be32dafcf2b8756eb045a SHA512 c3ba749f519cce3bb63fec6ee6819ad931f72d54258d4b7700c515cfeb137453271a408a9a353bf78715fe66a0c06539bdbf15f1c556a7b89a5c01af84f7fd49 |
24 |
+DIST mariadb-10.0.38.tar.gz 64755921 BLAKE2B 64ea08a2256063639021204f8c92d8f27b2bc0df6c9733255220df5728c128bd971bb907f2a30623a1c2cc536d47b8759781f2ccd97075ebace7c759b5cf0c14 SHA512 020c9b8bed5f5ff4e8f621665cc37f56fe9fbb4bda1f64d4bd9fe1bcaaf79dc2c254e582ee690c9aa4f810cf3eeb96249cb3b4b54a6604d035accf03846ba4a9 |
25 |
DIST mariadb-10.1.34.tar.gz 65298561 BLAKE2B 3f3af7b8bad68a08f69befd3f3e7bd88b8cf058feb20309dc2cdbd16bf5d015c2cb0d1d9d2fdf831f6183c0b9bb25405124c24b2940467489e05d42c57f7b0a6 SHA512 3c18359006b340dcf724d1fce36dcc19916c42492269a7545e0726172b8f7b84860e10725c74e4458dae34572395f1650bf17838e9058544e0a6cfcbffd54f6d |
26 |
DIST mariadb-10.1.37.tar.gz 63492946 BLAKE2B 0f19b402c597443ef970cbe2a2d85d51743cc2d05ab741897efb150f007d7be8b645706a2d0dc5a9f91c7a380d2313840f77d6e9b15f3335495f275b415e5a33 SHA512 b7c35cd67ad265ce2e3a4db20a2ae2b78745db96dc70a211f027a39b6dbb3dc900991c2ee1021ee6a97d12489c3e2a70252e2adf348a458af38b99c3de5a4f25 |
27 |
DIST mariadb-10.2.22.tar.gz 71907765 BLAKE2B e7781a9e1bb0becca543ebb0b9e03912fbafa9de45bbd5c7232f92d29b934148dd124ad462bf8aa5aec2e4ee0bf75a03fae5e5fe97a77e1d93095052a577c14b SHA512 cd61d0c2d528b23b975e6ea142560d9b9ebff7ecda6fa9b3659b25b3406e8cc925918f4c3bb0e200ddb8d0520bcaa4d4f70d245b4731896f9ba2f1bdf0a817b2 |
28 |
|
29 |
diff --git a/dev-db/mariadb/mariadb-10.0.38.ebuild b/dev-db/mariadb/mariadb-10.0.38.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..141158d014b |
32 |
--- /dev/null |
33 |
+++ b/dev-db/mariadb/mariadb-10.0.38.ebuild |
34 |
@@ -0,0 +1,848 @@ |
35 |
+# Copyright 1999-2019 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI="6" |
39 |
+MY_EXTRAS_VER="20180809-1700Z" |
40 |
+SUBSLOT="18" |
41 |
+ |
42 |
+JAVA_PKG_OPT_USE="jdbc" |
43 |
+ |
44 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
45 |
+ |
46 |
+inherit eutils flag-o-matic prefix toolchain-funcs java-pkg-opt-2 user cmake-utils multilib-build |
47 |
+ |
48 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
49 |
+ |
50 |
+# Gentoo patches to MySQL |
51 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
52 |
+ SRC_URI="${SRC_URI} |
53 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
54 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
55 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
56 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
57 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
58 |
+fi |
59 |
+ |
60 |
+HOMEPAGE="https://mariadb.org/" |
61 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
62 |
+LICENSE="GPL-2" |
63 |
+SLOT="0/${SUBSLOT:-0}" |
64 |
+IUSE="bindist client-libs debug extraengine jdbc jemalloc latin1 libressl |
65 |
+ numa odbc oqgraph pam +perl profiling selinux +server sphinx |
66 |
+ static static-libs systemtap tcmalloc |
67 |
+ test tokudb xml yassl" |
68 |
+ |
69 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
70 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
71 |
+ |
72 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
73 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
74 |
+ ?? ( tcmalloc jemalloc ) |
75 |
+ static? ( yassl !pam )" |
76 |
+ |
77 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
78 |
+ |
79 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
80 |
+# and we will run a mysql server during test phase |
81 |
+S="${WORKDIR}/mysql" |
82 |
+ |
83 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
84 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
85 |
+ inherit git-r3 |
86 |
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" |
87 |
+ EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
88 |
+ EGIT_CLONE_TYPE=shallow |
89 |
+else |
90 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
91 |
+fi |
92 |
+ |
93 |
+PATCHES=( |
94 |
+ "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch" |
95 |
+ "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-10.0.33.patch" |
96 |
+ "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch" |
97 |
+ "${MY_PATCH_DIR}/20018_all_mariadb-10.0.20-without-clientlibs-tools.patch" |
98 |
+) |
99 |
+ |
100 |
+# Be warned, *DEPEND are version-dependant |
101 |
+# These are used for both runtime and compiletime |
102 |
+COMMON_DEPEND=" |
103 |
+ kernel_linux? ( |
104 |
+ sys-process/procps:0= |
105 |
+ dev-libs/libaio:0= |
106 |
+ ) |
107 |
+ >=sys-apps/sed-4 |
108 |
+ >=sys-apps/texinfo-4.7-r1 |
109 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
110 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
111 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
112 |
+ !yassl? ( |
113 |
+ !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 ) |
114 |
+ libressl? ( dev-libs/libressl:0= ) |
115 |
+ ) |
116 |
+ >=sys-libs/zlib-1.2.3:0= |
117 |
+ sys-libs/ncurses:0= |
118 |
+ !bindist? ( |
119 |
+ >=sys-libs/readline-4.1:0= |
120 |
+ ) |
121 |
+ server? ( |
122 |
+ extraengine? ( |
123 |
+ odbc? ( dev-db/unixODBC:0= ) |
124 |
+ xml? ( dev-libs/libxml2:2= ) |
125 |
+ ) |
126 |
+ numa? ( sys-process/numactl ) |
127 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
128 |
+ pam? ( virtual/pam:0= ) |
129 |
+ tokudb? ( app-arch/snappy ) |
130 |
+ ) |
131 |
+ >=dev-libs/libpcre-8.41-r1:3= |
132 |
+ !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) |
133 |
+" |
134 |
+DEPEND="virtual/yacc |
135 |
+ static? ( sys-libs/ncurses[static-libs] ) |
136 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
137 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) |
138 |
+ ${COMMON_DEPEND}" |
139 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
140 |
+ client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) |
141 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
142 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
143 |
+ ${COMMON_DEPEND} |
144 |
+ perl? ( !dev-db/mytop |
145 |
+ virtual/perl-Getopt-Long |
146 |
+ dev-perl/TermReadKey |
147 |
+ virtual/perl-Term-ANSIColor |
148 |
+ virtual/perl-Time-HiRes ) |
149 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) |
150 |
+" |
151 |
+# For other stuff to bring us in |
152 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
153 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
154 |
+ |
155 |
+pkg_setup() { |
156 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
157 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
158 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
159 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
160 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
161 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
162 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
163 |
+ die |
164 |
+ fi |
165 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
166 |
+ # non x86{,_64} arches |
167 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
168 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
169 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
170 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
171 |
+ die |
172 |
+ fi |
173 |
+ fi |
174 |
+ java-pkg-opt-2_pkg_setup |
175 |
+ if has test ${FEATURES} && \ |
176 |
+ use server && ! has userpriv ${FEATURES} ; then |
177 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
178 |
+ fi |
179 |
+ |
180 |
+ # This should come after all of the die statements |
181 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
182 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
183 |
+} |
184 |
+ |
185 |
+pkg_preinst() { |
186 |
+ java-pkg-opt-2_pkg_preinst |
187 |
+} |
188 |
+ |
189 |
+pkg_postinst() { |
190 |
+ # Make sure the vars are correctly initialized |
191 |
+ mysql_init_vars |
192 |
+ |
193 |
+ # Create log directory securely if it does not exist |
194 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
195 |
+ |
196 |
+ if use server ; then |
197 |
+ if use pam; then |
198 |
+ einfo |
199 |
+ elog "This install includes the PAM authentication plugin." |
200 |
+ elog "To activate and configure the PAM plugin, please read:" |
201 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
202 |
+ einfo |
203 |
+ fi |
204 |
+ |
205 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
206 |
+ einfo |
207 |
+ elog "You might want to run:" |
208 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
209 |
+ elog "if this is a new install." |
210 |
+ elog |
211 |
+ elog "If you are switching server implentations, you should run the" |
212 |
+ elog "mysql_upgrade tool." |
213 |
+ einfo |
214 |
+ else |
215 |
+ einfo |
216 |
+ elog "If you are upgrading major versions, you should run the" |
217 |
+ elog "mysql_upgrade tool." |
218 |
+ einfo |
219 |
+ fi |
220 |
+ |
221 |
+ einfo |
222 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
223 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
224 |
+ elog "The first time the cluster is activated, you should add" |
225 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
226 |
+ elog "This option should then be removed for subsequent starts." |
227 |
+ einfo |
228 |
+ fi |
229 |
+} |
230 |
+ |
231 |
+src_unpack() { |
232 |
+ unpack ${A} |
233 |
+ # Grab the patches |
234 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack |
235 |
+ |
236 |
+ mv -f "${WORKDIR%/}/${P}" "${S}" || die |
237 |
+} |
238 |
+ |
239 |
+src_prepare() { |
240 |
+ _disable_engine() { |
241 |
+ echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
242 |
+ } |
243 |
+ |
244 |
+ _disable_plugin() { |
245 |
+ echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
246 |
+ } |
247 |
+ |
248 |
+ if use tcmalloc; then |
249 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die |
250 |
+ fi |
251 |
+ |
252 |
+ # Don't build bundled xz-utils for tokudb |
253 |
+ echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
254 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
255 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
256 |
+ |
257 |
+ local plugin |
258 |
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info |
259 |
+ locale_info qc_info server_audit semisync sql_errlog ) |
260 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext ) |
261 |
+ if ! use server; then # These plugins are for the server |
262 |
+ for plugin in "${server_plugins[@]}" ; do |
263 |
+ _disable_plugin "${plugin}" |
264 |
+ done |
265 |
+ fi |
266 |
+ |
267 |
+ if ! use test; then # These plugins are only used during testing |
268 |
+ for plugin in "${test_plugins[@]}" ; do |
269 |
+ _disable_plugin "${plugin}" |
270 |
+ done |
271 |
+ fi |
272 |
+ |
273 |
+ # Collides with mariadb-connector-c bug 655980 |
274 |
+ _disable_plugin auth_dialog |
275 |
+ |
276 |
+ # Don't build Mroonga or example |
277 |
+ _disable_engine mroonga |
278 |
+ _disable_engine example |
279 |
+ |
280 |
+ if ! use oqgraph ; then # avoids extra library checks |
281 |
+ _disable_engine oqgraph |
282 |
+ fi |
283 |
+ |
284 |
+ cmake-utils_src_prepare |
285 |
+ java-pkg-opt-2_src_prepare |
286 |
+} |
287 |
+ |
288 |
+src_configure(){ |
289 |
+ # bug 508724 mariadb cannot use ld.gold |
290 |
+ tc-ld-disable-gold |
291 |
+ # Bug #114895, bug #110149 |
292 |
+ filter-flags "-O" "-O[01]" |
293 |
+ |
294 |
+ append-cxxflags -felide-constructors |
295 |
+ |
296 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
297 |
+ append-flags -fno-strict-aliasing |
298 |
+ |
299 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
300 |
+ |
301 |
+ # debug hack wrt #497532 |
302 |
+ mycmakeargs=( |
303 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
304 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
305 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" |
306 |
+ -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql" |
307 |
+ -DINSTALL_BINDIR=bin |
308 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
309 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
310 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
311 |
+ -DINSTALL_INFODIR=share/info |
312 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
313 |
+ -DINSTALL_MANDIR=share/man |
314 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
315 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
316 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
317 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" |
318 |
+ -DINSTALL_SBINDIR=sbin |
319 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb" |
320 |
+ -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
321 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
322 |
+ -DWITH_ZLIB=system |
323 |
+ -DENABLED_LOCAL_INFILE=1 |
324 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
325 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
326 |
+ # The build forces this to be defined when cross-compiling. We pass it |
327 |
+ # all the time for simplicity and to make sure it is actually correct. |
328 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
329 |
+ -DWITHOUT_CLIENTLIBS=YES |
330 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
331 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
332 |
+ -DENABLE_DTRACE=$(usex systemtap) |
333 |
+ ) |
334 |
+ if use test ; then |
335 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
336 |
+ else |
337 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
338 |
+ fi |
339 |
+ |
340 |
+ if ! use yassl ; then |
341 |
+ mycmakeargs+=( -DWITH_SSL=system ) |
342 |
+ else |
343 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
344 |
+ fi |
345 |
+ |
346 |
+ if use server ; then |
347 |
+ |
348 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
349 |
+ if ! use extraengine ; then |
350 |
+ mycmakeargs+=( |
351 |
+ -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 |
352 |
+ -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 ) |
353 |
+ fi |
354 |
+ |
355 |
+ mycmakeargs+=( |
356 |
+ -DWITH_JEMALLOC=$(usex jemalloc system) |
357 |
+ -DWITH_PCRE=system |
358 |
+ -D$(usex sphinx WITH WITHOUT)_SPHINX_STORAGE_ENGINE=1 |
359 |
+ -D$(usex tokudb WITH WITHOUT)_TOKUDB_STORAGE_ENGINE=1 |
360 |
+ -D$(usex oqgraph WITH WITHOUT)_AUTH_PAM=1 |
361 |
+ -D$(usex extraengine WITH WITHOUT)_SEQUENCE_STORAGE_ENGINE=1 |
362 |
+ -D$(usex extraengine WITH WITHOUT)_SPIDER_STORAGE_ENGINE=1 |
363 |
+ -D$(usex extraengine WITH WITHOUT)_CONNECT_STORAGE_ENGINE=1 |
364 |
+ -DCONNECT_WITH_LIBXML2=$(usex xml) |
365 |
+ -DCONNECT_WITH_ODBC=$(usex odbc) |
366 |
+ -DCONNECT_WITH_JDBC=$(usex jdbc) |
367 |
+ # Build failure and autodep wrt bug 639144 |
368 |
+ -DCONNECT_WITH_MONGO=OFF |
369 |
+ -DINSTALL_SQLBENCHDIR=share/mariadb |
370 |
+ ) |
371 |
+ |
372 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
373 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
374 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
375 |
+ ewarn "You MUST file bugs without these variables set." |
376 |
+ |
377 |
+ mycmakeargs+=( |
378 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
379 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
380 |
+ ) |
381 |
+ |
382 |
+ elif ! use latin1 ; then |
383 |
+ mycmakeargs+=( |
384 |
+ -DDEFAULT_CHARSET=utf8 |
385 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
386 |
+ ) |
387 |
+ else |
388 |
+ mycmakeargs+=( |
389 |
+ -DDEFAULT_CHARSET=latin1 |
390 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
391 |
+ ) |
392 |
+ fi |
393 |
+ mycmakeargs+=( |
394 |
+ -DEXTRA_CHARSETS=all |
395 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
396 |
+ -DWITH_EMBEDDED_SERVER=OFF |
397 |
+ -DENABLED_PROFILING=$(usex profiling) |
398 |
+ ) |
399 |
+ |
400 |
+ if use static; then |
401 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
402 |
+ fi |
403 |
+ |
404 |
+ if use jemalloc || use tcmalloc ; then |
405 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
406 |
+ fi |
407 |
+ |
408 |
+ # Storage engines |
409 |
+ mycmakeargs+=( |
410 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
411 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
412 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
413 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
414 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
415 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
416 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
417 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
418 |
+ ) |
419 |
+ |
420 |
+ else |
421 |
+ mycmakeargs+=( |
422 |
+ -DWITHOUT_SERVER=1 |
423 |
+ -DEXTRA_CHARSETS=none |
424 |
+ -DINSTALL_SQLBENCHDIR= |
425 |
+ ) |
426 |
+ fi |
427 |
+ |
428 |
+ cmake-utils_src_configure |
429 |
+} |
430 |
+ |
431 |
+src_compile() { |
432 |
+ cmake-utils_src_compile |
433 |
+} |
434 |
+ |
435 |
+src_install() { |
436 |
+ cmake-utils_src_install |
437 |
+ |
438 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
439 |
+ if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then |
440 |
+ rm "${ED%/}/usr/include/mysql/server/private/config.h" || die |
441 |
+ fi |
442 |
+ |
443 |
+ # Make sure the vars are correctly initialized |
444 |
+ mysql_init_vars |
445 |
+ |
446 |
+ # Convenience links |
447 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
448 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
449 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
450 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
451 |
+ |
452 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
453 |
+ if [[ -d "${ED%/}/usr/data" ]] ; then |
454 |
+ rm -Rf "${ED%/}/usr/data" || die |
455 |
+ fi |
456 |
+ |
457 |
+ # Unless they explicitly specific USE=test, then do not install the |
458 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
459 |
+ # validation of your database configuration after tuning it. |
460 |
+ if ! use test ; then |
461 |
+ rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test" |
462 |
+ fi |
463 |
+ |
464 |
+ # Configuration stuff |
465 |
+ einfo "Building default configuration ..." |
466 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
467 |
+ [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf |
468 |
+ local mycnf_src="my.cnf-5.6-r1" |
469 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
470 |
+ "${FILESDIR%/}/${mycnf_src}" \ |
471 |
+ > "${TMPDIR%/}/my.cnf.ok" || die |
472 |
+ use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok" |
473 |
+ if use latin1 ; then |
474 |
+ sed -i \ |
475 |
+ -e "/character-set/s|utf8|latin1|g" \ |
476 |
+ "${TMPDIR%/}/my.cnf.ok" || die |
477 |
+ fi |
478 |
+ eprefixify "${TMPDIR%/}/my.cnf.ok" |
479 |
+ newins "${TMPDIR}/my.cnf.ok" my.cnf |
480 |
+ |
481 |
+ if use server ; then |
482 |
+ einfo "Including support files and sample configurations" |
483 |
+ docinto "support-files" |
484 |
+ local script |
485 |
+ for script in \ |
486 |
+ "${S%/}"/support-files/magic |
487 |
+ do |
488 |
+ [[ -f "$script" ]] && dodoc "${script}" |
489 |
+ done |
490 |
+ |
491 |
+ docinto "scripts" |
492 |
+ for script in "${S%/}"/scripts/mysql* ; do |
493 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
494 |
+ done |
495 |
+ # Manually install supporting files that conflict with other packages |
496 |
+ # but are needed for galera and initial installation |
497 |
+ exeinto /usr/libexec/mariadb |
498 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
499 |
+ fi |
500 |
+ |
501 |
+ #Remove mytop if perl is not selected |
502 |
+ [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop" |
503 |
+} |
504 |
+ |
505 |
+# Official test instructions: |
506 |
+# USE='extraengine perl server' \ |
507 |
+# FEATURES='test userpriv -usersandbox' \ |
508 |
+# ebuild mariadb-X.X.XX.ebuild \ |
509 |
+# digest clean package |
510 |
+src_test() { |
511 |
+ |
512 |
+ _disable_test() { |
513 |
+ local rawtestname reason |
514 |
+ rawtestname="${1}" ; shift |
515 |
+ reason="${@}" |
516 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
517 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
518 |
+ } |
519 |
+ |
520 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
521 |
+ local retstatus_unit |
522 |
+ local retstatus_tests |
523 |
+ |
524 |
+ if ! use server ; then |
525 |
+ einfo "Skipping server tests due to minimal build." |
526 |
+ return 0 |
527 |
+ fi |
528 |
+ |
529 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
530 |
+ # localhost. Also causes weird failures. |
531 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
532 |
+ |
533 |
+ if [[ $UID -eq 0 ]]; then |
534 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
535 |
+ fi |
536 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
537 |
+ |
538 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
539 |
+ |
540 |
+ # Run CTest (test-units) |
541 |
+ cmake-utils_src_test |
542 |
+ retstatus_unit=$? |
543 |
+ |
544 |
+ # Ensure that parallel runs don't die |
545 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
546 |
+ # Enable parallel testing, auto will try to detect number of cores |
547 |
+ # You may set this by hand. |
548 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
549 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
550 |
+ |
551 |
+ # create directories because mysqladmin might run out of order |
552 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
553 |
+ |
554 |
+ # Run mysql tests |
555 |
+ pushd "${TESTDIR}" > /dev/null || die |
556 |
+ |
557 |
+ touch "${T}/disabled.def" |
558 |
+ # These are failing in MariaDB 10.0 for now and are believed to be |
559 |
+ # false positives: |
560 |
+ # |
561 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock |
562 |
+ # main.mysql_client_test_comp: |
563 |
+ # segfaults at random under Portage only, suspect resource limits. |
564 |
+ |
565 |
+ local t |
566 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
567 |
+ main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam \ |
568 |
+ rpl.rpl_semi_sync_uninstall_plugin ; do |
569 |
+ _disable_test "$t" "False positives in Gentoo" |
570 |
+ done |
571 |
+ |
572 |
+ if ! use client-libs ; then |
573 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
574 |
+ fi |
575 |
+ |
576 |
+ # run mysql-test tests |
577 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
578 |
+ retstatus_tests=$? |
579 |
+ |
580 |
+ popd > /dev/null || die |
581 |
+ |
582 |
+ # Cleanup is important for these testcases. |
583 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
584 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
585 |
+ |
586 |
+ local failures="" |
587 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
588 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
589 |
+ |
590 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
591 |
+ einfo "Tests successfully completed" |
592 |
+} |
593 |
+ |
594 |
+mysql_init_vars() { |
595 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
596 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
597 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
598 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
599 |
+ |
600 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
601 |
+ MY_DATADIR="" |
602 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
603 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
604 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
605 |
+ | tail -n1` |
606 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
607 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
608 |
+ | sed -e 's/.*=\s*//' \ |
609 |
+ | tail -n1` |
610 |
+ fi |
611 |
+ fi |
612 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
613 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
614 |
+ einfo "Using default MY_DATADIR" |
615 |
+ fi |
616 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
617 |
+ |
618 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
619 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
620 |
+ # If you get this and you're wondering about it, see bug #207636 |
621 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
622 |
+ elog "A new one will not be created." |
623 |
+ PREVIOUS_DATADIR="yes" |
624 |
+ else |
625 |
+ PREVIOUS_DATADIR="no" |
626 |
+ fi |
627 |
+ export PREVIOUS_DATADIR |
628 |
+ fi |
629 |
+ else |
630 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
631 |
+ local new_MY_DATADIR |
632 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
633 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
634 |
+ | tail -n1` |
635 |
+ |
636 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
637 |
+ ewarn "MySQL MY_DATADIR has changed" |
638 |
+ ewarn "from ${MY_DATADIR}" |
639 |
+ ewarn "to ${new_MY_DATADIR}" |
640 |
+ MY_DATADIR="${new_MY_DATADIR}" |
641 |
+ fi |
642 |
+ fi |
643 |
+ fi |
644 |
+ |
645 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
646 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
647 |
+ export MY_DATADIR |
648 |
+} |
649 |
+ |
650 |
+pkg_config() { |
651 |
+ _getoptval() { |
652 |
+ local mypd="${EROOT}"/usr/bin/my_print_defaults |
653 |
+ local section="$1" |
654 |
+ local flag="--${2}=" |
655 |
+ local extra_options="${3}" |
656 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
657 |
+ } |
658 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
659 |
+ local old_HOME="${HOME}" |
660 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
661 |
+ export HOME=${EPREFIX}/root |
662 |
+ |
663 |
+ # Make sure the vars are correctly initialized |
664 |
+ mysql_init_vars |
665 |
+ |
666 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
667 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
668 |
+ die "Minimal builds do NOT include the MySQL server" |
669 |
+ fi |
670 |
+ |
671 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
672 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
673 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
674 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
675 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
676 |
+ |
677 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
678 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
679 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
680 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
681 |
+ else |
682 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
683 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
684 |
+ || die "Moving MY_DATADIR failed" |
685 |
+ fi |
686 |
+ else |
687 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
688 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
689 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
690 |
+ else |
691 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
692 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
693 |
+ fi |
694 |
+ fi |
695 |
+ fi |
696 |
+ |
697 |
+ local pwd1="a" |
698 |
+ local pwd2="b" |
699 |
+ local maxtry=15 |
700 |
+ |
701 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
702 |
+ local tmp_mysqld_password_source= |
703 |
+ |
704 |
+ for tmp_mysqld_password_source in mysql client; do |
705 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
706 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
707 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
708 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
709 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
710 |
+ MYSQL_ROOT_PASSWORD= |
711 |
+ continue |
712 |
+ fi |
713 |
+ |
714 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
715 |
+ break |
716 |
+ fi |
717 |
+ done |
718 |
+ |
719 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
720 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
721 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
722 |
+ fi |
723 |
+ |
724 |
+ unset tmp_mysqld_password_source |
725 |
+ fi |
726 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
727 |
+ # These are dir+prefix |
728 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
729 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
730 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
731 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
732 |
+ |
733 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
734 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
735 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
736 |
+ fi |
737 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
738 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
739 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
740 |
+ fi |
741 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
742 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
743 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
744 |
+ fi |
745 |
+ |
746 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
747 |
+ ewarn "You have already a MySQL database in place." |
748 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
749 |
+ ewarn "Please rename or delete it if you wish to replace it." |
750 |
+ die "MySQL database already exists!" |
751 |
+ fi |
752 |
+ |
753 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
754 |
+ # localhost. Also causes weird failures. |
755 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
756 |
+ |
757 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
758 |
+ |
759 |
+ einfo "Please provide a password for the mysql 'root' user now" |
760 |
+ einfo "or through the ${HOME}/.my.cnf file." |
761 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
762 |
+ read -rsp " >" pwd1 ; echo |
763 |
+ |
764 |
+ einfo "Retype the password" |
765 |
+ read -rsp " >" pwd2 ; echo |
766 |
+ |
767 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
768 |
+ die "Passwords are not the same" |
769 |
+ fi |
770 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
771 |
+ unset pwd1 pwd2 |
772 |
+ fi |
773 |
+ |
774 |
+ local options |
775 |
+ local sqltmp="$(emktemp)" |
776 |
+ |
777 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
778 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
779 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
780 |
+ |
781 |
+ # Figure out which options we need to disable to do the setup |
782 |
+ local helpfile="${TMPDIR}/mysqld-help" |
783 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
784 |
+ for opt in grant-tables host-cache name-resolve networking slave-start \ |
785 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
786 |
+ log-slave-updates \ |
787 |
+ ; do |
788 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
789 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
790 |
+ done |
791 |
+ |
792 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
793 |
+ |
794 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
795 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
796 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
797 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
798 |
+ fi |
799 |
+ |
800 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
801 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
802 |
+ fi |
803 |
+ |
804 |
+ pushd "${TMPDIR}" &>/dev/null || die |
805 |
+ |
806 |
+ # Filling timezones, see |
807 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
808 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
809 |
+ |
810 |
+ local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
811 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
812 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
813 |
+ einfo "Command: ${cmd[*]}" |
814 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
815 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
816 |
+ if [ $? -ne 0 ]; then |
817 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
818 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
819 |
+ fi |
820 |
+ popd &>/dev/null || die |
821 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
822 |
+ || die "MySQL databases not installed" |
823 |
+ |
824 |
+ use prefix || options="${options} --user=mysql" |
825 |
+ |
826 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
827 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
828 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
829 |
+ ${options} \ |
830 |
+ --log-warnings=0 \ |
831 |
+ --basedir=${EROOT}/usr \ |
832 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
833 |
+ --max_allowed_packet=8M \ |
834 |
+ --net_buffer_length=16K \ |
835 |
+ --socket=${socket} \ |
836 |
+ --pid-file=${pidfile} \ |
837 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
838 |
+ #einfo "About to start mysqld: ${mysqld}" |
839 |
+ ebegin "Starting mysqld" |
840 |
+ einfo "Command ${mysqld}" |
841 |
+ ${mysqld} & |
842 |
+ rc=$? |
843 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
844 |
+ maxtry=$((${maxtry}-1)) |
845 |
+ echo -n "." |
846 |
+ sleep 1 |
847 |
+ done |
848 |
+ eend $rc |
849 |
+ |
850 |
+ if ! [[ -S "${socket}" ]]; then |
851 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
852 |
+ fi |
853 |
+ |
854 |
+ ebegin "Setting root password" |
855 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
856 |
+ local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
857 |
+ "${EROOT}/usr/bin/mysql" \ |
858 |
+ "--socket=${socket}" \ |
859 |
+ -hlocalhost \ |
860 |
+ -e "${sql}" |
861 |
+ eend $? |
862 |
+ |
863 |
+ if [[ -n "${sqltmp}" ]] ; then |
864 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
865 |
+ "${EROOT}/usr/bin/mysql" \ |
866 |
+ "--socket=${socket}" \ |
867 |
+ -hlocalhost \ |
868 |
+ -uroot \ |
869 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
870 |
+ mysql < "${sqltmp}" |
871 |
+ rc=$? |
872 |
+ eend $? |
873 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
874 |
+ fi |
875 |
+ |
876 |
+ # Stop the server and cleanup |
877 |
+ einfo "Stopping the server ..." |
878 |
+ kill $(< "${pidfile}" ) |
879 |
+ rm -f "${sqltmp}" |
880 |
+ wait %1 |
881 |
+ einfo "Done" |
882 |
+} |