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