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