Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mariadb/
Date: Thu, 01 Aug 2019 00:35:04
Message-Id: 1564619672.5a42bbfac98753d7a16f00f9abbc3c7f1dd9d71f.grknight@gentoo
1 commit: 5a42bbfac98753d7a16f00f9abbc3c7f1dd9d71f
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 1 00:34:32 2019 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 1 00:34:32 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a42bbfa
7
8 dev-db/mariadb: Drop old
9
10 Package-Manager: Portage-2.3.69, Repoman-2.3.16
11 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
12
13 dev-db/mariadb/Manifest | 6 -
14 dev-db/mariadb/mariadb-10.1.40.ebuild | 887 ------------------------------
15 dev-db/mariadb/mariadb-10.2.25.ebuild | 973 ---------------------------------
16 dev-db/mariadb/mariadb-10.3.16.ebuild | 974 ---------------------------------
17 dev-db/mariadb/mariadb-10.4.6.ebuild | 985 ----------------------------------
18 dev-db/mariadb/mariadb-5.5.64.ebuild | 831 ----------------------------
19 6 files changed, 4656 deletions(-)
20
21 diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
22 index 5bffeb585e4..c9bff5bfe3f 100644
23 --- a/dev-db/mariadb/Manifest
24 +++ b/dev-db/mariadb/Manifest
25 @@ -1,16 +1,10 @@
26 DIST mariadb-10.1.38.tar.gz 63535685 BLAKE2B c179ea2f60287c2bc1c0d1c47ae989ac2653a24063e8344cef2f3062fc6798e18b969e8f9aa8287104ce2518e6c644cb8d3a4650b5a0bc5dfde973e76e618955 SHA512 184582f3a902a989ba3d9c4d21288c014c8b469adbbb4cbabc621c5006022cef29baed8c1140ed4476b124da83b76dfa414295ed0c3374be826e75aca953a77b
27 -DIST mariadb-10.1.40.tar.gz 63573615 BLAKE2B a57f89c3a9cbfdfc7ff85ec6d7f4231f29a8c2b5df8a86e069e9c077aafc16f60655eab2765a622ec2675fbec4739a477613a42c68f897785443d8366fb5d1a3 SHA512 6b946189c69905f1a23a96d34720f1592353e0095455bf452bba31d53c90143d088f0fd997cac3da0a779840bb6ae6cc30b45144cba474463a8e3a6978a8a8f3
28 DIST mariadb-10.1.41.tar.gz 63615288 BLAKE2B 91ebc6d24c80ad9651c42a2f4553ce3ec3b7beb17493f90ebbf02ab23f425b0f729766cf2c81202832dfbca0a5e285f94a4daf794fcf4d445730fbe4fcc88871 SHA512 4a18b06fda49c5c3627b4e7cd32fb460e73762273a0c3d09098e34c71e63caa8fad03cdd92ae4a391cdfdb3719934688f0bdf312fa4af7ac3b9e5f5d90f404be
29 DIST mariadb-10.2.22.tar.gz 71907765 BLAKE2B e7781a9e1bb0becca543ebb0b9e03912fbafa9de45bbd5c7232f92d29b934148dd124ad462bf8aa5aec2e4ee0bf75a03fae5e5fe97a77e1d93095052a577c14b SHA512 cd61d0c2d528b23b975e6ea142560d9b9ebff7ecda6fa9b3659b25b3406e8cc925918f4c3bb0e200ddb8d0520bcaa4d4f70d245b4731896f9ba2f1bdf0a817b2
30 -DIST mariadb-10.2.25.tar.gz 71997847 BLAKE2B 03435106c5b2316e8f66028fa05b85042f35ebe84fa245d214622252048befa414d1630c4edead9ccb07f88f8c8085bb4c2e1361e08f58829b0a751326503cf1 SHA512 0d0f5e188f81715edb02ee91cc6c15ad0f674da67bc8d291a2bad9454190e9423f85ee1b69f88d3b429bc56c58a899f889f04862a4bddf2afdac744318c9c723
31 DIST mariadb-10.2.26.tar.gz 73037655 BLAKE2B 54fd27959960736bffe0eeacc913b9aed0407d1be7a60d3035a1b84cbe8066aa1551c1c82a1b90b824debf85faaa9d11e3de29634a0108bc04bc17ca5c2a9d7c SHA512 1eaac1c1dda1017b64249d39d872729d3140d81653240c54f688f64440b1775e5f3a7c5a8486075fa1799411dfb0c2c09b7c1dbb46d95675572d90127048c124
32 -DIST mariadb-10.3.16.tar.gz 70862041 BLAKE2B 522c3185e9928cfb669065fd8b1b8538f53a63d0413ae32e317a1ee6c572c6af458ba15e904e19b2cdb6e83b870360f56f4368eecc2774caab8ac85bc000f609 SHA512 b22a8c8fa0265f88962432ade71c3f0ec554f7d38042def832cfcb50f3aa1dd77a715c76706ffeae679b95438529b06e98b73b7e219f9c645980802027ec022f
33 DIST mariadb-10.3.17.tar.gz 71894997 BLAKE2B 8e04302f67a99c28751f9970b7e8dfc5ada0583fdabc416e0469e23fa93d22dae8b79e762ef14ca65957e22ec310a290b15d33746f6f2e7287f922803e6a6826 SHA512 6fba995d8c284a12f19ee5635f5d69d8fa89fc314f512cd1764b2c4593933baf71a472ddce630463debd3bfbafa1cf5afee3f40d3c4062242f58cea16259561e
34 -DIST mariadb-10.4.6.tar.gz 76710358 BLAKE2B 7fcaced6cbcc027ad2a1f1e681af30d0f4ec45f432bad4c6c7d9625a8d20978e4c49cbec3016be873ecda16cb113a8f3b6a8ec8995772255c23e908cc5d11178 SHA512 b04c47f72de2473d7b5edd04b4785a1d7179bb1f429f30ba53ae6cfbbb413200d9803eff1072949b2e81fd7d2164ea34c68620d621d4181b913daa2293ae140c
35 DIST mariadb-10.4.7.tar.gz 78155161 BLAKE2B b2c92093438b3574e494bda2180f4a2b5cbe10bac1c46acc45b5303fb4c2a1ca54f3ea88d138ab9cbb492460171dde86f3c21e5873d964b15c6c064e2e6eb47f SHA512 cb8b5adaef1970b9c8f04db08c18660f8b3df87f699aa93c1bee9497b887ddf50fcf3a2aebbe21a5fc9dfcbd118d0192d7421512522d98eaf30a014822c2f7ce
36 -DIST mariadb-5.5.64.tar.gz 45953561 BLAKE2B d6efe53e520b829ec337a00efadd7d813afd5e3ee6ac5a298773c7cd1b724d01856979317fe2bcf814af3bdabdbd7c6c3d2e27a60b4cdf6032b1dfd64e54d84d SHA512 3e93044eb30d2ce50fefce503f16f4b542fd647ff4367675147ebe1b1f576b4fbad5c0bb25670136d0758d2b8b0c571119244c87d66565bb9b3471811f5dc6b8
37 DIST mariadb-5.5.65.tar.gz 45957577 BLAKE2B 9ed27349d008d2001ed4059370505064918ef3586f89157f5f28892bceabd3073b7070f4054c0a700f1504dde3a4077e274111d5b8cb3713bc5db0910b752628 SHA512 5dbaa2ba7a829a0d5ae6ab8394c31a58753cd93da2637cd83d1e055e78b0796d63214418ddc91a65cefdd791aad4f01b0743aa8c7c40ecbb404cb81fd0138443
38 DIST mysql-extras-20180809-1700Z.tar.bz2 322999 BLAKE2B 8b5feb32085dc35b2f68dae985b2d266c4eaa0e956b490050a2df04bbff99bf8623b67e75af9326d84e3ad625c4d86b0d21d23c9a96df5a0c9cd5ed730958970 SHA512 fbd7af9284bbf09d55f128361e7cc52d94f24ac491aac800cd6d61f2e444aeca66a4d5e6ae94c2fb4044e00cec9b232bae9a76a229f87f19d90b7aecf70792ec
39 DIST mysql-extras-20190305-2052Z.tar.bz2 331304 BLAKE2B 1d2c35a961159fa5ce9ee6699fce943f5a5b5cf60b11c9bb4bcccee4943f4508a9eb6d01050c642353ac592ce1a6b421abf2a1bebc706c44c4c8a36aa698ec43 SHA512 ae63403320e010acbb92f8aec6da8ed4f267cef0bad37147d594076fd94571de7f98bfc2afbe94af5d716f58d57696fd958b1e13e20e87052f252ed4a188cd3c
40 -DIST mysql-extras-20190521-1824Z.tar.bz2 331441 BLAKE2B d45fd1be113d3dc7f10a3ff89cfda3d59974d88366a143b473a68493c93e244d45a836b4e13dc9e88bbd8b734507858d6b4b1251325c464f48572fe158d7edf7 SHA512 8b91f534acbd07e3a2f66e28b1301f960ed9192c2bc1edbc07741b6200ad0767fdc004faebce2a60fa67a8f3aee186c98ee2f56278d4e8773e5df77f609ef837
41 DIST mysql-extras-20190731-2258Z.tar.bz2 332111 BLAKE2B cc144c9af852bfdd4149b96bdc22f8afb2d0aa92f95ebd272a244f0fb7743dc03f9244871d5c195260bac5d9ed20583093257ee2c95a5a4d0a4dae488d781adf SHA512 d4428a1128cd5aef62c463b659992b110090b1602cdcb6b8d922d570c6b946fde325bfcf5a9a955a8dcc61f3ccd3d612d8517ebf63e316f98ca9ff2cd8a807aa
42
43 diff --git a/dev-db/mariadb/mariadb-10.1.40.ebuild b/dev-db/mariadb/mariadb-10.1.40.ebuild
44 deleted file mode 100644
45 index 324475b3e08..00000000000
46 --- a/dev-db/mariadb/mariadb-10.1.40.ebuild
47 +++ /dev/null
48 @@ -1,887 +0,0 @@
49 -# Copyright 1999-2019 Gentoo Authors
50 -# Distributed under the terms of the GNU General Public License v2
51 -
52 -EAPI="6"
53 -MY_EXTRAS_VER="20190305-2052Z"
54 -SUBSLOT="18"
55 -
56 -JAVA_PKG_OPT_USE="jdbc"
57 -
58 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
59 -
60 -inherit eutils systemd flag-o-matic prefix toolchain-funcs java-pkg-opt-2 user cmake-utils multilib-build
61 -
62 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
63 -
64 -# Gentoo patches to MySQL
65 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
66 - SRC_URI="${SRC_URI}
67 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
68 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
69 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
70 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
71 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
72 -fi
73 -
74 -HOMEPAGE="https://mariadb.org/"
75 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
76 -LICENSE="GPL-2"
77 -SLOT="0/${SUBSLOT:-0}"
78 -IUSE="+backup bindist client-libs cracklib debug extraengine galera jdbc jemalloc kerberos
79 - innodb-lz4 innodb-lzo innodb-snappy latin1 libressl mroonga numa odbc oqgraph pam
80 - +perl profiling selinux +server sphinx sst-rsync sst-mariabackup sst-xtrabackup
81 - systemd systemtap static static-libs tcmalloc test tokudb xml yassl"
82 -
83 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
84 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
85 -
86 -REQUIRED_USE="jdbc? ( extraengine server !static )
87 - server? ( tokudb? ( jemalloc !tcmalloc ) )
88 - ?? ( tcmalloc jemalloc )
89 - static? ( yassl !pam )"
90 -
91 -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"
92 -
93 -# Shorten the path because the socket path length must be shorter than 107 chars
94 -# and we will run a mysql server during test phase
95 -S="${WORKDIR}/mysql"
96 -
97 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
98 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
99 - inherit git-r3
100 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
101 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
102 - EGIT_CLONE_TYPE=shallow
103 -else
104 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
105 -fi
106 -
107 -PATCHES=(
108 - "${MY_PATCH_DIR}"/20006_all_cmake_elib-mariadb-10.1.27.patch
109 - "${MY_PATCH_DIR}"/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch
110 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
111 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.1.16-without-clientlibs-tools.patch
112 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.1.26-gssapi-detect.patch
113 - "${MY_PATCH_DIR}"/20029_all_mariadb-10.1.37-enable-numa.patch
114 - "${MY_PATCH_DIR}"/20035_all_mariadb-10.1-atomic-detection.patch
115 -)
116 -
117 -# Be warned, *DEPEND are version-dependant
118 -# These are used for both runtime and compiletime
119 -COMMON_DEPEND="
120 - kernel_linux? (
121 - sys-process/procps:0=
122 - dev-libs/libaio:0=
123 - )
124 - >=sys-apps/sed-4
125 - >=sys-apps/texinfo-4.7-r1
126 - jemalloc? ( dev-libs/jemalloc:0= )
127 - tcmalloc? ( dev-util/google-perftools:0= )
128 - systemtap? ( >=dev-util/systemtap-1.3:0= )
129 - !yassl? (
130 - !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
131 - libressl? ( dev-libs/libressl:0= )
132 - )
133 - >=sys-libs/zlib-1.2.3:0=
134 - sys-libs/ncurses:0=
135 - !bindist? (
136 - sys-libs/binutils-libs:0=
137 - >=sys-libs/readline-4.1:0=
138 - )
139 - server? (
140 - backup? ( app-arch/libarchive:0= )
141 - cracklib? ( sys-libs/cracklib:0= )
142 - extraengine? (
143 - odbc? ( dev-db/unixODBC:0= )
144 - xml? ( dev-libs/libxml2:2= )
145 - sys-libs/zlib[minizip]
146 - )
147 - innodb-lz4? ( app-arch/lz4 )
148 - innodb-lzo? ( dev-libs/lzo )
149 - innodb-snappy? ( app-arch/snappy )
150 - kerberos? ( virtual/krb5 )
151 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
152 - numa? ( sys-process/numactl )
153 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
154 - pam? ( virtual/pam:0= )
155 - systemd? ( sys-apps/systemd:= )
156 - tokudb? ( app-arch/snappy )
157 - )
158 - !yassl? ( !libressl? ( !>=dev-libs/openssl-1.1.0 ) )
159 - >=dev-libs/libpcre-8.41-r1:3=
160 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
161 -"
162 -DEPEND="virtual/yacc
163 - static? ( sys-libs/ncurses[static-libs] )
164 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
165 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
166 - ${COMMON_DEPEND}"
167 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
168 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
169 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
170 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
171 - ${COMMON_DEPEND}
172 - server? ( galera? (
173 - sys-apps/iproute2
174 - =sys-cluster/galera-25*
175 - sst-rsync? ( sys-process/lsof )
176 - sst-mariabackup? ( net-misc/socat[ssl] )
177 - sst-xtrabackup? ( net-misc/socat[ssl] )
178 - ) )
179 - perl? ( !dev-db/mytop
180 - virtual/perl-Getopt-Long
181 - dev-perl/TermReadKey
182 - virtual/perl-Term-ANSIColor
183 - virtual/perl-Time-HiRes )
184 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
185 -"
186 -# For other stuff to bring us in
187 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
188 -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
189 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
190 - server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
191 -
192 -pkg_setup() {
193 - if [[ ${MERGE_TYPE} != binary ]] ; then
194 - local GCC_MAJOR_SET=$(gcc-major-version)
195 - local GCC_MINOR_SET=$(gcc-minor-version)
196 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
197 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
198 - eerror "${PN} with tokudb 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 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
203 - # non x86{,_64} arches
204 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
205 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
206 - eerror "${PN} needs to be built with gcc-4.7 or later."
207 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
208 - die
209 - fi
210 - fi
211 - java-pkg-opt-2_pkg_setup
212 - if has test ${FEATURES} && \
213 - use server && ! has userpriv ${FEATURES} ; then
214 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
215 - fi
216 -
217 - # This should come after all of the die statements
218 - enewgroup mysql 60 || die "problem adding 'mysql' group"
219 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
220 -}
221 -
222 -pkg_preinst() {
223 - java-pkg-opt-2_pkg_preinst
224 -}
225 -
226 -pkg_postinst() {
227 - # Make sure the vars are correctly initialized
228 - mysql_init_vars
229 -
230 - # Create log directory securely if it does not exist
231 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
232 -
233 - if use server ; then
234 - if use pam; then
235 - einfo
236 - elog "This install includes the PAM authentication plugin."
237 - elog "To activate and configure the PAM plugin, please read:"
238 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
239 - einfo
240 - fi
241 -
242 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
243 - einfo
244 - elog "You might want to run:"
245 - elog "\"emerge --config =${CATEGORY}/${PF}\""
246 - elog "if this is a new install."
247 - elog
248 - elog "If you are switching server implentations, you should run the"
249 - elog "mysql_upgrade tool."
250 - einfo
251 - else
252 - einfo
253 - elog "If you are upgrading major versions, you should run the"
254 - elog "mysql_upgrade tool."
255 - einfo
256 - fi
257 -
258 - einfo
259 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
260 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
261 - elog "The first time the cluster is activated, you should add"
262 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
263 - elog "This option should then be removed for subsequent starts."
264 - einfo
265 - fi
266 -}
267 -
268 -src_unpack() {
269 - unpack ${A}
270 - # Grab the patches
271 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
272 -
273 - mv -f "${WORKDIR%/}/${PN%%-galera}-${PV}" "${S}" || die
274 -}
275 -
276 -src_prepare() {
277 - _disable_engine() {
278 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
279 - }
280 -
281 - _disable_plugin() {
282 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
283 - }
284 -
285 - if use tcmalloc; then
286 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
287 - fi
288 -
289 - # Don't build bundled xz-utils for tokudb
290 - echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
291 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
292 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
293 -
294 - local plugin
295 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
296 - locale_info qc_info server_audit semisync sql_errlog )
297 - local test_plugins=( audit_null auth_examples daemon_example fulltext )
298 - if ! use server; then # These plugins are for the server
299 - for plugin in "${server_plugins[@]}" ; do
300 - _disable_plugin "${plugin}"
301 - done
302 - fi
303 -
304 - if ! use test; then # These plugins are only used during testing
305 - for plugin in "${test_plugins[@]}" ; do
306 - _disable_plugin "${plugin}"
307 - done
308 - fi
309 -
310 - # Collides with mariadb-connector-c bug 655980
311 - _disable_plugin auth_dialog
312 -
313 - # Avoid useless library checks
314 - use mroonga || _disable_engine mroonga
315 - use oqgraph || _disable_engine oqgraph
316 - _disable_engine example
317 -
318 - cmake-utils_src_prepare
319 - java-pkg-opt-2_src_prepare
320 -}
321 -
322 -src_configure(){
323 - # bug 508724 mariadb cannot use ld.gold
324 - tc-ld-disable-gold
325 - # Bug #114895, bug #110149
326 - filter-flags "-O" "-O[01]"
327 -
328 - append-cxxflags -felide-constructors
329 -
330 - # bug #283926, with GCC4.4, this is required to get correct behavior.
331 - append-flags -fno-strict-aliasing
332 -
333 - CMAKE_BUILD_TYPE="RelWithDebInfo"
334 -
335 - # debug hack wrt #497532
336 - mycmakeargs=(
337 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
338 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
339 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
340 - -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql"
341 - -DINSTALL_BINDIR=bin
342 - -DINSTALL_DOCDIR=share/doc/${PF}
343 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
344 - -DINSTALL_INCLUDEDIR=include/mysql
345 - -DINSTALL_INFODIR=share/info
346 - -DINSTALL_LIBDIR=$(get_libdir)
347 - -DINSTALL_MANDIR=share/man
348 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
349 - -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mariadb/mysql-test' '')
350 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
351 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
352 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
353 - -DINSTALL_SBINDIR=sbin
354 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb"
355 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
356 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
357 - -DWITH_ZLIB=system
358 - -DENABLED_LOCAL_INFILE=1
359 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
360 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
361 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
362 - -DWITH_DEFAULT_FEATURE_SET=0
363 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
364 - # The build forces this to be defined when cross-compiling. We pass it
365 - # all the time for simplicity and to make sure it is actually correct.
366 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
367 - -DWITHOUT_CLIENTLIBS=YES
368 - -DWITH_READLINE=$(usex bindist 1 0)
369 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
370 - -DENABLE_DTRACE=$(usex systemtap)
371 - -DWITH_SSL=$(usex yassl bundled system)
372 - )
373 -
374 - if use server ; then
375 -
376 - # Federated{,X} must be treated special otherwise they will not be built as plugins
377 - if ! use extraengine ; then
378 - mycmakeargs+=(
379 - -DPLUGIN_FEDERATED=NO
380 - -DPLUGIN_FEDERATEDX=NO )
381 - fi
382 -
383 - mycmakeargs+=(
384 - -DWITH_JEMALLOC=$(usex jemalloc system)
385 - -DWITH_PCRE=system
386 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
387 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
388 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
389 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
390 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
391 - -DPLUGIN_CASSANDRA=NO
392 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
393 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
394 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
395 - -DCONNECT_WITH_MYSQL=1
396 - -DCONNECT_WITH_LIBXML2=$(usex xml)
397 - -DCONNECT_WITH_ODBC=$(usex odbc)
398 - -DCONNECT_WITH_JDBC=$(usex jdbc)
399 - # Build failure and autodep wrt bug 639144
400 - -DCONNECT_WITH_MONGO=OFF
401 - -DWITH_WSREP=$(usex galera)
402 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
403 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
404 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
405 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
406 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
407 - -DPLUGIN_AUTH_GSSAPI_CLIENT=NO
408 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
409 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
410 - -DWITH_SYSTEMD=$(usex systemd yes no)
411 - -DWITH_NUMA=$(usex numa ON OFF)
412 - -DINSTALL_SQLBENCHDIR=''
413 - )
414 -
415 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
416 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
417 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
418 - ewarn "You MUST file bugs without these variables set."
419 -
420 - mycmakeargs+=(
421 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
422 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
423 - )
424 -
425 - elif ! use latin1 ; then
426 - mycmakeargs+=(
427 - -DDEFAULT_CHARSET=utf8
428 - -DDEFAULT_COLLATION=utf8_general_ci
429 - )
430 - else
431 - mycmakeargs+=(
432 - -DDEFAULT_CHARSET=latin1
433 - -DDEFAULT_COLLATION=latin1_swedish_ci
434 - )
435 - fi
436 - mycmakeargs+=(
437 - -DEXTRA_CHARSETS=all
438 - -DMYSQL_USER=mysql
439 - -DDISABLE_SHARED=$(usex static YES NO)
440 - -DWITH_DEBUG=$(usex debug)
441 - -DWITH_EMBEDDED_SERVER=OFF
442 - -DENABLED_PROFILING=$(usex profiling)
443 - )
444 -
445 - if use static; then
446 - mycmakeargs+=( -DWITH_PIC=1 )
447 - fi
448 -
449 - if use jemalloc || use tcmalloc ; then
450 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
451 - fi
452 -
453 - # Storage engines
454 - mycmakeargs+=(
455 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
456 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
457 - -DWITH_CSV_STORAGE_ENGINE=1
458 - -DWITH_HEAP_STORAGE_ENGINE=1
459 - -DWITH_INNOBASE_STORAGE_ENGINE=1
460 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
461 - -DWITH_MYISAM_STORAGE_ENGINE=1
462 - -DWITH_PARTITION_STORAGE_ENGINE=1
463 - )
464 -
465 - else
466 - mycmakeargs+=(
467 - -DWITHOUT_SERVER=1
468 - -DWITH_EMBEDDED_SERVER=OFF
469 - -DEXTRA_CHARSETS=none
470 - -DINSTALL_SQLBENCHDIR=
471 - -DWITH_SYSTEMD=no
472 - )
473 - fi
474 -
475 - cmake-utils_src_configure
476 -}
477 -
478 -src_compile() {
479 - cmake-utils_src_compile
480 -}
481 -
482 -src_install() {
483 - cmake-utils_src_install
484 -
485 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
486 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
487 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
488 - fi
489 -
490 - # Make sure the vars are correctly initialized
491 - mysql_init_vars
492 -
493 - # Convenience links
494 - einfo "Making Convenience links for mysqlcheck multi-call binary"
495 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
496 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
497 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
498 -
499 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
500 - if [[ -d "${ED}/usr/data" ]] ; then
501 - rm -Rf "${ED}/usr/data" || die
502 - fi
503 -
504 - # Unless they explicitly specific USE=test, then do not install the
505 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
506 - # validation of your database configuration after tuning it.
507 - if ! use test ; then
508 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
509 - fi
510 -
511 - # Configuration stuff
512 - einfo "Building default configuration ..."
513 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
514 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
515 - local mycnf_src="my.cnf-5.6-r1"
516 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
517 - "${FILESDIR}/${mycnf_src}" \
518 - > "${TMPDIR}/my.cnf.ok" || die
519 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
520 - if use latin1 ; then
521 - sed -i \
522 - -e "/character-set/s|utf8|latin1|g" \
523 - "${TMPDIR}/my.cnf.ok" || die
524 - fi
525 - eprefixify "${TMPDIR}/my.cnf.ok"
526 - newins "${TMPDIR}/my.cnf.ok" my.cnf
527 -
528 - if use server ; then
529 - einfo "Including support files and sample configurations"
530 - docinto "support-files"
531 - local script
532 - for script in \
533 - "${S}"/support-files/magic
534 - do
535 - [[ -f "$script" ]] && dodoc "${script}"
536 - done
537 -
538 - docinto "scripts"
539 - for script in "${S}"/scripts/mysql* ; do
540 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
541 - done
542 - # Manually install supporting files that conflict with other packages
543 - # but are needed for galera and initial installation
544 - exeinto /usr/libexec/mariadb
545 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
546 - fi
547 -
548 - #Remove mytop if perl is not selected
549 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
550 -}
551 -
552 -# Official test instructions:
553 -# USE='extraengine perl server' \
554 -# FEATURES='test userpriv -usersandbox' \
555 -# ebuild mariadb-X.X.XX.ebuild \
556 -# digest clean package
557 -src_test() {
558 -
559 - _disable_test() {
560 - local rawtestname reason
561 - rawtestname="${1}" ; shift
562 - reason="${@}"
563 - ewarn "test '${rawtestname}' disabled: '${reason}'"
564 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
565 - }
566 -
567 - local TESTDIR="${BUILD_DIR}/mysql-test"
568 - local retstatus_unit
569 - local retstatus_tests
570 -
571 - if ! use server ; then
572 - einfo "Skipping server tests due to minimal build."
573 - return 0
574 - fi
575 -
576 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
577 - # localhost. Also causes weird failures.
578 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
579 -
580 - if [[ $UID -eq 0 ]]; then
581 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
582 - fi
583 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
584 -
585 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
586 -
587 - # Run CTest (test-units)
588 -# cmake-utils_src_test
589 -# retstatus_unit=$?
590 -
591 - # Ensure that parallel runs don't die
592 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
593 - # Enable parallel testing, auto will try to detect number of cores
594 - # You may set this by hand.
595 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
596 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
597 -
598 - # create directories because mysqladmin might run out of order
599 - mkdir -p "${T}"/var-tests{,/log} || die
600 -
601 - # Run mysql tests
602 - pushd "${TESTDIR}" > /dev/null || die
603 -
604 - touch "${T}/disabled.def"
605 - # These are failing in MariaDB 10.0 for now and are believed to be
606 - # false positives:
607 - #
608 - # main.mysql_client_test, main.mysql_client_test_nonblock
609 - # main.mysql_client_test_comp:
610 - # segfaults at random under Portage only, suspect resource limits.
611 -
612 - local t
613 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
614 - _disable_test "$t" "False positive due to varying policies"
615 - done
616 -
617 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
618 - rpl.rpl_semi_sync_uninstall_plugin \
619 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
620 - _disable_test "$t" "False positives in Gentoo"
621 - done
622 -
623 - if ! use client-libs ; then
624 - _disable_test main.plugin_auth "Needs client libraries built"
625 - fi
626 -
627 - _disable_test sys_vars.sysvars_server_notembedded "Broken test" # bug #661700 required profiling always on
628 -
629 - # run mysql-test tests
630 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
631 - retstatus_tests=$?
632 -
633 - popd > /dev/null || die
634 -
635 - # Cleanup is important for these testcases.
636 - pkill -9 -f "${S}/ndb" 2>/dev/null
637 - pkill -9 -f "${S}/sql" 2>/dev/null
638 -
639 - local failures=""
640 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
641 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
642 -
643 - [[ -z "$failures" ]] || die "Test failures: $failures"
644 - einfo "Tests successfully completed"
645 -}
646 -
647 -mysql_init_vars() {
648 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
649 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
650 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
651 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
652 -
653 - if [[ -z "${MY_DATADIR}" ]] ; then
654 - MY_DATADIR=""
655 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
656 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
657 - | sed -ne '/datadir/s|^--datadir=||p' \
658 - | tail -n1`
659 - if [[ -z "${MY_DATADIR}" ]] ; then
660 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
661 - | sed -e 's/.*=\s*//' \
662 - | tail -n1`
663 - fi
664 - fi
665 - if [[ -z "${MY_DATADIR}" ]] ; then
666 - MY_DATADIR="${MY_LOCALSTATEDIR}"
667 - einfo "Using default MY_DATADIR"
668 - fi
669 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
670 -
671 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
672 - if [[ -e "${MY_DATADIR}" ]] ; then
673 - # If you get this and you're wondering about it, see bug #207636
674 - elog "MySQL datadir found in ${MY_DATADIR}"
675 - elog "A new one will not be created."
676 - PREVIOUS_DATADIR="yes"
677 - else
678 - PREVIOUS_DATADIR="no"
679 - fi
680 - export PREVIOUS_DATADIR
681 - fi
682 - else
683 - if [[ ${EBUILD_PHASE} == "config" ]]; then
684 - local new_MY_DATADIR
685 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
686 - | sed -ne '/datadir/s|^--datadir=||p' \
687 - | tail -n1`
688 -
689 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
690 - ewarn "MySQL MY_DATADIR has changed"
691 - ewarn "from ${MY_DATADIR}"
692 - ewarn "to ${new_MY_DATADIR}"
693 - MY_DATADIR="${new_MY_DATADIR}"
694 - fi
695 - fi
696 - fi
697 -
698 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
699 - export MY_LOCALSTATEDIR MY_LOGDIR
700 - export MY_DATADIR
701 -}
702 -
703 -pkg_config() {
704 - _getoptval() {
705 - local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults
706 - local section="$1"
707 - local flag="--${2}="
708 - local extra_options="${3}"
709 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
710 - }
711 - local old_MY_DATADIR="${MY_DATADIR}"
712 - local old_HOME="${HOME}"
713 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
714 - export HOME=${EPREFIX}/root
715 -
716 - # Make sure the vars are correctly initialized
717 - mysql_init_vars
718 -
719 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
720 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
721 - die "Minimal builds do NOT include the MySQL server"
722 - fi
723 -
724 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
725 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
726 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
727 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
728 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
729 -
730 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
731 - if [[ -d "${MY_DATADIR_s}" ]]; then
732 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
733 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
734 - else
735 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
736 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
737 - || die "Moving MY_DATADIR failed"
738 - fi
739 - else
740 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
741 - if [[ -d "${MY_DATADIR_s}" ]]; then
742 - ewarn "Attempting to use ${MY_DATADIR_s}"
743 - else
744 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
745 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
746 - fi
747 - fi
748 - fi
749 -
750 - local pwd1="a"
751 - local pwd2="b"
752 - local maxtry=15
753 -
754 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
755 - local tmp_mysqld_password_source=
756 -
757 - for tmp_mysqld_password_source in mysql client; do
758 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
759 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
760 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
761 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
762 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
763 - MYSQL_ROOT_PASSWORD=
764 - continue
765 - fi
766 -
767 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
768 - break
769 - fi
770 - done
771 -
772 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
773 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
774 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
775 - fi
776 -
777 - unset tmp_mysqld_password_source
778 - fi
779 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
780 - # These are dir+prefix
781 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
782 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
783 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
784 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
785 -
786 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
787 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
788 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
789 - fi
790 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
791 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
792 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
793 - fi
794 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
795 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
796 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
797 - fi
798 -
799 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
800 - ewarn "You have already a MySQL database in place."
801 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
802 - ewarn "Please rename or delete it if you wish to replace it."
803 - die "MySQL database already exists!"
804 - fi
805 -
806 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
807 - # localhost. Also causes weird failures.
808 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
809 -
810 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
811 -
812 - einfo "Please provide a password for the mysql 'root' user now"
813 - einfo "or through the ${HOME}/.my.cnf file."
814 - ewarn "Avoid [\"'\\_%] characters in the password"
815 - read -rsp " >" pwd1 ; echo
816 -
817 - einfo "Retype the password"
818 - read -rsp " >" pwd2 ; echo
819 -
820 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
821 - die "Passwords are not the same"
822 - fi
823 - MYSQL_ROOT_PASSWORD="${pwd1}"
824 - unset pwd1 pwd2
825 - fi
826 -
827 - local options
828 - local sqltmp="$(emktemp)"
829 -
830 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
831 - # see https://bugs.mysql.com/bug.php?id=31312
832 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
833 -
834 - # Figure out which options we need to disable to do the setup
835 - local helpfile="${TMPDIR}/mysqld-help"
836 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
837 - for opt in grant-tables host-cache name-resolve networking slave-start \
838 - federated ssl log-bin relay-log slow-query-log external-locking \
839 - log-slave-updates \
840 - ; do
841 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
842 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
843 - done
844 -
845 - einfo "Creating the mysql database and setting proper permissions on it ..."
846 -
847 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
848 - PID_DIR="${EROOT}/var/run/mysqld"
849 - if [[ ! -d "${PID_DIR}" ]]; then
850 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
851 - fi
852 -
853 - if [[ ! -d "${MY_DATADIR}" ]]; then
854 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
855 - fi
856 -
857 - pushd "${TMPDIR}" &>/dev/null || die
858 -
859 - # Filling timezones, see
860 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
861 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
862 -
863 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
864 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
865 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
866 - einfo "Command: ${cmd[*]}"
867 - su -s /bin/sh -c "${cmd[*]}" mysql \
868 - >"${TMPDIR}"/mysql_install_db.log 2>&1
869 - if [ $? -ne 0 ]; then
870 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
871 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
872 - fi
873 - popd &>/dev/null || die
874 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
875 - || die "MySQL databases not installed"
876 -
877 - use prefix || options="${options} --user=mysql"
878 -
879 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
880 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
881 - local mysqld="${EROOT}/usr/sbin/mysqld \
882 - ${options} \
883 - --log-warnings=0 \
884 - --basedir=${EROOT}/usr \
885 - --datadir=${ROOT}/${MY_DATADIR} \
886 - --max_allowed_packet=8M \
887 - --net_buffer_length=16K \
888 - --socket=${socket} \
889 - --pid-file=${pidfile} \
890 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
891 - #einfo "About to start mysqld: ${mysqld}"
892 - ebegin "Starting mysqld"
893 - einfo "Command ${mysqld}"
894 - ${mysqld} &
895 - rc=$?
896 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
897 - maxtry=$((${maxtry}-1))
898 - echo -n "."
899 - sleep 1
900 - done
901 - eend $rc
902 -
903 - if ! [[ -S "${socket}" ]]; then
904 - die "Completely failed to start up mysqld with: ${mysqld}"
905 - fi
906 -
907 - ebegin "Setting root password"
908 - # Do this from memory, as we don't want clear text passwords in temp files
909 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
910 - "${EROOT}/usr/bin/mysql" \
911 - "--socket=${socket}" \
912 - -hlocalhost \
913 - -e "${sql}"
914 - eend $?
915 -
916 - if [[ -n "${sqltmp}" ]] ; then
917 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
918 - "${EROOT}/usr/bin/mysql" \
919 - "--socket=${socket}" \
920 - -hlocalhost \
921 - -uroot \
922 - --password="${MYSQL_ROOT_PASSWORD}" \
923 - mysql < "${sqltmp}"
924 - rc=$?
925 - eend $?
926 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
927 - fi
928 -
929 - # Stop the server and cleanup
930 - einfo "Stopping the server ..."
931 - kill $(< "${pidfile}" )
932 - rm -f "${sqltmp}"
933 - wait %1
934 - einfo "Done"
935 -}
936
937 diff --git a/dev-db/mariadb/mariadb-10.2.25.ebuild b/dev-db/mariadb/mariadb-10.2.25.ebuild
938 deleted file mode 100644
939 index 164ae72f6c2..00000000000
940 --- a/dev-db/mariadb/mariadb-10.2.25.ebuild
941 +++ /dev/null
942 @@ -1,973 +0,0 @@
943 -# Copyright 1999-2019 Gentoo Authors
944 -# Distributed under the terms of the GNU General Public License v2
945 -
946 -EAPI="6"
947 -MY_EXTRAS_VER="20190305-2052Z"
948 -SUBSLOT="18"
949 -
950 -JAVA_PKG_OPT_USE="jdbc"
951 -
952 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
953 -
954 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
955 - java-pkg-opt-2 user cmake-utils
956 -
957 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
958 -
959 -# Gentoo patches to MySQL
960 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
961 - SRC_URI="${SRC_URI}
962 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
963 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
964 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
965 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
966 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
967 -fi
968 -
969 -HOMEPAGE="https://mariadb.org/"
970 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
971 -LICENSE="GPL-2 LGPL-2.1+"
972 -SLOT="0/${SUBSLOT:-0}"
973 -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4
974 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
975 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
976 - sst-rsync sst-mariabackup sst-xtrabackup static systemd systemtap tcmalloc
977 - test tokudb xml yassl"
978 -
979 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
980 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
981 -
982 -REQUIRED_USE="jdbc? ( extraengine server !static )
983 - server? ( tokudb? ( jemalloc !tcmalloc ) )
984 - ?? ( tcmalloc jemalloc )
985 - static? ( yassl !pam )"
986 -
987 -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"
988 -
989 -# Shorten the path because the socket path length must be shorter than 107 chars
990 -# and we will run a mysql server during test phase
991 -S="${WORKDIR}/mysql"
992 -
993 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
994 - inherit git-r3
995 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
996 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
997 - EGIT_CLONE_TYPE=shallow
998 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
999 -else
1000 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
1001 -fi
1002 -
1003 -PATCHES=(
1004 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
1005 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.16-without-clientlibs-tools.patch
1006 - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
1007 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
1008 - "${MY_PATCH_DIR}"/20035_all_mariadb-10.2-atomic-detection.patch
1009 -)
1010 -
1011 -# Be warned, *DEPEND are version-dependant
1012 -# These are used for both runtime and compiletime
1013 -COMMON_DEPEND="
1014 - kernel_linux? (
1015 - sys-process/procps:0=
1016 - dev-libs/libaio:0=
1017 - )
1018 - >=sys-apps/sed-4
1019 - >=sys-apps/texinfo-4.7-r1
1020 - jemalloc? ( dev-libs/jemalloc:0= )
1021 - tcmalloc? ( dev-util/google-perftools:0= )
1022 - systemtap? ( >=dev-util/systemtap-1.3:0= )
1023 - >=sys-libs/zlib-1.2.3:0=
1024 - kerberos? ( virtual/krb5 )
1025 - yassl? ( net-libs/gnutls:0= )
1026 - !yassl? (
1027 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
1028 - libressl? ( dev-libs/libressl:0= )
1029 - )
1030 - sys-libs/ncurses:0=
1031 - !bindist? (
1032 - sys-libs/binutils-libs:0=
1033 - >=sys-libs/readline-4.1:0=
1034 - )
1035 - server? (
1036 - backup? ( app-arch/libarchive:0= )
1037 - cracklib? ( sys-libs/cracklib:0= )
1038 - extraengine? (
1039 - odbc? ( dev-db/unixODBC:0= )
1040 - xml? ( dev-libs/libxml2:2= )
1041 - )
1042 - innodb-lz4? ( app-arch/lz4 )
1043 - innodb-lzo? ( dev-libs/lzo )
1044 - innodb-snappy? ( app-arch/snappy )
1045 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
1046 - numa? ( sys-process/numactl )
1047 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
1048 - pam? ( virtual/pam:0= )
1049 - systemd? ( sys-apps/systemd:= )
1050 - tokudb? ( app-arch/snappy )
1051 - )
1052 - >=dev-libs/libpcre-8.41-r1:3=
1053 -"
1054 -DEPEND="virtual/yacc
1055 - static? ( sys-libs/ncurses[static-libs] )
1056 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
1057 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
1058 - ${COMMON_DEPEND}"
1059 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
1060 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
1061 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
1062 - !<virtual/mysql-5.6-r11
1063 - ${COMMON_DEPEND}
1064 - server? ( galera? (
1065 - sys-apps/iproute2
1066 - =sys-cluster/galera-25*
1067 - sst-rsync? ( sys-process/lsof )
1068 - sst-mariabackup? ( net-misc/socat[ssl] )
1069 - sst-xtrabackup? ( net-misc/socat[ssl] )
1070 - ) )
1071 - perl? ( !dev-db/mytop
1072 - virtual/perl-Getopt-Long
1073 - dev-perl/TermReadKey
1074 - virtual/perl-Term-ANSIColor
1075 - virtual/perl-Time-HiRes )
1076 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
1077 -"
1078 -# For other stuff to bring us in
1079 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
1080 -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
1081 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
1082 - server? ( ~virtual/mysql-5.6[static=]
1083 - galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
1084 -
1085 -pkg_setup() {
1086 - if [[ ${MERGE_TYPE} != binary ]] ; then
1087 - local GCC_MAJOR_SET=$(gcc-major-version)
1088 - local GCC_MINOR_SET=$(gcc-minor-version)
1089 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
1090 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1091 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
1092 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1093 - die
1094 - fi
1095 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
1096 - # non x86{,_64} arches
1097 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
1098 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1099 - eerror "${PN} needs to be built with gcc-4.7 or later."
1100 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1101 - die
1102 - fi
1103 - fi
1104 - java-pkg-opt-2_pkg_setup
1105 - if has test ${FEATURES} && \
1106 - use server && ! has userpriv ${FEATURES} ; then
1107 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1108 - fi
1109 -
1110 - # This should come after all of the die statements
1111 - enewgroup mysql 60 || die "problem adding 'mysql' group"
1112 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
1113 -}
1114 -
1115 -pkg_preinst() {
1116 - java-pkg-opt-2_pkg_preinst
1117 -
1118 - # Here we need to see if the implementation switched client libraries
1119 - # We check if this is a new instance of the package and a client library already exists
1120 - local SHOW_ABI_MESSAGE libpath
1121 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
1122 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
1123 - elog "Due to ABI changes when switching between different client libraries,"
1124 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
1125 - elog "Please run: revdep-rebuild --library ${libpath}"
1126 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
1127 - fi
1128 -}
1129 -
1130 -pkg_postinst() {
1131 - # Make sure the vars are correctly initialized
1132 - mysql_init_vars
1133 -
1134 - # Create log directory securely if it does not exist
1135 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
1136 -
1137 - if use server ; then
1138 - if use pam; then
1139 - einfo
1140 - elog "This install includes the PAM authentication plugin."
1141 - elog "To activate and configure the PAM plugin, please read:"
1142 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
1143 - einfo
1144 - fi
1145 -
1146 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1147 - einfo
1148 - elog "You might want to run:"
1149 - elog "\"emerge --config =${CATEGORY}/${PF}\""
1150 - elog "if this is a new install."
1151 - elog
1152 - elog "If you are switching server implentations, you should run the"
1153 - elog "mysql_upgrade tool."
1154 - einfo
1155 - else
1156 - einfo
1157 - elog "If you are upgrading major versions, you should run the"
1158 - elog "mysql_upgrade tool."
1159 - einfo
1160 - fi
1161 -
1162 - if use galera ; then
1163 - einfo
1164 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
1165 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
1166 - elog "The first time the cluster is activated, you should add"
1167 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
1168 - elog "This option should then be removed for subsequent starts."
1169 - einfo
1170 - if use sst-xtrabackup ; then
1171 - ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup"
1172 - ewarn "as an SST is broken by default beginning with 10.2.19 with the setting"
1173 - ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead."
1174 - ewarn "sst-xtrabackup is being removed in 10.3 and higher."
1175 - fi
1176 - fi
1177 - fi
1178 -
1179 - # Note about configuration change
1180 - einfo
1181 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
1182 - elog "to several files in /etc/mysql/${PN}.d."
1183 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
1184 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
1185 - elog "You may have as many files as needed and they are read alphabetically."
1186 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
1187 - einfo
1188 -}
1189 -
1190 -src_unpack() {
1191 - unpack ${A}
1192 - # Grab the patches
1193 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
1194 -
1195 - mv -f "${WORKDIR%/}/${P}" "${S}" || die
1196 -}
1197 -
1198 -src_prepare() {
1199 - _disable_plugin() {
1200 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
1201 - }
1202 - _disable_engine() {
1203 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
1204 - }
1205 -
1206 - local malloc
1207 - for malloc in jemalloc tcmalloc ; do
1208 - if use ${malloc}; then
1209 - echo "TARGET_LINK_LIBRARIES(mysqld ${malloc})" >> "${S}/sql/CMakeLists.txt"
1210 - fi
1211 - done
1212 -
1213 - # Don't build bundled xz-utils for tokudb
1214 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
1215 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
1216 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
1217 -
1218 - local plugin
1219 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
1220 - locale_info qc_info server_audit sql_errlog )
1221 - local test_plugins=( audit_null auth_examples daemon_example fulltext
1222 - debug_key_management example_key_management )
1223 - if ! use server; then # These plugins are for the server
1224 - for plugin in "${server_plugins[@]}" ; do
1225 - _disable_plugin "${plugin}"
1226 - done
1227 - fi
1228 -
1229 - if ! use test; then # These plugins are only used during testing
1230 - for plugin in "${test_plugins[@]}" ; do
1231 - _disable_plugin "${plugin}"
1232 - done
1233 - _disable_engine test_sql_discovery
1234 - fi
1235 -
1236 - _disable_engine example
1237 -
1238 - if ! use oqgraph ; then # avoids extra library checks
1239 - _disable_engine oqgraph
1240 - fi
1241 -
1242 - if use mroonga ; then
1243 - # Remove the bundled groonga
1244 - # There is no CMake flag, it simply checks for existance
1245 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
1246 - else
1247 - _disable_engine mroonga
1248 - fi
1249 -
1250 - cmake-utils_src_prepare
1251 - java-pkg-opt-2_src_prepare
1252 -}
1253 -
1254 -src_configure(){
1255 - # bug 508724 mariadb cannot use ld.gold
1256 - tc-ld-disable-gold
1257 - # Bug #114895, bug #110149
1258 - filter-flags "-O" "-O[01]"
1259 -
1260 - append-cxxflags -felide-constructors
1261 -
1262 - # bug #283926, with GCC4.4, this is required to get correct behavior.
1263 - append-flags -fno-strict-aliasing
1264 -
1265 - CMAKE_BUILD_TYPE="RelWithDebInfo"
1266 -
1267 - # debug hack wrt #497532
1268 - mycmakeargs=(
1269 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1270 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1271 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
1272 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
1273 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
1274 - -DINSTALL_BINDIR=bin
1275 - -DINSTALL_DOCDIR=share/doc/${PF}
1276 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
1277 - -DINSTALL_INCLUDEDIR=include/mysql
1278 - -DINSTALL_INFODIR=share/info
1279 - -DINSTALL_LIBDIR=$(get_libdir)
1280 - -DINSTALL_MANDIR=share/man
1281 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
1282 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
1283 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
1284 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
1285 - -DINSTALL_SBINDIR=sbin
1286 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
1287 - -DWITH_COMMENT="Gentoo Linux ${PF}"
1288 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
1289 - -DWITH_LIBEDIT=0
1290 - -DWITH_ZLIB=system
1291 - -DWITHOUT_LIBWRAP=1
1292 - -DENABLED_LOCAL_INFILE=1
1293 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1294 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1295 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
1296 - -DWITH_DEFAULT_FEATURE_SET=0
1297 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
1298 - # The build forces this to be defined when cross-compiling. We pass it
1299 - # all the time for simplicity and to make sure it is actually correct.
1300 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
1301 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
1302 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
1303 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
1304 - -DCONC_WITH_EXTERNAL_ZLIB=YES
1305 - -DWITH_EXTERNAL_ZLIB=YES
1306 - -DSUFFIX_INSTALL_DIR=""
1307 - -DWITH_UNITTEST=OFF
1308 - -DWITHOUT_CLIENTLIBS=YES
1309 - -DCLIENT_PLUGIN_DIALOG=OFF
1310 - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
1311 - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
1312 - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
1313 - )
1314 - if use test ; then
1315 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
1316 - else
1317 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
1318 - fi
1319 -
1320 - if ! use yassl ; then
1321 - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
1322 - else
1323 - mycmakeargs+=( -DWITH_SSL=bundled )
1324 - fi
1325 -
1326 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
1327 - mycmakeargs+=(
1328 - -DWITH_READLINE=$(usex bindist 1 0)
1329 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
1330 - -DENABLE_DTRACE=$(usex systemtap)
1331 - )
1332 -
1333 - if use server ; then
1334 -
1335 - # Federated{,X} must be treated special otherwise they will not be built as plugins
1336 - if ! use extraengine ; then
1337 - mycmakeargs+=(
1338 - -DPLUGIN_FEDERATED=NO
1339 - -DPLUGIN_FEDERATEDX=NO )
1340 - fi
1341 -
1342 - mycmakeargs+=(
1343 - -DWITH_JEMALLOC=$(usex jemalloc system)
1344 - -DWITH_PCRE=system
1345 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
1346 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
1347 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
1348 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
1349 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
1350 - -DPLUGIN_CASSANDRA=NO
1351 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
1352 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
1353 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
1354 - -DCONNECT_WITH_MYSQL=1
1355 - -DCONNECT_WITH_LIBXML2=$(usex xml)
1356 - -DCONNECT_WITH_ODBC=$(usex odbc)
1357 - -DCONNECT_WITH_JDBC=$(usex jdbc)
1358 - # Build failure and autodep wrt bug 639144
1359 - -DCONNECT_WITH_MONGO=OFF
1360 - -DWITH_WSREP=$(usex galera)
1361 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
1362 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
1363 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
1364 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
1365 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
1366 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
1367 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
1368 - -DINSTALL_SQLBENCHDIR=share/mariadb
1369 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
1370 - # systemd is only linked to for server notification
1371 - -DWITH_SYSTEMD=$(usex systemd yes no)
1372 - -DWITH_NUMA=$(usex numa ON OFF)
1373 - )
1374 -
1375 - # Workaround for MDEV-14524
1376 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
1377 -
1378 - if use test ; then
1379 - # This is needed for the new client lib which tests a real, open server
1380 - mycmakeargs+=( -DSKIP_TESTS=ON )
1381 - fi
1382 -
1383 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
1384 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1385 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1386 - ewarn "You MUST file bugs without these variables set."
1387 -
1388 - mycmakeargs+=(
1389 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1390 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1391 - )
1392 -
1393 - elif ! use latin1 ; then
1394 - mycmakeargs+=(
1395 - -DDEFAULT_CHARSET=utf8
1396 - -DDEFAULT_COLLATION=utf8_general_ci
1397 - )
1398 - else
1399 - mycmakeargs+=(
1400 - -DDEFAULT_CHARSET=latin1
1401 - -DDEFAULT_COLLATION=latin1_swedish_ci
1402 - )
1403 - fi
1404 - mycmakeargs+=(
1405 - -DEXTRA_CHARSETS=all
1406 - -DMYSQL_USER=mysql
1407 - -DDISABLE_SHARED=$(usex static YES NO)
1408 - -DWITH_DEBUG=$(usex debug)
1409 - -DWITH_EMBEDDED_SERVER=OFF
1410 - -DWITH_PROFILING=$(usex profiling)
1411 - )
1412 -
1413 - if use static; then
1414 - mycmakeargs+=( -DWITH_PIC=1 )
1415 - fi
1416 -
1417 - if use jemalloc || use tcmalloc ; then
1418 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
1419 - fi
1420 -
1421 - # Storage engines
1422 - mycmakeargs+=(
1423 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1424 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1425 - -DWITH_CSV_STORAGE_ENGINE=1
1426 - -DWITH_HEAP_STORAGE_ENGINE=1
1427 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1428 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1429 - -DWITH_MYISAM_STORAGE_ENGINE=1
1430 - -DWITH_PARTITION_STORAGE_ENGINE=1
1431 - )
1432 -
1433 - else
1434 - mycmakeargs+=(
1435 - -DWITHOUT_SERVER=1
1436 - -DWITH_EMBEDDED_SERVER=OFF
1437 - -DEXTRA_CHARSETS=none
1438 - -DINSTALL_SQLBENCHDIR=
1439 - -DWITH_SYSTEMD=no
1440 - )
1441 - fi
1442 -
1443 - cmake-utils_src_configure
1444 -}
1445 -
1446 -src_compile() {
1447 - cmake-utils_src_compile
1448 -}
1449 -
1450 -src_install() {
1451 - cmake-utils_src_install
1452 -
1453 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
1454 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
1455 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
1456 - fi
1457 -
1458 - # Make sure the vars are correctly initialized
1459 - mysql_init_vars
1460 -
1461 - # Convenience links
1462 - einfo "Making Convenience links for mysqlcheck multi-call binary"
1463 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
1464 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
1465 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
1466 -
1467 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
1468 - if [[ -d "${ED}/usr/data" ]] ; then
1469 - rm -Rf "${ED}/usr/data" || die
1470 - fi
1471 -
1472 - # Unless they explicitly specific USE=test, then do not install the
1473 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
1474 - # validation of your database configuration after tuning it.
1475 - if ! use test ; then
1476 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
1477 - fi
1478 -
1479 - # Configuration stuff
1480 - einfo "Building default configuration ..."
1481 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
1482 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
1483 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
1484 - eprefixify "${TMPDIR}/my.cnf"
1485 - doins "${TMPDIR}/my.cnf"
1486 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
1487 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
1488 - eprefixify "${TMPDIR}/50-distro-client.cnf"
1489 - doins "${TMPDIR}/50-distro-client.cnf"
1490 -
1491 - if use server ; then
1492 - mycnf_src="my.cnf.distro-server"
1493 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
1494 - "${FILESDIR}/${mycnf_src}" \
1495 - > "${TMPDIR}/my.cnf.ok" || die
1496 - if use prefix ; then
1497 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
1498 - "${TMPDIR}/my.cnf.ok" || die
1499 - fi
1500 - if use latin1 ; then
1501 - sed -i \
1502 - -e "/character-set/s|utf8|latin1|g" \
1503 - "${TMPDIR}/my.cnf.ok" || die
1504 - fi
1505 - eprefixify "${TMPDIR}/my.cnf.ok"
1506 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
1507 -
1508 - einfo "Including support files and sample configurations"
1509 - docinto "support-files"
1510 - local script
1511 - for script in \
1512 - "${S}"/support-files/magic
1513 - do
1514 - [[ -f "$script" ]] && dodoc "${script}"
1515 - done
1516 -
1517 - docinto "scripts"
1518 - for script in "${S}"/scripts/mysql* ; do
1519 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
1520 - done
1521 - # Manually install supporting files that conflict with other packages
1522 - # but are needed for galera and initial installation
1523 - exeinto /usr/libexec/mariadb
1524 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
1525 - fi
1526 -
1527 - #Remove mytop if perl is not selected
1528 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
1529 -}
1530 -
1531 -# Official test instructions:
1532 -# USE='extraengine perl server' \
1533 -# FEATURES='test userpriv -usersandbox' \
1534 -# ebuild mariadb-X.X.XX.ebuild \
1535 -# digest clean package
1536 -src_test() {
1537 -
1538 - _disable_test() {
1539 - local rawtestname reason
1540 - rawtestname="${1}" ; shift
1541 - reason="${@}"
1542 - ewarn "test '${rawtestname}' disabled: '${reason}'"
1543 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
1544 - }
1545 -
1546 - local TESTDIR="${BUILD_DIR}/mysql-test"
1547 - local retstatus_unit
1548 - local retstatus_tests
1549 -
1550 - if ! use server ; then
1551 - einfo "Skipping server tests due to minimal build."
1552 - return 0
1553 - fi
1554 -
1555 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1556 - # localhost. Also causes weird failures.
1557 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1558 -
1559 - if [[ $UID -eq 0 ]]; then
1560 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1561 - fi
1562 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
1563 -
1564 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1565 -
1566 - # Run CTest (test-units)
1567 - cmake-utils_src_test
1568 - retstatus_unit=$?
1569 -
1570 - # Ensure that parallel runs don't die
1571 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
1572 - # Enable parallel testing, auto will try to detect number of cores
1573 - # You may set this by hand.
1574 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
1575 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
1576 -
1577 - # create directories because mysqladmin might run out of order
1578 - mkdir -p "${T}"/var-tests{,/log} || die
1579 -
1580 - # Run mysql tests
1581 - pushd "${TESTDIR}" > /dev/null || die
1582 -
1583 - touch "${T}/disabled.def"
1584 - # These are failing in MariaDB 10.0 for now and are believed to be
1585 - # false positives:
1586 - #
1587 - # main.mysql_client_test, main.mysql_client_test_nonblock
1588 - # main.mysql_client_test_comp:
1589 - # segfaults at random under Portage only, suspect resource limits.
1590 -
1591 - local t
1592 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
1593 - _disable_test "$t" "False positive due to varying policies"
1594 - done
1595 -
1596 - for t in main.mysql_client_test main.mysql_client_test_nonblock main.mysql \
1597 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
1598 - _disable_test "$t" "False positives in Gentoo"
1599 - done
1600 -
1601 - _disable_test main.gis_notembedded "Needs latin1 USE set"
1602 - _disable_test main.plugin_auth "Needs client libraries built"
1603 - _disable_test main.mysqldump "Test fails past 2018-12-31 due to event expiration"
1604 -
1605 - # Likely environment issues as only number of clients connected fails
1606 - _disable_test rpl.rpl_semi_sync_uninstall_plugin \
1607 - "Fails intermittently on parallel testing"
1608 -
1609 - # run mysql-test tests
1610 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
1611 - retstatus_tests=$?
1612 -
1613 - popd > /dev/null || die
1614 -
1615 - # Cleanup is important for these testcases.
1616 - pkill -9 -f "${S}/ndb" 2>/dev/null
1617 - pkill -9 -f "${S}/sql" 2>/dev/null
1618 -
1619 - local failures=""
1620 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
1621 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
1622 -
1623 - [[ -z "$failures" ]] || die "Test failures: $failures"
1624 - einfo "Tests successfully completed"
1625 -}
1626 -
1627 -mysql_init_vars() {
1628 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
1629 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
1630 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
1631 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
1632 -
1633 - if [[ -z "${MY_DATADIR}" ]] ; then
1634 - MY_DATADIR=""
1635 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
1636 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1637 - | sed -ne '/datadir/s|^--datadir=||p' \
1638 - | tail -n1`
1639 - if [[ -z "${MY_DATADIR}" ]] ; then
1640 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
1641 - | sed -e 's/.*=\s*//' \
1642 - | tail -n1`
1643 - fi
1644 - fi
1645 - if [[ -z "${MY_DATADIR}" ]] ; then
1646 - MY_DATADIR="${MY_LOCALSTATEDIR}"
1647 - einfo "Using default MY_DATADIR"
1648 - fi
1649 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
1650 -
1651 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
1652 - if [[ -e "${MY_DATADIR}" ]] ; then
1653 - # If you get this and you're wondering about it, see bug #207636
1654 - elog "MySQL datadir found in ${MY_DATADIR}"
1655 - elog "A new one will not be created."
1656 - PREVIOUS_DATADIR="yes"
1657 - else
1658 - PREVIOUS_DATADIR="no"
1659 - fi
1660 - export PREVIOUS_DATADIR
1661 - fi
1662 - else
1663 - if [[ ${EBUILD_PHASE} == "config" ]]; then
1664 - local new_MY_DATADIR
1665 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1666 - | sed -ne '/datadir/s|^--datadir=||p' \
1667 - | tail -n1`
1668 -
1669 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
1670 - ewarn "MySQL MY_DATADIR has changed"
1671 - ewarn "from ${MY_DATADIR}"
1672 - ewarn "to ${new_MY_DATADIR}"
1673 - MY_DATADIR="${new_MY_DATADIR}"
1674 - fi
1675 - fi
1676 - fi
1677 -
1678 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
1679 - export MY_LOCALSTATEDIR MY_LOGDIR
1680 - export MY_DATADIR
1681 -}
1682 -
1683 -pkg_config() {
1684 - _getoptval() {
1685 - local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults
1686 - local section="$1"
1687 - local flag="--${2}="
1688 - local extra_options="${3}"
1689 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
1690 - }
1691 - local old_MY_DATADIR="${MY_DATADIR}"
1692 - local old_HOME="${HOME}"
1693 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
1694 - export HOME=${EPREFIX}/root
1695 -
1696 - # Make sure the vars are correctly initialized
1697 - mysql_init_vars
1698 -
1699 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
1700 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
1701 - die "Minimal builds do NOT include the MySQL server"
1702 - fi
1703 -
1704 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
1705 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
1706 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
1707 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
1708 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
1709 -
1710 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
1711 - if [[ -d "${MY_DATADIR_s}" ]]; then
1712 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
1713 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
1714 - else
1715 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
1716 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
1717 - || die "Moving MY_DATADIR failed"
1718 - fi
1719 - else
1720 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
1721 - if [[ -d "${MY_DATADIR_s}" ]]; then
1722 - ewarn "Attempting to use ${MY_DATADIR_s}"
1723 - else
1724 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
1725 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
1726 - fi
1727 - fi
1728 - fi
1729 -
1730 - local pwd1="a"
1731 - local pwd2="b"
1732 - local maxtry=15
1733 -
1734 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1735 - local tmp_mysqld_password_source=
1736 -
1737 - for tmp_mysqld_password_source in mysql client; do
1738 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1739 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
1740 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
1741 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
1742 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1743 - MYSQL_ROOT_PASSWORD=
1744 - continue
1745 - fi
1746 -
1747 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1748 - break
1749 - fi
1750 - done
1751 -
1752 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1753 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
1754 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
1755 - fi
1756 -
1757 - unset tmp_mysqld_password_source
1758 - fi
1759 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
1760 - # These are dir+prefix
1761 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
1762 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1763 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
1764 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1765 -
1766 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
1767 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
1768 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
1769 - fi
1770 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
1771 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
1772 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
1773 - fi
1774 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
1775 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
1776 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
1777 - fi
1778 -
1779 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
1780 - ewarn "You have already a MySQL database in place."
1781 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
1782 - ewarn "Please rename or delete it if you wish to replace it."
1783 - die "MySQL database already exists!"
1784 - fi
1785 -
1786 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1787 - # localhost. Also causes weird failures.
1788 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1789 -
1790 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1791 -
1792 - einfo "Please provide a password for the mysql 'root' user now"
1793 - einfo "or through the ${HOME}/.my.cnf file."
1794 - ewarn "Avoid [\"'\\_%] characters in the password"
1795 - read -rsp " >" pwd1 ; echo
1796 -
1797 - einfo "Retype the password"
1798 - read -rsp " >" pwd2 ; echo
1799 -
1800 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1801 - die "Passwords are not the same"
1802 - fi
1803 - MYSQL_ROOT_PASSWORD="${pwd1}"
1804 - unset pwd1 pwd2
1805 - fi
1806 -
1807 - local options
1808 - local sqltmp="$(emktemp)"
1809 -
1810 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1811 - # see https://bugs.mysql.com/bug.php?id=31312
1812 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
1813 -
1814 - # Figure out which options we need to disable to do the setup
1815 - local helpfile="${TMPDIR}/mysqld-help"
1816 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
1817 - for opt in grant-tables host-cache name-resolve networking slave-start \
1818 - federated ssl log-bin relay-log slow-query-log external-locking \
1819 - log-slave-updates \
1820 - ; do
1821 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1822 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1823 - done
1824 -
1825 - einfo "Creating the mysql database and setting proper permissions on it ..."
1826 -
1827 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
1828 - PID_DIR="${EROOT}/var/run/mysqld"
1829 - if [[ ! -d "${PID_DIR}" ]]; then
1830 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
1831 - fi
1832 -
1833 - if [[ ! -d "${MY_DATADIR}" ]]; then
1834 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
1835 - fi
1836 -
1837 - pushd "${TMPDIR}" &>/dev/null || die
1838 -
1839 - # Filling timezones, see
1840 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
1841 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
1842 -
1843 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
1844 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
1845 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
1846 - einfo "Command: ${cmd[*]}"
1847 - su -s /bin/sh -c "${cmd[*]}" mysql \
1848 - >"${TMPDIR}"/mysql_install_db.log 2>&1
1849 - if [ $? -ne 0 ]; then
1850 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
1851 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
1852 - fi
1853 - popd &>/dev/null || die
1854 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
1855 - || die "MySQL databases not installed"
1856 -
1857 - use prefix || options="${options} --user=mysql"
1858 -
1859 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
1860 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
1861 - local mysqld="${EROOT}/usr/sbin/mysqld \
1862 - ${options} \
1863 - --log-warnings=0 \
1864 - --basedir=${EROOT}/usr \
1865 - --datadir=${ROOT}/${MY_DATADIR} \
1866 - --max_allowed_packet=8M \
1867 - --net_buffer_length=16K \
1868 - --socket=${socket} \
1869 - --pid-file=${pidfile} \
1870 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
1871 - #einfo "About to start mysqld: ${mysqld}"
1872 - ebegin "Starting mysqld"
1873 - einfo "Command ${mysqld}"
1874 - ${mysqld} &
1875 - rc=$?
1876 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1877 - maxtry=$((${maxtry}-1))
1878 - echo -n "."
1879 - sleep 1
1880 - done
1881 - eend $rc
1882 -
1883 - if ! [[ -S "${socket}" ]]; then
1884 - die "Completely failed to start up mysqld with: ${mysqld}"
1885 - fi
1886 -
1887 - ebegin "Setting root password"
1888 - # Do this from memory, as we don't want clear text passwords in temp files
1889 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
1890 - "${EROOT}/usr/bin/mysql" \
1891 - "--socket=${socket}" \
1892 - -hlocalhost \
1893 - -e "${sql}"
1894 - eend $?
1895 -
1896 - if [[ -n "${sqltmp}" ]] ; then
1897 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
1898 - "${EROOT}/usr/bin/mysql" \
1899 - "--socket=${socket}" \
1900 - -hlocalhost \
1901 - -uroot \
1902 - --password="${MYSQL_ROOT_PASSWORD}" \
1903 - mysql < "${sqltmp}"
1904 - rc=$?
1905 - eend $?
1906 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
1907 - fi
1908 -
1909 - # Stop the server and cleanup
1910 - einfo "Stopping the server ..."
1911 - kill $(< "${pidfile}" )
1912 - rm -f "${sqltmp}"
1913 - wait %1
1914 - einfo "Done"
1915 -}
1916
1917 diff --git a/dev-db/mariadb/mariadb-10.3.16.ebuild b/dev-db/mariadb/mariadb-10.3.16.ebuild
1918 deleted file mode 100644
1919 index ac4aefb9839..00000000000
1920 --- a/dev-db/mariadb/mariadb-10.3.16.ebuild
1921 +++ /dev/null
1922 @@ -1,974 +0,0 @@
1923 -# Copyright 1999-2019 Gentoo Authors
1924 -# Distributed under the terms of the GNU General Public License v2
1925 -
1926 -EAPI="6"
1927 -MY_EXTRAS_VER="20190305-2052Z"
1928 -SUBSLOT="18"
1929 -
1930 -JAVA_PKG_OPT_USE="jdbc"
1931 -
1932 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
1933 -
1934 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
1935 - java-pkg-opt-2 user cmake-utils
1936 -
1937 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
1938 -
1939 -# Gentoo patches to MySQL
1940 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
1941 - SRC_URI="${SRC_URI}
1942 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1943 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1944 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1945 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1946 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
1947 -fi
1948 -
1949 -HOMEPAGE="https://mariadb.org/"
1950 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
1951 -LICENSE="GPL-2 LGPL-2.1+"
1952 -SLOT="0/${SUBSLOT:-0}"
1953 -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4
1954 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
1955 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
1956 - sst-rsync sst-mariabackup static systemd systemtap tcmalloc
1957 - test tokudb xml yassl"
1958 -
1959 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
1960 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
1961 -
1962 -REQUIRED_USE="jdbc? ( extraengine server !static )
1963 - server? ( tokudb? ( jemalloc !tcmalloc ) )
1964 - ?? ( tcmalloc jemalloc )
1965 - static? ( yassl !pam )"
1966 -
1967 -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"
1968 -
1969 -# Shorten the path because the socket path length must be shorter than 107 chars
1970 -# and we will run a mysql server during test phase
1971 -S="${WORKDIR}/mysql"
1972 -
1973 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
1974 - inherit git-r3
1975 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
1976 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
1977 - EGIT_CLONE_TYPE=shallow
1978 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
1979 -else
1980 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
1981 -fi
1982 -
1983 -PATCHES=(
1984 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
1985 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.3.12-without-clientlibs-tools.patch
1986 - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
1987 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
1988 - "${MY_PATCH_DIR}"/20035_all_mariadb-10.3-atomic-detection.patch
1989 -)
1990 -
1991 -# Be warned, *DEPEND are version-dependant
1992 -# These are used for both runtime and compiletime
1993 -COMMON_DEPEND="
1994 - kernel_linux? (
1995 - sys-process/procps:0=
1996 - dev-libs/libaio:0=
1997 - )
1998 - >=sys-apps/sed-4
1999 - >=sys-apps/texinfo-4.7-r1
2000 - jemalloc? ( dev-libs/jemalloc:0= )
2001 - tcmalloc? ( dev-util/google-perftools:0= )
2002 - systemtap? ( >=dev-util/systemtap-1.3:0= )
2003 - >=sys-libs/zlib-1.2.3:0=
2004 - kerberos? ( virtual/krb5 )
2005 - yassl? ( net-libs/gnutls:0= )
2006 - !yassl? (
2007 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
2008 - libressl? ( dev-libs/libressl:0= )
2009 - )
2010 - sys-libs/ncurses:0=
2011 - !bindist? (
2012 - sys-libs/binutils-libs:0=
2013 - >=sys-libs/readline-4.1:0=
2014 - )
2015 - server? (
2016 - backup? ( app-arch/libarchive:0= )
2017 - cracklib? ( sys-libs/cracklib:0= )
2018 - extraengine? (
2019 - odbc? ( dev-db/unixODBC:0= )
2020 - xml? ( dev-libs/libxml2:2= )
2021 - )
2022 - innodb-lz4? ( app-arch/lz4 )
2023 - innodb-lzo? ( dev-libs/lzo )
2024 - innodb-snappy? ( app-arch/snappy )
2025 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
2026 - numa? ( sys-process/numactl )
2027 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
2028 - pam? ( virtual/pam:0= )
2029 - systemd? ( sys-apps/systemd:= )
2030 - tokudb? ( app-arch/snappy )
2031 - )
2032 - >=dev-libs/libpcre-8.41-r1:3=
2033 -"
2034 -DEPEND="virtual/yacc
2035 - static? ( sys-libs/ncurses[static-libs] )
2036 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
2037 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
2038 - ${COMMON_DEPEND}"
2039 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
2040 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
2041 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
2042 - !<virtual/mysql-5.6-r11
2043 - ${COMMON_DEPEND}
2044 - server? ( galera? (
2045 - sys-apps/iproute2
2046 - =sys-cluster/galera-25*
2047 - sst-rsync? ( sys-process/lsof )
2048 - sst-mariabackup? ( net-misc/socat[ssl] )
2049 - ) )
2050 - perl? ( !dev-db/mytop
2051 - virtual/perl-Getopt-Long
2052 - dev-perl/TermReadKey
2053 - virtual/perl-Term-ANSIColor
2054 - virtual/perl-Time-HiRes )
2055 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
2056 -"
2057 -# For other stuff to bring us in
2058 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
2059 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
2060 - server? ( ~virtual/mysql-5.6[static=] )"
2061 -
2062 -pkg_setup() {
2063 - if [[ ${MERGE_TYPE} != binary ]] ; then
2064 - local GCC_MAJOR_SET=$(gcc-major-version)
2065 - local GCC_MINOR_SET=$(gcc-minor-version)
2066 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
2067 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
2068 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
2069 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2070 - die
2071 - fi
2072 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
2073 - # non x86{,_64} arches
2074 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
2075 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
2076 - eerror "${PN} needs to be built with gcc-4.7 or later."
2077 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2078 - die
2079 - fi
2080 - fi
2081 - java-pkg-opt-2_pkg_setup
2082 - if has test ${FEATURES} && \
2083 - use server && ! has userpriv ${FEATURES} ; then
2084 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2085 - fi
2086 -
2087 - # This should come after all of the die statements
2088 - enewgroup mysql 60 || die "problem adding 'mysql' group"
2089 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
2090 -}
2091 -
2092 -pkg_preinst() {
2093 - java-pkg-opt-2_pkg_preinst
2094 -
2095 - # Here we need to see if the implementation switched client libraries
2096 - # We check if this is a new instance of the package and a client library already exists
2097 - local SHOW_ABI_MESSAGE libpath
2098 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
2099 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
2100 - elog "Due to ABI changes when switching between different client libraries,"
2101 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
2102 - elog "Please run: revdep-rebuild --library ${libpath}"
2103 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
2104 - fi
2105 -}
2106 -
2107 -pkg_postinst() {
2108 - # Make sure the vars are correctly initialized
2109 - mysql_init_vars
2110 -
2111 - # Create log directory securely if it does not exist
2112 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
2113 -
2114 - if use server ; then
2115 - if use pam; then
2116 - einfo
2117 - elog "This install includes the PAM authentication plugin."
2118 - elog "To activate and configure the PAM plugin, please read:"
2119 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
2120 - einfo
2121 - fi
2122 -
2123 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
2124 - einfo
2125 - elog "You might want to run:"
2126 - elog "\"emerge --config =${CATEGORY}/${PF}\""
2127 - elog "if this is a new install."
2128 - elog
2129 - elog "If you are switching server implentations, you should run the"
2130 - elog "mysql_upgrade tool."
2131 - einfo
2132 - else
2133 - einfo
2134 - elog "If you are upgrading major versions, you should run the"
2135 - elog "mysql_upgrade tool."
2136 - einfo
2137 - fi
2138 -
2139 - if use galera ; then
2140 - einfo
2141 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
2142 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
2143 - elog "The first time the cluster is activated, you should add"
2144 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
2145 - elog "This option should then be removed for subsequent starts."
2146 - einfo
2147 - fi
2148 - fi
2149 -
2150 - # Note about configuration change
2151 - einfo
2152 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
2153 - elog "to several files in /etc/mysql/${PN}.d."
2154 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
2155 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
2156 - elog "You may have as many files as needed and they are read alphabetically."
2157 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
2158 - einfo
2159 -}
2160 -
2161 -src_unpack() {
2162 - unpack ${A}
2163 - # Grab the patches
2164 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
2165 -
2166 - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
2167 -}
2168 -
2169 -src_prepare() {
2170 - _disable_plugin() {
2171 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
2172 - }
2173 - _disable_engine() {
2174 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
2175 - }
2176 -
2177 - if use jemalloc; then
2178 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt"
2179 - elif use tcmalloc; then
2180 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
2181 - fi
2182 -
2183 - # Don't build bundled xz-utils for tokudb
2184 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
2185 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
2186 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
2187 -
2188 - local plugin
2189 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
2190 - locale_info qc_info server_audit sql_errlog )
2191 - local test_plugins=( audit_null auth_examples daemon_example fulltext
2192 - debug_key_management example_key_management versioning )
2193 - if ! use server; then # These plugins are for the server
2194 - for plugin in "${server_plugins[@]}" ; do
2195 - _disable_plugin "${plugin}"
2196 - done
2197 - fi
2198 -
2199 - if ! use test; then # These plugins are only used during testing
2200 - for plugin in "${test_plugins[@]}" ; do
2201 - _disable_plugin "${plugin}"
2202 - done
2203 - _disable_engine test_sql_discovery
2204 - fi
2205 -
2206 - _disable_engine example
2207 -
2208 - if ! use oqgraph ; then # avoids extra library checks
2209 - _disable_engine oqgraph
2210 - fi
2211 -
2212 - if use mroonga ; then
2213 - # Remove the bundled groonga
2214 - # There is no CMake flag, it simply checks for existance
2215 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
2216 - else
2217 - _disable_engine mroonga
2218 - fi
2219 -
2220 - cmake-utils_src_prepare
2221 - java-pkg-opt-2_src_prepare
2222 -}
2223 -
2224 -src_configure(){
2225 - # bug 508724 mariadb cannot use ld.gold
2226 - tc-ld-disable-gold
2227 - # Bug #114895, bug #110149
2228 - filter-flags "-O" "-O[01]"
2229 -
2230 - append-cxxflags -felide-constructors
2231 -
2232 - # bug #283926, with GCC4.4, this is required to get correct behavior.
2233 - append-flags -fno-strict-aliasing
2234 -
2235 - CMAKE_BUILD_TYPE="RelWithDebInfo"
2236 -
2237 - # debug hack wrt #497532
2238 - mycmakeargs=(
2239 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2240 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2241 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
2242 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
2243 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
2244 - -DINSTALL_BINDIR=bin
2245 - -DINSTALL_DOCDIR=share/doc/${PF}
2246 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
2247 - -DINSTALL_INCLUDEDIR=include/mysql
2248 - -DINSTALL_INFODIR=share/info
2249 - -DINSTALL_LIBDIR=$(get_libdir)
2250 - -DINSTALL_MANDIR=share/man
2251 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
2252 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
2253 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
2254 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
2255 - -DINSTALL_SBINDIR=sbin
2256 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
2257 - -DWITH_COMMENT="Gentoo Linux ${PF}"
2258 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
2259 - -DWITH_LIBEDIT=0
2260 - -DWITH_ZLIB=system
2261 - -DWITHOUT_LIBWRAP=1
2262 - -DENABLED_LOCAL_INFILE=1
2263 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
2264 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
2265 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
2266 - -DWITH_DEFAULT_FEATURE_SET=0
2267 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
2268 - # The build forces this to be defined when cross-compiling. We pass it
2269 - # all the time for simplicity and to make sure it is actually correct.
2270 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
2271 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
2272 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
2273 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
2274 - -DCONC_WITH_EXTERNAL_ZLIB=YES
2275 - -DWITH_EXTERNAL_ZLIB=YES
2276 - -DSUFFIX_INSTALL_DIR=""
2277 - -DWITH_UNITTEST=OFF
2278 - -DWITHOUT_CLIENTLIBS=YES
2279 - -DCLIENT_PLUGIN_DIALOG=OFF
2280 - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
2281 - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
2282 - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
2283 - )
2284 - if use test ; then
2285 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
2286 - else
2287 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
2288 - fi
2289 -
2290 - if ! use yassl ; then
2291 - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
2292 - else
2293 - mycmakeargs+=( -DWITH_SSL=bundled )
2294 - fi
2295 -
2296 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
2297 - mycmakeargs+=(
2298 - -DWITH_READLINE=$(usex bindist 1 0)
2299 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
2300 - -DENABLE_DTRACE=$(usex systemtap)
2301 - )
2302 -
2303 - if use server ; then
2304 -
2305 - # Federated{,X} must be treated special otherwise they will not be built as plugins
2306 - if ! use extraengine ; then
2307 - mycmakeargs+=(
2308 - -DPLUGIN_FEDERATED=NO
2309 - -DPLUGIN_FEDERATEDX=NO )
2310 - fi
2311 -
2312 - mycmakeargs+=(
2313 - -DWITH_PCRE=system
2314 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
2315 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
2316 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
2317 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
2318 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
2319 - -DPLUGIN_CASSANDRA=NO
2320 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
2321 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
2322 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
2323 - -DCONNECT_WITH_MYSQL=1
2324 - -DCONNECT_WITH_LIBXML2=$(usex xml)
2325 - -DCONNECT_WITH_ODBC=$(usex odbc)
2326 - -DCONNECT_WITH_JDBC=$(usex jdbc)
2327 - # Build failure and autodep wrt bug 639144
2328 - -DCONNECT_WITH_MONGO=OFF
2329 - -DWITH_WSREP=$(usex galera)
2330 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
2331 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
2332 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
2333 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
2334 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
2335 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
2336 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
2337 - -DINSTALL_SQLBENCHDIR=""
2338 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
2339 - # systemd is only linked to for server notification
2340 - -DWITH_SYSTEMD=$(usex systemd yes no)
2341 - -DWITH_NUMA=$(usex numa ON OFF)
2342 - )
2343 -
2344 - # Workaround for MDEV-14524
2345 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
2346 -
2347 - if use test ; then
2348 - # This is needed for the new client lib which tests a real, open server
2349 - mycmakeargs+=( -DSKIP_TESTS=ON )
2350 - fi
2351 -
2352 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
2353 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
2354 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
2355 - ewarn "You MUST file bugs without these variables set."
2356 -
2357 - mycmakeargs+=(
2358 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
2359 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
2360 - )
2361 -
2362 - elif ! use latin1 ; then
2363 - mycmakeargs+=(
2364 - -DDEFAULT_CHARSET=utf8
2365 - -DDEFAULT_COLLATION=utf8_general_ci
2366 - )
2367 - else
2368 - mycmakeargs+=(
2369 - -DDEFAULT_CHARSET=latin1
2370 - -DDEFAULT_COLLATION=latin1_swedish_ci
2371 - )
2372 - fi
2373 - mycmakeargs+=(
2374 - -DEXTRA_CHARSETS=all
2375 - -DMYSQL_USER=mysql
2376 - -DDISABLE_SHARED=$(usex static YES NO)
2377 - -DWITH_DEBUG=$(usex debug)
2378 - -DWITH_EMBEDDED_SERVER=OFF
2379 - -DWITH_PROFILING=$(usex profiling)
2380 - )
2381 -
2382 - if use static; then
2383 - mycmakeargs+=( -DWITH_PIC=1 )
2384 - fi
2385 -
2386 - if use jemalloc || use tcmalloc ; then
2387 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
2388 - fi
2389 -
2390 - # Storage engines
2391 - mycmakeargs+=(
2392 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
2393 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
2394 - -DWITH_CSV_STORAGE_ENGINE=1
2395 - -DWITH_HEAP_STORAGE_ENGINE=1
2396 - -DWITH_INNOBASE_STORAGE_ENGINE=1
2397 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
2398 - -DWITH_MYISAM_STORAGE_ENGINE=1
2399 - -DWITH_PARTITION_STORAGE_ENGINE=1
2400 - )
2401 -
2402 - else
2403 - mycmakeargs+=(
2404 - -DWITHOUT_SERVER=1
2405 - -DWITH_EMBEDDED_SERVER=OFF
2406 - -DEXTRA_CHARSETS=none
2407 - -DINSTALL_SQLBENCHDIR=
2408 - -DWITH_SYSTEMD=no
2409 - )
2410 - fi
2411 -
2412 - cmake-utils_src_configure
2413 -}
2414 -
2415 -src_compile() {
2416 - cmake-utils_src_compile
2417 -}
2418 -
2419 -src_install() {
2420 - cmake-utils_src_install
2421 -
2422 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
2423 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
2424 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
2425 - fi
2426 -
2427 - # Make sure the vars are correctly initialized
2428 - mysql_init_vars
2429 -
2430 - # Convenience links
2431 - einfo "Making Convenience links for mysqlcheck multi-call binary"
2432 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
2433 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
2434 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
2435 -
2436 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
2437 - if [[ -d "${ED}/usr/data" ]] ; then
2438 - rm -Rf "${ED}/usr/data" || die
2439 - fi
2440 -
2441 - # Unless they explicitly specific USE=test, then do not install the
2442 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
2443 - # validation of your database configuration after tuning it.
2444 - if ! use test ; then
2445 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
2446 - fi
2447 -
2448 - # Configuration stuff
2449 - einfo "Building default configuration ..."
2450 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
2451 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
2452 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
2453 - eprefixify "${TMPDIR}/my.cnf"
2454 - doins "${TMPDIR}/my.cnf"
2455 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
2456 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
2457 - eprefixify "${TMPDIR}/50-distro-client.cnf"
2458 - doins "${TMPDIR}/50-distro-client.cnf"
2459 -
2460 - if use server ; then
2461 - mycnf_src="my.cnf.distro-server"
2462 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
2463 - "${FILESDIR}/${mycnf_src}" \
2464 - > "${TMPDIR}/my.cnf.ok" || die
2465 - if use prefix ; then
2466 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
2467 - "${TMPDIR}/my.cnf.ok" || die
2468 - fi
2469 - if use latin1 ; then
2470 - sed -i \
2471 - -e "/character-set/s|utf8|latin1|g" \
2472 - "${TMPDIR}/my.cnf.ok" || die
2473 - fi
2474 - eprefixify "${TMPDIR}/my.cnf.ok"
2475 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
2476 -
2477 - einfo "Including support files and sample configurations"
2478 - docinto "support-files"
2479 - local script
2480 - for script in \
2481 - "${S}"/support-files/magic
2482 - do
2483 - [[ -f "$script" ]] && dodoc "${script}"
2484 - done
2485 -
2486 - docinto "scripts"
2487 - for script in "${S}"/scripts/mysql* ; do
2488 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
2489 - done
2490 - # Manually install supporting files that conflict with other packages
2491 - # but are needed for galera and initial installation
2492 - exeinto /usr/libexec/mariadb
2493 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
2494 - fi
2495 -
2496 - # Remove mytop if perl is not selected
2497 - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then
2498 - rm -f "${ED}/usr/bin/mytop" || die
2499 - fi
2500 -
2501 - # Fix a dangling symlink when galera is not built
2502 - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
2503 - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
2504 - fi
2505 -
2506 - # Remove broken SST scripts that are incompatible
2507 - local scriptremove
2508 - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
2509 - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
2510 - rm "${ED}/usr/bin/${scriptremove}" || die
2511 - fi
2512 - done
2513 -}
2514 -
2515 -# Official test instructions:
2516 -# USE='extraengine perl server' \
2517 -# FEATURES='test userpriv -usersandbox' \
2518 -# ebuild mariadb-X.X.XX.ebuild \
2519 -# digest clean package
2520 -src_test() {
2521 -
2522 - _disable_test() {
2523 - local rawtestname reason
2524 - rawtestname="${1}" ; shift
2525 - reason="${@}"
2526 - ewarn "test '${rawtestname}' disabled: '${reason}'"
2527 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
2528 - }
2529 -
2530 - local TESTDIR="${BUILD_DIR}/mysql-test"
2531 - local retstatus_unit
2532 - local retstatus_tests
2533 -
2534 - if ! use server ; then
2535 - einfo "Skipping server tests due to minimal build."
2536 - return 0
2537 - fi
2538 -
2539 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2540 - # localhost. Also causes weird failures.
2541 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2542 -
2543 - if [[ $UID -eq 0 ]]; then
2544 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2545 - fi
2546 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
2547 -
2548 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
2549 -
2550 - # Run CTest (test-units)
2551 - cmake-utils_src_test
2552 - retstatus_unit=$?
2553 -
2554 - # Ensure that parallel runs don't die
2555 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
2556 - # Enable parallel testing, auto will try to detect number of cores
2557 - # You may set this by hand.
2558 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
2559 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
2560 -
2561 - # create directories because mysqladmin might run out of order
2562 - mkdir -p "${T}"/var-tests{,/log} || die
2563 -
2564 - # Run mysql tests
2565 - pushd "${TESTDIR}" > /dev/null || die
2566 -
2567 - touch "${T}/disabled.def"
2568 - # These are failing in MariaDB 10.0 for now and are believed to be
2569 - # false positives:
2570 - #
2571 - # main.mysql_client_test, main.mysql_client_test_nonblock
2572 - # main.mysql_client_test_comp:
2573 - # segfaults at random under Portage only, suspect resource limits.
2574 -
2575 - local t
2576 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
2577 - _disable_test "$t" "False positive due to varying policies"
2578 - done
2579 -
2580 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
2581 - main.mysql main.gis_notembedded \
2582 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
2583 - _disable_test "$t" "False positives in Gentoo"
2584 - done
2585 -
2586 - _disable_test main.plugin_auth "Needs client libraries built"
2587 -
2588 - _disable_test main.func_time "Dependent on time test was written"
2589 -
2590 - # run mysql-test tests
2591 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
2592 - retstatus_tests=$?
2593 -
2594 - popd > /dev/null || die
2595 -
2596 - # Cleanup is important for these testcases.
2597 - pkill -9 -f "${S}/ndb" 2>/dev/null
2598 - pkill -9 -f "${S}/sql" 2>/dev/null
2599 -
2600 - local failures=""
2601 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
2602 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
2603 -
2604 - [[ -z "$failures" ]] || die "Test failures: $failures"
2605 - einfo "Tests successfully completed"
2606 -}
2607 -
2608 -mysql_init_vars() {
2609 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
2610 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
2611 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
2612 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
2613 -
2614 - if [[ -z "${MY_DATADIR}" ]] ; then
2615 - MY_DATADIR=""
2616 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
2617 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2618 - | sed -ne '/datadir/s|^--datadir=||p' \
2619 - | tail -n1`
2620 - if [[ -z "${MY_DATADIR}" ]] ; then
2621 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
2622 - | sed -e 's/.*=\s*//' \
2623 - | tail -n1`
2624 - fi
2625 - fi
2626 - if [[ -z "${MY_DATADIR}" ]] ; then
2627 - MY_DATADIR="${MY_LOCALSTATEDIR}"
2628 - einfo "Using default MY_DATADIR"
2629 - fi
2630 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
2631 -
2632 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
2633 - if [[ -e "${MY_DATADIR}" ]] ; then
2634 - # If you get this and you're wondering about it, see bug #207636
2635 - elog "MySQL datadir found in ${MY_DATADIR}"
2636 - elog "A new one will not be created."
2637 - PREVIOUS_DATADIR="yes"
2638 - else
2639 - PREVIOUS_DATADIR="no"
2640 - fi
2641 - export PREVIOUS_DATADIR
2642 - fi
2643 - else
2644 - if [[ ${EBUILD_PHASE} == "config" ]]; then
2645 - local new_MY_DATADIR
2646 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2647 - | sed -ne '/datadir/s|^--datadir=||p' \
2648 - | tail -n1`
2649 -
2650 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
2651 - ewarn "MySQL MY_DATADIR has changed"
2652 - ewarn "from ${MY_DATADIR}"
2653 - ewarn "to ${new_MY_DATADIR}"
2654 - MY_DATADIR="${new_MY_DATADIR}"
2655 - fi
2656 - fi
2657 - fi
2658 -
2659 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
2660 - export MY_LOCALSTATEDIR MY_LOGDIR
2661 - export MY_DATADIR
2662 -}
2663 -
2664 -pkg_config() {
2665 - _getoptval() {
2666 - local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults
2667 - local section="$1"
2668 - local flag="--${2}="
2669 - local extra_options="${3}"
2670 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
2671 - }
2672 - local old_MY_DATADIR="${MY_DATADIR}"
2673 - local old_HOME="${HOME}"
2674 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
2675 - export HOME=${EPREFIX}/root
2676 -
2677 - # Make sure the vars are correctly initialized
2678 - mysql_init_vars
2679 -
2680 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
2681 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
2682 - die "Minimal builds do NOT include the MySQL server"
2683 - fi
2684 -
2685 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
2686 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
2687 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
2688 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
2689 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
2690 -
2691 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
2692 - if [[ -d "${MY_DATADIR_s}" ]]; then
2693 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
2694 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
2695 - else
2696 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
2697 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
2698 - || die "Moving MY_DATADIR failed"
2699 - fi
2700 - else
2701 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
2702 - if [[ -d "${MY_DATADIR_s}" ]]; then
2703 - ewarn "Attempting to use ${MY_DATADIR_s}"
2704 - else
2705 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
2706 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
2707 - fi
2708 - fi
2709 - fi
2710 -
2711 - local pwd1="a"
2712 - local pwd2="b"
2713 - local maxtry=15
2714 -
2715 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2716 - local tmp_mysqld_password_source=
2717 -
2718 - for tmp_mysqld_password_source in mysql client; do
2719 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
2720 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
2721 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
2722 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
2723 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
2724 - MYSQL_ROOT_PASSWORD=
2725 - continue
2726 - fi
2727 -
2728 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
2729 - break
2730 - fi
2731 - done
2732 -
2733 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
2734 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
2735 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
2736 - fi
2737 -
2738 - unset tmp_mysqld_password_source
2739 - fi
2740 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
2741 - # These are dir+prefix
2742 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
2743 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
2744 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
2745 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
2746 -
2747 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
2748 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
2749 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
2750 - fi
2751 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
2752 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
2753 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
2754 - fi
2755 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
2756 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
2757 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
2758 - fi
2759 -
2760 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
2761 - ewarn "You have already a MySQL database in place."
2762 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
2763 - ewarn "Please rename or delete it if you wish to replace it."
2764 - die "MySQL database already exists!"
2765 - fi
2766 -
2767 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2768 - # localhost. Also causes weird failures.
2769 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2770 -
2771 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2772 -
2773 - einfo "Please provide a password for the mysql 'root' user now"
2774 - einfo "or through the ${HOME}/.my.cnf file."
2775 - ewarn "Avoid [\"'\\_%] characters in the password"
2776 - read -rsp " >" pwd1 ; echo
2777 -
2778 - einfo "Retype the password"
2779 - read -rsp " >" pwd2 ; echo
2780 -
2781 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
2782 - die "Passwords are not the same"
2783 - fi
2784 - MYSQL_ROOT_PASSWORD="${pwd1}"
2785 - unset pwd1 pwd2
2786 - fi
2787 -
2788 - local options
2789 - local sqltmp="$(emktemp)"
2790 -
2791 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
2792 - # see https://bugs.mysql.com/bug.php?id=31312
2793 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
2794 -
2795 - # Figure out which options we need to disable to do the setup
2796 - local helpfile="${TMPDIR}/mysqld-help"
2797 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
2798 - for opt in grant-tables host-cache name-resolve networking slave-start \
2799 - federated ssl log-bin relay-log slow-query-log external-locking \
2800 - log-slave-updates \
2801 - ; do
2802 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
2803 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
2804 - done
2805 -
2806 - einfo "Creating the mysql database and setting proper permissions on it ..."
2807 -
2808 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
2809 - PID_DIR="${EROOT}/var/run/mysqld"
2810 - if [[ ! -d "${PID_DIR}" ]]; then
2811 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
2812 - fi
2813 -
2814 - if [[ ! -d "${MY_DATADIR}" ]]; then
2815 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
2816 - fi
2817 -
2818 - pushd "${TMPDIR}" &>/dev/null || die
2819 -
2820 - # Filling timezones, see
2821 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
2822 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
2823 -
2824 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
2825 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
2826 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
2827 - einfo "Command: ${cmd[*]}"
2828 - su -s /bin/sh -c "${cmd[*]}" mysql \
2829 - >"${TMPDIR}"/mysql_install_db.log 2>&1
2830 - if [ $? -ne 0 ]; then
2831 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
2832 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
2833 - fi
2834 - popd &>/dev/null || die
2835 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
2836 - || die "MySQL databases not installed"
2837 -
2838 - use prefix || options="${options} --user=mysql"
2839 -
2840 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
2841 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
2842 - local mysqld="${EROOT}/usr/sbin/mysqld \
2843 - ${options} \
2844 - --log-warnings=0 \
2845 - --basedir=${EROOT}/usr \
2846 - --datadir=${ROOT}/${MY_DATADIR} \
2847 - --max_allowed_packet=8M \
2848 - --net_buffer_length=16K \
2849 - --socket=${socket} \
2850 - --pid-file=${pidfile} \
2851 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
2852 - #einfo "About to start mysqld: ${mysqld}"
2853 - ebegin "Starting mysqld"
2854 - einfo "Command ${mysqld}"
2855 - ${mysqld} &
2856 - rc=$?
2857 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
2858 - maxtry=$((${maxtry}-1))
2859 - echo -n "."
2860 - sleep 1
2861 - done
2862 - eend $rc
2863 -
2864 - if ! [[ -S "${socket}" ]]; then
2865 - die "Completely failed to start up mysqld with: ${mysqld}"
2866 - fi
2867 -
2868 - ebegin "Setting root password"
2869 - # Do this from memory, as we don't want clear text passwords in temp files
2870 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
2871 - "${EROOT}/usr/bin/mysql" \
2872 - "--socket=${socket}" \
2873 - -hlocalhost \
2874 - -e "${sql}"
2875 - eend $?
2876 -
2877 - if [[ -n "${sqltmp}" ]] ; then
2878 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
2879 - "${EROOT}/usr/bin/mysql" \
2880 - "--socket=${socket}" \
2881 - -hlocalhost \
2882 - -uroot \
2883 - --password="${MYSQL_ROOT_PASSWORD}" \
2884 - mysql < "${sqltmp}"
2885 - rc=$?
2886 - eend $?
2887 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
2888 - fi
2889 -
2890 - # Stop the server and cleanup
2891 - einfo "Stopping the server ..."
2892 - kill $(< "${pidfile}" )
2893 - rm -f "${sqltmp}"
2894 - wait %1
2895 - einfo "Done"
2896 -}
2897
2898 diff --git a/dev-db/mariadb/mariadb-10.4.6.ebuild b/dev-db/mariadb/mariadb-10.4.6.ebuild
2899 deleted file mode 100644
2900 index 890930c4809..00000000000
2901 --- a/dev-db/mariadb/mariadb-10.4.6.ebuild
2902 +++ /dev/null
2903 @@ -1,985 +0,0 @@
2904 -# Copyright 1999-2019 Gentoo Authors
2905 -# Distributed under the terms of the GNU General Public License v2
2906 -
2907 -EAPI="7"
2908 -MY_EXTRAS_VER="20190521-1824Z"
2909 -SUBSLOT="18"
2910 -
2911 -JAVA_PKG_OPT_USE="jdbc"
2912 -
2913 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
2914 - java-pkg-opt-2 user cmake-utils
2915 -
2916 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
2917 -
2918 -# Gentoo patches to MySQL
2919 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
2920 - SRC_URI="${SRC_URI}
2921 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2922 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2923 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2924 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2925 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
2926 -fi
2927 -
2928 -HOMEPAGE="https://mariadb.org/"
2929 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
2930 -LICENSE="GPL-2 LGPL-2.1+"
2931 -SLOT="0/${SUBSLOT:-0}"
2932 -IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4
2933 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
2934 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
2935 - sst-rsync sst-mariabackup static systemd systemtap tcmalloc
2936 - test tokudb xml yassl"
2937 -
2938 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
2939 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
2940 -
2941 -REQUIRED_USE="jdbc? ( extraengine server !static )
2942 - server? ( tokudb? ( jemalloc !tcmalloc ) )
2943 - ?? ( tcmalloc jemalloc )
2944 - static? ( yassl !pam )"
2945 -
2946 -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"
2947 -
2948 -# Shorten the path because the socket path length must be shorter than 107 chars
2949 -# and we will run a mysql server during test phase
2950 -S="${WORKDIR}/mysql"
2951 -
2952 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
2953 - inherit git-r3
2954 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
2955 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
2956 - EGIT_CLONE_TYPE=shallow
2957 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
2958 -else
2959 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
2960 -fi
2961 -
2962 -PATCHES=(
2963 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
2964 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.4.5-without-clientlibs-tools.patch
2965 - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
2966 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
2967 - "${MY_PATCH_DIR}"/20035_all_mariadb-10.3-atomic-detection.patch
2968 -)
2969 -
2970 -# Be warned, *DEPEND are version-dependant
2971 -# These are used for both runtime and compiletime
2972 -COMMON_DEPEND="
2973 - kernel_linux? (
2974 - sys-process/procps:0=
2975 - dev-libs/libaio:0=
2976 - )
2977 - >=sys-apps/sed-4
2978 - >=sys-apps/texinfo-4.7-r1
2979 - jemalloc? ( dev-libs/jemalloc:0= )
2980 - tcmalloc? ( dev-util/google-perftools:0= )
2981 - systemtap? ( >=dev-util/systemtap-1.3:0= )
2982 - >=sys-libs/zlib-1.2.3:0=
2983 - kerberos? ( virtual/krb5 )
2984 - yassl? ( net-libs/gnutls:0= )
2985 - !yassl? (
2986 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
2987 - libressl? ( dev-libs/libressl:0= )
2988 - )
2989 - sys-libs/ncurses:0=
2990 - !bindist? (
2991 - sys-libs/binutils-libs:0=
2992 - >=sys-libs/readline-4.1:0=
2993 - )
2994 - server? (
2995 - backup? ( app-arch/libarchive:0= )
2996 - cracklib? ( sys-libs/cracklib:0= )
2997 - extraengine? (
2998 - odbc? ( dev-db/unixODBC:0= )
2999 - xml? ( dev-libs/libxml2:2= )
3000 - )
3001 - innodb-lz4? ( app-arch/lz4 )
3002 - innodb-lzo? ( dev-libs/lzo )
3003 - innodb-snappy? ( app-arch/snappy )
3004 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
3005 - numa? ( sys-process/numactl )
3006 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
3007 - pam? ( virtual/pam:0= )
3008 - systemd? ( sys-apps/systemd:= )
3009 - tokudb? ( app-arch/snappy )
3010 - )
3011 - >=dev-libs/libpcre-8.41-r1:3=
3012 -"
3013 -BDEPEND="virtual/yacc
3014 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
3015 -"
3016 -DEPEND="static? ( sys-libs/ncurses[static-libs] )
3017 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
3018 - ${COMMON_DEPEND}"
3019 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
3020 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
3021 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
3022 - !<virtual/mysql-5.6-r11
3023 - !<virtual/libmysqlclient-18-r1
3024 - ${COMMON_DEPEND}
3025 - server? ( galera? (
3026 - sys-apps/iproute2
3027 - =sys-cluster/galera-26*
3028 - sst-rsync? ( sys-process/lsof )
3029 - sst-mariabackup? ( net-misc/socat[ssl] )
3030 - ) )
3031 - perl? ( !dev-db/mytop
3032 - virtual/perl-Getopt-Long
3033 - dev-perl/TermReadKey
3034 - virtual/perl-Term-ANSIColor
3035 - virtual/perl-Time-HiRes )
3036 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
3037 -"
3038 -# For other stuff to bring us in
3039 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
3040 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
3041 - server? ( ~virtual/mysql-5.6[static=] )"
3042 -
3043 -pkg_setup() {
3044 - if [[ ${MERGE_TYPE} != binary ]] ; then
3045 - local GCC_MAJOR_SET=$(gcc-major-version)
3046 - local GCC_MINOR_SET=$(gcc-minor-version)
3047 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
3048 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
3049 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
3050 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
3051 - die
3052 - fi
3053 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
3054 - # non x86{,_64} arches
3055 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
3056 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
3057 - eerror "${PN} needs to be built with gcc-4.7 or later."
3058 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
3059 - die
3060 - fi
3061 - fi
3062 - java-pkg-opt-2_pkg_setup
3063 - if has test ${FEATURES} && \
3064 - use server && ! has userpriv ${FEATURES} ; then
3065 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
3066 - fi
3067 -
3068 - # This should come after all of the die statements
3069 - enewgroup mysql 60 || die "problem adding 'mysql' group"
3070 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
3071 -}
3072 -
3073 -pkg_preinst() {
3074 - java-pkg-opt-2_pkg_preinst
3075 -}
3076 -
3077 -pkg_postinst() {
3078 - # Make sure the vars are correctly initialized
3079 - mysql_init_vars
3080 -
3081 - # Create log directory securely if it does not exist
3082 - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
3083 -
3084 - if use server ; then
3085 - if use pam; then
3086 - einfo
3087 - elog "This install includes the PAM authentication plugin."
3088 - elog "To activate and configure the PAM plugin, please read:"
3089 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
3090 - einfo
3091 - fi
3092 -
3093 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
3094 - einfo
3095 - elog "You might want to run:"
3096 - elog "\"emerge --config =${CATEGORY}/${PF}\""
3097 - elog "if this is a new install."
3098 - elog
3099 - elog "If you are switching server implentations, you should run the"
3100 - elog "mysql_upgrade tool."
3101 - einfo
3102 - else
3103 - einfo
3104 - elog "If you are upgrading major versions, you should run the"
3105 - elog "mysql_upgrade tool."
3106 - einfo
3107 - fi
3108 -
3109 - if use galera ; then
3110 - einfo
3111 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
3112 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
3113 - elog "The first time the cluster is activated, you should add"
3114 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
3115 - elog "This option should then be removed for subsequent starts."
3116 - einfo
3117 - if [[ -n "${REPLACING_VERSIONS}" ]] ; then
3118 - local rver
3119 - for rver in ${REPLACING_VERSIONS} ; do
3120 - if ver_test "${rver}" -lt "10.4.0" ; then
3121 - ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
3122 - ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera"
3123 - ewarn "for more information"
3124 - fi
3125 - done
3126 - fi
3127 - fi
3128 - fi
3129 -
3130 - # Note about configuration change
3131 - einfo
3132 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
3133 - elog "to several files in /etc/mysql/${PN}.d."
3134 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
3135 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
3136 - elog "You may have as many files as needed and they are read alphabetically."
3137 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
3138 - einfo
3139 -}
3140 -
3141 -src_unpack() {
3142 - unpack ${A}
3143 - # Grab the patches
3144 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
3145 -
3146 - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
3147 -}
3148 -
3149 -src_prepare() {
3150 - _disable_plugin() {
3151 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
3152 - }
3153 - _disable_engine() {
3154 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
3155 - }
3156 -
3157 - if use jemalloc; then
3158 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt"
3159 - elif use tcmalloc; then
3160 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
3161 - fi
3162 -
3163 - # Don't build bundled xz-utils for tokudb
3164 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
3165 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
3166 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
3167 -
3168 - local plugin
3169 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
3170 - locale_info qc_info server_audit sql_errlog )
3171 - local test_plugins=( audit_null auth_examples daemon_example fulltext
3172 - debug_key_management example_key_management versioning )
3173 - if ! use server; then # These plugins are for the server
3174 - for plugin in "${server_plugins[@]}" ; do
3175 - _disable_plugin "${plugin}"
3176 - done
3177 - fi
3178 -
3179 - if ! use test; then # These plugins are only used during testing
3180 - for plugin in "${test_plugins[@]}" ; do
3181 - _disable_plugin "${plugin}"
3182 - done
3183 - _disable_engine test_sql_discovery
3184 - fi
3185 -
3186 - _disable_engine example
3187 -
3188 - if ! use oqgraph ; then # avoids extra library checks
3189 - _disable_engine oqgraph
3190 - fi
3191 -
3192 - if use mroonga ; then
3193 - # Remove the bundled groonga
3194 - # There is no CMake flag, it simply checks for existance
3195 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
3196 - else
3197 - _disable_engine mroonga
3198 - fi
3199 -
3200 - cmake-utils_src_prepare
3201 - java-pkg-opt-2_src_prepare
3202 -}
3203 -
3204 -src_configure(){
3205 - # bug 508724 mariadb cannot use ld.gold
3206 - tc-ld-disable-gold
3207 - # Bug #114895, bug #110149
3208 - filter-flags "-O" "-O[01]"
3209 -
3210 - append-cxxflags -felide-constructors
3211 -
3212 - # bug #283926, with GCC4.4, this is required to get correct behavior.
3213 - append-flags -fno-strict-aliasing
3214 -
3215 - CMAKE_BUILD_TYPE="RelWithDebInfo"
3216 -
3217 - # debug hack wrt #497532
3218 - mycmakeargs=(
3219 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
3220 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
3221 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
3222 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
3223 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
3224 - -DINSTALL_BINDIR=bin
3225 - -DINSTALL_DOCDIR=share/doc/${PF}
3226 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
3227 - -DINSTALL_INCLUDEDIR=include/mysql
3228 - -DINSTALL_INFODIR=share/info
3229 - -DINSTALL_LIBDIR=$(get_libdir)
3230 - -DINSTALL_MANDIR=share/man
3231 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
3232 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
3233 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
3234 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
3235 - -DINSTALL_SBINDIR=sbin
3236 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
3237 - -DWITH_COMMENT="Gentoo Linux ${PF}"
3238 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
3239 - -DWITH_LIBEDIT=0
3240 - -DWITH_ZLIB=system
3241 - -DWITHOUT_LIBWRAP=1
3242 - -DENABLED_LOCAL_INFILE=1
3243 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
3244 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
3245 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
3246 - -DWITH_DEFAULT_FEATURE_SET=0
3247 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
3248 - # The build forces this to be defined when cross-compiling. We pass it
3249 - # all the time for simplicity and to make sure it is actually correct.
3250 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
3251 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
3252 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
3253 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
3254 - -DCONC_WITH_EXTERNAL_ZLIB=YES
3255 - -DWITH_EXTERNAL_ZLIB=YES
3256 - -DSUFFIX_INSTALL_DIR=""
3257 - -DWITH_UNITTEST=OFF
3258 - -DWITHOUT_CLIENTLIBS=YES
3259 - -DCLIENT_PLUGIN_DIALOG=OFF
3260 - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
3261 - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
3262 - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
3263 - )
3264 - if use test ; then
3265 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
3266 - else
3267 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
3268 - fi
3269 -
3270 - if ! use yassl ; then
3271 - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
3272 - else
3273 - mycmakeargs+=( -DWITH_SSL=bundled )
3274 - fi
3275 -
3276 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
3277 - mycmakeargs+=(
3278 - -DWITH_READLINE=$(usex bindist 1 0)
3279 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
3280 - -DENABLE_DTRACE=$(usex systemtap)
3281 - )
3282 -
3283 - if use server ; then
3284 -
3285 - # Federated{,X} must be treated special otherwise they will not be built as plugins
3286 - if ! use extraengine ; then
3287 - mycmakeargs+=(
3288 - -DPLUGIN_FEDERATED=NO
3289 - -DPLUGIN_FEDERATEDX=NO )
3290 - fi
3291 -
3292 - mycmakeargs+=(
3293 - -DWITH_PCRE=system
3294 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
3295 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
3296 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
3297 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
3298 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
3299 - -DPLUGIN_CASSANDRA=NO
3300 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
3301 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
3302 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
3303 - -DCONNECT_WITH_MYSQL=1
3304 - -DCONNECT_WITH_LIBXML2=$(usex xml)
3305 - -DCONNECT_WITH_ODBC=$(usex odbc)
3306 - -DCONNECT_WITH_JDBC=$(usex jdbc)
3307 - # Build failure and autodep wrt bug 639144
3308 - -DCONNECT_WITH_MONGO=OFF
3309 - -DWITH_WSREP=$(usex galera)
3310 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
3311 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
3312 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
3313 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
3314 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
3315 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
3316 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
3317 - -DINSTALL_SQLBENCHDIR=""
3318 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
3319 - # systemd is only linked to for server notification
3320 - -DWITH_SYSTEMD=$(usex systemd yes no)
3321 - -DWITH_NUMA=$(usex numa ON OFF)
3322 - )
3323 -
3324 - # Workaround for MDEV-14524
3325 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
3326 -
3327 - if use test ; then
3328 - # This is needed for the new client lib which tests a real, open server
3329 - mycmakeargs+=( -DSKIP_TESTS=ON )
3330 - fi
3331 -
3332 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
3333 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
3334 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
3335 - ewarn "You MUST file bugs without these variables set."
3336 -
3337 - mycmakeargs+=(
3338 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
3339 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
3340 - )
3341 -
3342 - elif ! use latin1 ; then
3343 - mycmakeargs+=(
3344 - -DDEFAULT_CHARSET=utf8
3345 - -DDEFAULT_COLLATION=utf8_general_ci
3346 - )
3347 - else
3348 - mycmakeargs+=(
3349 - -DDEFAULT_CHARSET=latin1
3350 - -DDEFAULT_COLLATION=latin1_swedish_ci
3351 - )
3352 - fi
3353 - mycmakeargs+=(
3354 - -DEXTRA_CHARSETS=all
3355 - -DMYSQL_USER=mysql
3356 - -DDISABLE_SHARED=$(usex static YES NO)
3357 - -DWITH_DEBUG=$(usex debug)
3358 - -DWITH_EMBEDDED_SERVER=OFF
3359 - -DWITH_PROFILING=$(usex profiling)
3360 - )
3361 -
3362 - if use static; then
3363 - mycmakeargs+=( -DWITH_PIC=1 )
3364 - fi
3365 -
3366 - if use jemalloc || use tcmalloc ; then
3367 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
3368 - fi
3369 -
3370 - # Storage engines
3371 - mycmakeargs+=(
3372 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
3373 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
3374 - -DWITH_CSV_STORAGE_ENGINE=1
3375 - -DWITH_HEAP_STORAGE_ENGINE=1
3376 - -DWITH_INNOBASE_STORAGE_ENGINE=1
3377 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
3378 - -DWITH_MYISAM_STORAGE_ENGINE=1
3379 - -DWITH_PARTITION_STORAGE_ENGINE=1
3380 - )
3381 -
3382 - else
3383 - mycmakeargs+=(
3384 - -DWITHOUT_SERVER=1
3385 - -DWITH_EMBEDDED_SERVER=OFF
3386 - -DEXTRA_CHARSETS=none
3387 - -DINSTALL_SQLBENCHDIR=
3388 - -DWITH_SYSTEMD=no
3389 - )
3390 - fi
3391 -
3392 - cmake-utils_src_configure
3393 -}
3394 -
3395 -src_compile() {
3396 - cmake-utils_src_compile
3397 -}
3398 -
3399 -src_install() {
3400 - cmake-utils_src_install
3401 -
3402 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
3403 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
3404 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
3405 - fi
3406 -
3407 - # Make sure the vars are correctly initialized
3408 - mysql_init_vars
3409 -
3410 - # Convenience links
3411 - einfo "Making Convenience links for mysqlcheck multi-call binary"
3412 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
3413 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
3414 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
3415 -
3416 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
3417 - if [[ -d "${ED}/usr/data" ]] ; then
3418 - rm -Rf "${ED}/usr/data" || die
3419 - fi
3420 -
3421 - # Unless they explicitly specific USE=test, then do not install the
3422 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
3423 - # validation of your database configuration after tuning it.
3424 - if ! use test ; then
3425 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
3426 - fi
3427 -
3428 - # Configuration stuff
3429 - einfo "Building default configuration ..."
3430 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
3431 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
3432 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
3433 - eprefixify "${TMPDIR}/my.cnf"
3434 - doins "${TMPDIR}/my.cnf"
3435 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
3436 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
3437 - eprefixify "${TMPDIR}/50-distro-client.cnf"
3438 - doins "${TMPDIR}/50-distro-client.cnf"
3439 -
3440 - if use server ; then
3441 - mycnf_src="my.cnf.distro-server"
3442 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
3443 - "${FILESDIR}/${mycnf_src}" \
3444 - > "${TMPDIR}/my.cnf.ok" || die
3445 - if use prefix ; then
3446 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
3447 - "${TMPDIR}/my.cnf.ok" || die
3448 - fi
3449 - if use latin1 ; then
3450 - sed -i \
3451 - -e "/character-set/s|utf8|latin1|g" \
3452 - "${TMPDIR}/my.cnf.ok" || die
3453 - fi
3454 - eprefixify "${TMPDIR}/my.cnf.ok"
3455 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
3456 -
3457 - einfo "Including support files and sample configurations"
3458 - docinto "support-files"
3459 - local script
3460 - for script in \
3461 - "${S}"/support-files/magic
3462 - do
3463 - [[ -f "$script" ]] && dodoc "${script}"
3464 - done
3465 -
3466 - docinto "scripts"
3467 - for script in "${S}"/scripts/mysql* ; do
3468 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
3469 - done
3470 - # Manually install supporting files that conflict with other packages
3471 - # but are needed for galera and initial installation
3472 - exeinto /usr/libexec/mariadb
3473 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
3474 - fi
3475 -
3476 - # Remove mytop if perl is not selected
3477 - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then
3478 - rm -f "${ED}/usr/bin/mytop" || die
3479 - fi
3480 -
3481 - # Fix a dangling symlink when galera is not built
3482 - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
3483 - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
3484 - fi
3485 -
3486 - # Remove broken SST scripts that are incompatible
3487 - local scriptremove
3488 - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
3489 - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
3490 - rm "${ED}/usr/bin/${scriptremove}" || die
3491 - fi
3492 - done
3493 -}
3494 -
3495 -# Official test instructions:
3496 -# USE='extraengine perl server' \
3497 -# FEATURES='test userpriv -usersandbox' \
3498 -# ebuild mariadb-X.X.XX.ebuild \
3499 -# digest clean package
3500 -src_test() {
3501 -
3502 - _disable_test() {
3503 - local rawtestname reason
3504 - rawtestname="${1}" ; shift
3505 - reason="${@}"
3506 - ewarn "test '${rawtestname}' disabled: '${reason}'"
3507 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
3508 - }
3509 -
3510 - local TESTDIR="${BUILD_DIR}/mysql-test"
3511 - local retstatus_unit
3512 - local retstatus_tests
3513 -
3514 - if ! use server ; then
3515 - einfo "Skipping server tests due to minimal build."
3516 - return 0
3517 - fi
3518 -
3519 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
3520 - # localhost. Also causes weird failures.
3521 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
3522 -
3523 - if [[ $UID -eq 0 ]]; then
3524 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
3525 - fi
3526 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
3527 -
3528 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
3529 -
3530 - # Run CTest (test-units)
3531 - cmake-utils_src_test
3532 - retstatus_unit=$?
3533 -
3534 - # Ensure that parallel runs don't die
3535 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
3536 - # Enable parallel testing, auto will try to detect number of cores
3537 - # You may set this by hand.
3538 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
3539 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
3540 -
3541 - # create directories because mysqladmin might run out of order
3542 - mkdir -p "${T}"/var-tests{,/log} || die
3543 -
3544 - # Run mysql tests
3545 - pushd "${TESTDIR}" > /dev/null || die
3546 -
3547 - touch "${T}/disabled.def"
3548 - # These are failing in MariaDB 10.0 for now and are believed to be
3549 - # false positives:
3550 - #
3551 - # main.mysql_client_test, main.mysql_client_test_nonblock
3552 - # main.mysql_client_test_comp:
3553 - # segfaults at random under Portage only, suspect resource limits.
3554 -
3555 - local t
3556 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
3557 - _disable_test "$t" "False positive due to varying policies"
3558 - done
3559 -
3560 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
3561 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
3562 - _disable_test "$t" "False positives in Gentoo"
3563 - done
3564 -
3565 - _disable_test main.plugin_auth "Needs client libraries built"
3566 -
3567 - _disable_test main.func_time "Dependent on time test was written"
3568 -
3569 - _disable_test compat/oracle.plugin "Needs example plugin which Gentoo disables"
3570 -
3571 - # run mysql-test tests
3572 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
3573 - retstatus_tests=$?
3574 -
3575 - popd > /dev/null || die
3576 -
3577 - # Cleanup is important for these testcases.
3578 - pkill -9 -f "${S}/ndb" 2>/dev/null
3579 - pkill -9 -f "${S}/sql" 2>/dev/null
3580 -
3581 - local failures=""
3582 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
3583 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
3584 -
3585 - [[ -z "$failures" ]] || die "Test failures: $failures"
3586 - einfo "Tests successfully completed"
3587 -}
3588 -
3589 -mysql_init_vars() {
3590 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
3591 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
3592 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
3593 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
3594 -
3595 - if [[ -z "${MY_DATADIR}" ]] ; then
3596 - MY_DATADIR=""
3597 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
3598 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
3599 - | sed -ne '/datadir/s|^--datadir=||p' \
3600 - | tail -n1`
3601 - if [[ -z "${MY_DATADIR}" ]] ; then
3602 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
3603 - | sed -e 's/.*=\s*//' \
3604 - | tail -n1`
3605 - fi
3606 - fi
3607 - if [[ -z "${MY_DATADIR}" ]] ; then
3608 - MY_DATADIR="${MY_LOCALSTATEDIR}"
3609 - einfo "Using default MY_DATADIR"
3610 - fi
3611 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
3612 -
3613 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
3614 - if [[ -e "${MY_DATADIR}" ]] ; then
3615 - # If you get this and you're wondering about it, see bug #207636
3616 - elog "MySQL datadir found in ${MY_DATADIR}"
3617 - elog "A new one will not be created."
3618 - PREVIOUS_DATADIR="yes"
3619 - else
3620 - PREVIOUS_DATADIR="no"
3621 - fi
3622 - export PREVIOUS_DATADIR
3623 - fi
3624 - else
3625 - if [[ ${EBUILD_PHASE} == "config" ]]; then
3626 - local new_MY_DATADIR
3627 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
3628 - | sed -ne '/datadir/s|^--datadir=||p' \
3629 - | tail -n1`
3630 -
3631 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
3632 - ewarn "MySQL MY_DATADIR has changed"
3633 - ewarn "from ${MY_DATADIR}"
3634 - ewarn "to ${new_MY_DATADIR}"
3635 - MY_DATADIR="${new_MY_DATADIR}"
3636 - fi
3637 - fi
3638 - fi
3639 -
3640 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
3641 - export MY_LOCALSTATEDIR MY_LOGDIR
3642 - export MY_DATADIR
3643 -}
3644 -
3645 -pkg_config() {
3646 - _getoptval() {
3647 - local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults
3648 - local section="$1"
3649 - local flag="--${2}="
3650 - local extra_options="${3}"
3651 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
3652 - }
3653 - local old_MY_DATADIR="${MY_DATADIR}"
3654 - local old_HOME="${HOME}"
3655 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
3656 - export HOME=${EPREFIX}/root
3657 -
3658 - # Make sure the vars are correctly initialized
3659 - mysql_init_vars
3660 -
3661 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
3662 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
3663 - die "Minimal builds do NOT include the MySQL server"
3664 - fi
3665 -
3666 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
3667 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
3668 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
3669 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
3670 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
3671 -
3672 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
3673 - if [[ -d "${MY_DATADIR_s}" ]]; then
3674 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
3675 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
3676 - else
3677 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
3678 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
3679 - || die "Moving MY_DATADIR failed"
3680 - fi
3681 - else
3682 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
3683 - if [[ -d "${MY_DATADIR_s}" ]]; then
3684 - ewarn "Attempting to use ${MY_DATADIR_s}"
3685 - else
3686 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
3687 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
3688 - fi
3689 - fi
3690 - fi
3691 -
3692 - local pwd1="a"
3693 - local pwd2="b"
3694 - local maxtry=15
3695 -
3696 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
3697 - local tmp_mysqld_password_source=
3698 -
3699 - for tmp_mysqld_password_source in mysql client; do
3700 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
3701 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
3702 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
3703 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
3704 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
3705 - MYSQL_ROOT_PASSWORD=
3706 - continue
3707 - fi
3708 -
3709 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
3710 - break
3711 - fi
3712 - done
3713 -
3714 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
3715 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
3716 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
3717 - fi
3718 -
3719 - unset tmp_mysqld_password_source
3720 - fi
3721 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
3722 - # These are dir+prefix
3723 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
3724 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
3725 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
3726 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
3727 -
3728 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
3729 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
3730 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
3731 - fi
3732 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
3733 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
3734 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
3735 - fi
3736 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
3737 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
3738 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
3739 - fi
3740 -
3741 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
3742 - ewarn "You have already a MySQL database in place."
3743 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
3744 - ewarn "Please rename or delete it if you wish to replace it."
3745 - die "MySQL database already exists!"
3746 - fi
3747 -
3748 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
3749 - # localhost. Also causes weird failures.
3750 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
3751 -
3752 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
3753 -
3754 - einfo "Please provide a password for the mysql 'root'@'localhost' user now"
3755 - einfo "or through the ${HOME}/.my.cnf file."
3756 - ewarn "Avoid [\"'\\_%] characters in the password"
3757 - einfo "Not entering a password defaults to UNIX authentication"
3758 - read -rsp " >" pwd1 ; echo
3759 -
3760 - if [[ -n "${pwd1}" ]] ; then
3761 -
3762 - einfo "Retype the password"
3763 - read -rsp " >" pwd2 ; echo
3764 -
3765 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
3766 - die "Passwords are not the same"
3767 - fi
3768 - MYSQL_ROOT_PASSWORD="${pwd1}"
3769 - fi
3770 - unset pwd1 pwd2
3771 - fi
3772 -
3773 - local options
3774 - local sqltmp="$(emktemp)"
3775 -
3776 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
3777 - # see https://bugs.mysql.com/bug.php?id=31312
3778 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
3779 -
3780 - # Figure out which options we need to disable to do the setup
3781 - local helpfile="${TMPDIR}/mysqld-help"
3782 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
3783 - for opt in grant-tables host-cache name-resolve networking slave-start \
3784 - federated ssl log-bin relay-log slow-query-log external-locking \
3785 - log-slave-updates \
3786 - ; do
3787 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
3788 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
3789 - done
3790 -
3791 - einfo "Creating the mysql database and setting proper permissions on it ..."
3792 -
3793 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
3794 - PID_DIR="${EROOT}/var/run/mysqld"
3795 - if [[ ! -d "${PID_DIR}" ]]; then
3796 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
3797 - fi
3798 -
3799 - if [[ ! -d "${MY_DATADIR}" ]]; then
3800 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
3801 - fi
3802 -
3803 - pushd "${TMPDIR}" &>/dev/null || die
3804 -
3805 - # Filling timezones, see
3806 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
3807 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
3808 -
3809 - local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" )
3810 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" )
3811 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
3812 - einfo "Command: ${cmd[*]}"
3813 - su -s /bin/sh -c "${cmd[*]}" mysql \
3814 - >"${TMPDIR}"/mysql_install_db.log 2>&1
3815 - if [[ $? -ne 0 ]]; then
3816 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
3817 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
3818 - fi
3819 - popd &>/dev/null || die
3820 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
3821 - || die "MySQL databases not installed"
3822 -
3823 - if [[ -z ${sqltmp} && -z ${MYSQL_ROOT_PASSWORD} ]] ; then
3824 - einfo "Done"
3825 - exit 0
3826 - fi
3827 -
3828 - use prefix || options="${options} --user=mysql"
3829 -
3830 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
3831 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
3832 - local mysqld="${EROOT}/usr/sbin/mysqld \
3833 - ${options} \
3834 - --log-warnings=0 \
3835 - --basedir=${EROOT}/usr \
3836 - --datadir=${ROOT}/${MY_DATADIR} \
3837 - --max_allowed_packet=8M \
3838 - --net_buffer_length=16K \
3839 - --socket=${socket} \
3840 - --pid-file=${pidfile} \
3841 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
3842 - #einfo "About to start mysqld: ${mysqld}"
3843 - ebegin "Starting mysqld"
3844 - einfo "Command ${mysqld}"
3845 - ${mysqld} &
3846 - rc=$?
3847 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
3848 - maxtry=$((${maxtry}-1))
3849 - echo -n "."
3850 - sleep 1
3851 - done
3852 - eend $rc
3853 -
3854 - [[ -S "${socket}" ]] ||
3855 - die "Completely failed to start up mysqld with: ${mysqld}"
3856 -
3857 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
3858 - ebegin "Setting root password"
3859 - # Do this from memory, as we don't want clear text passwords in temp files
3860 - local sql="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MYSQL_ROOT_PASSWORD}')"
3861 - "${EROOT}/usr/bin/mysql" \
3862 - "--socket=${socket}" \
3863 - -hlocalhost \
3864 - -e "${sql}"
3865 - unset sql
3866 - eend $?
3867 - fi
3868 -
3869 - if [[ -n "${sqltmp}" ]] ; then
3870 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
3871 - "${EROOT}/usr/bin/mysql" \
3872 - "--socket=${socket}" \
3873 - -hlocalhost \
3874 - -uroot \
3875 - --password="${MYSQL_ROOT_PASSWORD}" \
3876 - mysql < "${sqltmp}"
3877 - rc=$?
3878 - eend $?
3879 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
3880 - fi
3881 -
3882 - # Stop the server and cleanup
3883 - einfo "Stopping the server ..."
3884 - kill $(< "${pidfile}" )
3885 - rm -f "${sqltmp}"
3886 - wait %1
3887 - einfo "Done"
3888 -}
3889
3890 diff --git a/dev-db/mariadb/mariadb-5.5.64.ebuild b/dev-db/mariadb/mariadb-5.5.64.ebuild
3891 deleted file mode 100644
3892 index c09952b96da..00000000000
3893 --- a/dev-db/mariadb/mariadb-5.5.64.ebuild
3894 +++ /dev/null
3895 @@ -1,831 +0,0 @@
3896 -# Copyright 1999-2019 Gentoo Authors
3897 -# Distributed under the terms of the GNU General Public License v2
3898 -
3899 -EAPI="6"
3900 -MY_EXTRAS_VER="20180809-1700Z"
3901 -SUBSLOT="18"
3902 -
3903 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
3904 -
3905 -inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build
3906 -
3907 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
3908 -
3909 -# Gentoo patches to MySQL
3910 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
3911 - SRC_URI="${SRC_URI}
3912 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
3913 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
3914 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
3915 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
3916 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
3917 -fi
3918 -
3919 -HOMEPAGE="https://mariadb.org/"
3920 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
3921 -LICENSE="GPL-2"
3922 -SLOT="0/${SUBSLOT:-0}"
3923 -IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl
3924 - oqgraph pam +perl profiling selinux +server sphinx
3925 - static static-libs systemtap tcmalloc
3926 - test tokudb yassl"
3927 -
3928 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
3929 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
3930 -
3931 -REQUIRED_USE="server? ( tokudb? ( jemalloc !tcmalloc ) )
3932 - ?? ( tcmalloc jemalloc )
3933 - static? ( yassl !pam )"
3934 -
3935 -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"
3936 -
3937 -# Shorten the path because the socket path length must be shorter than 107 chars
3938 -# and we will run a mysql server during test phase
3939 -S="${WORKDIR}/mysql"
3940 -
3941 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
3942 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
3943 - inherit git-r3
3944 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
3945 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
3946 - EGIT_CLONE_TYPE=shallow
3947 -else
3948 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
3949 -fi
3950 -
3951 -PATCHES=(
3952 - "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch"
3953 - "${MY_PATCH_DIR}/20004_all_mariadb-filter-tokudb-flags.patch"
3954 - "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-5.5.50.patch"
3955 - "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch"
3956 - "${MY_PATCH_DIR}/20018_all_mariadb-5.5.60-without-clientlibs-tools.patch"
3957 -)
3958 -
3959 -# Be warned, *DEPEND are version-dependant
3960 -# These are used for both runtime and compiletime
3961 -COMMON_DEPEND="
3962 - kernel_linux? (
3963 - sys-process/procps:0=
3964 - dev-libs/libaio:0=
3965 - )
3966 - >=sys-apps/sed-4
3967 - >=sys-apps/texinfo-4.7-r1
3968 - jemalloc? ( dev-libs/jemalloc:0= )
3969 - tcmalloc? ( dev-util/google-perftools:0= )
3970 - systemtap? ( >=dev-util/systemtap-1.3:0= )
3971 - !yassl? (
3972 - !libressl? ( <dev-libs/openssl-1.1.0:0= )
3973 - libressl? ( dev-libs/libressl:0= )
3974 - )
3975 - >=sys-libs/zlib-1.2.3:0=
3976 - sys-libs/ncurses:0=
3977 - !bindist? (
3978 - >=sys-libs/readline-4.1:0=
3979 - )
3980 - server? (
3981 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
3982 - pam? ( virtual/pam:0= )
3983 - )
3984 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
3985 -"
3986 -DEPEND="virtual/yacc
3987 - static? ( sys-libs/ncurses[static-libs] )
3988 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
3989 - ${COMMON_DEPEND}"
3990 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
3991 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
3992 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
3993 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
3994 - ${COMMON_DEPEND}
3995 - perl? ( !dev-db/mytop
3996 - virtual/perl-Getopt-Long
3997 - dev-perl/TermReadKey
3998 - virtual/perl-Term-ANSIColor
3999 - virtual/perl-Time-HiRes )
4000 -"
4001 -# For other stuff to bring us in
4002 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
4003 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
4004 -
4005 -pkg_setup() {
4006 - if [[ ${MERGE_TYPE} != binary ]] ; then
4007 - local GCC_MAJOR_SET=$(gcc-major-version)
4008 - local GCC_MINOR_SET=$(gcc-minor-version)
4009 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
4010 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
4011 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
4012 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
4013 - die
4014 - fi
4015 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
4016 - # non x86{,_64} arches
4017 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
4018 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
4019 - eerror "${PN} needs to be built with gcc-4.7 or later."
4020 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
4021 - die
4022 - fi
4023 - fi
4024 - if has test ${FEATURES} && \
4025 - use server && ! has userpriv ${FEATURES} ; then
4026 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
4027 - fi
4028 -
4029 - # This should come after all of the die statements
4030 - enewgroup mysql 60 || die "problem adding 'mysql' group"
4031 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
4032 -}
4033 -
4034 -pkg_postinst() {
4035 - # Make sure the vars are correctly initialized
4036 - mysql_init_vars
4037 -
4038 - # Create log directory securely if it does not exist
4039 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
4040 -
4041 - if use server ; then
4042 - if use pam; then
4043 - einfo
4044 - elog "This install includes the PAM authentication plugin."
4045 - elog "To activate and configure the PAM plugin, please read:"
4046 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
4047 - einfo
4048 - fi
4049 -
4050 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
4051 - einfo
4052 - elog "You might want to run:"
4053 - elog "\"emerge --config =${CATEGORY}/${PF}\""
4054 - elog "if this is a new install."
4055 - elog
4056 - elog "If you are switching server implentations, you should run the"
4057 - elog "mysql_upgrade tool."
4058 - einfo
4059 - else
4060 - einfo
4061 - elog "If you are upgrading major versions, you should run the"
4062 - elog "mysql_upgrade tool."
4063 - einfo
4064 - fi
4065 -
4066 - einfo
4067 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
4068 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
4069 - elog "The first time the cluster is activated, you should add"
4070 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
4071 - elog "This option should then be removed for subsequent starts."
4072 - einfo
4073 - fi
4074 -}
4075 -
4076 -src_unpack() {
4077 - unpack ${A}
4078 - # Grab the patches
4079 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
4080 -
4081 - mv -f "${WORKDIR%/}/${P}" "${S}" || die
4082 -}
4083 -
4084 -src_prepare() {
4085 - _disable_engine() {
4086 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
4087 - }
4088 -
4089 - _disable_plugin() {
4090 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
4091 - }
4092 -
4093 - if use tcmalloc; then
4094 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
4095 - fi
4096 -
4097 - # Don't build bundled xz-utils for tokudb
4098 - echo > "${S%/}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
4099 - sed -i -e 's/ build_lzma//' "${S%/}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
4100 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/ft-index/portability/CMakeLists.txt" || die
4101 -
4102 - local plugin
4103 - local server_plugins=( handler_socket auth_socket feedback qc_info server_audit semisync sql_errlog )
4104 - local test_plugins=( audit_null auth_examples daemon_example fulltext )
4105 - if ! use server; then # These plugins are for the server
4106 - for plugin in "${server_plugins[@]}" ; do
4107 - _disable_plugin "${plugin}"
4108 - done
4109 - fi
4110 -
4111 - if ! use test; then # These plugins are only used during testing
4112 - for plugin in "${test_plugins[@]}" ; do
4113 - _disable_plugin "${plugin}"
4114 - done
4115 - fi
4116 -
4117 - # Collides with mariadb-connector-c bug 655980
4118 - _disable_plugin auth_dialog
4119 -
4120 - # Don't build example
4121 - _disable_engine example
4122 -
4123 - if ! use oqgraph ; then # avoids extra library checks
4124 - _disable_engine oqgraph
4125 - fi
4126 -
4127 - cmake-utils_src_prepare
4128 -}
4129 -
4130 -src_configure(){
4131 - # bug 508724 mariadb cannot use ld.gold
4132 - tc-ld-disable-gold
4133 - # Bug #114895, bug #110149
4134 - filter-flags "-O" "-O[01]"
4135 -
4136 - append-cxxflags -felide-constructors
4137 -
4138 - # bug #283926, with GCC4.4, this is required to get correct behavior.
4139 - append-flags -fno-strict-aliasing
4140 -
4141 - CMAKE_BUILD_TYPE="RelWithDebInfo"
4142 -
4143 - # debug hack wrt #497532
4144 - mycmakeargs=(
4145 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
4146 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
4147 - -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
4148 - -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql"
4149 - -DINSTALL_BINDIR=bin
4150 - -DINSTALL_DOCDIR=share/doc/${PF}
4151 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
4152 - -DINSTALL_INCLUDEDIR=include/mysql
4153 - -DINSTALL_INFODIR=share/info
4154 - -DINSTALL_LIBDIR=$(get_libdir)
4155 - -DINSTALL_MANDIR=share/man
4156 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
4157 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
4158 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
4159 - -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
4160 - -DINSTALL_SBINDIR=sbin
4161 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb"
4162 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
4163 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
4164 - -DWITH_ZLIB=system
4165 - -DENABLED_LOCAL_INFILE=1
4166 - -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
4167 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
4168 - # The build forces this to be defined when cross-compiling. We pass it
4169 - # all the time for simplicity and to make sure it is actually correct.
4170 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
4171 - -DWITHOUT_CLIENTLIBS=YES
4172 - -DWITH_READLINE=$(usex bindist 1 0)
4173 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
4174 - -DENABLE_DTRACE=$(usex systemtap)
4175 - )
4176 - if use test ; then
4177 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
4178 - else
4179 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
4180 - fi
4181 -
4182 - if ! use yassl ; then
4183 - mycmakeargs+=( -DWITH_SSL=system )
4184 - else
4185 - mycmakeargs+=( -DWITH_SSL=bundled )
4186 - fi
4187 -
4188 - if use server ; then
4189 -
4190 - # Federated{,X} must be treated special otherwise they will not be built as plugins
4191 - if ! use extraengine ; then
4192 - mycmakeargs+=(
4193 - -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
4194 - -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 )
4195 - fi
4196 -
4197 - mycmakeargs+=(
4198 - -DWITH_JEMALLOC=$(usex jemalloc system)
4199 - -D$(usex sphinx WITH WITHOUT)_SPHINX_STORAGE_ENGINE=1
4200 - -D$(usex tokudb WITH WITHOUT)_TOKUDB_STORAGE_ENGINE=1
4201 - -D$(usex oqgraph WITH WITHOUT)_AUTH_PAM=1
4202 - -DINSTALL_SQLBENCHDIR=share/mariadb
4203 - )
4204 -
4205 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
4206 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
4207 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
4208 - ewarn "You MUST file bugs without these variables set."
4209 -
4210 - mycmakeargs+=(
4211 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
4212 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
4213 - )
4214 -
4215 - elif ! use latin1 ; then
4216 - mycmakeargs+=(
4217 - -DDEFAULT_CHARSET=utf8
4218 - -DDEFAULT_COLLATION=utf8_general_ci
4219 - )
4220 - else
4221 - mycmakeargs+=(
4222 - -DDEFAULT_CHARSET=latin1
4223 - -DDEFAULT_COLLATION=latin1_swedish_ci
4224 - )
4225 - fi
4226 - mycmakeargs+=(
4227 - -DEXTRA_CHARSETS=all
4228 - -DDISABLE_SHARED=$(usex static YES NO)
4229 - -DWITH_EMBEDDED_SERVER=OFF
4230 - -DENABLED_PROFILING=$(usex profiling)
4231 - )
4232 -
4233 - if use static; then
4234 - mycmakeargs+=( -DWITH_PIC=1 )
4235 - fi
4236 -
4237 - if use jemalloc || use tcmalloc ; then
4238 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
4239 - fi
4240 -
4241 - # Storage engines
4242 - mycmakeargs+=(
4243 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
4244 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
4245 - -DWITH_CSV_STORAGE_ENGINE=1
4246 - -DWITH_HEAP_STORAGE_ENGINE=1
4247 - -DWITH_INNOBASE_STORAGE_ENGINE=1
4248 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
4249 - -DWITH_MYISAM_STORAGE_ENGINE=1
4250 - -DWITH_PARTITION_STORAGE_ENGINE=1
4251 - )
4252 -
4253 - else
4254 - mycmakeargs+=(
4255 - -DWITHOUT_SERVER=1
4256 - -DEXTRA_CHARSETS=none
4257 - -DINSTALL_SQLBENCHDIR=
4258 - )
4259 - fi
4260 -
4261 - cmake-utils_src_configure
4262 -}
4263 -
4264 -src_compile() {
4265 - cmake-utils_src_compile
4266 -}
4267 -
4268 -src_install() {
4269 - cmake-utils_src_install
4270 -
4271 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
4272 - if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then
4273 - rm "${ED%/}/usr/include/mysql/server/private/config.h" || die
4274 - fi
4275 -
4276 - # Make sure the vars are correctly initialized
4277 - mysql_init_vars
4278 -
4279 - # Convenience links
4280 - einfo "Making Convenience links for mysqlcheck multi-call binary"
4281 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
4282 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
4283 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
4284 -
4285 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
4286 - if [[ -d "${ED%/}/usr/data" ]] ; then
4287 - rm -Rf "${ED%/}/usr/data" || die
4288 - fi
4289 -
4290 - # Unless they explicitly specific USE=test, then do not install the
4291 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
4292 - # validation of your database configuration after tuning it.
4293 - if ! use test ; then
4294 - rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test"
4295 - fi
4296 -
4297 - # Configuration stuff
4298 - einfo "Building default configuration ..."
4299 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
4300 - [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf
4301 - local mycnf_src="my.cnf-5.5"
4302 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
4303 - "${FILESDIR%/}/${mycnf_src}" \
4304 - > "${TMPDIR%/}/my.cnf.ok" || die
4305 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok"
4306 - if use latin1 ; then
4307 - sed -i \
4308 - -e "/character-set/s|utf8|latin1|g" \
4309 - "${TMPDIR%/}/my.cnf.ok" || die
4310 - fi
4311 - eprefixify "${TMPDIR%/}/my.cnf.ok"
4312 - newins "${TMPDIR}/my.cnf.ok" my.cnf
4313 -
4314 - if use server ; then
4315 - einfo "Including support files and sample configurations"
4316 - docinto "support-files"
4317 - local script
4318 - for script in \
4319 - "${S%/}"/support-files/magic
4320 - do
4321 - [[ -f "$script" ]] && dodoc "${script}"
4322 - done
4323 -
4324 - docinto "scripts"
4325 - for script in "${S%/}"/scripts/mysql* ; do
4326 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
4327 - done
4328 - # Manually install supporting files that conflict with other packages
4329 - # but are needed for galera and initial installation
4330 - exeinto /usr/libexec/mariadb
4331 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
4332 - fi
4333 -
4334 - #Remove mytop if perl is not selected
4335 - [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop"
4336 -}
4337 -
4338 -# Official test instructions:
4339 -# USE='extraengine perl server' \
4340 -# FEATURES='test userpriv -usersandbox' \
4341 -# ebuild mariadb-X.X.XX.ebuild \
4342 -# digest clean package
4343 -src_test() {
4344 -
4345 - _disable_test() {
4346 - local rawtestname reason
4347 - rawtestname="${1}" ; shift
4348 - reason="${@}"
4349 - ewarn "test '${rawtestname}' disabled: '${reason}'"
4350 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
4351 - }
4352 -
4353 - local TESTDIR="${BUILD_DIR}/mysql-test"
4354 - local retstatus_unit
4355 - local retstatus_tests
4356 -
4357 - if ! use server ; then
4358 - einfo "Skipping server tests due to minimal build."
4359 - return 0
4360 - fi
4361 -
4362 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
4363 - # localhost. Also causes weird failures.
4364 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
4365 -
4366 - if [[ $UID -eq 0 ]]; then
4367 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
4368 - fi
4369 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
4370 -
4371 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
4372 -
4373 - # Run CTest (test-units)
4374 - cmake-utils_src_test
4375 - retstatus_unit=$?
4376 -
4377 - # Ensure that parallel runs don't die
4378 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
4379 - # Enable parallel testing, auto will try to detect number of cores
4380 - # You may set this by hand.
4381 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
4382 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
4383 -
4384 - # create directories because mysqladmin might run out of order
4385 - mkdir -p "${T}"/var-tests{,/log} || die
4386 -
4387 - # Run mysql tests
4388 - pushd "${TESTDIR}" > /dev/null || die
4389 -
4390 - touch "${T}/disabled.def"
4391 - # These are failing in MariaDB 5.5 for now and are believed to be
4392 - # false positives:
4393 - #
4394 - # main.information_schema, binlog.binlog_statement_insert_delayed,
4395 - # main.mysqld--help, funcs_1.is_triggers, funcs_1.is_tables_mysql,
4396 - # funcs_1.is_columns_mysql
4397 - # fails due to USE=-latin1 / utf8 default
4398 - #
4399 - # main.mysql_client_test, main.mysql_client_test_nonblock:
4400 - # segfaults at random under Portage only, suspect resource limits.
4401 - #
4402 - # archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam
4403 - # fails due to bad cleanup of previous tests when run in parallel
4404 - # The tool is deprecated anyway
4405 - # Bug 532288
4406 -
4407 - local t
4408 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
4409 - binlog.binlog_statement_insert_delayed main.information_schema \
4410 - main.mysqld--help \
4411 - archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam \
4412 - funcs_1.is_triggers funcs_1.is_tables_mysql funcs_1.is_columns_mysql ; do
4413 - _disable_test "$t" "False positives in Gentoo"
4414 - done
4415 -
4416 - if ! use client-libs ; then
4417 - _disable_test main.plugin_auth "Needs client libraries built"
4418 - fi
4419 -
4420 - # run mysql-test tests
4421 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
4422 - retstatus_tests=$?
4423 -
4424 - popd > /dev/null || die
4425 -
4426 - # Cleanup is important for these testcases.
4427 - pkill -9 -f "${S}/ndb" 2>/dev/null
4428 - pkill -9 -f "${S}/sql" 2>/dev/null
4429 -
4430 - local failures=""
4431 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
4432 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
4433 -
4434 - [[ -z "$failures" ]] || die "Test failures: $failures"
4435 - einfo "Tests successfully completed"
4436 -}
4437 -
4438 -mysql_init_vars() {
4439 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
4440 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
4441 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
4442 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
4443 -
4444 - if [[ -z "${MY_DATADIR}" ]] ; then
4445 - MY_DATADIR=""
4446 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
4447 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
4448 - | sed -ne '/datadir/s|^--datadir=||p' \
4449 - | tail -n1`
4450 - if [[ -z "${MY_DATADIR}" ]] ; then
4451 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
4452 - | sed -e 's/.*=\s*//' \
4453 - | tail -n1`
4454 - fi
4455 - fi
4456 - if [[ -z "${MY_DATADIR}" ]] ; then
4457 - MY_DATADIR="${MY_LOCALSTATEDIR}"
4458 - einfo "Using default MY_DATADIR"
4459 - fi
4460 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
4461 -
4462 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
4463 - if [[ -e "${MY_DATADIR}" ]] ; then
4464 - # If you get this and you're wondering about it, see bug #207636
4465 - elog "MySQL datadir found in ${MY_DATADIR}"
4466 - elog "A new one will not be created."
4467 - PREVIOUS_DATADIR="yes"
4468 - else
4469 - PREVIOUS_DATADIR="no"
4470 - fi
4471 - export PREVIOUS_DATADIR
4472 - fi
4473 - else
4474 - if [[ ${EBUILD_PHASE} == "config" ]]; then
4475 - local new_MY_DATADIR
4476 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
4477 - | sed -ne '/datadir/s|^--datadir=||p' \
4478 - | tail -n1`
4479 -
4480 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
4481 - ewarn "MySQL MY_DATADIR has changed"
4482 - ewarn "from ${MY_DATADIR}"
4483 - ewarn "to ${new_MY_DATADIR}"
4484 - MY_DATADIR="${new_MY_DATADIR}"
4485 - fi
4486 - fi
4487 - fi
4488 -
4489 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
4490 - export MY_LOCALSTATEDIR MY_LOGDIR
4491 - export MY_DATADIR
4492 -}
4493 -
4494 -pkg_config() {
4495 - _getoptval() {
4496 - local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults
4497 - local section="$1"
4498 - local flag="--${2}="
4499 - local extra_options="${3}"
4500 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
4501 - }
4502 - local old_MY_DATADIR="${MY_DATADIR}"
4503 - local old_HOME="${HOME}"
4504 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
4505 - export HOME=${EPREFIX}/root
4506 -
4507 - # Make sure the vars are correctly initialized
4508 - mysql_init_vars
4509 -
4510 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
4511 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
4512 - die "Minimal builds do NOT include the MySQL server"
4513 - fi
4514 -
4515 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
4516 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
4517 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
4518 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
4519 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
4520 -
4521 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
4522 - if [[ -d "${MY_DATADIR_s}" ]]; then
4523 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
4524 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
4525 - else
4526 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
4527 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
4528 - || die "Moving MY_DATADIR failed"
4529 - fi
4530 - else
4531 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
4532 - if [[ -d "${MY_DATADIR_s}" ]]; then
4533 - ewarn "Attempting to use ${MY_DATADIR_s}"
4534 - else
4535 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
4536 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
4537 - fi
4538 - fi
4539 - fi
4540 -
4541 - local pwd1="a"
4542 - local pwd2="b"
4543 - local maxtry=15
4544 -
4545 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
4546 - local tmp_mysqld_password_source=
4547 -
4548 - for tmp_mysqld_password_source in mysql client; do
4549 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
4550 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
4551 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
4552 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
4553 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
4554 - MYSQL_ROOT_PASSWORD=
4555 - continue
4556 - fi
4557 -
4558 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
4559 - break
4560 - fi
4561 - done
4562 -
4563 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
4564 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
4565 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
4566 - fi
4567 -
4568 - unset tmp_mysqld_password_source
4569 - fi
4570 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n 1)"
4571 - # These are dir+prefix
4572 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n 1)"
4573 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
4574 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n 1)"
4575 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
4576 -
4577 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
4578 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
4579 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
4580 - fi
4581 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
4582 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
4583 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
4584 - fi
4585 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
4586 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
4587 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
4588 - fi
4589 -
4590 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
4591 - ewarn "You have already a MySQL database in place."
4592 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
4593 - ewarn "Please rename or delete it if you wish to replace it."
4594 - die "MySQL database already exists!"
4595 - fi
4596 -
4597 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
4598 - # localhost. Also causes weird failures.
4599 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
4600 -
4601 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
4602 -
4603 - einfo "Please provide a password for the mysql 'root' user now"
4604 - einfo "or through the ${HOME}/.my.cnf file."
4605 - ewarn "Avoid [\"'\\_%] characters in the password"
4606 - read -rsp " >" pwd1 ; echo
4607 -
4608 - einfo "Retype the password"
4609 - read -rsp " >" pwd2 ; echo
4610 -
4611 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
4612 - die "Passwords are not the same"
4613 - fi
4614 - MYSQL_ROOT_PASSWORD="${pwd1}"
4615 - unset pwd1 pwd2
4616 - fi
4617 -
4618 - local options
4619 - local sqltmp="$(emktemp)"
4620 -
4621 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
4622 - # see https://bugs.mysql.com/bug.php?id=31312
4623 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
4624 -
4625 - # Figure out which options we need to disable to do the setup
4626 - local helpfile="${TMPDIR}/mysqld-help"
4627 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
4628 - for opt in grant-tables host-cache name-resolve networking slave-start \
4629 - federated ssl log-bin relay-log slow-query-log external-locking \
4630 - log-slave-updates \
4631 - ; do
4632 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
4633 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
4634 - done
4635 -
4636 - einfo "Creating the mysql database and setting proper permissions on it ..."
4637 -
4638 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
4639 - PID_DIR="${EROOT}/var/run/mysqld"
4640 - if [[ ! -d "${PID_DIR}" ]]; then
4641 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
4642 - fi
4643 -
4644 - if [[ ! -d "${MY_DATADIR}" ]]; then
4645 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
4646 - fi
4647 -
4648 - pushd "${TMPDIR}" &>/dev/null || die
4649 -
4650 - # Filling timezones, see
4651 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
4652 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
4653 -
4654 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
4655 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
4656 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
4657 - einfo "Command: ${cmd[*]}"
4658 - su -s /bin/sh -c "${cmd[*]}" mysql \
4659 - >"${TMPDIR}"/mysql_install_db.log 2>&1
4660 - if [ $? -ne 0 ]; then
4661 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
4662 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
4663 - fi
4664 - popd &>/dev/null || die
4665 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
4666 - || die "MySQL databases not installed"
4667 -
4668 - use prefix || options="${options} --user=mysql"
4669 -
4670 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
4671 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
4672 - local mysqld="${EROOT}/usr/sbin/mysqld \
4673 - ${options} \
4674 - --log-warnings=0 \
4675 - --basedir=${EROOT}/usr \
4676 - --datadir=${ROOT}/${MY_DATADIR} \
4677 - --max_allowed_packet=8M \
4678 - --net_buffer_length=16K \
4679 - --socket=${socket} \
4680 - --pid-file=${pidfile} \
4681 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
4682 - #einfo "About to start mysqld: ${mysqld}"
4683 - ebegin "Starting mysqld"
4684 - einfo "Command ${mysqld}"
4685 - ${mysqld} &
4686 - rc=$?
4687 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
4688 - maxtry=$((${maxtry}-1))
4689 - echo -n "."
4690 - sleep 1
4691 - done
4692 - eend $rc
4693 -
4694 - if ! [[ -S "${socket}" ]]; then
4695 - die "Completely failed to start up mysqld with: ${mysqld}"
4696 - fi
4697 -
4698 - ebegin "Setting root password"
4699 - # Do this from memory, as we don't want clear text passwords in temp files
4700 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
4701 - "${EROOT}/usr/bin/mysql" \
4702 - "--socket=${socket}" \
4703 - -hlocalhost \
4704 - -e "${sql}"
4705 - eend $?
4706 -
4707 - if [[ -n "${sqltmp}" ]] ; then
4708 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
4709 - "${EROOT}/usr/bin/mysql" \
4710 - "--socket=${socket}" \
4711 - -hlocalhost \
4712 - -uroot \
4713 - --password="${MYSQL_ROOT_PASSWORD}" \
4714 - mysql < "${sqltmp}"
4715 - rc=$?
4716 - eend $?
4717 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
4718 - fi
4719 -
4720 - # Stop the server and cleanup
4721 - einfo "Stopping the server ..."
4722 - kill $(< "${pidfile}" )
4723 - rm -f "${sqltmp}"
4724 - wait %1
4725 - einfo "Done"
4726 -}