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