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