1 |
commit: e21cad70e47bfd6d8f0f55f9246c940a53acd97b |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 22 12:04:01 2021 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 22 12:16:32 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e21cad70 |
7 |
|
8 |
dev-db/mysql: drop old |
9 |
|
10 |
Bug: https://github.com/gentoo/gentoo/pull/20679 |
11 |
Bug: https://github.com/gentoo/gentoo/pull/22237 |
12 |
Package-Manager: Portage-3.0.23, Repoman-3.0.3 |
13 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
14 |
|
15 |
dev-db/mysql/Manifest | 14 - |
16 |
dev-db/mysql/metadata.xml | 1 - |
17 |
dev-db/mysql/mysql-5.7.27-r2.ebuild | 995 ---------------------------- |
18 |
dev-db/mysql/mysql-5.7.29-r1.ebuild | 986 ---------------------------- |
19 |
dev-db/mysql/mysql-5.7.30-r1.ebuild | 977 ---------------------------- |
20 |
dev-db/mysql/mysql-5.7.31.ebuild | 1227 ----------------------------------- |
21 |
dev-db/mysql/mysql-8.0.19-r2.ebuild | 1160 --------------------------------- |
22 |
dev-db/mysql/mysql-8.0.20-r1.ebuild | 1143 -------------------------------- |
23 |
dev-db/mysql/mysql-8.0.21-r1.ebuild | 1166 --------------------------------- |
24 |
9 files changed, 7669 deletions(-) |
25 |
|
26 |
diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest |
27 |
index b1c2887c3e0..709e33edbfe 100644 |
28 |
--- a/dev-db/mysql/Manifest |
29 |
+++ b/dev-db/mysql/Manifest |
30 |
@@ -1,32 +1,18 @@ |
31 |
-DIST mysql-5.7.30-patches-01.tar.xz 6684 BLAKE2B 9350280094619fda0d91eacae573396198954fceb5dc039669d236b1dad98eef306702550b517ef30ee3d0e6721667b6f5549df91e3c15cef68888079c00d9ba SHA512 74e8e8794fe54b73776b38296aa42c65547311b80bfe65c88b2f961bd44083e9628eb47da4ebcf4c20e2d7c694f514223bcbf29cce27853cca500710ae97778d |
32 |
-DIST mysql-5.7.31-patches-01.tar.xz 6664 BLAKE2B 8225f286f0090653f9714545daa95ccdadaa58812e55284d1ee52ad2dcca18960b9266797630762595d832aa1dda1d9e2df691f0c728102f162b376346c99b3c SHA512 c6260e688da6e8f049ba7ac0553ad442e76829deaca32c1b7a101ec927a36b1571cb24982391f05545a9f62d94502efc09530d444e4abfc08350ab4c19fbfd37 |
33 |
DIST mysql-5.7.32-patches-01.tar.xz 6660 BLAKE2B 5c63158615398bdcc4480a0e1b058f491b39ffc7ee33767b425f3b254555411031f64d865e1924afe8aa3926e4cba18049f1219a0a8acc702bc5e011c94fa947 SHA512 bf5e0d27af81e599005268ee243af4cd93f6df95c32cccb268a749322b4e5f73a2ce5d51f0ad1b0e1f2cf4702b8a05e4b2e0b73110fd4aac61f2a0f51bf4952e |
34 |
DIST mysql-5.7.33-patches-01.tar.xz 6672 BLAKE2B cfa410f9ba5a4ba7e43923e7b5940c2dc6a9356b49230ebaea24bd7eef8a9639fc746e917c22241e19c830b81252e95f38e2c9d6054494de700bae46011fb2f4 SHA512 b16bb9531c44f1c5ec9c08aee6c1f5f5d2e3fe59a0039a54f6c050660a18f7c78b955e7eea7bef4e7dccfcdaa81464e0d8e47ac7d0e40ecb90187865a8a0412e |
35 |
DIST mysql-5.7.34-patches-01.tar.xz 6676 BLAKE2B b925880bfbb991fcba81964ff658a2ecab38da637a6093270a724ab8e405ab092d5fb9684f53f44d001e34287366df234b841d9ebcae62d49becdb93a3c3e324 SHA512 80a89f4b4a7ecc04f3115c6aaa0b0013e38c2813fa6dea095e826ef3944298715a48e0deacb691d23526b1524b207c83176290faea2461d3fcd94edabe3d8943 |
36 |
DIST mysql-5.7.34-patches-02.tar.xz 6408 BLAKE2B fdb36247832b6282af94ce2f61b5dd77f6b45f9efca4b438ecd5fed8d810d9d51547d0ae3de085e7f5dcc8795b4bc4f1210902495b92859e1d5aec3048256ef3 SHA512 f0513eb7f0c9e415aa972a53af668939934ea4f4fa438f468f32a46ccc2aa3b84ba8edd999e4786256ada34851ad64c81e9dd0e36c2a21da641987dfd18635c3 |
37 |
DIST mysql-5.7.35-patches-01.tar.xz 6408 BLAKE2B ddead9d6f5570f23433ffaef0188a8e93c0220b3d59ae24b870927e9e5908619f357725c1ab2d16905f39dd9d5f6cd23d3aabf6a1df2abdc865683f603912b8f SHA512 6374536299c691fd12a3f8b7cd27291e6f3b0b6d159284b2866caaed6a7f124439c16e659e6da5aae9e72d613de2a1e1b80066c961e122e90ad644e9a32633cc |
38 |
-DIST mysql-8.0.20-patches-01.tar.xz 7176 BLAKE2B 2fc51986c0a4da60521d0e64b9f8705caf8ec3869af930c9729359c3710059fc78aae176523fdf17d10173b404431f31f9bb23ee5c82fba7cbbb4cb39881c005 SHA512 bf8211cf3873f8672b9d3d1dc42b68a1c635690ffdc2d3393eafa83f060ada9f2eaa63f859bf8eecc24976a733d8c7c3b9632ac70f28b5facf48eae921c7ceeb |
39 |
-DIST mysql-8.0.21-patches-01.tar.xz 7212 BLAKE2B 2f1b38b3f84a124e3636cb726f3fcef82d71d933e90429dc78be44afeb4f456a37104359c5fd58ab50f0c03c1698e6c79f9b1e07640f0411c0024f558b4e9595 SHA512 3edcbb529b0623adaed30150d88c9b54d1a3e402faf5c7cff4ed626bbf4e5f50838d8f3c79bd2173439d748ded13412ff7fe37e3742c55879ff28907b9eb5660 |
40 |
DIST mysql-8.0.22-patches-02.tar.xz 7580 BLAKE2B a50704c3c58b1f67ca86edb233544137927b0ae5fdf302687b48f6fd30fbbd26798e8ef8282662586b25a7240b47278b44f944a8ca59f1a198bc228dd74459c9 SHA512 59f864452e9fdebe4d3990eff8b756e9bbfad58da216b74fa8b7e8391cb0d9d543ca2828591b9ed1ee276c1dec9e1851a8c2683507f0a326c85054e31cc3f950 |
41 |
DIST mysql-8.0.23-patches-01.tar.xz 7568 BLAKE2B 222120dcb5556457f382eefbb10f66f46fe1673c64730c8c8a5566942031bc98bab1f1182f747e79e23fccfb6b09197d5c2874aa2087104b6f1eaa25ea9fd60c SHA512 54222c420d57c1b206d920f22738746925ed1e0d78683f01c97cac5bd1d3450f70f784a7f603304b8595fb58120e691f94e28fa1d1884a7cc8bea1d7b177470f |
42 |
DIST mysql-8.0.25-patches-01.tar.xz 3604 BLAKE2B 09cccab204c30d16bdc374bcd01d4a8e6298955f86f479b8e287aab74fb6bd9857547e360be725dfc66acb56e1bb5665277d340761d0110a8823763ad4d2d1f4 SHA512 6d90a34a20e9cbc7e7a9b5b63a1408f33ac8523f2be6c9ab6d9ad7589c3ded83c87e460d782d4d8c33f11b337151fd8db994099e371260ecf204933e844eb50e |
43 |
DIST mysql-8.0.25-patches-02.tar.xz 6456 BLAKE2B c9c1020a505ebcee836f8dc3bbe540ff924a0174daf36c37b852df267a81919d37581d1c9be037d52cdcd34c27c5c34d3f0af6160857b22d8ab4d8ece37798e0 SHA512 3c3726b397f3a6fb1d84396bb571b4903a167c9a47273b9d5996949e1d3febc96d3528bfa8dfaeea073a245051ae10c983f2ad258268babc91649563ce3cfc00 |
44 |
DIST mysql-8.0.26-patches-01.tar.xz 6980 BLAKE2B 5fc86125b622ac978dc7ec3d6954a1d366315a57b6f56ca8dade9ad4a255b4b793ad33736404b29ab2db12f726897f014aeec9232dc52954087e7533d0f593d2 SHA512 00e6478716cf857b8ab768ec481dc1e7d809db17a9d899a52822f61dcc18797e87c0eecfafb1bb9065895c1b261c03c87fe0593b59dc86fb40853b0c660c9bfb |
45 |
-DIST mysql-boost-5.7.27.tar.gz 51436383 BLAKE2B 6db64ab5fa659aae9baa3725a0de9465e48c37618ffd69f34809880c06a00ce55dce77f507810c6fa52d86901facfa42d3d1bd8db1914a779fbc88a69be82497 SHA512 573f4555f3d62bcd3dc2228bcfba023518d462bb6689114a3505ccf7c7c3061d2775a8e7a37ec3c8b9dea6e8fbc56ba599610f237abc38cedff58e75799bdc52 |
46 |
-DIST mysql-boost-5.7.29.tar.gz 51417554 BLAKE2B 652ce9f99419387e9bcc37afeb1b46438784752e963c3aa1877f17650c31d8b058b4052da97c3a7e9454e758c259d6c311e0518f9a75909fce9741150b82164c SHA512 38acf7c2a10b20c59230ad05cd2cd6996c4c582233c1be573ead08e5c6684275790da07a036570363f89b4d61547b306589b0b98ed5fca70723a3f2cbc21fe11 |
47 |
-DIST mysql-boost-5.7.30.tar.gz 51363998 BLAKE2B 7897ad74b685c3b30e7ecdf132fdfa72f3416c05e8d0086cb8f7674b6c4f377fff9abc51ed258cc4dfeab50a2cb393af9076d9c1f9a83a26521facbaf223afa1 SHA512 b75d41d0c72d16c6f8d5393dab6e476b7993d296eb5683c12417ce2da3db2052fdab2a152f6e7c545315d21bfa35f26a247cb6cdab83d3418b5d34ed7f5f9560 |
48 |
-DIST mysql-boost-5.7.31.tar.gz 51382559 BLAKE2B 86430ee01b0b066ffbd1c876c7d09afecdd57f99cfe07417f406345bcdb14cc6fd33a2d4d92dfe15e87f34ec476bf34d62508ac3f99fb3e11957458e0d6ec20b SHA512 d7fc1927c860562d121658031bcbd58d36a942340423bf7b692cef84c29e67b56d009c9f9bb10cde8acabd6f9db58c67eb542349eccc4719fb38c8570738700a |
49 |
DIST mysql-boost-5.7.32.tar.gz 52882168 BLAKE2B dd112fa1d8bd29d86fba076675b5b7c9c98b6fb876aed45a00e8a25be716102fc9aa688b7170bef07b1c9f9751737277774d8fb2c64c21e181ecae58f89b4a8a SHA512 33a617d040efd065ea1c2ad84be537f851480abd5cc8a6879b7f170bc4e6db9432bd03f2a6bc680b71f17839c508cab0e7ef1a3aba032197da1b7943c916c77a |
50 |
DIST mysql-boost-5.7.33.tar.gz 52912380 BLAKE2B bca09314ae73932f6095799faa016998e65655cf5ea74d5596dcdc785e77014fe0b29a6c123e8618771f4a20a19978df00f7b79eea329aeb4b536ae71a4bef94 SHA512 1d1e1e5934fb17ff731fea45b88d4af6a394c2fbf0177a87803b18cb0eb4fb8d4939f82fc22b6cbc2af64022a44e206cd23e2e88ce11cc119c3ea22129d54e7a |
51 |
DIST mysql-boost-5.7.34.tar.gz 52891142 BLAKE2B 986fe106d73495ea9acb837f699ef2b1ffd123d9728b61da42f990d670569f1f7c12dc0a8611c3a7b6e3ed7be9fc277e1a977fa6c6d06f7d156a2f492951d9c7 SHA512 4eab7e90477b75643df743d806d5abcfb56572a2aa003a354980287c9148209f4fb7f0158ba969fb0462c32e49fcb4cf2a79f0330ab1bd2b243725dbf6f31d6d |
52 |
DIST mysql-boost-5.7.35.tar.gz 52959014 BLAKE2B 02cbc2201176773516479636ab40828a98bbc6bc1e90060e36d36af5c20a84b4b415d6e467328890ecff044834c81458fff8b717fd8942196dcf35e0ae85f298 SHA512 2469c8e13a236aee327bc0828804ba189e3abf78b6e0b3ef65b2343210f9c0cd5313d18b57ae3b76ca1487dc1d70854c8a12e6da61a6fffbce95854dcc792482 |
53 |
-DIST mysql-boost-8.0.19.tar.gz 264147972 BLAKE2B 61a5ccbef1a7a675c85e4e6bda8e5285bdb931e6ee14d4710bf13dfd9157d1095200db2886dc93ea7251d3d59245f35c0bef5ba88ba6aac209b1e080f3b07dc4 SHA512 5ffc03f005ab2585694902e926b6cb2b10059b2b030549eccd3949f9c3b2f02626d02529f940dec003f2d69683856fd1c720ff12f89dfbdc48befaf24a9c4d01 |
54 |
-DIST mysql-boost-8.0.20.tar.gz 266282970 BLAKE2B 2aeb9d6c575ed9dc2d00d3e51e6391c59ffa39156491d9ed2c07e19bb2efb88a14d5a9d4b537c137d71854e39fa3a7fc2b93618118d4fd062e92ba2d83783c6f SHA512 7a962e9ddec7069008c5ab6ac2801515e2661ca2875afc6141541c03e2f941f4255b3c0d806a4df2fd2f2f1d12323aeb1e456c1d364777a18ccebefad7b22a99 |
55 |
-DIST mysql-boost-8.0.21.tar.gz 278292192 BLAKE2B 9e5a14d1401f58f6f620c8691d2d4d3ada122a79a4e081380050961f0add93bf32b682c60ea2a6e58f50a4fcedbd323d8efe2d5f3e1f2bba5010e201a2df5d44 SHA512 18128edd7d9604ea69bd308f372d6663ef3629503969148e3a2117175c4ef625358b31b96e0e1b8d10a87037719e3cb61d5c71eee1e26ab0e0a1731977a2d7c1 |
56 |
DIST mysql-boost-8.0.22.tar.gz 285934450 BLAKE2B 1ba0c9bb9a0cb74af4842d3b746f8b690c122cfbf2c6d5201ce95e59a257427a8683dd8d5c2be31dfe9ece4761366c1287fa7b841c45db222725bf76b0639bc6 SHA512 792f2ada93ec67a4679228478c6b798e81d9e9f6d13c7f4977cb7682738a4aae3cb483294edc6b2fde16c3960e51af8786216c063ab500840afd39a609e4b612 |
57 |
DIST mysql-boost-8.0.23.tar.gz 291039175 BLAKE2B 3a7d3e05c774085d6078d0d3effd58d2df47521615356a2aa5efc2ea2ef8457e19ad57a054926ccff0a4752ca71d0464daa7fe9a3ac6c1b1d3bd86a9a82dfc58 SHA512 b8c2e2ac772b7b730f8b3bac7a5afb205da173b3639500606e7d1fac74832a0134027951855a2dc81af015e6158c924927ad63b9e1f2e7c823d45d4c4961c3f8 |
58 |
DIST mysql-boost-8.0.25.tar.gz 290265324 BLAKE2B 5393a2a2525a886d9ece19777deae01e6c0b24b9ff5a0a5ffb9075740ed912d0df59a165b6ec9ceb60c7c28f3062cda5cceb4da3a8280f42549984c846f1ce5c SHA512 af653ccff66a9d87221b46ad4f7bcc629700549f758998b9a7fb22e4573b9495a28624e031f016f9ad8fe0dfcf481b82f1ffe224aa48c2d45531570026b26081 |
59 |
DIST mysql-boost-8.0.26.tar.gz 291285918 BLAKE2B 6198ca8982a8c9df7e6ee4df5e2c1e0d64d2eb4d83cb7265317b58d55f6787c3240c8e40d196f2326ff3d66926ad7dab0705edd92e5a82881ce6ddb7f0c510b9 SHA512 63d47cb52407a816dc9f4330b99924624dfee46e57e7fdce19eff32909dd9e23251e2439d1807b002a1661b547173222c77465a3ca4dbb312414a84927809cfc |
60 |
-DIST mysql-extras-20190822-1908Z.tar.bz2 338830 BLAKE2B bc197f8e541206548d8982814e82e028d699ba9c41aec8d5191bcc46581f7880ed2741dbe2206fde44a5e8d8d54bbcf40efbd0709b357636c4c8fdb2ccc3a7bb SHA512 be469e55f7e9966638600d6836a44258c74e5600240fafe2d79eaeebe7d1695b043678184b5d18ee9946f28154bc2529586a7f860b510180a30c82454ed575c8 |
61 |
-DIST mysql-extras-20200125-1945Z.tar.bz2 344906 BLAKE2B 0e87875efbc221ded43d6f080dc7dce4277b676b538950120c94b962e51d054093286486e5d83ea3e38e1b2d0b12cf81873df50e1cebbe4cff33b54297e6a17a SHA512 5fcc5d372998db2b8aef32661ff71290791c20c1195a6210ca79c0fda12008906e665f9dc878d3df5a38a95e23ff05b910daa861002c17a1b6de71ef0520bee1 |
62 |
-DIST mysql-extras-20200317-0103Z.tar.bz2 344905 BLAKE2B c4c8bb2acea16663ab32cf291d0a2d52af04448a507ad3a6dc22dfdef4d6ba427582d66e5923d05cd51565286f85c8df5ccabef9a67a4a500574d21e1f708f27 SHA512 d1d34817faf0a1271f906213eea9081c204d745b14f96166f17d5c60a29ec58c05926e7216f135b6e9d5df2ceab373f10fc4e6a652514d99ba34a336571dce1f |
63 |
|
64 |
diff --git a/dev-db/mysql/metadata.xml b/dev-db/mysql/metadata.xml |
65 |
index d2c76395be3..d24d1320721 100644 |
66 |
--- a/dev-db/mysql/metadata.xml |
67 |
+++ b/dev-db/mysql/metadata.xml |
68 |
@@ -21,6 +21,5 @@ dev-db/mariadb |
69 |
<flag name="server">Build the server program</flag> |
70 |
<flag name="systemtap">Build support for profiling and tracing using <pkg>dev-util/systemtap</pkg></flag> |
71 |
<flag name="test">Install upstream testsuites for end use.</flag> |
72 |
- <flag name="yassl">Enable SSL connections and crypto functions using the bundled yaSSL</flag> |
73 |
</use> |
74 |
</pkgmetadata> |
75 |
|
76 |
diff --git a/dev-db/mysql/mysql-5.7.27-r2.ebuild b/dev-db/mysql/mysql-5.7.27-r2.ebuild |
77 |
deleted file mode 100644 |
78 |
index e1cf579b3c7..00000000000 |
79 |
--- a/dev-db/mysql/mysql-5.7.27-r2.ebuild |
80 |
+++ /dev/null |
81 |
@@ -1,995 +0,0 @@ |
82 |
-# Copyright 1999-2021 Gentoo Authors |
83 |
-# Distributed under the terms of the GNU General Public License v2 |
84 |
- |
85 |
-EAPI="6" |
86 |
-MY_EXTRAS_VER="20190822-1908Z" |
87 |
- |
88 |
-CMAKE_MAKEFILE_GENERATOR=emake |
89 |
- |
90 |
-# Keeping eutils in EAPI=6 for emktemp in pkg_config |
91 |
- |
92 |
-inherit cmake-utils eutils flag-o-matic linux-info \ |
93 |
- prefix toolchain-funcs multilib-minimal |
94 |
- |
95 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz |
96 |
- https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz |
97 |
- http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz" |
98 |
- |
99 |
-# Gentoo patches to MySQL |
100 |
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then |
101 |
- SRC_URI="${SRC_URI} |
102 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
103 |
- https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
104 |
-fi |
105 |
- |
106 |
-HOMEPAGE="https://www.mysql.com/" |
107 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
108 |
-LICENSE="GPL-2" |
109 |
-SLOT="5.7/18" |
110 |
-IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 numa +perl profiling |
111 |
- selinux +server static static-libs systemtap tcmalloc test yassl" |
112 |
- |
113 |
-RESTRICT="!test? ( test )" |
114 |
- |
115 |
-REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )" |
116 |
- |
117 |
-KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris" |
118 |
- |
119 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
120 |
-# and we will run a mysql server during test phase |
121 |
-S="${WORKDIR}/mysql" |
122 |
- |
123 |
-if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
124 |
- inherit git-r3 |
125 |
- EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
126 |
- EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
127 |
- EGIT_CLONE_TYPE=shallow |
128 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
129 |
-else |
130 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
131 |
-fi |
132 |
- |
133 |
-PATCHES=( |
134 |
- "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.23.patch |
135 |
- "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch |
136 |
- "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch |
137 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.26-without-clientlibs-tools.patch |
138 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-add-missing-gcc-8-fix.patch |
139 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch |
140 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch |
141 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-mips-ASM.patch |
142 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.25-fix-build-without-server.patch |
143 |
-) |
144 |
- |
145 |
-# Be warned, *DEPEND are version-dependant |
146 |
-# These are used for both runtime and compiletime |
147 |
-# MULTILIB_USEDEP only set for libraries used by the client library |
148 |
-COMMON_DEPEND="net-misc/curl:= |
149 |
- >=sys-apps/sed-4 |
150 |
- >=sys-apps/texinfo-4.7-r1 |
151 |
- sys-libs/ncurses:0= |
152 |
- client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] ) |
153 |
- !client-libs? ( |
154 |
- dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] |
155 |
- >=sys-libs/zlib-1.2.3:0= |
156 |
- ) |
157 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
158 |
- kernel_linux? ( |
159 |
- dev-libs/libaio:0= |
160 |
- sys-process/procps:0= |
161 |
- ) |
162 |
- server? ( |
163 |
- >=app-arch/lz4-0_p131:= |
164 |
- cjk? ( app-text/mecab:= ) |
165 |
- experimental? ( |
166 |
- dev-libs/libevent:= |
167 |
- dev-libs/protobuf:= |
168 |
- net-libs/libtirpc:= |
169 |
- ) |
170 |
- numa? ( sys-process/numactl ) |
171 |
- ) |
172 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
173 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
174 |
- !yassl? ( |
175 |
- client-libs? ( |
176 |
- >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] |
177 |
- ) |
178 |
- !client-libs? ( |
179 |
- >=dev-libs/openssl-1.0.0:0= |
180 |
- ) |
181 |
- ) |
182 |
-" |
183 |
-DEPEND="${COMMON_DEPEND} |
184 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
185 |
- dev-libs/protobuf |
186 |
- virtual/yacc |
187 |
- server? ( |
188 |
- dev-libs/libevent |
189 |
- experimental? ( net-libs/rpcsvc-proto ) |
190 |
- ) |
191 |
- static? ( sys-libs/ncurses[static-libs] ) |
192 |
- test? ( |
193 |
- acct-group/mysql acct-user/mysql |
194 |
- dev-perl/JSON |
195 |
- ) |
196 |
-" |
197 |
-RDEPEND="${COMMON_DEPEND} |
198 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
199 |
- !dev-db/mysql:0 |
200 |
- !dev-db/mysql:8.0 |
201 |
- client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= ) |
202 |
- selinux? ( sec-policy/selinux-mysql ) |
203 |
- server? ( |
204 |
- !prefix? ( |
205 |
- acct-group/mysql acct-user/mysql |
206 |
- dev-db/mysql-init-scripts |
207 |
- ) |
208 |
- ) |
209 |
-" |
210 |
-# For other stuff to bring us in |
211 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
212 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
213 |
- |
214 |
-mysql_init_vars() { |
215 |
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
216 |
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
217 |
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
218 |
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
219 |
- |
220 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
221 |
- MY_DATADIR="" |
222 |
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
223 |
- MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
224 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
225 |
- | tail -n1` |
226 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
227 |
- MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
228 |
- | sed -e 's/.*=\s*//' \ |
229 |
- | tail -n1` |
230 |
- fi |
231 |
- fi |
232 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
233 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
234 |
- einfo "Using default MY_DATADIR" |
235 |
- fi |
236 |
- elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
237 |
- |
238 |
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
239 |
- if [[ -e "${MY_DATADIR}" ]] ; then |
240 |
- # If you get this and you're wondering about it, see bug #207636 |
241 |
- elog "MySQL datadir found in ${MY_DATADIR}" |
242 |
- elog "A new one will not be created." |
243 |
- PREVIOUS_DATADIR="yes" |
244 |
- else |
245 |
- PREVIOUS_DATADIR="no" |
246 |
- fi |
247 |
- export PREVIOUS_DATADIR |
248 |
- fi |
249 |
- else |
250 |
- if [[ ${EBUILD_PHASE} == "config" ]] ; then |
251 |
- local new_MY_DATADIR |
252 |
- new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
253 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
254 |
- | tail -n1` |
255 |
- |
256 |
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then |
257 |
- ewarn "MySQL MY_DATADIR has changed" |
258 |
- ewarn "from ${MY_DATADIR}" |
259 |
- ewarn "to ${new_MY_DATADIR}" |
260 |
- MY_DATADIR="${new_MY_DATADIR}" |
261 |
- fi |
262 |
- fi |
263 |
- fi |
264 |
- |
265 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
266 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
267 |
- export MY_DATADIR |
268 |
-} |
269 |
- |
270 |
-pkg_pretend() { |
271 |
- if use numa ; then |
272 |
- local CONFIG_CHECK="~NUMA" |
273 |
- |
274 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
275 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
276 |
- |
277 |
- check_extra_config |
278 |
- fi |
279 |
-} |
280 |
- |
281 |
-pkg_setup() { |
282 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
283 |
- local GCC_MAJOR_SET=$(gcc-major-version) |
284 |
- local GCC_MINOR_SET=$(gcc-minor-version) |
285 |
- # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on |
286 |
- # non x86{,_64} arches |
287 |
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
288 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
289 |
- eerror "${PN} needs to be built with gcc-4.7 or later." |
290 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
291 |
- die |
292 |
- fi |
293 |
- fi |
294 |
- |
295 |
- if has test ${FEATURES} && \ |
296 |
- use server && ! has userpriv ${FEATURES} ; then |
297 |
- eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
298 |
- fi |
299 |
-} |
300 |
- |
301 |
-pkg_preinst() { |
302 |
- # Here we need to see if the implementation switched client libraries |
303 |
- # We check if this is a new instance of the package and a client library already exists |
304 |
- local SHOW_ABI_MESSAGE libpath |
305 |
- if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
306 |
- libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
307 |
- elog "Due to ABI changes when switching between different client libraries," |
308 |
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
309 |
- elog "Please run: revdep-rebuild --library ${libpath}" |
310 |
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
311 |
- fi |
312 |
-} |
313 |
- |
314 |
-pkg_postinst() { |
315 |
- # Make sure the vars are correctly initialized |
316 |
- mysql_init_vars |
317 |
- |
318 |
- # Create log directory securely if it does not exist |
319 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
320 |
- |
321 |
- if use server ; then |
322 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
323 |
- einfo |
324 |
- elog "You might want to run:" |
325 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
326 |
- elog "if this is a new install." |
327 |
- elog |
328 |
- elog "If you are switching server implentations, you should run the" |
329 |
- elog "mysql_upgrade tool." |
330 |
- einfo |
331 |
- else |
332 |
- einfo |
333 |
- elog "If you are upgrading major versions, you should run the" |
334 |
- elog "mysql_upgrade tool." |
335 |
- einfo |
336 |
- fi |
337 |
- fi |
338 |
- |
339 |
- # Note about configuration change |
340 |
- einfo |
341 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
342 |
- elog "to several files in /etc/mysql/mysql.d." |
343 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
344 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
345 |
- elog "You may have as many files as needed and they are read alphabetically." |
346 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
347 |
- einfo |
348 |
-} |
349 |
- |
350 |
-src_unpack() { |
351 |
- unpack ${A} |
352 |
- # Grab the patches |
353 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
354 |
- |
355 |
- mv -f "${WORKDIR}/${P}" "${S}" || die |
356 |
-} |
357 |
- |
358 |
-src_prepare() { |
359 |
- cmake-utils_src_prepare |
360 |
- |
361 |
- if use jemalloc ; then |
362 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
363 |
- fi |
364 |
- |
365 |
- if use tcmalloc ; then |
366 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
367 |
- fi |
368 |
- |
369 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
370 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
371 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
372 |
- fi |
373 |
- |
374 |
- # Remove bundled libs so we cannot accidentally use them |
375 |
- # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394 |
376 |
- rm -rv \ |
377 |
- "${S}"/extra/protobuf \ |
378 |
- "${S}"/extra/libevent \ |
379 |
- "${S}"/zlib \ |
380 |
- || die |
381 |
- |
382 |
- # Don't clash with dev-db/mysql-connector-c |
383 |
- rm \ |
384 |
- man/my_print_defaults.1 \ |
385 |
- man/perror.1 \ |
386 |
- man/zlib_decompress.1 \ |
387 |
- || die |
388 |
- |
389 |
- sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
390 |
-} |
391 |
- |
392 |
-src_configure() { |
393 |
- # Bug #114895, bug #110149 |
394 |
- filter-flags "-O" "-O[01]" |
395 |
- |
396 |
- append-cxxflags -felide-constructors |
397 |
- |
398 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
399 |
- append-flags -fno-strict-aliasing |
400 |
- |
401 |
- if use client-libs ; then |
402 |
- multilib-minimal_src_configure |
403 |
- else |
404 |
- multilib_src_configure |
405 |
- fi |
406 |
-} |
407 |
- |
408 |
-multilib_src_configure() { |
409 |
- debug-print-function ${FUNCNAME} "$@" |
410 |
- |
411 |
- if ! multilib_is_native_abi && ! use client-libs ; then |
412 |
- return |
413 |
- fi |
414 |
- |
415 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
416 |
- |
417 |
- # debug hack wrt #497532 |
418 |
- mycmakeargs=( |
419 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
420 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
421 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
422 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
423 |
- -DINSTALL_BINDIR=bin |
424 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
425 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
426 |
- -DINSTALL_INCLUDEDIR=include/mysql |
427 |
- -DINSTALL_INFODIR=share/info |
428 |
- -DINSTALL_LIBDIR=$(get_libdir) |
429 |
- -DINSTALL_MANDIR=share/man |
430 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
431 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
432 |
- -DINSTALL_SCRIPTDIR=share/mysql/scripts |
433 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
434 |
- -DINSTALL_SBINDIR=sbin |
435 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
436 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
437 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
438 |
- ### TODO: make this system but issues with UTF-8 prevent it |
439 |
- -DWITH_EDITLINE=bundled |
440 |
- -DWITH_ZLIB=system |
441 |
- -DWITH_LIBWRAP=0 |
442 |
- -DENABLED_LOCAL_INFILE=1 |
443 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
444 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
445 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
446 |
- # The build forces this to be defined when cross-compiling. We pass it |
447 |
- # all the time for simplicity and to make sure it is actually correct. |
448 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
449 |
- -DWITH_CURL=system |
450 |
- -DWITH_BOOST="${S}/boost" |
451 |
- ) |
452 |
- if use test ; then |
453 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
454 |
- else |
455 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
456 |
- fi |
457 |
- |
458 |
- if ! use yassl ; then |
459 |
- mycmakeargs+=( -DWITH_SSL=system ) |
460 |
- else |
461 |
- mycmakeargs+=( -DWITH_SSL=bundled ) |
462 |
- fi |
463 |
- |
464 |
- if ! use client-libs ; then |
465 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
466 |
- fi |
467 |
- |
468 |
- # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
469 |
- # systemtap only works on native ABI, bug 530132 |
470 |
- if multilib_is_native_abi ; then |
471 |
- mycmakeargs+=( |
472 |
- -DENABLE_DTRACE=$(usex systemtap) |
473 |
- ) |
474 |
- else |
475 |
- mycmakeargs+=( |
476 |
- -DWITHOUT_TOOLS=1 |
477 |
- -DWITH_READLINE=1 |
478 |
- -DENABLE_DTRACE=0 |
479 |
- ) |
480 |
- fi |
481 |
- |
482 |
- if multilib_is_native_abi && use server ; then |
483 |
- mycmakeargs+=( |
484 |
- -DWITH_LIBEVENT=system |
485 |
- -DWITH_LZ4=system |
486 |
- -DWITH_PROTOBUF=system |
487 |
- -DWITH_MECAB=$(usex cjk system OFF) |
488 |
- -DWITH_NUMA=$(usex numa ON OFF) |
489 |
- -DWITH_RAPID=$(usex experimental ON OFF) |
490 |
- ) |
491 |
- |
492 |
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then |
493 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
494 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
495 |
- ewarn "You MUST file bugs without these variables set." |
496 |
- |
497 |
- mycmakeargs+=( |
498 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
499 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
500 |
- ) |
501 |
- elif ! use latin1 ; then |
502 |
- mycmakeargs+=( |
503 |
- -DDEFAULT_CHARSET=utf8 |
504 |
- -DDEFAULT_COLLATION=utf8_general_ci |
505 |
- ) |
506 |
- else |
507 |
- mycmakeargs+=( |
508 |
- -DDEFAULT_CHARSET=latin1 |
509 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
510 |
- ) |
511 |
- fi |
512 |
- |
513 |
- mycmakeargs+=( |
514 |
- -DEXTRA_CHARSETS=all |
515 |
- -DDISABLE_SHARED=$(usex static YES NO) |
516 |
- -DWITH_DEBUG=$(usex debug) |
517 |
- -DWITH_EMBEDDED_SERVER=OFF |
518 |
- ) |
519 |
- |
520 |
- if use profiling ; then |
521 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
522 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
523 |
- # "main.mysqld--help-notwin" test to fail |
524 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
525 |
- fi |
526 |
- |
527 |
- if use static ; then |
528 |
- mycmakeargs+=( -DWITH_PIC=1 ) |
529 |
- fi |
530 |
- |
531 |
- # Storage engines |
532 |
- mycmakeargs+=( |
533 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
534 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
535 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
536 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
537 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
538 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
539 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
540 |
- -DWITH_INNODB_MEMCACHED=0 |
541 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
542 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
543 |
- -DWITH_PARTITION_STORAGE_ENGINE=1 |
544 |
- ) |
545 |
- |
546 |
- else |
547 |
- mycmakeargs+=( |
548 |
- -DWITHOUT_SERVER=1 |
549 |
- -DWITH_EMBEDDED_SERVER=OFF |
550 |
- -DEXTRA_CHARSETS=none |
551 |
- ) |
552 |
- fi |
553 |
- |
554 |
- cmake-utils_src_configure |
555 |
-} |
556 |
- |
557 |
-src_compile() { |
558 |
- if use client-libs ; then |
559 |
- multilib-minimal_src_compile |
560 |
- else |
561 |
- multilib_src_compile |
562 |
- fi |
563 |
-} |
564 |
- |
565 |
-multilib_src_compile() { |
566 |
- cmake-utils_src_compile |
567 |
-} |
568 |
- |
569 |
-# Official test instructions: |
570 |
-# ulimit -n 16500 && \ |
571 |
-# USE='latin1 perl server' \ |
572 |
-# FEATURES='test userpriv -usersandbox' \ |
573 |
-# ebuild mysql-X.X.XX.ebuild \ |
574 |
-# digest clean package |
575 |
-src_test() { |
576 |
- _disable_test() { |
577 |
- local rawtestname reason |
578 |
- rawtestname="${1}" ; shift |
579 |
- reason="${@}" |
580 |
- ewarn "test '${rawtestname}' disabled: '${reason}'" |
581 |
- echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
582 |
- } |
583 |
- |
584 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
585 |
- local retstatus_unit |
586 |
- local retstatus_tests |
587 |
- |
588 |
- if ! use server ; then |
589 |
- einfo "Skipping server tests due to minimal build." |
590 |
- return 0 |
591 |
- fi |
592 |
- |
593 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
594 |
- # localhost. Also causes weird failures. |
595 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
596 |
- |
597 |
- if [[ $UID -eq 0 ]] ; then |
598 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
599 |
- fi |
600 |
- has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
601 |
- |
602 |
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
603 |
- |
604 |
- # Run CTest (test-units) |
605 |
- cmake-utils_src_test |
606 |
- retstatus_unit=$? |
607 |
- |
608 |
- # Ensure that parallel runs don't die |
609 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
610 |
- # Enable parallel testing, auto will try to detect number of cores |
611 |
- # You may set this by hand. |
612 |
- # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
613 |
- export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
614 |
- |
615 |
- # create directories because mysqladmin might run out of order |
616 |
- mkdir -p "${T}"/var-tests{,/log} || die |
617 |
- |
618 |
- # Run mysql tests |
619 |
- pushd "${TESTDIR}" &>/dev/null || die |
620 |
- |
621 |
- touch "${T}/disabled.def" |
622 |
- # These are failing in MySQL 5.7 for now and are believed to be |
623 |
- # false positives: |
624 |
- # |
625 |
- local t |
626 |
- |
627 |
- for t in auth_sec.keyring_udf ; do |
628 |
- _disable_test "$t" "False positives in Gentoo" |
629 |
- done |
630 |
- |
631 |
- # Unstable tests |
632 |
- # - main.xa_prepared_binlog_off: https://bugs.mysql.com/bug.php?id=83340 |
633 |
- # - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223 |
634 |
- # - rpl.rpl_non_direct_stm_mixing_engines: MDEV-14489 |
635 |
- for t in \ |
636 |
- main.xa_prepared_binlog_off \ |
637 |
- rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \ |
638 |
- rpl.rpl_non_direct_stm_mixing_engines \ |
639 |
- ; do |
640 |
- _disable_test "$t" "Unstable test" |
641 |
- done |
642 |
- |
643 |
- for t in \ |
644 |
- gis.geometry_class_attri_prop \ |
645 |
- gis.geometry_property_function_issimple \ |
646 |
- gis.gis_bugs_crashes \ |
647 |
- gis.spatial_op_testingfunc_mix \ |
648 |
- gis.spatial_analysis_functions_buffer \ |
649 |
- gis.spatial_analysis_functions_distance \ |
650 |
- gis.spatial_utility_function_distance_sphere \ |
651 |
- gis.spatial_utility_function_simplify \ |
652 |
- gis.spatial_analysis_functions_centroid \ |
653 |
- ; do |
654 |
- _disable_test "$t" "Known rounding error with latest AMD processors" |
655 |
- done |
656 |
- |
657 |
- if use numa && use kernel_linux ; then |
658 |
- # bug 584880 |
659 |
- if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then |
660 |
- for t in sys_vars.innodb_numa_interleave_basic ; do |
661 |
- _disable_test "$t" "Test $t requires system with NUMA support" |
662 |
- done |
663 |
- fi |
664 |
- fi |
665 |
- |
666 |
- if ! use latin1 ; then |
667 |
- # The following tests will fail if DEFAULT_CHARSET |
668 |
- # isn't set to latin1: |
669 |
- for t in \ |
670 |
- binlog.binlog_mysqlbinlog_filter \ |
671 |
- binlog.binlog_xa_prepared_disconnect \ |
672 |
- funcs_1.is_columns_mysql \ |
673 |
- funcs_1.is_tables_mysql \ |
674 |
- funcs_1.is_triggers \ |
675 |
- innodb.innodb_pagesize_max_recordsize \ |
676 |
- innodb.innodb-system-table-view \ |
677 |
- innodb.mysqldump_max_recordsize \ |
678 |
- main.mysql_client_test \ |
679 |
- main.mysqld--help-notwin \ |
680 |
- main.type_string \ |
681 |
- main.information_schema \ |
682 |
- perfschema.binlog_edge_mix \ |
683 |
- perfschema.binlog_edge_stmt \ |
684 |
- rpl.rpl_xa_survive_disconnect \ |
685 |
- rpl.rpl_xa_survive_disconnect_lsu_off \ |
686 |
- rpl.rpl_xa_survive_disconnect_table \ |
687 |
- ; do |
688 |
- _disable_test "$t" "Requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set" |
689 |
- done |
690 |
- fi |
691 |
- |
692 |
- if has_version '>=dev-libs/openssl-1.1.1' ; then |
693 |
- # Tests are expecting <openssl-1.1.1 default cipher |
694 |
- for t in \ |
695 |
- auth_sec.cert_verify \ |
696 |
- auth_sec.mysql_ssl_connection \ |
697 |
- auth_sec.openssl_cert_generation \ |
698 |
- auth_sec.ssl_auto_detect \ |
699 |
- auth_sec.ssl_mode \ |
700 |
- auth_sec.tls \ |
701 |
- binlog.binlog_grant_alter_user \ |
702 |
- encryption.innodb_onlinealter_encryption \ |
703 |
- main.grant_alter_user_qa \ |
704 |
- main.grant_user_lock_qa \ |
705 |
- main.mysql_ssl_default \ |
706 |
- main.openssl_1 \ |
707 |
- main.plugin_auth_sha256_tls \ |
708 |
- main.ssl \ |
709 |
- main.ssl_8k_key \ |
710 |
- main.ssl_bug75311 \ |
711 |
- main.ssl_ca \ |
712 |
- main.ssl_cipher \ |
713 |
- main.ssl_compress \ |
714 |
- main.ssl_crl \ |
715 |
- main.ssl_ecdh \ |
716 |
- main.ssl_verify_identity \ |
717 |
- x.connection_tls_version \ |
718 |
- x.connection_openssl \ |
719 |
- ; do |
720 |
- _disable_test "$t" "Requires <dev-libs/openssl-1.1.1" |
721 |
- done |
722 |
- fi |
723 |
- |
724 |
- # Try to increase file limits to increase test coverage |
725 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
726 |
- # Upper limit comes from parts.partition_* tests |
727 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
728 |
- |
729 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
730 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
731 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
732 |
- |
733 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
734 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
735 |
- else |
736 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
737 |
- fi |
738 |
- else |
739 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
740 |
- fi |
741 |
- else |
742 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
743 |
- fi |
744 |
- |
745 |
- # run mysql-test tests |
746 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
747 |
- retstatus_tests=$? |
748 |
- |
749 |
- popd &>/dev/null || die |
750 |
- |
751 |
- # Cleanup is important for these testcases. |
752 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
753 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
754 |
- |
755 |
- local failures="" |
756 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
757 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
758 |
- |
759 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
760 |
- einfo "Tests successfully completed" |
761 |
-} |
762 |
- |
763 |
-src_install() { |
764 |
- local MULTILIB_WRAPPED_HEADERS |
765 |
- local MULTILIB_CHOST_TOOLS |
766 |
- if use client-libs ; then |
767 |
- # headers with ABI specific data |
768 |
- MULTILIB_WRAPPED_HEADERS=( |
769 |
- /usr/include/mysql/server/my_config.h |
770 |
- /usr/include/mysql/server/mysql_version.h ) |
771 |
- |
772 |
- # wrap the config scripts |
773 |
- MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config ) |
774 |
- multilib-minimal_src_install |
775 |
- else |
776 |
- multilib_src_install |
777 |
- multilib_src_install_all |
778 |
- fi |
779 |
-} |
780 |
- |
781 |
-# Intentionally override eclass function |
782 |
-multilib_src_install() { |
783 |
- |
784 |
- cmake-utils_src_install |
785 |
- |
786 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
787 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
788 |
-} |
789 |
- |
790 |
-multilib_src_install_all() { |
791 |
- # Make sure the vars are correctly initialized |
792 |
- mysql_init_vars |
793 |
- |
794 |
- # Convenience links |
795 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
796 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
797 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
798 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
799 |
- |
800 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
801 |
- if [[ -d "${ED}/usr/data" ]] ; then |
802 |
- rm -Rf "${ED}/usr/data" || die |
803 |
- fi |
804 |
- |
805 |
- # Unless they explicitly specific USE=test, then do not install the |
806 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
807 |
- # validation of your database configuration after tuning it. |
808 |
- if ! use test ; then |
809 |
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
810 |
- fi |
811 |
- |
812 |
- # Configuration stuff |
813 |
- einfo "Building default configuration ..." |
814 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
815 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
816 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
817 |
- eprefixify "${TMPDIR}/my.cnf" |
818 |
- doins "${TMPDIR}/my.cnf" |
819 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
820 |
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
821 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
822 |
- doins "${TMPDIR}/50-distro-client.cnf" |
823 |
- |
824 |
- if use server ; then |
825 |
- mycnf_src="my.cnf.distro-server" |
826 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
827 |
- "${FILESDIR}/${mycnf_src}" \ |
828 |
- > "${TMPDIR}/my.cnf.ok" || die |
829 |
- |
830 |
- if use prefix ; then |
831 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
832 |
- "${TMPDIR}/my.cnf.ok" || die |
833 |
- fi |
834 |
- |
835 |
- if use latin1 ; then |
836 |
- sed -i \ |
837 |
- -e "/character-set/s|utf8|latin1|g" \ |
838 |
- "${TMPDIR}/my.cnf.ok" || die |
839 |
- fi |
840 |
- |
841 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
842 |
- |
843 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
844 |
- fi |
845 |
- |
846 |
- #Remove mytop if perl is not selected |
847 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
848 |
-} |
849 |
- |
850 |
-pkg_config() { |
851 |
- _getoptval() { |
852 |
- local mypd="${EROOT%/}"/usr/bin/my_print_defaults |
853 |
- local section="$1" |
854 |
- local flag="--${2}=" |
855 |
- local extra_options="${3}" |
856 |
- "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
857 |
- } |
858 |
- local old_MY_DATADIR="${MY_DATADIR}" |
859 |
- local old_HOME="${HOME}" |
860 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
861 |
- export HOME=${EPREFIX}/root |
862 |
- |
863 |
- # Make sure the vars are correctly initialized |
864 |
- mysql_init_vars |
865 |
- |
866 |
- [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
867 |
- if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then |
868 |
- die "Minimal builds do NOT include the MySQL server" |
869 |
- fi |
870 |
- |
871 |
- if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then |
872 |
- local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}" |
873 |
- MY_DATADIR_s="${MY_DATADIR_s%%/}" |
874 |
- local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}" |
875 |
- old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
876 |
- |
877 |
- if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then |
878 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
879 |
- ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
880 |
- ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
881 |
- else |
882 |
- elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
883 |
- mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
884 |
- || die "Moving MY_DATADIR failed" |
885 |
- fi |
886 |
- else |
887 |
- ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
888 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
889 |
- ewarn "Attempting to use ${MY_DATADIR_s}" |
890 |
- else |
891 |
- eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
892 |
- die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
893 |
- fi |
894 |
- fi |
895 |
- fi |
896 |
- |
897 |
- local pwd1="a" |
898 |
- local pwd2="b" |
899 |
- local maxtry=15 |
900 |
- |
901 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
902 |
- local tmp_mysqld_password_source= |
903 |
- |
904 |
- for tmp_mysqld_password_source in mysql client ; do |
905 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
906 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
907 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
908 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
909 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
910 |
- MYSQL_ROOT_PASSWORD= |
911 |
- continue |
912 |
- fi |
913 |
- |
914 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
915 |
- break |
916 |
- fi |
917 |
- done |
918 |
- |
919 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
920 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
921 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
922 |
- fi |
923 |
- |
924 |
- unset tmp_mysqld_password_source |
925 |
- fi |
926 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
927 |
- # These are dir+prefix |
928 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
929 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
930 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
931 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
932 |
- |
933 |
- if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then |
934 |
- einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
935 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR" |
936 |
- fi |
937 |
- |
938 |
- if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then |
939 |
- einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
940 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN" |
941 |
- fi |
942 |
- |
943 |
- if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then |
944 |
- einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
945 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG" |
946 |
- fi |
947 |
- |
948 |
- if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then |
949 |
- ewarn "You have already a MySQL database in place." |
950 |
- ewarn "(${ROOT%/}/${MY_DATADIR}/*)" |
951 |
- ewarn "Please rename or delete it if you wish to replace it." |
952 |
- die "MySQL database already exists!" |
953 |
- fi |
954 |
- |
955 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
956 |
- # localhost. Also causes weird failures. |
957 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
958 |
- |
959 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
960 |
- |
961 |
- einfo "Please provide a password for the mysql 'root' user now" |
962 |
- einfo "or through the ${HOME}/.my.cnf file." |
963 |
- ewarn "Avoid [\"'\\_%] characters in the password" |
964 |
- read -rsp " >" pwd1 ; echo |
965 |
- |
966 |
- einfo "Retype the password" |
967 |
- read -rsp " >" pwd2 ; echo |
968 |
- |
969 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
970 |
- die "Passwords are not the same" |
971 |
- fi |
972 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
973 |
- unset pwd1 pwd2 |
974 |
- fi |
975 |
- |
976 |
- local options |
977 |
- local sqltmp="$(emktemp)" |
978 |
- |
979 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
980 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
981 |
- use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
982 |
- |
983 |
- # Figure out which options we need to disable to do the setup |
984 |
- local helpfile="${TMPDIR%/}/mysqld-help" |
985 |
- "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
986 |
- for opt in host-cache name-resolve networking slave-start \ |
987 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
988 |
- log-slave-updates \ |
989 |
- ; do |
990 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
991 |
- egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
992 |
- done |
993 |
- |
994 |
- einfo "Creating the mysql database and setting proper permissions on it ..." |
995 |
- |
996 |
- # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
997 |
- PID_DIR="${EROOT%/}/var/run/mysqld" |
998 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
999 |
- install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
1000 |
- fi |
1001 |
- |
1002 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
1003 |
- install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
1004 |
- fi |
1005 |
- |
1006 |
- pushd "${TMPDIR}" &>/dev/null || die |
1007 |
- |
1008 |
- # Filling timezones, see |
1009 |
- # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
1010 |
- echo "USE mysql;" >"${sqltmp}" |
1011 |
- "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null |
1012 |
- chown mysql "${sqltmp}" || die |
1013 |
- |
1014 |
- # --initialize-insecure will not set root password |
1015 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
1016 |
- local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" ) |
1017 |
- cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" ) |
1018 |
- einfo "Command: ${cmd[*]}" |
1019 |
- su -s /bin/sh -c "${cmd[*]}" mysql \ |
1020 |
- >"${TMPDIR%/}"/mysql_install_db.log 2>&1 |
1021 |
- if [[ $? -ne 0 ]] ; then |
1022 |
- grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2 |
1023 |
- die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log" |
1024 |
- fi |
1025 |
- popd &>/dev/null || die |
1026 |
- [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \ |
1027 |
- || die "MySQL databases not installed" |
1028 |
- |
1029 |
- use prefix || options="${options} --user=mysql" |
1030 |
- |
1031 |
- local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock" |
1032 |
- local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid" |
1033 |
- local mysqld="${EROOT%/}/usr/sbin/mysqld \ |
1034 |
- ${options} \ |
1035 |
- $(use prefix || echo --user=mysql) \ |
1036 |
- --log-warnings=0 \ |
1037 |
- --basedir=${EROOT%/}/usr \ |
1038 |
- --datadir=${ROOT%/}/${MY_DATADIR} \ |
1039 |
- --max_allowed_packet=8M \ |
1040 |
- --net_buffer_length=16K \ |
1041 |
- --socket=${socket} \ |
1042 |
- --pid-file=${pidfile} \ |
1043 |
- --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
1044 |
- #einfo "About to start mysqld: ${mysqld}" |
1045 |
- ebegin "Starting mysqld" |
1046 |
- einfo "Command ${mysqld}" |
1047 |
- ${mysqld} & |
1048 |
- rc=$? |
1049 |
- while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
1050 |
- maxtry=$((${maxtry}-1)) |
1051 |
- echo -n "." |
1052 |
- sleep 1 |
1053 |
- done |
1054 |
- eend $rc |
1055 |
- |
1056 |
- if ! [[ -S "${socket}" ]] ; then |
1057 |
- die "Completely failed to start up mysqld with: ${mysqld}" |
1058 |
- fi |
1059 |
- |
1060 |
- ebegin "Setting root password" |
1061 |
- # Do this from memory, as we don't want clear text passwords in temp files |
1062 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'" |
1063 |
- "${EROOT%/}/usr/bin/mysql" \ |
1064 |
- --no-defaults \ |
1065 |
- "--socket=${socket}" \ |
1066 |
- -hlocalhost \ |
1067 |
- -e "${sql}" |
1068 |
- eend $? |
1069 |
- |
1070 |
- # Stop the server and cleanup |
1071 |
- einfo "Stopping the server ..." |
1072 |
- kill $(< "${pidfile}" ) |
1073 |
- rm -f "${sqltmp}" |
1074 |
- wait %1 |
1075 |
- einfo "Done" |
1076 |
-} |
1077 |
|
1078 |
diff --git a/dev-db/mysql/mysql-5.7.29-r1.ebuild b/dev-db/mysql/mysql-5.7.29-r1.ebuild |
1079 |
deleted file mode 100644 |
1080 |
index a68c2ae2ff7..00000000000 |
1081 |
--- a/dev-db/mysql/mysql-5.7.29-r1.ebuild |
1082 |
+++ /dev/null |
1083 |
@@ -1,986 +0,0 @@ |
1084 |
-# Copyright 1999-2021 Gentoo Authors |
1085 |
-# Distributed under the terms of the GNU General Public License v2 |
1086 |
- |
1087 |
-EAPI="6" |
1088 |
-MY_EXTRAS_VER="20200125-1945Z" |
1089 |
- |
1090 |
-CMAKE_MAKEFILE_GENERATOR=emake |
1091 |
- |
1092 |
-# Keeping eutils in EAPI=6 for emktemp in pkg_config |
1093 |
- |
1094 |
-inherit cmake-utils eutils flag-o-matic linux-info \ |
1095 |
- prefix toolchain-funcs multilib-minimal |
1096 |
- |
1097 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz |
1098 |
- https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz |
1099 |
- http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz" |
1100 |
- |
1101 |
-# Gentoo patches to MySQL |
1102 |
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then |
1103 |
- SRC_URI="${SRC_URI} |
1104 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
1105 |
- https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
1106 |
-fi |
1107 |
- |
1108 |
-HOMEPAGE="https://www.mysql.com/" |
1109 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
1110 |
-LICENSE="GPL-2" |
1111 |
-SLOT="5.7/18" |
1112 |
-IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 numa +perl profiling |
1113 |
- selinux +server static static-libs systemtap tcmalloc test" |
1114 |
- |
1115 |
-RESTRICT="!test? ( test )" |
1116 |
- |
1117 |
-REQUIRED_USE="?? ( tcmalloc jemalloc )" |
1118 |
- |
1119 |
-KEYWORDS="amd64 arm ~arm64 ~hppa ~ia64 ~mips ~ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris" |
1120 |
- |
1121 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
1122 |
-# and we will run a mysql server during test phase |
1123 |
-S="${WORKDIR}/mysql" |
1124 |
- |
1125 |
-if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
1126 |
- inherit git-r3 |
1127 |
- EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
1128 |
- EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
1129 |
- EGIT_CLONE_TYPE=shallow |
1130 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
1131 |
-else |
1132 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
1133 |
-fi |
1134 |
- |
1135 |
-PATCHES=( |
1136 |
- "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.23.patch |
1137 |
- "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch |
1138 |
- "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch |
1139 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.29-without-clientlibs-tools.patch |
1140 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch |
1141 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-round-off-test-values-for-same-output-on-all-architectures.patch |
1142 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.25-fix-build-without-server.patch |
1143 |
-) |
1144 |
- |
1145 |
-# Be warned, *DEPEND are version-dependant |
1146 |
-# These are used for both runtime and compiletime |
1147 |
-# MULTILIB_USEDEP only set for libraries used by the client library |
1148 |
-COMMON_DEPEND="net-misc/curl:= |
1149 |
- >=sys-apps/sed-4 |
1150 |
- >=sys-apps/texinfo-4.7-r1 |
1151 |
- sys-libs/ncurses:0= |
1152 |
- client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] ) |
1153 |
- !client-libs? ( |
1154 |
- dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] |
1155 |
- >=sys-libs/zlib-1.2.3:0= |
1156 |
- ) |
1157 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
1158 |
- kernel_linux? ( |
1159 |
- dev-libs/libaio:0= |
1160 |
- sys-process/procps:0= |
1161 |
- ) |
1162 |
- server? ( |
1163 |
- >=app-arch/lz4-0_p131:= |
1164 |
- cjk? ( app-text/mecab:= ) |
1165 |
- experimental? ( |
1166 |
- dev-libs/libevent:= |
1167 |
- dev-libs/protobuf:= |
1168 |
- net-libs/libtirpc:= |
1169 |
- ) |
1170 |
- numa? ( sys-process/numactl ) |
1171 |
- ) |
1172 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
1173 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
1174 |
- client-libs? ( |
1175 |
- >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] |
1176 |
- ) |
1177 |
- !client-libs? ( |
1178 |
- >=dev-libs/openssl-1.0.0:0= |
1179 |
- ) |
1180 |
-" |
1181 |
-DEPEND="${COMMON_DEPEND} |
1182 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
1183 |
- dev-libs/protobuf |
1184 |
- virtual/yacc |
1185 |
- server? ( |
1186 |
- dev-libs/libevent |
1187 |
- experimental? ( net-libs/rpcsvc-proto ) |
1188 |
- ) |
1189 |
- static? ( sys-libs/ncurses[static-libs] ) |
1190 |
- test? ( |
1191 |
- acct-group/mysql acct-user/mysql |
1192 |
- dev-perl/JSON |
1193 |
- ) |
1194 |
-" |
1195 |
-RDEPEND="${COMMON_DEPEND} |
1196 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
1197 |
- !dev-db/mysql:0 |
1198 |
- !dev-db/mysql:8.0 |
1199 |
- client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= ) |
1200 |
- selinux? ( sec-policy/selinux-mysql ) |
1201 |
- server? ( |
1202 |
- !prefix? ( |
1203 |
- acct-group/mysql acct-user/mysql |
1204 |
- dev-db/mysql-init-scripts |
1205 |
- ) |
1206 |
- ) |
1207 |
-" |
1208 |
-# For other stuff to bring us in |
1209 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
1210 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
1211 |
- |
1212 |
-mysql_init_vars() { |
1213 |
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
1214 |
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
1215 |
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
1216 |
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
1217 |
- |
1218 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
1219 |
- MY_DATADIR="" |
1220 |
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
1221 |
- MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
1222 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
1223 |
- | tail -n1` |
1224 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
1225 |
- MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
1226 |
- | sed -e 's/.*=\s*//' \ |
1227 |
- | tail -n1` |
1228 |
- fi |
1229 |
- fi |
1230 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
1231 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
1232 |
- einfo "Using default MY_DATADIR" |
1233 |
- fi |
1234 |
- elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
1235 |
- |
1236 |
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
1237 |
- if [[ -e "${MY_DATADIR}" ]] ; then |
1238 |
- # If you get this and you're wondering about it, see bug #207636 |
1239 |
- elog "MySQL datadir found in ${MY_DATADIR}" |
1240 |
- elog "A new one will not be created." |
1241 |
- PREVIOUS_DATADIR="yes" |
1242 |
- else |
1243 |
- PREVIOUS_DATADIR="no" |
1244 |
- fi |
1245 |
- export PREVIOUS_DATADIR |
1246 |
- fi |
1247 |
- else |
1248 |
- if [[ ${EBUILD_PHASE} == "config" ]] ; then |
1249 |
- local new_MY_DATADIR |
1250 |
- new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
1251 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
1252 |
- | tail -n1` |
1253 |
- |
1254 |
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then |
1255 |
- ewarn "MySQL MY_DATADIR has changed" |
1256 |
- ewarn "from ${MY_DATADIR}" |
1257 |
- ewarn "to ${new_MY_DATADIR}" |
1258 |
- MY_DATADIR="${new_MY_DATADIR}" |
1259 |
- fi |
1260 |
- fi |
1261 |
- fi |
1262 |
- |
1263 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
1264 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
1265 |
- export MY_DATADIR |
1266 |
-} |
1267 |
- |
1268 |
-pkg_pretend() { |
1269 |
- if use numa ; then |
1270 |
- local CONFIG_CHECK="~NUMA" |
1271 |
- |
1272 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
1273 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
1274 |
- |
1275 |
- check_extra_config |
1276 |
- fi |
1277 |
-} |
1278 |
- |
1279 |
-pkg_setup() { |
1280 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
1281 |
- local GCC_MAJOR_SET=$(gcc-major-version) |
1282 |
- local GCC_MINOR_SET=$(gcc-minor-version) |
1283 |
- # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on |
1284 |
- # non x86{,_64} arches |
1285 |
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
1286 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
1287 |
- eerror "${PN} needs to be built with gcc-4.7 or later." |
1288 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
1289 |
- die |
1290 |
- fi |
1291 |
- fi |
1292 |
- |
1293 |
- if has test ${FEATURES} && \ |
1294 |
- use server && ! has userpriv ${FEATURES} ; then |
1295 |
- eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
1296 |
- fi |
1297 |
-} |
1298 |
- |
1299 |
-pkg_preinst() { |
1300 |
- # Here we need to see if the implementation switched client libraries |
1301 |
- # We check if this is a new instance of the package and a client library already exists |
1302 |
- local SHOW_ABI_MESSAGE libpath |
1303 |
- if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
1304 |
- libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
1305 |
- elog "Due to ABI changes when switching between different client libraries," |
1306 |
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
1307 |
- elog "Please run: revdep-rebuild --library ${libpath}" |
1308 |
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
1309 |
- fi |
1310 |
-} |
1311 |
- |
1312 |
-pkg_postinst() { |
1313 |
- # Make sure the vars are correctly initialized |
1314 |
- mysql_init_vars |
1315 |
- |
1316 |
- # Create log directory securely if it does not exist |
1317 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
1318 |
- |
1319 |
- if use server ; then |
1320 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
1321 |
- einfo |
1322 |
- elog "You might want to run:" |
1323 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
1324 |
- elog "if this is a new install." |
1325 |
- elog |
1326 |
- elog "If you are switching server implentations, you should run the" |
1327 |
- elog "mysql_upgrade tool." |
1328 |
- einfo |
1329 |
- else |
1330 |
- einfo |
1331 |
- elog "If you are upgrading major versions, you should run the" |
1332 |
- elog "mysql_upgrade tool." |
1333 |
- einfo |
1334 |
- fi |
1335 |
- fi |
1336 |
- |
1337 |
- # Note about configuration change |
1338 |
- einfo |
1339 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
1340 |
- elog "to several files in /etc/mysql/mysql.d." |
1341 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
1342 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
1343 |
- elog "You may have as many files as needed and they are read alphabetically." |
1344 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
1345 |
- einfo |
1346 |
-} |
1347 |
- |
1348 |
-src_unpack() { |
1349 |
- unpack ${A} |
1350 |
- # Grab the patches |
1351 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
1352 |
- |
1353 |
- mv -f "${WORKDIR}/${P}" "${S}" || die |
1354 |
-} |
1355 |
- |
1356 |
-src_prepare() { |
1357 |
- cmake-utils_src_prepare |
1358 |
- |
1359 |
- if use jemalloc ; then |
1360 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
1361 |
- fi |
1362 |
- |
1363 |
- if use tcmalloc ; then |
1364 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
1365 |
- fi |
1366 |
- |
1367 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
1368 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
1369 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
1370 |
- fi |
1371 |
- |
1372 |
- # Remove bundled libs so we cannot accidentally use them |
1373 |
- # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394 |
1374 |
- rm -rv \ |
1375 |
- "${S}"/extra/protobuf \ |
1376 |
- "${S}"/extra/libevent \ |
1377 |
- "${S}"/zlib \ |
1378 |
- || die |
1379 |
- |
1380 |
- # Don't clash with dev-db/mysql-connector-c |
1381 |
- rm \ |
1382 |
- man/my_print_defaults.1 \ |
1383 |
- man/perror.1 \ |
1384 |
- man/zlib_decompress.1 \ |
1385 |
- || die |
1386 |
- |
1387 |
- sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
1388 |
-} |
1389 |
- |
1390 |
-src_configure() { |
1391 |
- # Bug #114895, bug #110149 |
1392 |
- filter-flags "-O" "-O[01]" |
1393 |
- |
1394 |
- append-cxxflags -felide-constructors |
1395 |
- |
1396 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
1397 |
- append-flags -fno-strict-aliasing |
1398 |
- |
1399 |
- if use client-libs ; then |
1400 |
- multilib-minimal_src_configure |
1401 |
- else |
1402 |
- multilib_src_configure |
1403 |
- fi |
1404 |
-} |
1405 |
- |
1406 |
-multilib_src_configure() { |
1407 |
- debug-print-function ${FUNCNAME} "$@" |
1408 |
- |
1409 |
- if ! multilib_is_native_abi && ! use client-libs ; then |
1410 |
- return |
1411 |
- fi |
1412 |
- |
1413 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
1414 |
- |
1415 |
- # debug hack wrt #497532 |
1416 |
- mycmakeargs=( |
1417 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
1418 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
1419 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
1420 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
1421 |
- -DINSTALL_BINDIR=bin |
1422 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
1423 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
1424 |
- -DINSTALL_INCLUDEDIR=include/mysql |
1425 |
- -DINSTALL_INFODIR=share/info |
1426 |
- -DINSTALL_LIBDIR=$(get_libdir) |
1427 |
- -DINSTALL_MANDIR=share/man |
1428 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
1429 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
1430 |
- -DINSTALL_SCRIPTDIR=share/mysql/scripts |
1431 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
1432 |
- -DINSTALL_SBINDIR=sbin |
1433 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
1434 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
1435 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
1436 |
- ### TODO: make this system but issues with UTF-8 prevent it |
1437 |
- -DWITH_EDITLINE=bundled |
1438 |
- -DWITH_ZLIB=system |
1439 |
- -DWITH_SSL=system |
1440 |
- -DWITH_LIBWRAP=0 |
1441 |
- -DENABLED_LOCAL_INFILE=1 |
1442 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
1443 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
1444 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
1445 |
- # The build forces this to be defined when cross-compiling. We pass it |
1446 |
- # all the time for simplicity and to make sure it is actually correct. |
1447 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
1448 |
- -DWITH_CURL=system |
1449 |
- -DWITH_BOOST="${S}/boost" |
1450 |
- ) |
1451 |
- if use test ; then |
1452 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
1453 |
- else |
1454 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
1455 |
- fi |
1456 |
- |
1457 |
- if ! use client-libs ; then |
1458 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
1459 |
- fi |
1460 |
- |
1461 |
- # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
1462 |
- # systemtap only works on native ABI, bug 530132 |
1463 |
- if multilib_is_native_abi ; then |
1464 |
- mycmakeargs+=( |
1465 |
- -DENABLE_DTRACE=$(usex systemtap) |
1466 |
- ) |
1467 |
- else |
1468 |
- mycmakeargs+=( |
1469 |
- -DWITHOUT_TOOLS=1 |
1470 |
- -DWITH_READLINE=1 |
1471 |
- -DENABLE_DTRACE=0 |
1472 |
- ) |
1473 |
- fi |
1474 |
- |
1475 |
- if multilib_is_native_abi && use server ; then |
1476 |
- mycmakeargs+=( |
1477 |
- -DWITH_LIBEVENT=system |
1478 |
- -DWITH_LZ4=system |
1479 |
- -DWITH_PROTOBUF=system |
1480 |
- -DWITH_MECAB=$(usex cjk system OFF) |
1481 |
- -DWITH_NUMA=$(usex numa ON OFF) |
1482 |
- -DWITH_RAPID=$(usex experimental ON OFF) |
1483 |
- ) |
1484 |
- |
1485 |
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then |
1486 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
1487 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
1488 |
- ewarn "You MUST file bugs without these variables set." |
1489 |
- |
1490 |
- mycmakeargs+=( |
1491 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
1492 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
1493 |
- ) |
1494 |
- elif ! use latin1 ; then |
1495 |
- mycmakeargs+=( |
1496 |
- -DDEFAULT_CHARSET=utf8 |
1497 |
- -DDEFAULT_COLLATION=utf8_general_ci |
1498 |
- ) |
1499 |
- else |
1500 |
- mycmakeargs+=( |
1501 |
- -DDEFAULT_CHARSET=latin1 |
1502 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
1503 |
- ) |
1504 |
- fi |
1505 |
- |
1506 |
- mycmakeargs+=( |
1507 |
- -DEXTRA_CHARSETS=all |
1508 |
- -DDISABLE_SHARED=$(usex static YES NO) |
1509 |
- -DWITH_DEBUG=$(usex debug) |
1510 |
- -DWITH_EMBEDDED_SERVER=OFF |
1511 |
- ) |
1512 |
- |
1513 |
- if use profiling ; then |
1514 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
1515 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
1516 |
- # "main.mysqld--help-notwin" test to fail |
1517 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
1518 |
- fi |
1519 |
- |
1520 |
- if use static ; then |
1521 |
- mycmakeargs+=( -DWITH_PIC=1 ) |
1522 |
- fi |
1523 |
- |
1524 |
- # Storage engines |
1525 |
- mycmakeargs+=( |
1526 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
1527 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
1528 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
1529 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
1530 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
1531 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
1532 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
1533 |
- -DWITH_INNODB_MEMCACHED=0 |
1534 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
1535 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
1536 |
- -DWITH_PARTITION_STORAGE_ENGINE=1 |
1537 |
- ) |
1538 |
- |
1539 |
- else |
1540 |
- mycmakeargs+=( |
1541 |
- -DWITHOUT_SERVER=1 |
1542 |
- -DWITH_EMBEDDED_SERVER=OFF |
1543 |
- -DEXTRA_CHARSETS=none |
1544 |
- ) |
1545 |
- fi |
1546 |
- |
1547 |
- cmake-utils_src_configure |
1548 |
-} |
1549 |
- |
1550 |
-src_compile() { |
1551 |
- if use client-libs ; then |
1552 |
- multilib-minimal_src_compile |
1553 |
- else |
1554 |
- multilib_src_compile |
1555 |
- fi |
1556 |
-} |
1557 |
- |
1558 |
-multilib_src_compile() { |
1559 |
- cmake-utils_src_compile |
1560 |
-} |
1561 |
- |
1562 |
-# Official test instructions: |
1563 |
-# ulimit -n 16500 && \ |
1564 |
-# USE='latin1 perl server' \ |
1565 |
-# FEATURES='test userpriv -usersandbox' \ |
1566 |
-# ebuild mysql-X.X.XX.ebuild \ |
1567 |
-# digest clean package |
1568 |
-src_test() { |
1569 |
- _disable_test() { |
1570 |
- local rawtestname reason |
1571 |
- rawtestname="${1}" ; shift |
1572 |
- reason="${@}" |
1573 |
- ewarn "test '${rawtestname}' disabled: '${reason}'" |
1574 |
- echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
1575 |
- } |
1576 |
- |
1577 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
1578 |
- local retstatus_unit |
1579 |
- local retstatus_tests |
1580 |
- |
1581 |
- if ! use server ; then |
1582 |
- einfo "Skipping server tests due to minimal build." |
1583 |
- return 0 |
1584 |
- fi |
1585 |
- |
1586 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1587 |
- # localhost. Also causes weird failures. |
1588 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1589 |
- |
1590 |
- if [[ $UID -eq 0 ]] ; then |
1591 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
1592 |
- fi |
1593 |
- has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
1594 |
- |
1595 |
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
1596 |
- |
1597 |
- # Run CTest (test-units) |
1598 |
- cmake-utils_src_test |
1599 |
- retstatus_unit=$? |
1600 |
- |
1601 |
- # Ensure that parallel runs don't die |
1602 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
1603 |
- # Enable parallel testing, auto will try to detect number of cores |
1604 |
- # You may set this by hand. |
1605 |
- # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
1606 |
- export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
1607 |
- |
1608 |
- # create directories because mysqladmin might run out of order |
1609 |
- mkdir -p "${T}"/var-tests{,/log} || die |
1610 |
- |
1611 |
- # Run mysql tests |
1612 |
- pushd "${TESTDIR}" &>/dev/null || die |
1613 |
- |
1614 |
- touch "${T}/disabled.def" |
1615 |
- # These are failing in MySQL 5.7 for now and are believed to be |
1616 |
- # false positives: |
1617 |
- # |
1618 |
- local t |
1619 |
- |
1620 |
- for t in auth_sec.keyring_udf ; do |
1621 |
- _disable_test "$t" "False positives in Gentoo" |
1622 |
- done |
1623 |
- |
1624 |
- # Unstable tests |
1625 |
- # - main.xa_prepared_binlog_off: https://bugs.mysql.com/bug.php?id=83340 |
1626 |
- # - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223 |
1627 |
- # - rpl.rpl_non_direct_stm_mixing_engines: MDEV-14489 |
1628 |
- for t in \ |
1629 |
- main.xa_prepared_binlog_off \ |
1630 |
- rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \ |
1631 |
- rpl.rpl_non_direct_stm_mixing_engines \ |
1632 |
- ; do |
1633 |
- _disable_test "$t" "Unstable test" |
1634 |
- done |
1635 |
- |
1636 |
- for t in \ |
1637 |
- gis.geometry_class_attri_prop \ |
1638 |
- gis.geometry_property_function_issimple \ |
1639 |
- gis.gis_bugs_crashes \ |
1640 |
- gis.spatial_op_testingfunc_mix \ |
1641 |
- gis.spatial_analysis_functions_buffer \ |
1642 |
- gis.spatial_analysis_functions_distance \ |
1643 |
- gis.spatial_utility_function_distance_sphere \ |
1644 |
- gis.spatial_utility_function_simplify \ |
1645 |
- gis.spatial_analysis_functions_centroid \ |
1646 |
- ; do |
1647 |
- _disable_test "$t" "Known rounding error with latest AMD processors" |
1648 |
- done |
1649 |
- |
1650 |
- if use numa && use kernel_linux ; then |
1651 |
- # bug 584880 |
1652 |
- if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then |
1653 |
- for t in sys_vars.innodb_numa_interleave_basic ; do |
1654 |
- _disable_test "$t" "Test $t requires system with NUMA support" |
1655 |
- done |
1656 |
- fi |
1657 |
- fi |
1658 |
- |
1659 |
- if ! use latin1 ; then |
1660 |
- # The following tests will fail if DEFAULT_CHARSET |
1661 |
- # isn't set to latin1: |
1662 |
- for t in \ |
1663 |
- binlog.binlog_mysqlbinlog_filter \ |
1664 |
- binlog.binlog_xa_prepared_disconnect \ |
1665 |
- funcs_1.is_columns_mysql \ |
1666 |
- funcs_1.is_tables_mysql \ |
1667 |
- funcs_1.is_triggers \ |
1668 |
- innodb.innodb_pagesize_max_recordsize \ |
1669 |
- innodb.innodb-system-table-view \ |
1670 |
- innodb.mysqldump_max_recordsize \ |
1671 |
- main.mysql_client_test \ |
1672 |
- main.mysqld--help-notwin \ |
1673 |
- main.type_string \ |
1674 |
- main.information_schema \ |
1675 |
- perfschema.binlog_edge_mix \ |
1676 |
- perfschema.binlog_edge_stmt \ |
1677 |
- rpl.rpl_xa_survive_disconnect \ |
1678 |
- rpl.rpl_xa_survive_disconnect_lsu_off \ |
1679 |
- rpl.rpl_xa_survive_disconnect_table \ |
1680 |
- ; do |
1681 |
- _disable_test "$t" "Requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set" |
1682 |
- done |
1683 |
- fi |
1684 |
- |
1685 |
- if has_version '>=dev-libs/openssl-1.1.1' ; then |
1686 |
- # Tests are expecting <openssl-1.1.1 default cipher |
1687 |
- for t in \ |
1688 |
- auth_sec.cert_verify \ |
1689 |
- auth_sec.mysql_ssl_connection \ |
1690 |
- auth_sec.openssl_cert_generation \ |
1691 |
- auth_sec.ssl_auto_detect \ |
1692 |
- auth_sec.ssl_mode \ |
1693 |
- auth_sec.tls \ |
1694 |
- binlog.binlog_grant_alter_user \ |
1695 |
- encryption.innodb_onlinealter_encryption \ |
1696 |
- main.grant_alter_user_qa \ |
1697 |
- main.grant_user_lock_qa \ |
1698 |
- main.mysql_ssl_default \ |
1699 |
- main.openssl_1 \ |
1700 |
- main.plugin_auth_sha256_tls \ |
1701 |
- main.ssl \ |
1702 |
- main.ssl_8k_key \ |
1703 |
- main.ssl_bug75311 \ |
1704 |
- main.ssl_ca \ |
1705 |
- main.ssl_cipher \ |
1706 |
- main.ssl_compress \ |
1707 |
- main.ssl_crl \ |
1708 |
- main.ssl_ecdh \ |
1709 |
- main.ssl_verify_identity \ |
1710 |
- x.connection_tls_version \ |
1711 |
- x.connection_openssl \ |
1712 |
- ; do |
1713 |
- _disable_test "$t" "Requires <dev-libs/openssl-1.1.1" |
1714 |
- done |
1715 |
- fi |
1716 |
- |
1717 |
- # Try to increase file limits to increase test coverage |
1718 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
1719 |
- # Upper limit comes from parts.partition_* tests |
1720 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
1721 |
- |
1722 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
1723 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
1724 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
1725 |
- |
1726 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
1727 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
1728 |
- else |
1729 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
1730 |
- fi |
1731 |
- else |
1732 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
1733 |
- fi |
1734 |
- else |
1735 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
1736 |
- fi |
1737 |
- |
1738 |
- # run mysql-test tests |
1739 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
1740 |
- retstatus_tests=$? |
1741 |
- |
1742 |
- popd &>/dev/null || die |
1743 |
- |
1744 |
- # Cleanup is important for these testcases. |
1745 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
1746 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
1747 |
- |
1748 |
- local failures="" |
1749 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
1750 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
1751 |
- |
1752 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
1753 |
- einfo "Tests successfully completed" |
1754 |
-} |
1755 |
- |
1756 |
-src_install() { |
1757 |
- local MULTILIB_WRAPPED_HEADERS |
1758 |
- local MULTILIB_CHOST_TOOLS |
1759 |
- if use client-libs ; then |
1760 |
- # headers with ABI specific data |
1761 |
- MULTILIB_WRAPPED_HEADERS=( |
1762 |
- /usr/include/mysql/server/my_config.h |
1763 |
- /usr/include/mysql/server/mysql_version.h ) |
1764 |
- |
1765 |
- # wrap the config scripts |
1766 |
- MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config ) |
1767 |
- multilib-minimal_src_install |
1768 |
- else |
1769 |
- multilib_src_install |
1770 |
- multilib_src_install_all |
1771 |
- fi |
1772 |
-} |
1773 |
- |
1774 |
-# Intentionally override eclass function |
1775 |
-multilib_src_install() { |
1776 |
- |
1777 |
- cmake-utils_src_install |
1778 |
- |
1779 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
1780 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
1781 |
-} |
1782 |
- |
1783 |
-multilib_src_install_all() { |
1784 |
- # Make sure the vars are correctly initialized |
1785 |
- mysql_init_vars |
1786 |
- |
1787 |
- # Convenience links |
1788 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
1789 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
1790 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
1791 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
1792 |
- |
1793 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
1794 |
- if [[ -d "${ED}/usr/data" ]] ; then |
1795 |
- rm -Rf "${ED}/usr/data" || die |
1796 |
- fi |
1797 |
- |
1798 |
- # Unless they explicitly specific USE=test, then do not install the |
1799 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
1800 |
- # validation of your database configuration after tuning it. |
1801 |
- if ! use test ; then |
1802 |
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
1803 |
- fi |
1804 |
- |
1805 |
- # Configuration stuff |
1806 |
- einfo "Building default configuration ..." |
1807 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
1808 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
1809 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
1810 |
- eprefixify "${TMPDIR}/my.cnf" |
1811 |
- doins "${TMPDIR}/my.cnf" |
1812 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
1813 |
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
1814 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
1815 |
- doins "${TMPDIR}/50-distro-client.cnf" |
1816 |
- |
1817 |
- if use server ; then |
1818 |
- mycnf_src="my.cnf.distro-server" |
1819 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
1820 |
- "${FILESDIR}/${mycnf_src}" \ |
1821 |
- > "${TMPDIR}/my.cnf.ok" || die |
1822 |
- |
1823 |
- if use prefix ; then |
1824 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
1825 |
- "${TMPDIR}/my.cnf.ok" || die |
1826 |
- fi |
1827 |
- |
1828 |
- if use latin1 ; then |
1829 |
- sed -i \ |
1830 |
- -e "/character-set/s|utf8|latin1|g" \ |
1831 |
- "${TMPDIR}/my.cnf.ok" || die |
1832 |
- fi |
1833 |
- |
1834 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
1835 |
- |
1836 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
1837 |
- fi |
1838 |
- |
1839 |
- #Remove mytop if perl is not selected |
1840 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
1841 |
-} |
1842 |
- |
1843 |
-pkg_config() { |
1844 |
- _getoptval() { |
1845 |
- local mypd="${EROOT%/}"/usr/bin/my_print_defaults |
1846 |
- local section="$1" |
1847 |
- local flag="--${2}=" |
1848 |
- local extra_options="${3}" |
1849 |
- "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
1850 |
- } |
1851 |
- local old_MY_DATADIR="${MY_DATADIR}" |
1852 |
- local old_HOME="${HOME}" |
1853 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
1854 |
- export HOME=${EPREFIX}/root |
1855 |
- |
1856 |
- # Make sure the vars are correctly initialized |
1857 |
- mysql_init_vars |
1858 |
- |
1859 |
- [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
1860 |
- if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then |
1861 |
- die "Minimal builds do NOT include the MySQL server" |
1862 |
- fi |
1863 |
- |
1864 |
- if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then |
1865 |
- local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}" |
1866 |
- MY_DATADIR_s="${MY_DATADIR_s%%/}" |
1867 |
- local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}" |
1868 |
- old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
1869 |
- |
1870 |
- if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then |
1871 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
1872 |
- ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
1873 |
- ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
1874 |
- else |
1875 |
- elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
1876 |
- mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
1877 |
- || die "Moving MY_DATADIR failed" |
1878 |
- fi |
1879 |
- else |
1880 |
- ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
1881 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
1882 |
- ewarn "Attempting to use ${MY_DATADIR_s}" |
1883 |
- else |
1884 |
- eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
1885 |
- die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
1886 |
- fi |
1887 |
- fi |
1888 |
- fi |
1889 |
- |
1890 |
- local pwd1="a" |
1891 |
- local pwd2="b" |
1892 |
- local maxtry=15 |
1893 |
- |
1894 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1895 |
- local tmp_mysqld_password_source= |
1896 |
- |
1897 |
- for tmp_mysqld_password_source in mysql client ; do |
1898 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
1899 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
1900 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1901 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
1902 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
1903 |
- MYSQL_ROOT_PASSWORD= |
1904 |
- continue |
1905 |
- fi |
1906 |
- |
1907 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
1908 |
- break |
1909 |
- fi |
1910 |
- done |
1911 |
- |
1912 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
1913 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
1914 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
1915 |
- fi |
1916 |
- |
1917 |
- unset tmp_mysqld_password_source |
1918 |
- fi |
1919 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
1920 |
- # These are dir+prefix |
1921 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
1922 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
1923 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
1924 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
1925 |
- |
1926 |
- if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then |
1927 |
- einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
1928 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR" |
1929 |
- fi |
1930 |
- |
1931 |
- if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then |
1932 |
- einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
1933 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN" |
1934 |
- fi |
1935 |
- |
1936 |
- if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then |
1937 |
- einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
1938 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG" |
1939 |
- fi |
1940 |
- |
1941 |
- if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then |
1942 |
- ewarn "You have already a MySQL database in place." |
1943 |
- ewarn "(${ROOT%/}/${MY_DATADIR}/*)" |
1944 |
- ewarn "Please rename or delete it if you wish to replace it." |
1945 |
- die "MySQL database already exists!" |
1946 |
- fi |
1947 |
- |
1948 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1949 |
- # localhost. Also causes weird failures. |
1950 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1951 |
- |
1952 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1953 |
- |
1954 |
- einfo "Please provide a password for the mysql 'root' user now" |
1955 |
- einfo "or through the ${HOME}/.my.cnf file." |
1956 |
- ewarn "Avoid [\"'\\_%] characters in the password" |
1957 |
- read -rsp " >" pwd1 ; echo |
1958 |
- |
1959 |
- einfo "Retype the password" |
1960 |
- read -rsp " >" pwd2 ; echo |
1961 |
- |
1962 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
1963 |
- die "Passwords are not the same" |
1964 |
- fi |
1965 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
1966 |
- unset pwd1 pwd2 |
1967 |
- fi |
1968 |
- |
1969 |
- local options |
1970 |
- local sqltmp="$(emktemp)" |
1971 |
- |
1972 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
1973 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
1974 |
- use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
1975 |
- |
1976 |
- # Figure out which options we need to disable to do the setup |
1977 |
- local helpfile="${TMPDIR%/}/mysqld-help" |
1978 |
- "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
1979 |
- for opt in host-cache name-resolve networking slave-start \ |
1980 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
1981 |
- log-slave-updates \ |
1982 |
- ; do |
1983 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
1984 |
- egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
1985 |
- done |
1986 |
- |
1987 |
- einfo "Creating the mysql database and setting proper permissions on it ..." |
1988 |
- |
1989 |
- # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
1990 |
- PID_DIR="${EROOT%/}/var/run/mysqld" |
1991 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
1992 |
- install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
1993 |
- fi |
1994 |
- |
1995 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
1996 |
- install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
1997 |
- fi |
1998 |
- |
1999 |
- pushd "${TMPDIR}" &>/dev/null || die |
2000 |
- |
2001 |
- # Filling timezones, see |
2002 |
- # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
2003 |
- echo "USE mysql;" >"${sqltmp}" |
2004 |
- "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null |
2005 |
- chown mysql "${sqltmp}" || die |
2006 |
- |
2007 |
- # --initialize-insecure will not set root password |
2008 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
2009 |
- local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" ) |
2010 |
- cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" ) |
2011 |
- einfo "Command: ${cmd[*]}" |
2012 |
- su -s /bin/sh -c "${cmd[*]}" mysql \ |
2013 |
- >"${TMPDIR%/}"/mysql_install_db.log 2>&1 |
2014 |
- if [[ $? -ne 0 ]] ; then |
2015 |
- grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2 |
2016 |
- die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log" |
2017 |
- fi |
2018 |
- popd &>/dev/null || die |
2019 |
- [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \ |
2020 |
- || die "MySQL databases not installed" |
2021 |
- |
2022 |
- use prefix || options="${options} --user=mysql" |
2023 |
- |
2024 |
- local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock" |
2025 |
- local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid" |
2026 |
- local mysqld="${EROOT%/}/usr/sbin/mysqld \ |
2027 |
- ${options} \ |
2028 |
- $(use prefix || echo --user=mysql) \ |
2029 |
- --log-warnings=0 \ |
2030 |
- --basedir=${EROOT%/}/usr \ |
2031 |
- --datadir=${ROOT%/}/${MY_DATADIR} \ |
2032 |
- --max_allowed_packet=8M \ |
2033 |
- --net_buffer_length=16K \ |
2034 |
- --socket=${socket} \ |
2035 |
- --pid-file=${pidfile} \ |
2036 |
- --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
2037 |
- #einfo "About to start mysqld: ${mysqld}" |
2038 |
- ebegin "Starting mysqld" |
2039 |
- einfo "Command ${mysqld}" |
2040 |
- ${mysqld} & |
2041 |
- rc=$? |
2042 |
- while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
2043 |
- maxtry=$((${maxtry}-1)) |
2044 |
- echo -n "." |
2045 |
- sleep 1 |
2046 |
- done |
2047 |
- eend $rc |
2048 |
- |
2049 |
- if ! [[ -S "${socket}" ]] ; then |
2050 |
- die "Completely failed to start up mysqld with: ${mysqld}" |
2051 |
- fi |
2052 |
- |
2053 |
- ebegin "Setting root password" |
2054 |
- # Do this from memory, as we don't want clear text passwords in temp files |
2055 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'" |
2056 |
- "${EROOT%/}/usr/bin/mysql" \ |
2057 |
- --no-defaults \ |
2058 |
- "--socket=${socket}" \ |
2059 |
- -hlocalhost \ |
2060 |
- -e "${sql}" |
2061 |
- eend $? |
2062 |
- |
2063 |
- # Stop the server and cleanup |
2064 |
- einfo "Stopping the server ..." |
2065 |
- kill $(< "${pidfile}" ) |
2066 |
- rm -f "${sqltmp}" |
2067 |
- wait %1 |
2068 |
- einfo "Done" |
2069 |
-} |
2070 |
|
2071 |
diff --git a/dev-db/mysql/mysql-5.7.30-r1.ebuild b/dev-db/mysql/mysql-5.7.30-r1.ebuild |
2072 |
deleted file mode 100644 |
2073 |
index 8df5b377bb6..00000000000 |
2074 |
--- a/dev-db/mysql/mysql-5.7.30-r1.ebuild |
2075 |
+++ /dev/null |
2076 |
@@ -1,977 +0,0 @@ |
2077 |
-# Copyright 1999-2021 Gentoo Authors |
2078 |
-# Distributed under the terms of the GNU General Public License v2 |
2079 |
- |
2080 |
-EAPI="6" |
2081 |
- |
2082 |
-CMAKE_MAKEFILE_GENERATOR=emake |
2083 |
- |
2084 |
-# Keeping eutils in EAPI=6 for emktemp in pkg_config |
2085 |
- |
2086 |
-inherit cmake-utils eutils flag-o-matic linux-info \ |
2087 |
- prefix toolchain-funcs multilib-minimal |
2088 |
- |
2089 |
-# Patch version |
2090 |
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/mysql/${PN}-5.7.30-patches-01.tar.xz" |
2091 |
- |
2092 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz |
2093 |
- https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz |
2094 |
- http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz |
2095 |
- ${PATCH_SET}" |
2096 |
- |
2097 |
-HOMEPAGE="https://www.mysql.com/" |
2098 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
2099 |
-LICENSE="GPL-2" |
2100 |
-SLOT="5.7/18" |
2101 |
-IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 numa +perl profiling |
2102 |
- selinux +server static static-libs systemtap tcmalloc test" |
2103 |
- |
2104 |
-RESTRICT="!test? ( test )" |
2105 |
- |
2106 |
-REQUIRED_USE="?? ( tcmalloc jemalloc )" |
2107 |
- |
2108 |
-KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris" |
2109 |
- |
2110 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
2111 |
-# and we will run a mysql server during test phase |
2112 |
-S="${WORKDIR}/mysql" |
2113 |
- |
2114 |
-# Be warned, *DEPEND are version-dependant |
2115 |
-# These are used for both runtime and compiletime |
2116 |
-# MULTILIB_USEDEP only set for libraries used by the client library |
2117 |
-COMMON_DEPEND="net-misc/curl:= |
2118 |
- >=sys-apps/sed-4 |
2119 |
- >=sys-apps/texinfo-4.7-r1 |
2120 |
- sys-libs/ncurses:0= |
2121 |
- client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] ) |
2122 |
- !client-libs? ( |
2123 |
- dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] |
2124 |
- >=sys-libs/zlib-1.2.3:0= |
2125 |
- ) |
2126 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
2127 |
- kernel_linux? ( |
2128 |
- dev-libs/libaio:0= |
2129 |
- sys-process/procps:0= |
2130 |
- ) |
2131 |
- server? ( |
2132 |
- >=app-arch/lz4-0_p131:= |
2133 |
- cjk? ( app-text/mecab:= ) |
2134 |
- experimental? ( |
2135 |
- dev-libs/libevent:= |
2136 |
- dev-libs/protobuf:= |
2137 |
- net-libs/libtirpc:= |
2138 |
- ) |
2139 |
- numa? ( sys-process/numactl ) |
2140 |
- ) |
2141 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
2142 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
2143 |
- client-libs? ( |
2144 |
- >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] |
2145 |
- ) |
2146 |
- !client-libs? ( |
2147 |
- >=dev-libs/openssl-1.0.0:0= |
2148 |
- ) |
2149 |
-" |
2150 |
-DEPEND="${COMMON_DEPEND} |
2151 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
2152 |
- dev-libs/protobuf |
2153 |
- virtual/yacc |
2154 |
- server? ( |
2155 |
- dev-libs/libevent |
2156 |
- experimental? ( net-libs/rpcsvc-proto ) |
2157 |
- ) |
2158 |
- static? ( sys-libs/ncurses[static-libs] ) |
2159 |
- test? ( |
2160 |
- acct-group/mysql acct-user/mysql |
2161 |
- dev-perl/JSON |
2162 |
- ) |
2163 |
-" |
2164 |
-RDEPEND="${COMMON_DEPEND} |
2165 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
2166 |
- !dev-db/mysql:0 |
2167 |
- !dev-db/mysql:8.0 |
2168 |
- client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= ) |
2169 |
- selinux? ( sec-policy/selinux-mysql ) |
2170 |
- server? ( |
2171 |
- !prefix? ( |
2172 |
- acct-group/mysql acct-user/mysql |
2173 |
- dev-db/mysql-init-scripts |
2174 |
- ) |
2175 |
- ) |
2176 |
-" |
2177 |
-# For other stuff to bring us in |
2178 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
2179 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
2180 |
- |
2181 |
-mysql_init_vars() { |
2182 |
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
2183 |
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
2184 |
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
2185 |
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
2186 |
- |
2187 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
2188 |
- MY_DATADIR="" |
2189 |
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
2190 |
- MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
2191 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
2192 |
- | tail -n1` |
2193 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
2194 |
- MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
2195 |
- | sed -e 's/.*=\s*//' \ |
2196 |
- | tail -n1` |
2197 |
- fi |
2198 |
- fi |
2199 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
2200 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
2201 |
- einfo "Using default MY_DATADIR" |
2202 |
- fi |
2203 |
- elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
2204 |
- |
2205 |
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
2206 |
- if [[ -e "${MY_DATADIR}" ]] ; then |
2207 |
- # If you get this and you're wondering about it, see bug #207636 |
2208 |
- elog "MySQL datadir found in ${MY_DATADIR}" |
2209 |
- elog "A new one will not be created." |
2210 |
- PREVIOUS_DATADIR="yes" |
2211 |
- else |
2212 |
- PREVIOUS_DATADIR="no" |
2213 |
- fi |
2214 |
- export PREVIOUS_DATADIR |
2215 |
- fi |
2216 |
- else |
2217 |
- if [[ ${EBUILD_PHASE} == "config" ]] ; then |
2218 |
- local new_MY_DATADIR |
2219 |
- new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
2220 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
2221 |
- | tail -n1` |
2222 |
- |
2223 |
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]] ; then |
2224 |
- ewarn "MySQL MY_DATADIR has changed" |
2225 |
- ewarn "from ${MY_DATADIR}" |
2226 |
- ewarn "to ${new_MY_DATADIR}" |
2227 |
- MY_DATADIR="${new_MY_DATADIR}" |
2228 |
- fi |
2229 |
- fi |
2230 |
- fi |
2231 |
- |
2232 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
2233 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
2234 |
- export MY_DATADIR |
2235 |
-} |
2236 |
- |
2237 |
-pkg_pretend() { |
2238 |
- if use numa ; then |
2239 |
- local CONFIG_CHECK="~NUMA" |
2240 |
- |
2241 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
2242 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
2243 |
- |
2244 |
- check_extra_config |
2245 |
- fi |
2246 |
-} |
2247 |
- |
2248 |
-pkg_setup() { |
2249 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
2250 |
- local GCC_MAJOR_SET=$(gcc-major-version) |
2251 |
- local GCC_MINOR_SET=$(gcc-minor-version) |
2252 |
- # Bug 565584: InnoDB now requires atomic functions introduced with gcc-4.7 on |
2253 |
- # non x86{,_64} arches |
2254 |
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
2255 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
2256 |
- eerror "${PN} needs to be built with gcc-4.7 or later." |
2257 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
2258 |
- die |
2259 |
- fi |
2260 |
- fi |
2261 |
- |
2262 |
- if has test ${FEATURES} && \ |
2263 |
- use server && ! has userpriv ${FEATURES} ; then |
2264 |
- eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
2265 |
- fi |
2266 |
-} |
2267 |
- |
2268 |
-pkg_preinst() { |
2269 |
- # Here we need to see if the implementation switched client libraries |
2270 |
- # We check if this is a new instance of the package and a client library already exists |
2271 |
- local SHOW_ABI_MESSAGE libpath |
2272 |
- if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
2273 |
- libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
2274 |
- elog "Due to ABI changes when switching between different client libraries," |
2275 |
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
2276 |
- elog "Please run: revdep-rebuild --library ${libpath}" |
2277 |
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
2278 |
- fi |
2279 |
-} |
2280 |
- |
2281 |
-pkg_postinst() { |
2282 |
- # Make sure the vars are correctly initialized |
2283 |
- mysql_init_vars |
2284 |
- |
2285 |
- # Create log directory securely if it does not exist |
2286 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
2287 |
- |
2288 |
- if use server ; then |
2289 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
2290 |
- einfo |
2291 |
- elog "You might want to run:" |
2292 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
2293 |
- elog "if this is a new install." |
2294 |
- elog |
2295 |
- elog "If you are switching server implentations, you should run the" |
2296 |
- elog "mysql_upgrade tool." |
2297 |
- einfo |
2298 |
- else |
2299 |
- einfo |
2300 |
- elog "If you are upgrading major versions, you should run the" |
2301 |
- elog "mysql_upgrade tool." |
2302 |
- einfo |
2303 |
- fi |
2304 |
- fi |
2305 |
- |
2306 |
- # Note about configuration change |
2307 |
- einfo |
2308 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
2309 |
- elog "to several files in /etc/mysql/mysql.d." |
2310 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
2311 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
2312 |
- elog "You may have as many files as needed and they are read alphabetically." |
2313 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
2314 |
- einfo |
2315 |
-} |
2316 |
- |
2317 |
-src_unpack() { |
2318 |
- unpack ${A} |
2319 |
- |
2320 |
- mv -f "${WORKDIR}/${P}" "${S}" || die |
2321 |
-} |
2322 |
- |
2323 |
-src_prepare() { |
2324 |
- eapply "${WORKDIR}"/mysql-patches |
2325 |
- |
2326 |
- cmake-utils_src_prepare |
2327 |
- |
2328 |
- if use jemalloc ; then |
2329 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
2330 |
- fi |
2331 |
- |
2332 |
- if use tcmalloc ; then |
2333 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
2334 |
- fi |
2335 |
- |
2336 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
2337 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
2338 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
2339 |
- fi |
2340 |
- |
2341 |
- # Remove bundled libs so we cannot accidentally use them |
2342 |
- # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394 |
2343 |
- rm -rv \ |
2344 |
- "${S}"/extra/protobuf \ |
2345 |
- "${S}"/extra/libevent \ |
2346 |
- "${S}"/zlib \ |
2347 |
- || die |
2348 |
- |
2349 |
- # Don't clash with dev-db/mysql-connector-c |
2350 |
- rm \ |
2351 |
- man/my_print_defaults.1 \ |
2352 |
- man/perror.1 \ |
2353 |
- man/zlib_decompress.1 \ |
2354 |
- || die |
2355 |
- |
2356 |
- sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
2357 |
-} |
2358 |
- |
2359 |
-src_configure() { |
2360 |
- # Bug #114895, bug #110149 |
2361 |
- filter-flags "-O" "-O[01]" |
2362 |
- |
2363 |
- append-cxxflags -felide-constructors |
2364 |
- |
2365 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
2366 |
- append-flags -fno-strict-aliasing |
2367 |
- |
2368 |
- if use client-libs ; then |
2369 |
- multilib-minimal_src_configure |
2370 |
- else |
2371 |
- multilib_src_configure |
2372 |
- fi |
2373 |
-} |
2374 |
- |
2375 |
-multilib_src_configure() { |
2376 |
- debug-print-function ${FUNCNAME} "$@" |
2377 |
- |
2378 |
- if ! multilib_is_native_abi && ! use client-libs ; then |
2379 |
- return |
2380 |
- fi |
2381 |
- |
2382 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
2383 |
- |
2384 |
- # debug hack wrt #497532 |
2385 |
- mycmakeargs=( |
2386 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
2387 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
2388 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
2389 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
2390 |
- -DINSTALL_BINDIR=bin |
2391 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
2392 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
2393 |
- -DINSTALL_INCLUDEDIR=include/mysql |
2394 |
- -DINSTALL_INFODIR=share/info |
2395 |
- -DINSTALL_LIBDIR=$(get_libdir) |
2396 |
- -DINSTALL_MANDIR=share/man |
2397 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
2398 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
2399 |
- -DINSTALL_SCRIPTDIR=share/mysql/scripts |
2400 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
2401 |
- -DINSTALL_SBINDIR=sbin |
2402 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
2403 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
2404 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
2405 |
- ### TODO: make this system but issues with UTF-8 prevent it |
2406 |
- -DWITH_EDITLINE=bundled |
2407 |
- -DWITH_ZLIB=system |
2408 |
- -DWITH_SSL=system |
2409 |
- -DWITH_LIBWRAP=0 |
2410 |
- -DENABLED_LOCAL_INFILE=1 |
2411 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
2412 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
2413 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
2414 |
- # The build forces this to be defined when cross-compiling. We pass it |
2415 |
- # all the time for simplicity and to make sure it is actually correct. |
2416 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
2417 |
- -DWITH_CURL=system |
2418 |
- -DWITH_BOOST="${S}/boost" |
2419 |
- ) |
2420 |
- if use test ; then |
2421 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
2422 |
- else |
2423 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
2424 |
- fi |
2425 |
- |
2426 |
- if ! use client-libs ; then |
2427 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
2428 |
- fi |
2429 |
- |
2430 |
- # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
2431 |
- # systemtap only works on native ABI, bug 530132 |
2432 |
- if multilib_is_native_abi ; then |
2433 |
- mycmakeargs+=( |
2434 |
- -DENABLE_DTRACE=$(usex systemtap) |
2435 |
- ) |
2436 |
- else |
2437 |
- mycmakeargs+=( |
2438 |
- -DWITHOUT_TOOLS=1 |
2439 |
- -DWITH_READLINE=1 |
2440 |
- -DENABLE_DTRACE=0 |
2441 |
- ) |
2442 |
- fi |
2443 |
- |
2444 |
- if multilib_is_native_abi && use server ; then |
2445 |
- mycmakeargs+=( |
2446 |
- -DWITH_LIBEVENT=system |
2447 |
- -DWITH_LZ4=system |
2448 |
- -DWITH_PROTOBUF=system |
2449 |
- -DWITH_MECAB=$(usex cjk system OFF) |
2450 |
- -DWITH_NUMA=$(usex numa ON OFF) |
2451 |
- -DWITH_RAPID=$(usex experimental ON OFF) |
2452 |
- ) |
2453 |
- |
2454 |
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then |
2455 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
2456 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
2457 |
- ewarn "You MUST file bugs without these variables set." |
2458 |
- |
2459 |
- mycmakeargs+=( |
2460 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
2461 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
2462 |
- ) |
2463 |
- elif ! use latin1 ; then |
2464 |
- mycmakeargs+=( |
2465 |
- -DDEFAULT_CHARSET=utf8 |
2466 |
- -DDEFAULT_COLLATION=utf8_general_ci |
2467 |
- ) |
2468 |
- else |
2469 |
- mycmakeargs+=( |
2470 |
- -DDEFAULT_CHARSET=latin1 |
2471 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
2472 |
- ) |
2473 |
- fi |
2474 |
- |
2475 |
- mycmakeargs+=( |
2476 |
- -DEXTRA_CHARSETS=all |
2477 |
- -DDISABLE_SHARED=$(usex static YES NO) |
2478 |
- -DWITH_DEBUG=$(usex debug) |
2479 |
- -DWITH_EMBEDDED_SERVER=OFF |
2480 |
- ) |
2481 |
- |
2482 |
- if use profiling ; then |
2483 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
2484 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
2485 |
- # "main.mysqld--help-notwin" test to fail |
2486 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
2487 |
- fi |
2488 |
- |
2489 |
- if use static ; then |
2490 |
- mycmakeargs+=( -DWITH_PIC=1 ) |
2491 |
- fi |
2492 |
- |
2493 |
- # Storage engines |
2494 |
- mycmakeargs+=( |
2495 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
2496 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
2497 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
2498 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
2499 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
2500 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
2501 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
2502 |
- -DWITH_INNODB_MEMCACHED=0 |
2503 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
2504 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
2505 |
- -DWITH_PARTITION_STORAGE_ENGINE=1 |
2506 |
- ) |
2507 |
- |
2508 |
- else |
2509 |
- mycmakeargs+=( |
2510 |
- -DWITHOUT_SERVER=1 |
2511 |
- -DWITH_EMBEDDED_SERVER=OFF |
2512 |
- -DEXTRA_CHARSETS=none |
2513 |
- ) |
2514 |
- fi |
2515 |
- |
2516 |
- cmake-utils_src_configure |
2517 |
-} |
2518 |
- |
2519 |
-src_compile() { |
2520 |
- if use client-libs ; then |
2521 |
- multilib-minimal_src_compile |
2522 |
- else |
2523 |
- multilib_src_compile |
2524 |
- fi |
2525 |
-} |
2526 |
- |
2527 |
-multilib_src_compile() { |
2528 |
- cmake-utils_src_compile |
2529 |
-} |
2530 |
- |
2531 |
-# Official test instructions: |
2532 |
-# ulimit -n 16500 && \ |
2533 |
-# USE='latin1 perl server' \ |
2534 |
-# FEATURES='test userpriv -usersandbox' \ |
2535 |
-# ebuild mysql-X.X.XX.ebuild \ |
2536 |
-# digest clean package |
2537 |
-src_test() { |
2538 |
- _disable_test() { |
2539 |
- local rawtestname reason |
2540 |
- rawtestname="${1}" ; shift |
2541 |
- reason="${@}" |
2542 |
- ewarn "test '${rawtestname}' disabled: '${reason}'" |
2543 |
- echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
2544 |
- } |
2545 |
- |
2546 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
2547 |
- local retstatus_unit |
2548 |
- local retstatus_tests |
2549 |
- |
2550 |
- if ! use server ; then |
2551 |
- einfo "Skipping server tests due to minimal build." |
2552 |
- return 0 |
2553 |
- fi |
2554 |
- |
2555 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
2556 |
- # localhost. Also causes weird failures. |
2557 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
2558 |
- |
2559 |
- if [[ $UID -eq 0 ]] ; then |
2560 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
2561 |
- fi |
2562 |
- has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
2563 |
- |
2564 |
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
2565 |
- |
2566 |
- # Run CTest (test-units) |
2567 |
- cmake-utils_src_test |
2568 |
- retstatus_unit=$? |
2569 |
- |
2570 |
- # Ensure that parallel runs don't die |
2571 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
2572 |
- # Enable parallel testing, auto will try to detect number of cores |
2573 |
- # You may set this by hand. |
2574 |
- # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
2575 |
- export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
2576 |
- |
2577 |
- # create directories because mysqladmin might run out of order |
2578 |
- mkdir -p "${T}"/var-tests{,/log} || die |
2579 |
- |
2580 |
- # Run mysql tests |
2581 |
- pushd "${TESTDIR}" &>/dev/null || die |
2582 |
- |
2583 |
- touch "${T}/disabled.def" |
2584 |
- # These are failing in MySQL 5.7 for now and are believed to be |
2585 |
- # false positives: |
2586 |
- # |
2587 |
- local t |
2588 |
- |
2589 |
- for t in auth_sec.keyring_udf ; do |
2590 |
- _disable_test "$t" "False positives in Gentoo" |
2591 |
- done |
2592 |
- |
2593 |
- # Unstable tests |
2594 |
- # - main.xa_prepared_binlog_off: https://bugs.mysql.com/bug.php?id=83340 |
2595 |
- # - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223 |
2596 |
- # - rpl.rpl_non_direct_stm_mixing_engines: MDEV-14489 |
2597 |
- for t in \ |
2598 |
- main.xa_prepared_binlog_off \ |
2599 |
- rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \ |
2600 |
- rpl.rpl_non_direct_stm_mixing_engines \ |
2601 |
- ; do |
2602 |
- _disable_test "$t" "Unstable test" |
2603 |
- done |
2604 |
- |
2605 |
- for t in \ |
2606 |
- gis.geometry_class_attri_prop \ |
2607 |
- gis.geometry_property_function_issimple \ |
2608 |
- gis.gis_bugs_crashes \ |
2609 |
- gis.spatial_op_testingfunc_mix \ |
2610 |
- gis.spatial_analysis_functions_buffer \ |
2611 |
- gis.spatial_analysis_functions_distance \ |
2612 |
- gis.spatial_utility_function_distance_sphere \ |
2613 |
- gis.spatial_utility_function_simplify \ |
2614 |
- gis.spatial_analysis_functions_centroid \ |
2615 |
- main.with_recursive \ |
2616 |
- ; do |
2617 |
- _disable_test "$t" "Known rounding error with latest AMD processors" |
2618 |
- done |
2619 |
- |
2620 |
- if ! hash zip 1>/dev/null 2>&1 ; then |
2621 |
- # no need to force dep app-arch/zip for one test |
2622 |
- _disable_test "innodb.partition_upgrade_create" "Requires app-arch/zip" |
2623 |
- fi |
2624 |
- |
2625 |
- if use numa && use kernel_linux ; then |
2626 |
- # bug 584880 |
2627 |
- if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then |
2628 |
- for t in sys_vars.innodb_numa_interleave_basic ; do |
2629 |
- _disable_test "$t" "Test $t requires system with NUMA support" |
2630 |
- done |
2631 |
- fi |
2632 |
- fi |
2633 |
- |
2634 |
- if ! use latin1 ; then |
2635 |
- # The following tests will fail if DEFAULT_CHARSET |
2636 |
- # isn't set to latin1: |
2637 |
- for t in \ |
2638 |
- binlog.binlog_mysqlbinlog_filter \ |
2639 |
- binlog.binlog_xa_prepared_disconnect \ |
2640 |
- funcs_1.is_columns_mysql \ |
2641 |
- funcs_1.is_tables_mysql \ |
2642 |
- funcs_1.is_triggers \ |
2643 |
- innodb.innodb_pagesize_max_recordsize \ |
2644 |
- innodb.innodb-system-table-view \ |
2645 |
- innodb.mysqldump_max_recordsize \ |
2646 |
- main.mysql_client_test \ |
2647 |
- main.mysqld--help-notwin \ |
2648 |
- main.type_string \ |
2649 |
- main.information_schema \ |
2650 |
- perfschema.binlog_edge_mix \ |
2651 |
- perfschema.binlog_edge_stmt \ |
2652 |
- rpl.rpl_xa_survive_disconnect \ |
2653 |
- rpl.rpl_xa_survive_disconnect_lsu_off \ |
2654 |
- rpl.rpl_xa_survive_disconnect_table \ |
2655 |
- ; do |
2656 |
- _disable_test "$t" "Requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set" |
2657 |
- done |
2658 |
- fi |
2659 |
- |
2660 |
- if has_version '>=dev-libs/openssl-1.1.1' ; then |
2661 |
- # Tests are expecting <openssl-1.1.1 default cipher |
2662 |
- for t in \ |
2663 |
- auth_sec.cert_verify \ |
2664 |
- auth_sec.mysql_ssl_connection \ |
2665 |
- auth_sec.openssl_cert_generation \ |
2666 |
- auth_sec.ssl_auto_detect \ |
2667 |
- auth_sec.ssl_mode \ |
2668 |
- auth_sec.tls \ |
2669 |
- binlog.binlog_grant_alter_user \ |
2670 |
- encryption.innodb_onlinealter_encryption \ |
2671 |
- main.grant_alter_user_qa \ |
2672 |
- main.grant_user_lock_qa \ |
2673 |
- main.mysql_ssl_default \ |
2674 |
- main.openssl_1 \ |
2675 |
- main.plugin_auth_sha256_tls \ |
2676 |
- main.ssl \ |
2677 |
- main.ssl_8k_key \ |
2678 |
- main.ssl_bug75311 \ |
2679 |
- main.ssl_ca \ |
2680 |
- main.ssl_cipher \ |
2681 |
- main.ssl_compress \ |
2682 |
- main.ssl_crl \ |
2683 |
- main.ssl_ecdh \ |
2684 |
- main.ssl_verify_identity \ |
2685 |
- x.connection_tls_version \ |
2686 |
- x.connection_openssl \ |
2687 |
- ; do |
2688 |
- _disable_test "$t" "Requires <dev-libs/openssl-1.1.1" |
2689 |
- done |
2690 |
- fi |
2691 |
- |
2692 |
- # Try to increase file limits to increase test coverage |
2693 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
2694 |
- # Upper limit comes from parts.partition_* tests |
2695 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
2696 |
- |
2697 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
2698 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
2699 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
2700 |
- |
2701 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
2702 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
2703 |
- else |
2704 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
2705 |
- fi |
2706 |
- else |
2707 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
2708 |
- fi |
2709 |
- else |
2710 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
2711 |
- fi |
2712 |
- |
2713 |
- # run mysql-test tests |
2714 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
2715 |
- retstatus_tests=$? |
2716 |
- |
2717 |
- popd &>/dev/null || die |
2718 |
- |
2719 |
- # Cleanup is important for these testcases. |
2720 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
2721 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
2722 |
- |
2723 |
- local failures="" |
2724 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
2725 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
2726 |
- |
2727 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
2728 |
- einfo "Tests successfully completed" |
2729 |
-} |
2730 |
- |
2731 |
-src_install() { |
2732 |
- local MULTILIB_WRAPPED_HEADERS |
2733 |
- local MULTILIB_CHOST_TOOLS |
2734 |
- if use client-libs ; then |
2735 |
- # headers with ABI specific data |
2736 |
- MULTILIB_WRAPPED_HEADERS=( |
2737 |
- /usr/include/mysql/server/my_config.h |
2738 |
- /usr/include/mysql/server/mysql_version.h ) |
2739 |
- |
2740 |
- # wrap the config scripts |
2741 |
- MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config ) |
2742 |
- multilib-minimal_src_install |
2743 |
- else |
2744 |
- multilib_src_install |
2745 |
- multilib_src_install_all |
2746 |
- fi |
2747 |
-} |
2748 |
- |
2749 |
-# Intentionally override eclass function |
2750 |
-multilib_src_install() { |
2751 |
- |
2752 |
- cmake-utils_src_install |
2753 |
- |
2754 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
2755 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
2756 |
-} |
2757 |
- |
2758 |
-multilib_src_install_all() { |
2759 |
- # Make sure the vars are correctly initialized |
2760 |
- mysql_init_vars |
2761 |
- |
2762 |
- # Convenience links |
2763 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
2764 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
2765 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
2766 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
2767 |
- |
2768 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
2769 |
- if [[ -d "${ED}/usr/data" ]] ; then |
2770 |
- rm -Rf "${ED}/usr/data" || die |
2771 |
- fi |
2772 |
- |
2773 |
- # Unless they explicitly specific USE=test, then do not install the |
2774 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
2775 |
- # validation of your database configuration after tuning it. |
2776 |
- if ! use test ; then |
2777 |
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
2778 |
- fi |
2779 |
- |
2780 |
- # Configuration stuff |
2781 |
- einfo "Building default configuration ..." |
2782 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
2783 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
2784 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
2785 |
- eprefixify "${TMPDIR}/my.cnf" |
2786 |
- doins "${TMPDIR}/my.cnf" |
2787 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
2788 |
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
2789 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
2790 |
- doins "${TMPDIR}/50-distro-client.cnf" |
2791 |
- |
2792 |
- if use server ; then |
2793 |
- mycnf_src="my.cnf.distro-server" |
2794 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
2795 |
- "${FILESDIR}/${mycnf_src}" \ |
2796 |
- > "${TMPDIR}/my.cnf.ok" || die |
2797 |
- |
2798 |
- if use prefix ; then |
2799 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
2800 |
- "${TMPDIR}/my.cnf.ok" || die |
2801 |
- fi |
2802 |
- |
2803 |
- if use latin1 ; then |
2804 |
- sed -i \ |
2805 |
- -e "/character-set/s|utf8|latin1|g" \ |
2806 |
- "${TMPDIR}/my.cnf.ok" || die |
2807 |
- fi |
2808 |
- |
2809 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
2810 |
- |
2811 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
2812 |
- fi |
2813 |
- |
2814 |
- #Remove mytop if perl is not selected |
2815 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
2816 |
-} |
2817 |
- |
2818 |
-pkg_config() { |
2819 |
- _getoptval() { |
2820 |
- local section="$1" |
2821 |
- local flag="--${2}=" |
2822 |
- local extra_options="${3}" |
2823 |
- local cmd=( |
2824 |
- "${EROOT%/}/usr/bin/my_print_defaults" |
2825 |
- "${extra_options}" |
2826 |
- "${section}" |
2827 |
- ) |
2828 |
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) |
2829 |
- |
2830 |
- if [[ ${#results[@]} -gt 0 ]] ; then |
2831 |
- # When option is set multiple times only return last value |
2832 |
- echo "${results[-1]}" |
2833 |
- fi |
2834 |
- } |
2835 |
- local old_MY_DATADIR="${MY_DATADIR}" |
2836 |
- local old_HOME="${HOME}" |
2837 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
2838 |
- export HOME=${EPREFIX}/root |
2839 |
- |
2840 |
- # Make sure the vars are correctly initialized |
2841 |
- mysql_init_vars |
2842 |
- |
2843 |
- [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
2844 |
- if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then |
2845 |
- die "Minimal builds do NOT include the MySQL server" |
2846 |
- fi |
2847 |
- |
2848 |
- if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]] ; then |
2849 |
- local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}" |
2850 |
- MY_DATADIR_s="${MY_DATADIR_s%%/}" |
2851 |
- local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}" |
2852 |
- old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
2853 |
- |
2854 |
- if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]] ; then |
2855 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
2856 |
- ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
2857 |
- ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
2858 |
- else |
2859 |
- elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
2860 |
- mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
2861 |
- || die "Moving MY_DATADIR failed" |
2862 |
- fi |
2863 |
- else |
2864 |
- ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
2865 |
- if [[ -d "${MY_DATADIR_s}" ]] ; then |
2866 |
- ewarn "Attempting to use ${MY_DATADIR_s}" |
2867 |
- else |
2868 |
- eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
2869 |
- die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
2870 |
- fi |
2871 |
- fi |
2872 |
- fi |
2873 |
- |
2874 |
- local pwd1="a" |
2875 |
- local pwd2="b" |
2876 |
- local maxtry=15 |
2877 |
- |
2878 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
2879 |
- local tmp_mysqld_password_source= |
2880 |
- |
2881 |
- for tmp_mysqld_password_source in mysql client ; do |
2882 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
2883 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
2884 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
2885 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
2886 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
2887 |
- MYSQL_ROOT_PASSWORD= |
2888 |
- continue |
2889 |
- fi |
2890 |
- |
2891 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
2892 |
- break |
2893 |
- fi |
2894 |
- done |
2895 |
- |
2896 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
2897 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
2898 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
2899 |
- fi |
2900 |
- |
2901 |
- unset tmp_mysqld_password_source |
2902 |
- fi |
2903 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
2904 |
- # These are dir+prefix |
2905 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
2906 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
2907 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
2908 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
2909 |
- |
2910 |
- if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]] ; then |
2911 |
- einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
2912 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR" |
2913 |
- fi |
2914 |
- |
2915 |
- if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]] ; then |
2916 |
- einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
2917 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN" |
2918 |
- fi |
2919 |
- |
2920 |
- if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]] ; then |
2921 |
- einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
2922 |
- install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG" |
2923 |
- fi |
2924 |
- |
2925 |
- if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then |
2926 |
- ewarn "You have already a MySQL database in place." |
2927 |
- ewarn "(${ROOT%/}/${MY_DATADIR}/*)" |
2928 |
- ewarn "Please rename or delete it if you wish to replace it." |
2929 |
- die "MySQL database already exists!" |
2930 |
- fi |
2931 |
- |
2932 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
2933 |
- # localhost. Also causes weird failures. |
2934 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
2935 |
- |
2936 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
2937 |
- |
2938 |
- einfo "Please provide a password for the mysql 'root' user now" |
2939 |
- einfo "or through the ${HOME}/.my.cnf file." |
2940 |
- ewarn "Avoid [\"'\\_%] characters in the password" |
2941 |
- read -rsp " >" pwd1 ; echo |
2942 |
- |
2943 |
- einfo "Retype the password" |
2944 |
- read -rsp " >" pwd2 ; echo |
2945 |
- |
2946 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
2947 |
- die "Passwords are not the same" |
2948 |
- fi |
2949 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
2950 |
- unset pwd1 pwd2 |
2951 |
- fi |
2952 |
- |
2953 |
- local options |
2954 |
- local sqltmp="$(emktemp "${EROOT%/}/tmp")" |
2955 |
- |
2956 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
2957 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
2958 |
- use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
2959 |
- |
2960 |
- # Figure out which options we need to disable to do the setup |
2961 |
- local helpfile="${TMPDIR%/}/mysqld-help" |
2962 |
- "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
2963 |
- for opt in host-cache name-resolve networking slave-start \ |
2964 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
2965 |
- log-slave-updates \ |
2966 |
- ; do |
2967 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
2968 |
- egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
2969 |
- done |
2970 |
- |
2971 |
- einfo "Creating the mysql database and setting proper permissions on it ..." |
2972 |
- |
2973 |
- # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
2974 |
- PID_DIR="${EROOT%/}/var/run/mysqld" |
2975 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
2976 |
- install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
2977 |
- fi |
2978 |
- |
2979 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
2980 |
- install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
2981 |
- fi |
2982 |
- |
2983 |
- pushd "${TMPDIR}" &>/dev/null || die |
2984 |
- |
2985 |
- # Filling timezones, see |
2986 |
- # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
2987 |
- echo "USE mysql;" >"${sqltmp}" |
2988 |
- "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null |
2989 |
- chown mysql "${sqltmp}" || die |
2990 |
- |
2991 |
- # --initialize-insecure will not set root password |
2992 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
2993 |
- local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" ) |
2994 |
- cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" ) |
2995 |
- einfo "Command: ${cmd[*]}" |
2996 |
- su -s /bin/sh -c "${cmd[*]}" mysql \ |
2997 |
- >"${TMPDIR%/}"/mysql_install_db.log 2>&1 |
2998 |
- if [[ $? -ne 0 ]] ; then |
2999 |
- grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2 |
3000 |
- die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log" |
3001 |
- fi |
3002 |
- popd &>/dev/null || die |
3003 |
- [[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \ |
3004 |
- || die "MySQL databases not installed" |
3005 |
- |
3006 |
- use prefix || options="${options} --user=mysql" |
3007 |
- |
3008 |
- local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock" |
3009 |
- local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid" |
3010 |
- local mysqld="${EROOT%/}/usr/sbin/mysqld \ |
3011 |
- ${options} \ |
3012 |
- $(use prefix || echo --user=mysql) \ |
3013 |
- --log-warnings=0 \ |
3014 |
- --basedir=${EROOT%/}/usr \ |
3015 |
- --datadir=${ROOT%/}/${MY_DATADIR} \ |
3016 |
- --max_allowed_packet=8M \ |
3017 |
- --net_buffer_length=16K \ |
3018 |
- --socket=${socket} \ |
3019 |
- --pid-file=${pidfile} \ |
3020 |
- --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
3021 |
- #einfo "About to start mysqld: ${mysqld}" |
3022 |
- ebegin "Starting mysqld" |
3023 |
- einfo "Command ${mysqld}" |
3024 |
- ${mysqld} & |
3025 |
- rc=$? |
3026 |
- while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
3027 |
- maxtry=$((${maxtry}-1)) |
3028 |
- echo -n "." |
3029 |
- sleep 1 |
3030 |
- done |
3031 |
- eend $rc |
3032 |
- |
3033 |
- if ! [[ -S "${socket}" ]] ; then |
3034 |
- die "Completely failed to start up mysqld with: ${mysqld}" |
3035 |
- fi |
3036 |
- |
3037 |
- ebegin "Setting root password" |
3038 |
- # Do this from memory, as we don't want clear text passwords in temp files |
3039 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'" |
3040 |
- "${EROOT%/}/usr/bin/mysql" \ |
3041 |
- --no-defaults \ |
3042 |
- "--socket=${socket}" \ |
3043 |
- -hlocalhost \ |
3044 |
- -e "${sql}" |
3045 |
- eend $? |
3046 |
- |
3047 |
- # Stop the server and cleanup |
3048 |
- einfo "Stopping the server ..." |
3049 |
- kill $(< "${pidfile}" ) |
3050 |
- rm -f "${sqltmp}" |
3051 |
- wait %1 |
3052 |
- einfo "Done" |
3053 |
-} |
3054 |
|
3055 |
diff --git a/dev-db/mysql/mysql-5.7.31.ebuild b/dev-db/mysql/mysql-5.7.31.ebuild |
3056 |
deleted file mode 100644 |
3057 |
index c5a202eecc1..00000000000 |
3058 |
--- a/dev-db/mysql/mysql-5.7.31.ebuild |
3059 |
+++ /dev/null |
3060 |
@@ -1,1227 +0,0 @@ |
3061 |
-# Copyright 1999-2021 Gentoo Authors |
3062 |
-# Distributed under the terms of the GNU General Public License v2 |
3063 |
- |
3064 |
-EAPI="7" |
3065 |
- |
3066 |
-CMAKE_MAKEFILE_GENERATOR=emake |
3067 |
- |
3068 |
-inherit check-reqs cmake flag-o-matic linux-info \ |
3069 |
- multiprocessing prefix toolchain-funcs multilib-minimal |
3070 |
- |
3071 |
-# Patch version |
3072 |
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/mysql/${PN}-5.7.31-patches-01.tar.xz" |
3073 |
- |
3074 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz |
3075 |
- https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz |
3076 |
- http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz |
3077 |
- ${PATCH_SET}" |
3078 |
- |
3079 |
-HOMEPAGE="https://www.mysql.com/" |
3080 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
3081 |
-LICENSE="GPL-2" |
3082 |
-SLOT="5.7/18" |
3083 |
-IUSE="cjk client-libs cracklib debug experimental jemalloc latin1 numa +perl profiling |
3084 |
- selinux +server static static-libs systemtap tcmalloc test" |
3085 |
- |
3086 |
-RESTRICT="!test? ( test )" |
3087 |
- |
3088 |
-REQUIRED_USE="?? ( tcmalloc jemalloc )" |
3089 |
- |
3090 |
-KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris" |
3091 |
- |
3092 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
3093 |
-# and we will run a mysql server during test phase |
3094 |
-S="${WORKDIR}/mysql" |
3095 |
- |
3096 |
-# Be warned, *DEPEND are version-dependant |
3097 |
-# These are used for both runtime and compiletime |
3098 |
-# MULTILIB_USEDEP only set for libraries used by the client library |
3099 |
-COMMON_DEPEND=" |
3100 |
- sys-libs/ncurses:0= |
3101 |
- client-libs? ( |
3102 |
- >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] |
3103 |
- >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] |
3104 |
- ) |
3105 |
- !client-libs? ( |
3106 |
- dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] |
3107 |
- >=sys-libs/zlib-1.2.3:0= |
3108 |
- >=dev-libs/openssl-1.0.0:0= |
3109 |
- ) |
3110 |
- server? ( |
3111 |
- >=app-arch/lz4-0_p131:= |
3112 |
- cjk? ( app-text/mecab:= ) |
3113 |
- experimental? ( |
3114 |
- dev-libs/libevent:=[ssl] |
3115 |
- dev-libs/protobuf:= |
3116 |
- net-libs/libtirpc:= |
3117 |
- ) |
3118 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
3119 |
- kernel_linux? ( |
3120 |
- dev-libs/libaio:0= |
3121 |
- sys-process/procps:0= |
3122 |
- ) |
3123 |
- numa? ( sys-process/numactl ) |
3124 |
- ) |
3125 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
3126 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
3127 |
-" |
3128 |
-DEPEND="${COMMON_DEPEND} |
3129 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
3130 |
- dev-libs/protobuf |
3131 |
- virtual/yacc |
3132 |
- server? ( |
3133 |
- dev-libs/libevent:=[ssl] |
3134 |
- experimental? ( net-libs/rpcsvc-proto ) |
3135 |
- ) |
3136 |
- static? ( sys-libs/ncurses[static-libs] ) |
3137 |
- test? ( |
3138 |
- acct-group/mysql acct-user/mysql |
3139 |
- dev-perl/JSON |
3140 |
- ) |
3141 |
-" |
3142 |
-RDEPEND="${COMMON_DEPEND} |
3143 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
3144 |
- !dev-db/mysql:0 |
3145 |
- !dev-db/mysql:8.0 |
3146 |
- client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= ) |
3147 |
- selinux? ( sec-policy/selinux-mysql ) |
3148 |
- server? ( |
3149 |
- !prefix? ( |
3150 |
- acct-group/mysql acct-user/mysql |
3151 |
- dev-db/mysql-init-scripts |
3152 |
- ) |
3153 |
- ) |
3154 |
-" |
3155 |
-# For other stuff to bring us in |
3156 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
3157 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
3158 |
- |
3159 |
-mysql_init_vars() { |
3160 |
- : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
3161 |
- : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
3162 |
- : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
3163 |
- : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
3164 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
3165 |
- |
3166 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
3167 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
3168 |
- export MY_DATADIR |
3169 |
-} |
3170 |
- |
3171 |
-pkg_pretend() { |
3172 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
3173 |
- if use server ; then |
3174 |
- CHECKREQS_DISK_BUILD="3G" |
3175 |
- |
3176 |
- if has test $FEATURES ; then |
3177 |
- CHECKREQS_DISK_BUILD="9G" |
3178 |
- fi |
3179 |
- |
3180 |
- check-reqs_pkg_pretend |
3181 |
- fi |
3182 |
- fi |
3183 |
-} |
3184 |
- |
3185 |
-pkg_setup() { |
3186 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
3187 |
- CHECKREQS_DISK_BUILD="3G" |
3188 |
- |
3189 |
- if has test ${FEATURES} ; then |
3190 |
- CHECKREQS_DISK_BUILD="9G" |
3191 |
- |
3192 |
- # Bug #213475 - MySQL _will_ object strenuously if your machine is named |
3193 |
- # localhost. Also causes weird failures. |
3194 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
3195 |
- |
3196 |
- if ! has userpriv ${FEATURES} ; then |
3197 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
3198 |
- fi |
3199 |
- |
3200 |
- local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) |
3201 |
- [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] \ |
3202 |
- && die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!" |
3203 |
- |
3204 |
- if use latin1 ; then |
3205 |
- # Upstream only supports tests with default charset |
3206 |
- die "Testing with USE=latin1 is not supported." |
3207 |
- fi |
3208 |
- fi |
3209 |
- |
3210 |
- if use kernel_linux ; then |
3211 |
- if use numa ; then |
3212 |
- linux-info_get_any_version |
3213 |
- |
3214 |
- local CONFIG_CHECK="~NUMA" |
3215 |
- |
3216 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
3217 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
3218 |
- |
3219 |
- check_extra_config |
3220 |
- fi |
3221 |
- fi |
3222 |
- |
3223 |
- use server && check-reqs_pkg_setup |
3224 |
- fi |
3225 |
-} |
3226 |
- |
3227 |
-pkg_preinst() { |
3228 |
- # Here we need to see if the implementation switched client libraries |
3229 |
- # We check if this is a new instance of the package and a client library already exists |
3230 |
- local SHOW_ABI_MESSAGE libpath |
3231 |
- if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
3232 |
- libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so") |
3233 |
- elog "Due to ABI changes when switching between different client libraries," |
3234 |
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
3235 |
- elog "Please run: revdep-rebuild --library ${libpath}" |
3236 |
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
3237 |
- fi |
3238 |
-} |
3239 |
- |
3240 |
-pkg_postinst() { |
3241 |
- # Make sure the vars are correctly initialized |
3242 |
- mysql_init_vars |
3243 |
- |
3244 |
- # Create log directory securely if it does not exist |
3245 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
3246 |
- |
3247 |
- if use server ; then |
3248 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
3249 |
- einfo |
3250 |
- elog "You might want to run:" |
3251 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
3252 |
- elog "if this is a new install." |
3253 |
- elog |
3254 |
- elog "If you are switching server implentations, you should run the" |
3255 |
- elog "mysql_upgrade tool." |
3256 |
- einfo |
3257 |
- else |
3258 |
- einfo |
3259 |
- elog "If you are upgrading major versions, you should run the" |
3260 |
- elog "mysql_upgrade tool." |
3261 |
- einfo |
3262 |
- fi |
3263 |
- fi |
3264 |
- |
3265 |
- # Note about configuration change |
3266 |
- einfo |
3267 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
3268 |
- elog "to several files in /etc/mysql/mysql.d." |
3269 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
3270 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
3271 |
- elog "You may have as many files as needed and they are read alphabetically." |
3272 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
3273 |
- einfo |
3274 |
-} |
3275 |
- |
3276 |
-src_unpack() { |
3277 |
- unpack ${A} |
3278 |
- |
3279 |
- mv -f "${WORKDIR}/${P}" "${S}" || die |
3280 |
-} |
3281 |
- |
3282 |
-src_prepare() { |
3283 |
- eapply "${WORKDIR}"/mysql-patches |
3284 |
- |
3285 |
- if use jemalloc ; then |
3286 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
3287 |
- fi |
3288 |
- |
3289 |
- if use tcmalloc ; then |
3290 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
3291 |
- fi |
3292 |
- |
3293 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
3294 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
3295 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
3296 |
- fi |
3297 |
- |
3298 |
- # Remove bundled libs so we cannot accidentally use them |
3299 |
- # We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394 |
3300 |
- rm -rv \ |
3301 |
- "${S}"/extra/protobuf \ |
3302 |
- "${S}"/extra/libevent \ |
3303 |
- "${S}"/zlib \ |
3304 |
- || die |
3305 |
- |
3306 |
- # Don't clash with dev-db/mysql-connector-c |
3307 |
- rm \ |
3308 |
- man/my_print_defaults.1 \ |
3309 |
- man/perror.1 \ |
3310 |
- man/zlib_decompress.1 \ |
3311 |
- || die |
3312 |
- |
3313 |
- sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die |
3314 |
- |
3315 |
- cmake_src_prepare |
3316 |
-} |
3317 |
- |
3318 |
-src_configure() { |
3319 |
- # Bug #114895, bug #110149 |
3320 |
- filter-flags "-O" "-O[01]" |
3321 |
- |
3322 |
- append-cxxflags -felide-constructors |
3323 |
- |
3324 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
3325 |
- append-flags -fno-strict-aliasing |
3326 |
- |
3327 |
- if use client-libs ; then |
3328 |
- multilib-minimal_src_configure |
3329 |
- else |
3330 |
- multilib_src_configure |
3331 |
- fi |
3332 |
-} |
3333 |
- |
3334 |
-multilib_src_configure() { |
3335 |
- debug-print-function ${FUNCNAME} "$@" |
3336 |
- |
3337 |
- if ! multilib_is_native_abi && ! use client-libs ; then |
3338 |
- return |
3339 |
- fi |
3340 |
- |
3341 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
3342 |
- |
3343 |
- # debug hack wrt #497532 |
3344 |
- mycmakeargs=( |
3345 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
3346 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
3347 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
3348 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
3349 |
- -DINSTALL_BINDIR=bin |
3350 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
3351 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
3352 |
- -DINSTALL_INCLUDEDIR=include/mysql |
3353 |
- -DINSTALL_INFODIR=share/info |
3354 |
- -DINSTALL_LIBDIR=$(get_libdir) |
3355 |
- -DINSTALL_MANDIR=share/man |
3356 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
3357 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
3358 |
- -DINSTALL_SCRIPTDIR=share/mysql/scripts |
3359 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
3360 |
- -DINSTALL_SBINDIR=sbin |
3361 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
3362 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
3363 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
3364 |
- ### TODO: make this system but issues with UTF-8 prevent it |
3365 |
- -DWITH_EDITLINE=bundled |
3366 |
- -DWITH_ZLIB=system |
3367 |
- -DWITH_SSL=system |
3368 |
- -DWITH_LIBWRAP=0 |
3369 |
- -DENABLED_LOCAL_INFILE=1 |
3370 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
3371 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
3372 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
3373 |
- # The build forces this to be defined when cross-compiling. We pass it |
3374 |
- # all the time for simplicity and to make sure it is actually correct. |
3375 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
3376 |
- -DWITH_CURL=system |
3377 |
- -DWITH_BOOST="${S}/boost" |
3378 |
- ) |
3379 |
- if use test ; then |
3380 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
3381 |
- else |
3382 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
3383 |
- fi |
3384 |
- |
3385 |
- if ! use client-libs ; then |
3386 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
3387 |
- fi |
3388 |
- |
3389 |
- # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
3390 |
- # systemtap only works on native ABI, bug 530132 |
3391 |
- if multilib_is_native_abi ; then |
3392 |
- mycmakeargs+=( |
3393 |
- -DENABLE_DTRACE=$(usex systemtap) |
3394 |
- ) |
3395 |
- else |
3396 |
- mycmakeargs+=( |
3397 |
- -DWITHOUT_TOOLS=1 |
3398 |
- -DWITH_READLINE=1 |
3399 |
- -DENABLE_DTRACE=0 |
3400 |
- ) |
3401 |
- fi |
3402 |
- |
3403 |
- if multilib_is_native_abi && use server ; then |
3404 |
- mycmakeargs+=( |
3405 |
- -DWITH_LIBEVENT=system |
3406 |
- -DWITH_LZ4=system |
3407 |
- -DWITH_PROTOBUF=system |
3408 |
- -DWITH_MECAB=$(usex cjk system OFF) |
3409 |
- -DWITH_NUMA=$(usex numa ON OFF) |
3410 |
- -DWITH_RAPID=$(usex experimental ON OFF) |
3411 |
- ) |
3412 |
- |
3413 |
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]] ; then |
3414 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
3415 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
3416 |
- ewarn "You MUST file bugs without these variables set." |
3417 |
- |
3418 |
- mycmakeargs+=( |
3419 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
3420 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
3421 |
- ) |
3422 |
- elif ! use latin1 ; then |
3423 |
- mycmakeargs+=( |
3424 |
- -DDEFAULT_CHARSET=utf8 |
3425 |
- -DDEFAULT_COLLATION=utf8_general_ci |
3426 |
- ) |
3427 |
- else |
3428 |
- mycmakeargs+=( |
3429 |
- -DDEFAULT_CHARSET=latin1 |
3430 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
3431 |
- ) |
3432 |
- fi |
3433 |
- |
3434 |
- mycmakeargs+=( |
3435 |
- -DEXTRA_CHARSETS=all |
3436 |
- -DDISABLE_SHARED=$(usex static YES NO) |
3437 |
- -DWITH_DEBUG=$(usex debug) |
3438 |
- -DWITH_EMBEDDED_SERVER=OFF |
3439 |
- ) |
3440 |
- |
3441 |
- if use profiling ; then |
3442 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
3443 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
3444 |
- # "main.mysqld--help-notwin" test to fail |
3445 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
3446 |
- fi |
3447 |
- |
3448 |
- if use static ; then |
3449 |
- mycmakeargs+=( -DWITH_PIC=1 ) |
3450 |
- fi |
3451 |
- |
3452 |
- # Storage engines |
3453 |
- mycmakeargs+=( |
3454 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
3455 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
3456 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
3457 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
3458 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
3459 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
3460 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
3461 |
- -DWITH_INNODB_MEMCACHED=0 |
3462 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
3463 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
3464 |
- -DWITH_PARTITION_STORAGE_ENGINE=1 |
3465 |
- ) |
3466 |
- |
3467 |
- else |
3468 |
- mycmakeargs+=( |
3469 |
- -DWITHOUT_SERVER=1 |
3470 |
- -DWITH_EMBEDDED_SERVER=OFF |
3471 |
- -DEXTRA_CHARSETS=none |
3472 |
- ) |
3473 |
- fi |
3474 |
- |
3475 |
- cmake_src_configure |
3476 |
-} |
3477 |
- |
3478 |
-src_compile() { |
3479 |
- if use client-libs ; then |
3480 |
- multilib-minimal_src_compile |
3481 |
- else |
3482 |
- multilib_src_compile |
3483 |
- fi |
3484 |
-} |
3485 |
- |
3486 |
-multilib_src_compile() { |
3487 |
- cmake_src_compile |
3488 |
-} |
3489 |
- |
3490 |
-# Official test instructions: |
3491 |
-# ulimit -n 16500 && \ |
3492 |
-# USE='latin1 perl server' \ |
3493 |
-# FEATURES='test userpriv -usersandbox' \ |
3494 |
-# ebuild mysql-X.X.XX.ebuild \ |
3495 |
-# digest clean package |
3496 |
-src_test() { |
3497 |
- _disable_test() { |
3498 |
- local rawtestname reason |
3499 |
- rawtestname="${1}" ; shift |
3500 |
- reason="${@}" |
3501 |
- ewarn "test '${rawtestname}' disabled: '${reason}'" |
3502 |
- echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
3503 |
- } |
3504 |
- |
3505 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
3506 |
- local retstatus_unit |
3507 |
- local retstatus_tests |
3508 |
- |
3509 |
- if ! use server ; then |
3510 |
- einfo "Skipping server tests due to minimal build." |
3511 |
- return 0 |
3512 |
- fi |
3513 |
- |
3514 |
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
3515 |
- |
3516 |
- # Run CTest (test-units) |
3517 |
- cmake_src_test |
3518 |
- retstatus_unit=$? |
3519 |
- |
3520 |
- # Ensure that parallel runs don't die |
3521 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
3522 |
- |
3523 |
- if [[ -z "${MTR_PARALLEL}" ]] ; then |
3524 |
- local -x MTR_PARALLEL=$(makeopts_jobs) |
3525 |
- |
3526 |
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then |
3527 |
- # Running multiple tests in parallel usually require higher ulimit |
3528 |
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update |
3529 |
- # are known to hit timeout when system is busy. |
3530 |
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of |
3531 |
- # using "auto". |
3532 |
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" |
3533 |
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" |
3534 |
- einfo "${info_msg}" |
3535 |
- unset info_msg |
3536 |
- MTR_PARALLEL=4 |
3537 |
- fi |
3538 |
- else |
3539 |
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" |
3540 |
- fi |
3541 |
- |
3542 |
- # create directories because mysqladmin might run out of order |
3543 |
- mkdir -p "${T}"/var-tests{,/log} || die |
3544 |
- |
3545 |
- # Run mysql tests |
3546 |
- pushd "${TESTDIR}" &>/dev/null || die |
3547 |
- |
3548 |
- touch "${T}/disabled.def" |
3549 |
- # These are failing in MySQL 5.7 for now and are believed to be |
3550 |
- # false positives: |
3551 |
- # |
3552 |
- local t |
3553 |
- |
3554 |
- for t in auth_sec.keyring_udf ; do |
3555 |
- _disable_test "$t" "False positives in Gentoo" |
3556 |
- done |
3557 |
- |
3558 |
- # Unstable tests |
3559 |
- # - main.xa_prepared_binlog_off: https://bugs.mysql.com/bug.php?id=83340 |
3560 |
- # - rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch: https://bugs.mysql.com/bug.php?id=89223 |
3561 |
- # - rpl.rpl_non_direct_stm_mixing_engines: MDEV-14489 |
3562 |
- for t in \ |
3563 |
- main.xa_prepared_binlog_off \ |
3564 |
- rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch \ |
3565 |
- rpl.rpl_non_direct_stm_mixing_engines \ |
3566 |
- ; do |
3567 |
- _disable_test "$t" "Unstable test" |
3568 |
- done |
3569 |
- |
3570 |
- for t in \ |
3571 |
- gis.geometry_class_attri_prop \ |
3572 |
- gis.geometry_property_function_issimple \ |
3573 |
- gis.gis_bugs_crashes \ |
3574 |
- gis.spatial_op_testingfunc_mix \ |
3575 |
- gis.spatial_analysis_functions_buffer \ |
3576 |
- gis.spatial_analysis_functions_distance \ |
3577 |
- gis.spatial_utility_function_distance_sphere \ |
3578 |
- gis.spatial_utility_function_simplify \ |
3579 |
- gis.spatial_analysis_functions_centroid \ |
3580 |
- main.with_recursive \ |
3581 |
- ; do |
3582 |
- _disable_test "$t" "Known rounding error with latest AMD processors" |
3583 |
- done |
3584 |
- |
3585 |
- if ! hash zip 1>/dev/null 2>&1 ; then |
3586 |
- # no need to force dep app-arch/zip for one test |
3587 |
- _disable_test "innodb.partition_upgrade_create" "Requires app-arch/zip" |
3588 |
- fi |
3589 |
- |
3590 |
- if use numa && use kernel_linux ; then |
3591 |
- # bug 584880 |
3592 |
- if ! linux_config_exists || ! linux_chkconfig_present NUMA ; then |
3593 |
- for t in sys_vars.innodb_numa_interleave_basic ; do |
3594 |
- _disable_test "$t" "Test $t requires system with NUMA support" |
3595 |
- done |
3596 |
- fi |
3597 |
- fi |
3598 |
- |
3599 |
- if ! use latin1 ; then |
3600 |
- # The following tests will fail if DEFAULT_CHARSET |
3601 |
- # isn't set to latin1: |
3602 |
- for t in \ |
3603 |
- binlog.binlog_mysqlbinlog_filter \ |
3604 |
- binlog.binlog_xa_prepared_disconnect \ |
3605 |
- funcs_1.is_columns_mysql \ |
3606 |
- funcs_1.is_tables_mysql \ |
3607 |
- funcs_1.is_triggers \ |
3608 |
- innodb.innodb_pagesize_max_recordsize \ |
3609 |
- innodb.innodb-system-table-view \ |
3610 |
- innodb.mysqldump_max_recordsize \ |
3611 |
- main.mysql_client_test \ |
3612 |
- main.mysqld--help-notwin \ |
3613 |
- main.type_string \ |
3614 |
- main.information_schema \ |
3615 |
- perfschema.binlog_edge_mix \ |
3616 |
- perfschema.binlog_edge_stmt \ |
3617 |
- rpl.rpl_xa_survive_disconnect \ |
3618 |
- rpl.rpl_xa_survive_disconnect_lsu_off \ |
3619 |
- rpl.rpl_xa_survive_disconnect_table \ |
3620 |
- ; do |
3621 |
- _disable_test "$t" "Requires DEFAULT_CHARSET=latin1 but USE=-latin1 is set" |
3622 |
- done |
3623 |
- fi |
3624 |
- |
3625 |
- if has_version '>=dev-libs/openssl-1.1.1' ; then |
3626 |
- # Tests are expecting <openssl-1.1.1 default cipher |
3627 |
- for t in \ |
3628 |
- auth_sec.cert_verify \ |
3629 |
- auth_sec.mysql_ssl_connection \ |
3630 |
- auth_sec.openssl_cert_generation \ |
3631 |
- auth_sec.ssl_auto_detect \ |
3632 |
- auth_sec.ssl_mode \ |
3633 |
- auth_sec.tls \ |
3634 |
- binlog.binlog_grant_alter_user \ |
3635 |
- encryption.innodb_onlinealter_encryption \ |
3636 |
- main.grant_alter_user_qa \ |
3637 |
- main.grant_user_lock_qa \ |
3638 |
- main.mysql_ssl_default \ |
3639 |
- main.openssl_1 \ |
3640 |
- main.plugin_auth_sha256_tls \ |
3641 |
- main.ssl \ |
3642 |
- main.ssl_8k_key \ |
3643 |
- main.ssl_bug75311 \ |
3644 |
- main.ssl_ca \ |
3645 |
- main.ssl_cipher \ |
3646 |
- main.ssl_compress \ |
3647 |
- main.ssl_crl \ |
3648 |
- main.ssl_ecdh \ |
3649 |
- main.ssl_verify_identity \ |
3650 |
- x.connection_tls_version \ |
3651 |
- x.connection_openssl \ |
3652 |
- ; do |
3653 |
- _disable_test "$t" "Requires <dev-libs/openssl-1.1.1" |
3654 |
- done |
3655 |
- fi |
3656 |
- |
3657 |
- # Try to increase file limits to increase test coverage |
3658 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
3659 |
- # Upper limit comes from parts.partition_* tests |
3660 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
3661 |
- |
3662 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
3663 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
3664 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
3665 |
- |
3666 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
3667 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
3668 |
- else |
3669 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
3670 |
- fi |
3671 |
- else |
3672 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
3673 |
- fi |
3674 |
- else |
3675 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
3676 |
- fi |
3677 |
- |
3678 |
- # run mysql-test tests |
3679 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
3680 |
- retstatus_tests=$? |
3681 |
- |
3682 |
- popd &>/dev/null || die |
3683 |
- |
3684 |
- # Cleanup is important for these testcases. |
3685 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
3686 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
3687 |
- |
3688 |
- local failures="" |
3689 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
3690 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
3691 |
- |
3692 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
3693 |
- einfo "Tests successfully completed" |
3694 |
-} |
3695 |
- |
3696 |
-src_install() { |
3697 |
- local MULTILIB_WRAPPED_HEADERS |
3698 |
- local MULTILIB_CHOST_TOOLS |
3699 |
- if use client-libs ; then |
3700 |
- # headers with ABI specific data |
3701 |
- MULTILIB_WRAPPED_HEADERS=( |
3702 |
- /usr/include/mysql/server/my_config.h |
3703 |
- /usr/include/mysql/server/mysql_version.h ) |
3704 |
- |
3705 |
- # wrap the config scripts |
3706 |
- MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config ) |
3707 |
- multilib-minimal_src_install |
3708 |
- else |
3709 |
- multilib_src_install |
3710 |
- multilib_src_install_all |
3711 |
- fi |
3712 |
-} |
3713 |
- |
3714 |
-# Intentionally override eclass function |
3715 |
-multilib_src_install() { |
3716 |
- cmake_src_install |
3717 |
- |
3718 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
3719 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
3720 |
-} |
3721 |
- |
3722 |
-multilib_src_install_all() { |
3723 |
- # Make sure the vars are correctly initialized |
3724 |
- mysql_init_vars |
3725 |
- |
3726 |
- # Convenience links |
3727 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
3728 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
3729 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
3730 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
3731 |
- |
3732 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
3733 |
- if [[ -d "${ED}/usr/data" ]] ; then |
3734 |
- rm -Rf "${ED}/usr/data" || die |
3735 |
- fi |
3736 |
- |
3737 |
- # Unless they explicitly specific USE=test, then do not install the |
3738 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
3739 |
- # validation of your database configuration after tuning it. |
3740 |
- if ! use test ; then |
3741 |
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
3742 |
- fi |
3743 |
- |
3744 |
- # Configuration stuff |
3745 |
- einfo "Building default configuration ..." |
3746 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
3747 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
3748 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
3749 |
- eprefixify "${TMPDIR}/my.cnf" |
3750 |
- doins "${TMPDIR}/my.cnf" |
3751 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
3752 |
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
3753 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
3754 |
- doins "${TMPDIR}/50-distro-client.cnf" |
3755 |
- |
3756 |
- if use server ; then |
3757 |
- mycnf_src="my.cnf.distro-server" |
3758 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
3759 |
- "${FILESDIR}/${mycnf_src}" \ |
3760 |
- > "${TMPDIR}/my.cnf.ok" || die |
3761 |
- |
3762 |
- if use prefix ; then |
3763 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
3764 |
- "${TMPDIR}/my.cnf.ok" || die |
3765 |
- fi |
3766 |
- |
3767 |
- if use latin1 ; then |
3768 |
- sed -i \ |
3769 |
- -e "/character-set/s|utf8|latin1|g" \ |
3770 |
- "${TMPDIR}/my.cnf.ok" || die |
3771 |
- fi |
3772 |
- |
3773 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
3774 |
- |
3775 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
3776 |
- fi |
3777 |
- |
3778 |
- #Remove mytop if perl is not selected |
3779 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
3780 |
-} |
3781 |
- |
3782 |
-pkg_config() { |
3783 |
- _getoptval() { |
3784 |
- local section="$1" |
3785 |
- local flag="--${2}=" |
3786 |
- local extra_options="${3}" |
3787 |
- local cmd=( |
3788 |
- "${my_print_defaults_binary}" |
3789 |
- "${extra_options}" |
3790 |
- "${section}" |
3791 |
- ) |
3792 |
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) |
3793 |
- |
3794 |
- if [[ ${#results[@]} -gt 0 ]] ; then |
3795 |
- # When option is set multiple times only return last value |
3796 |
- echo "${results[-1]}" |
3797 |
- fi |
3798 |
- } |
3799 |
- |
3800 |
- _mktemp_dry() { |
3801 |
- # emktemp has no --dry-run option |
3802 |
- local template="${1}" |
3803 |
- |
3804 |
- if [[ -z "${template}" ]] ; then |
3805 |
- if [[ -z "${T}" ]] ; then |
3806 |
- template="/tmp/XXXXXXX" |
3807 |
- else |
3808 |
- template="${T}/XXXXXXX" |
3809 |
- fi |
3810 |
- fi |
3811 |
- |
3812 |
- local template_wo_X=${template//X/} |
3813 |
- local n_X |
3814 |
- let n_X=${#template}-${#template_wo_X} |
3815 |
- if [[ ${n_X} -lt 3 ]] ; then |
3816 |
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 |
3817 |
- return |
3818 |
- fi |
3819 |
- |
3820 |
- local attempts=0 |
3821 |
- local character tmpfile |
3822 |
- while [[ true ]] ; do |
3823 |
- let attempts=attempts+1 |
3824 |
- |
3825 |
- new_file= |
3826 |
- while read -n1 character ; do |
3827 |
- if [[ "${character}" == "X" ]] ; then |
3828 |
- tmpfile+="${RANDOM:0:1}" |
3829 |
- else |
3830 |
- tmpfile+="${character}" |
3831 |
- fi |
3832 |
- done < <(echo -n "${template}") |
3833 |
- |
3834 |
- if [[ ! -f "${tmpfile}" ]] |
3835 |
- then |
3836 |
- echo "${tmpfile}" |
3837 |
- return |
3838 |
- fi |
3839 |
- |
3840 |
- if [[ ${attempts} -ge 100 ]] ; then |
3841 |
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 |
3842 |
- return |
3843 |
- fi |
3844 |
- done |
3845 |
- } |
3846 |
- |
3847 |
- local mysqld_binary="${EROOT}/usr/sbin/mysqld" |
3848 |
- if [[ ! -x "${mysqld_binary}" ]] ; then |
3849 |
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
3850 |
- fi |
3851 |
- |
3852 |
- local mysql_binary="${EROOT}/usr/bin/mysql" |
3853 |
- if [[ ! -x "${mysql_binary}" ]] ; then |
3854 |
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
3855 |
- fi |
3856 |
- |
3857 |
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" |
3858 |
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then |
3859 |
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" |
3860 |
- fi |
3861 |
- |
3862 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
3863 |
- MYSQL_USER=mysql |
3864 |
- if use prefix ; then |
3865 |
- MYSQL_USER=$(id -u -n 2>/dev/null) |
3866 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
3867 |
- die "Failed to determine current username!" |
3868 |
- fi |
3869 |
- fi |
3870 |
- fi |
3871 |
- |
3872 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
3873 |
- MYSQL_GROUP=mysql |
3874 |
- if use prefix ; then |
3875 |
- MYSQL_GROUP=$(id -g -n 2>/dev/null) |
3876 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
3877 |
- die "Failed to determine current user groupname!" |
3878 |
- fi |
3879 |
- fi |
3880 |
- fi |
3881 |
- |
3882 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
3883 |
- local -x HOME="${EROOT}/root" |
3884 |
- |
3885 |
- # Make sure the vars are correctly initialized |
3886 |
- mysql_init_vars |
3887 |
- |
3888 |
- # Read currently set data directory |
3889 |
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
3890 |
- |
3891 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
3892 |
- # localhost. Also causes weird failures. |
3893 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
3894 |
- |
3895 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
3896 |
- die "Sorry, unable to find MY_DATADIR!" |
3897 |
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then |
3898 |
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" |
3899 |
- ewarn "Please rename or delete its content if you wish to initialize a new data directory." |
3900 |
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" |
3901 |
- fi |
3902 |
- |
3903 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
3904 |
- MYSQL_TMPDIR=${MYSQL_TMPDIR%/} |
3905 |
- # These are dir+prefix |
3906 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
3907 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
3908 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
3909 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
3910 |
- |
3911 |
- # Create missing directories. |
3912 |
- # Always check if mysql user can write to directory even if we just |
3913 |
- # created directory because a parent directory might be not |
3914 |
- # accessible for that user. |
3915 |
- PID_DIR="${EROOT}/run/mysqld" |
3916 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
3917 |
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..." |
3918 |
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ |
3919 |
- || die "Failed to create PID directory '${PID_DIR}'!" |
3920 |
- fi |
3921 |
- |
3922 |
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" |
3923 |
- [[ -z "${_pid_dir_testfile}" ]] \ |
3924 |
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
3925 |
- |
3926 |
- if use prefix ; then |
3927 |
- touch "${_pid_dir_testfile}" &>/dev/null |
3928 |
- else |
3929 |
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null |
3930 |
- fi |
3931 |
- |
3932 |
- if [[ $? -ne 0 ]] ; then |
3933 |
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" |
3934 |
- else |
3935 |
- rm "${_pid_dir_testfile}" || die |
3936 |
- unset _pid_dir_testfile |
3937 |
- fi |
3938 |
- |
3939 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
3940 |
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." |
3941 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ |
3942 |
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" |
3943 |
- fi |
3944 |
- |
3945 |
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" |
3946 |
- [[ -z "${_my_datadir_testfile}" ]] \ |
3947 |
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
3948 |
- |
3949 |
- if use prefix ; then |
3950 |
- touch "${_my_datadir_testfile}" &>/dev/null |
3951 |
- else |
3952 |
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null |
3953 |
- fi |
3954 |
- |
3955 |
- if [[ $? -ne 0 ]] ; then |
3956 |
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" |
3957 |
- else |
3958 |
- rm "${_my_datadir_testfile}" || die |
3959 |
- unset _my_datadir_testfile |
3960 |
- fi |
3961 |
- |
3962 |
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then |
3963 |
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." |
3964 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ |
3965 |
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" |
3966 |
- fi |
3967 |
- |
3968 |
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then |
3969 |
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" |
3970 |
- [[ -z "${MYSQL_TMPDIR}" ]] \ |
3971 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" |
3972 |
- |
3973 |
- mkdir "${MYSQL_TMPDIR}" || die |
3974 |
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die |
3975 |
- fi |
3976 |
- |
3977 |
- # Now we need to test MYSQL_TMPDIR... |
3978 |
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" |
3979 |
- [[ -z "${_my_tmpdir_testfile}" ]] \ |
3980 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
3981 |
- |
3982 |
- if use prefix ; then |
3983 |
- touch "${_my_tmpdir_testfile}" &>/dev/null |
3984 |
- else |
3985 |
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null |
3986 |
- fi |
3987 |
- |
3988 |
- if [[ $? -ne 0 ]] ; then |
3989 |
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" |
3990 |
- else |
3991 |
- rm "${_my_tmpdir_testfile}" || die |
3992 |
- unset _my_tmpdir_testfile |
3993 |
- fi |
3994 |
- |
3995 |
- if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then |
3996 |
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." |
3997 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ |
3998 |
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" |
3999 |
- fi |
4000 |
- |
4001 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
4002 |
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" |
4003 |
- [[ -z "${_my_logbin_testfile}" ]] \ |
4004 |
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" |
4005 |
- |
4006 |
- if use prefix ; then |
4007 |
- touch "${_my_logbin_testfile}" &>/dev/null |
4008 |
- else |
4009 |
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null |
4010 |
- fi |
4011 |
- |
4012 |
- if [[ $? -ne 0 ]] ; then |
4013 |
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" |
4014 |
- else |
4015 |
- rm "${_my_logbin_testfile}" || die |
4016 |
- unset _my_logbin_testfile |
4017 |
- fi |
4018 |
- fi |
4019 |
- |
4020 |
- if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then |
4021 |
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." |
4022 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ |
4023 |
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" |
4024 |
- fi |
4025 |
- |
4026 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
4027 |
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" |
4028 |
- [[ -z "${_my_relaylog_testfile}" ]] \ |
4029 |
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" |
4030 |
- |
4031 |
- if use prefix ; then |
4032 |
- touch "${_my_relaylog_testfile}" &>/dev/null |
4033 |
- else |
4034 |
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null |
4035 |
- fi |
4036 |
- |
4037 |
- if [[ $? -ne 0 ]] ; then |
4038 |
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" |
4039 |
- else |
4040 |
- rm "${_my_relaylog_testfile}" || die |
4041 |
- unset _my_relaylog_testfile |
4042 |
- fi |
4043 |
- fi |
4044 |
- |
4045 |
- local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" |
4046 |
- if [[ -z "${mysql_install_log}" ]] ; then |
4047 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" |
4048 |
- else |
4049 |
- # make sure file is writable for MYSQL_USER... |
4050 |
- touch "${mysql_install_log}" || die |
4051 |
- chown ${MYSQL_USER} "${mysql_install_log}" || die |
4052 |
- fi |
4053 |
- |
4054 |
- local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" |
4055 |
- if [[ -z "${mysqld_logfile}" ]] ; then |
4056 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" |
4057 |
- else |
4058 |
- # make sure file is writable for MYSQL_USER... |
4059 |
- touch "${mysqld_logfile}" || die |
4060 |
- chown ${MYSQL_USER} "${mysqld_logfile}" || die |
4061 |
- fi |
4062 |
- |
4063 |
- echo "" |
4064 |
- einfo "Detected settings:" |
4065 |
- einfo "==================" |
4066 |
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}" |
4067 |
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" |
4068 |
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}" |
4069 |
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" |
4070 |
- |
4071 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
4072 |
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" |
4073 |
- fi |
4074 |
- |
4075 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
4076 |
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" |
4077 |
- fi |
4078 |
- |
4079 |
- einfo "PID DIR:\t\t\t\t${PID_DIR}" |
4080 |
- einfo "Install db log:\t\t\t${mysql_install_log}" |
4081 |
- einfo "Install server log:\t\t\t${mysqld_logfile}" |
4082 |
- |
4083 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
4084 |
- local tmp_mysqld_password_source= |
4085 |
- |
4086 |
- for tmp_mysqld_password_source in mysql client ; do |
4087 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
4088 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
4089 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
4090 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
4091 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
4092 |
- MYSQL_ROOT_PASSWORD= |
4093 |
- continue |
4094 |
- fi |
4095 |
- |
4096 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
4097 |
- break |
4098 |
- fi |
4099 |
- done |
4100 |
- |
4101 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
4102 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
4103 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
4104 |
- fi |
4105 |
- |
4106 |
- unset tmp_mysqld_password_source |
4107 |
- fi |
4108 |
- |
4109 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
4110 |
- local pwd1="a" |
4111 |
- local pwd2="b" |
4112 |
- |
4113 |
- echo |
4114 |
- einfo "No password for mysql 'root' user was specified via environment" |
4115 |
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" |
4116 |
- einfo "file like '${HOME}/.my.cnf'." |
4117 |
- einfo "To continue please provide a password for the mysql 'root' user" |
4118 |
- einfo "now on console:" |
4119 |
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" |
4120 |
- read -rsp " >" pwd1 ; echo |
4121 |
- |
4122 |
- einfo "Retype the password" |
4123 |
- read -rsp " >" pwd2 ; echo |
4124 |
- |
4125 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
4126 |
- die "Passwords are not the same!" |
4127 |
- fi |
4128 |
- |
4129 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
4130 |
- unset pwd1 pwd2 |
4131 |
- |
4132 |
- echo |
4133 |
- fi |
4134 |
- |
4135 |
- local -a mysqld_options |
4136 |
- |
4137 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
4138 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
4139 |
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) |
4140 |
- |
4141 |
- # Figure out which options we need to disable to do the setup |
4142 |
- local helpfile="${TMPDIR}/mysqld-help" |
4143 |
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
4144 |
- |
4145 |
- local opt optexp optfull |
4146 |
- for opt in host-cache name-resolve networking slave-start \ |
4147 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
4148 |
- log-slave-updates \ |
4149 |
- ; do |
4150 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
4151 |
- egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) |
4152 |
- done |
4153 |
- |
4154 |
- # Prepare timezones, see |
4155 |
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
4156 |
- local tz_sql="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" |
4157 |
- [[ -z "${tz_sql}" ]] \ |
4158 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" |
4159 |
- |
4160 |
- echo "USE mysql;" >"${tz_sql}" |
4161 |
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null |
4162 |
- if [[ $? -ne 0 ]] ; then |
4163 |
- die "mysql_tzinfo_to_sql failed!" |
4164 |
- fi |
4165 |
- |
4166 |
- # --initialize-insecure will not set root password |
4167 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
4168 |
- local cmd=( |
4169 |
- "${mysqld_binary}" |
4170 |
- "${mysqld_options[@]}" |
4171 |
- "--initialize-insecure" |
4172 |
- "--init-file='${tz_sql}'" |
4173 |
- "--basedir='${EROOT}/usr'" |
4174 |
- "--datadir='${MY_DATADIR}'" |
4175 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
4176 |
- "--log-error='${mysql_install_log}'" |
4177 |
- "--user=${MYSQL_USER}" |
4178 |
- ) |
4179 |
- |
4180 |
- einfo "Initializing ${PN} data directory: ${cmd[@]}" |
4181 |
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 |
4182 |
- |
4183 |
- if [[ $? -ne 0 ]] ; then |
4184 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 |
4185 |
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" |
4186 |
- fi |
4187 |
- |
4188 |
- rm "${tz_sql}" || die |
4189 |
- |
4190 |
- local x=${RANDOM} |
4191 |
- local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" |
4192 |
- local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" |
4193 |
- unset x |
4194 |
- |
4195 |
- cmd=( |
4196 |
- "${mysqld_binary}" |
4197 |
- "${mysqld_options[@]}" |
4198 |
- "--basedir='${EROOT}/usr'" |
4199 |
- "--datadir='${MY_DATADIR}'" |
4200 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
4201 |
- --max_allowed_packet=8M |
4202 |
- --net_buffer_length=16K |
4203 |
- "--socket='${socket}'" |
4204 |
- "--pid-file='${pidfile}'" |
4205 |
- "--log-error='${mysqld_logfile}'" |
4206 |
- "--user=${MYSQL_USER}" |
4207 |
- ) |
4208 |
- |
4209 |
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}" |
4210 |
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & |
4211 |
- |
4212 |
- echo -n "Waiting for mysqld to accept connections " |
4213 |
- local maxtry=15 |
4214 |
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
4215 |
- maxtry=$((${maxtry}-1)) |
4216 |
- echo -n "." |
4217 |
- sleep 1 |
4218 |
- done |
4219 |
- |
4220 |
- if [[ -S "${socket}" ]] ; then |
4221 |
- # Even with a socket we don't know if mysqld will abort |
4222 |
- # start due to an error so just wait a little bit more... |
4223 |
- maxtry=5 |
4224 |
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
4225 |
- maxtry=$((${maxtry}-1)) |
4226 |
- echo -n "." |
4227 |
- sleep 1 |
4228 |
- done |
4229 |
- fi |
4230 |
- |
4231 |
- echo |
4232 |
- |
4233 |
- if [[ ! -S "${socket}" ]] ; then |
4234 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 |
4235 |
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" |
4236 |
- fi |
4237 |
- |
4238 |
- local mysql_logfile="${TMPDIR}/set_root_pw.log" |
4239 |
- touch "${mysql_logfile}" || die |
4240 |
- |
4241 |
- ebegin "Setting root password" |
4242 |
- # Do this from memory, as we don't want clear text passwords in temp files |
4243 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" |
4244 |
- cmd=( |
4245 |
- "${mysql_binary}" |
4246 |
- --no-defaults |
4247 |
- "--socket='${socket}'" |
4248 |
- -hlocalhost |
4249 |
- "-e \"${sql}\"" |
4250 |
- ) |
4251 |
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 |
4252 |
- local rc=$? |
4253 |
- eend ${rc} |
4254 |
- |
4255 |
- if [[ ${rc} -ne 0 ]] ; then |
4256 |
- # Poor man's solution which tries to avoid having password |
4257 |
- # in log. NOTE: sed can fail if user didn't follow advice |
4258 |
- # and included character which will require escaping... |
4259 |
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null |
4260 |
- |
4261 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" |
4262 |
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" |
4263 |
- fi |
4264 |
- |
4265 |
- # Stop the server |
4266 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
4267 |
- echo -n "Stopping the server " |
4268 |
- pkill -F "${pidfile}" &>/dev/null |
4269 |
- |
4270 |
- maxtry=10 |
4271 |
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do |
4272 |
- maxtry=$((${maxtry}-1)) |
4273 |
- echo -n "." |
4274 |
- sleep 1 |
4275 |
- done |
4276 |
- |
4277 |
- echo |
4278 |
- |
4279 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
4280 |
- # We somehow failed to stop server. |
4281 |
- # However, not a fatal error. Just warn the user. |
4282 |
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" |
4283 |
- fi |
4284 |
- fi |
4285 |
- |
4286 |
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" |
4287 |
-} |
4288 |
|
4289 |
diff --git a/dev-db/mysql/mysql-8.0.19-r2.ebuild b/dev-db/mysql/mysql-8.0.19-r2.ebuild |
4290 |
deleted file mode 100644 |
4291 |
index f979bb9020f..00000000000 |
4292 |
--- a/dev-db/mysql/mysql-8.0.19-r2.ebuild |
4293 |
+++ /dev/null |
4294 |
@@ -1,1160 +0,0 @@ |
4295 |
-# Copyright 1999-2021 Gentoo Authors |
4296 |
-# Distributed under the terms of the GNU General Public License v2 |
4297 |
- |
4298 |
-EAPI="7" |
4299 |
-MY_EXTRAS_VER="20200317-0103Z" |
4300 |
- |
4301 |
-CMAKE_MAKEFILE_GENERATOR=emake |
4302 |
- |
4303 |
-inherit cmake-utils flag-o-matic linux-info \ |
4304 |
- multiprocessing prefix toolchain-funcs check-reqs |
4305 |
- |
4306 |
-MY_PV="${PV//_pre*}" |
4307 |
-MY_P="${PN}-${MY_PV}" |
4308 |
- |
4309 |
-S="${WORKDIR}/${PN}-${MY_PV}" |
4310 |
- |
4311 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-${MY_PV}.tar.gz |
4312 |
- https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-${MY_PV}.tar.gz |
4313 |
- http://downloads.mysql.com/archives/MySQL-8.0/${PN}-boost-${MY_PV}.tar.gz" |
4314 |
- |
4315 |
-# Gentoo patches to MySQL |
4316 |
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]] ; then |
4317 |
- SRC_URI="${SRC_URI} |
4318 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
4319 |
- https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
4320 |
-fi |
4321 |
- |
4322 |
-HOMEPAGE="https://www.mysql.com/" |
4323 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
4324 |
-LICENSE="GPL-2" |
4325 |
-SLOT="8.0" |
4326 |
-IUSE="cjk cracklib debug jemalloc latin1 numa +perl profiling |
4327 |
- router selinux +server tcmalloc test" |
4328 |
- |
4329 |
-RESTRICT="!test? ( test )" |
4330 |
- |
4331 |
-REQUIRED_USE="?? ( tcmalloc jemalloc ) |
4332 |
- cjk? ( server ) |
4333 |
- jemalloc? ( server ) |
4334 |
- numa? ( server ) |
4335 |
- profiling? ( server ) |
4336 |
- router? ( server ) |
4337 |
- tcmalloc? ( server )" |
4338 |
- |
4339 |
-KEYWORDS="amd64 arm ~arm64 ~hppa ~ia64 ~mips ~ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris" |
4340 |
- |
4341 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
4342 |
-# and we will run a mysql server during test phase |
4343 |
-S="${WORKDIR}/mysql" |
4344 |
- |
4345 |
-if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
4346 |
- inherit git-r3 |
4347 |
- EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
4348 |
- EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
4349 |
- EGIT_CLONE_TYPE=shallow |
4350 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
4351 |
-else |
4352 |
- MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
4353 |
-fi |
4354 |
- |
4355 |
-PATCHES=( |
4356 |
- "${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-8.0.17.patch |
4357 |
- "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-8.0.18.patch |
4358 |
- "${MY_PATCH_DIR}"/20018_all_mysql-5.7.23-fix-grant_user_lock-a-root.patch |
4359 |
- "${MY_PATCH_DIR}"/20018_all_mysql-8.0.19-without-clientlibs-tools.patch |
4360 |
- "${MY_PATCH_DIR}"/20018_all_mysql-8.0.19-fix-events_bugs-test.patch |
4361 |
-) |
4362 |
- |
4363 |
-# Be warned, *DEPEND are version-dependant |
4364 |
-# These are used for both runtime and compiletime |
4365 |
-COMMON_DEPEND=" |
4366 |
- >=app-arch/lz4-0_p131:= |
4367 |
- sys-libs/ncurses:0= |
4368 |
- >=sys-libs/zlib-1.2.3:0= |
4369 |
- >=dev-libs/openssl-1.0.0:0= |
4370 |
- server? ( |
4371 |
- dev-libs/icu:= |
4372 |
- dev-libs/libevent:= |
4373 |
- >=dev-libs/protobuf-3.8:= |
4374 |
- net-libs/libtirpc:= |
4375 |
- cjk? ( app-text/mecab:= ) |
4376 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
4377 |
- kernel_linux? ( |
4378 |
- dev-libs/libaio:0= |
4379 |
- sys-process/procps:0= |
4380 |
- ) |
4381 |
- numa? ( sys-process/numactl ) |
4382 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
4383 |
- ) |
4384 |
-" |
4385 |
-DEPEND="${COMMON_DEPEND} |
4386 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
4387 |
- virtual/yacc |
4388 |
- server? ( net-libs/rpcsvc-proto ) |
4389 |
- test? ( |
4390 |
- acct-group/mysql acct-user/mysql |
4391 |
- dev-perl/JSON |
4392 |
- ) |
4393 |
-" |
4394 |
-RDEPEND="${COMMON_DEPEND} |
4395 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
4396 |
- !dev-db/mysql:0 |
4397 |
- !dev-db/mysql:5.7 |
4398 |
- selinux? ( sec-policy/selinux-mysql ) |
4399 |
- !prefix? ( |
4400 |
- acct-group/mysql acct-user/mysql |
4401 |
- dev-db/mysql-init-scripts |
4402 |
- ) |
4403 |
-" |
4404 |
-# For other stuff to bring us in |
4405 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
4406 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
4407 |
- |
4408 |
-CHECKREQS_DISK_BUILD="8G" |
4409 |
- |
4410 |
-mysql_init_vars() { |
4411 |
- : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
4412 |
- : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
4413 |
- : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
4414 |
- : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
4415 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
4416 |
- |
4417 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
4418 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
4419 |
- export MY_DATADIR |
4420 |
-} |
4421 |
- |
4422 |
-pkg_pretend() { |
4423 |
- [[ ${MERGE_TYPE} == binary ]] && return |
4424 |
- use server && check-reqs_pkg_pretend |
4425 |
-} |
4426 |
- |
4427 |
-pkg_setup() { |
4428 |
- [[ ${MERGE_TYPE} == binary ]] && return |
4429 |
- |
4430 |
- if has test ${FEATURES} ; then |
4431 |
- # Bug #213475 - MySQL _will_ object strenuously if your machine is named |
4432 |
- # localhost. Also causes weird failures. |
4433 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
4434 |
- |
4435 |
- if ! has userpriv ${FEATURES} ; then |
4436 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
4437 |
- fi |
4438 |
- |
4439 |
- local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) |
4440 |
- [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] \ |
4441 |
- && die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!" |
4442 |
- |
4443 |
- if use latin1 ; then |
4444 |
- # Upstream only supports tests with default charset |
4445 |
- die "Testing with USE=latin1 is not supported." |
4446 |
- fi |
4447 |
- fi |
4448 |
- |
4449 |
- if use kernel_linux ; then |
4450 |
- if use numa ; then |
4451 |
- linux-info_get_any_version |
4452 |
- |
4453 |
- local CONFIG_CHECK="~NUMA" |
4454 |
- |
4455 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
4456 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
4457 |
- |
4458 |
- check_extra_config |
4459 |
- fi |
4460 |
- fi |
4461 |
- |
4462 |
- use server && check-reqs_pkg_setup |
4463 |
-} |
4464 |
- |
4465 |
-src_unpack() { |
4466 |
- unpack ${A} |
4467 |
- |
4468 |
- # Grab the patches |
4469 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
4470 |
- |
4471 |
- mv -f "${WORKDIR}/${MY_P}" "${S}" || die |
4472 |
-} |
4473 |
- |
4474 |
-src_prepare() { |
4475 |
- # Avoid rpm call which would trigger sandbox, #692368 |
4476 |
- sed -i \ |
4477 |
- -e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \ |
4478 |
- CMakeLists.txt || die |
4479 |
- |
4480 |
- if use jemalloc ; then |
4481 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
4482 |
- fi |
4483 |
- |
4484 |
- if use tcmalloc ; then |
4485 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
4486 |
- fi |
4487 |
- |
4488 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
4489 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
4490 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
4491 |
- fi |
4492 |
- |
4493 |
- # Remove man pages for client-lib tools we don't install |
4494 |
- rm \ |
4495 |
- man/my_print_defaults.1 \ |
4496 |
- man/perror.1 \ |
4497 |
- man/zlib_decompress.1 \ |
4498 |
- || die |
4499 |
- |
4500 |
- cmake-utils_src_prepare |
4501 |
-} |
4502 |
- |
4503 |
-src_configure() { |
4504 |
- # Bug #114895, bug #110149 |
4505 |
- filter-flags "-O" "-O[01]" |
4506 |
- |
4507 |
- append-cxxflags -felide-constructors |
4508 |
- |
4509 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
4510 |
- append-flags -fno-strict-aliasing |
4511 |
- |
4512 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
4513 |
- |
4514 |
- # debug hack wrt #497532 |
4515 |
- mycmakeargs=( |
4516 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
4517 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
4518 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
4519 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
4520 |
- -DINSTALL_BINDIR=bin |
4521 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
4522 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
4523 |
- -DINSTALL_INCLUDEDIR=include/mysql |
4524 |
- -DINSTALL_INFODIR=share/info |
4525 |
- -DINSTALL_LIBDIR=$(get_libdir) |
4526 |
- -DINSTALL_MANDIR=share/man |
4527 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
4528 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
4529 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
4530 |
- -DINSTALL_SBINDIR=sbin |
4531 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
4532 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
4533 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
4534 |
- # Using bundled editline to get CTRL+C working |
4535 |
- -DWITH_EDITLINE=bundled |
4536 |
- -DWITH_ZLIB=system |
4537 |
- -DWITH_SSL=system |
4538 |
- -DWITH_LIBWRAP=0 |
4539 |
- -DENABLED_LOCAL_INFILE=1 |
4540 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
4541 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
4542 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
4543 |
- # The build forces this to be defined when cross-compiling. We pass it |
4544 |
- # all the time for simplicity and to make sure it is actually correct. |
4545 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
4546 |
- -DCMAKE_POSITION_INDEPENDENT_CODE=ON |
4547 |
- -DWITH_CURL=system |
4548 |
- -DWITH_BOOST="${S}/boost" |
4549 |
- -DWITH_ROUTER=$(usex router ON OFF) |
4550 |
- ) |
4551 |
- |
4552 |
- if is-flagq -fno-lto ; then |
4553 |
- einfo "LTO disabled via {C,CXX,F,FC}FLAGS" |
4554 |
- mycmakeargs+=( -DWITH_LTO=OFF ) |
4555 |
- elif is-flagq -flto ; then |
4556 |
- einfo "LTO forced via {C,CXX,F,FC}FLAGS" |
4557 |
- myconf+=( -DWITH_LTO=ON ) |
4558 |
- else |
4559 |
- # Disable automagic |
4560 |
- myconf+=( -DWITH_LTO=OFF ) |
4561 |
- fi |
4562 |
- |
4563 |
- if use test ; then |
4564 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
4565 |
- else |
4566 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
4567 |
- fi |
4568 |
- |
4569 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
4570 |
- |
4571 |
- mycmakeargs+=( |
4572 |
- -DWITH_ICU=system |
4573 |
- -DWITH_LZ4=system |
4574 |
- # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex |
4575 |
- -DWITH_RAPIDJSON=bundled |
4576 |
- ) |
4577 |
- |
4578 |
- if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then |
4579 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
4580 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
4581 |
- ewarn "You MUST file bugs without these variables set." |
4582 |
- ewarn "Tests will probably fail!" |
4583 |
- |
4584 |
- mycmakeargs+=( |
4585 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
4586 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
4587 |
- ) |
4588 |
- elif use latin1 ; then |
4589 |
- mycmakeargs+=( |
4590 |
- -DDEFAULT_CHARSET=latin1 |
4591 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
4592 |
- ) |
4593 |
- else |
4594 |
- mycmakeargs+=( |
4595 |
- -DDEFAULT_CHARSET=utf8mb4 |
4596 |
- -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci |
4597 |
- ) |
4598 |
- fi |
4599 |
- |
4600 |
- if use server ; then |
4601 |
- mycmakeargs+=( |
4602 |
- -DWITH_EXTRA_CHARSETS=all |
4603 |
- -DWITH_DEBUG=$(usex debug) |
4604 |
- -DWITH_MECAB=$(usex cjk system OFF) |
4605 |
- -DWITH_LIBEVENT=system |
4606 |
- -DWITH_PROTOBUF=system |
4607 |
- -DWITH_NUMA=$(usex numa ON OFF) |
4608 |
- ) |
4609 |
- |
4610 |
- if use profiling ; then |
4611 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
4612 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
4613 |
- # "main.mysqld--help-notwin" test to fail |
4614 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
4615 |
- fi |
4616 |
- |
4617 |
- # Storage engines |
4618 |
- mycmakeargs+=( |
4619 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
4620 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
4621 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
4622 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
4623 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
4624 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
4625 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
4626 |
- -DWITH_INNODB_MEMCACHED=0 |
4627 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
4628 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
4629 |
- ) |
4630 |
- else |
4631 |
- mycmakeargs+=( |
4632 |
- -DWITHOUT_SERVER=1 |
4633 |
- -DWITH_SYSTEMD=no |
4634 |
- ) |
4635 |
- fi |
4636 |
- |
4637 |
- cmake-utils_src_configure |
4638 |
-} |
4639 |
- |
4640 |
-# Official test instructions: |
4641 |
-# ulimit -n 16500 && \ |
4642 |
-# USE='perl server' \ |
4643 |
-# FEATURES='test userpriv' \ |
4644 |
-# ebuild mysql-X.X.XX.ebuild \ |
4645 |
-# digest clean package |
4646 |
-src_test() { |
4647 |
- _disable_test() { |
4648 |
- local rawtestname bug reason |
4649 |
- rawtestname="${1}" ; shift |
4650 |
- bug="${1}" ; shift |
4651 |
- reason="${@}" |
4652 |
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" |
4653 |
- echo ${rawtestname} : BUG#${bug} ${reason} >> "${T}/disabled.def" |
4654 |
- } |
4655 |
- |
4656 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
4657 |
- local retstatus_unit |
4658 |
- local retstatus_tests |
4659 |
- |
4660 |
- # Run CTest (test-units) |
4661 |
- cmake-utils_src_test |
4662 |
- retstatus_unit=$? |
4663 |
- |
4664 |
- # Ensure that parallel runs don't die |
4665 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
4666 |
- |
4667 |
- if [[ -z "${MTR_PARALLEL}" ]] ; then |
4668 |
- local -x MTR_PARALLEL=$(makeopts_jobs) |
4669 |
- |
4670 |
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then |
4671 |
- # Running multiple tests in parallel usually require higher ulimit |
4672 |
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update |
4673 |
- # are known to hit timeout when system is busy. |
4674 |
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of |
4675 |
- # using "auto". |
4676 |
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" |
4677 |
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" |
4678 |
- einfo "${info_msg}" |
4679 |
- unset info_msg |
4680 |
- MTR_PARALLEL=4 |
4681 |
- fi |
4682 |
- else |
4683 |
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" |
4684 |
- fi |
4685 |
- |
4686 |
- # create directories because mysqladmin might run out of order |
4687 |
- mkdir -p "${T}"/var-tests{,/log} || die |
4688 |
- |
4689 |
- # Run mysql tests |
4690 |
- pushd "${TESTDIR}" &>/dev/null || die |
4691 |
- |
4692 |
- touch "${T}/disabled.def" |
4693 |
- |
4694 |
- local -a disabled_tests |
4695 |
- disabled_tests+=( "auth_sec.keyring_file_data_qa;0;Won't work with user privileges" ) |
4696 |
- disabled_tests+=( "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" ) |
4697 |
- disabled_tests+=( "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" ) |
4698 |
- disabled_tests+=( "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" ) |
4699 |
- disabled_tests+=( "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" ) |
4700 |
- disabled_tests+=( "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" ) |
4701 |
- disabled_tests+=( "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" ) |
4702 |
- disabled_tests+=( "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" ) |
4703 |
- disabled_tests+=( "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" ) |
4704 |
- disabled_tests+=( "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" ) |
4705 |
- disabled_tests+=( "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" ) |
4706 |
- disabled_tests+=( "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
4707 |
- disabled_tests+=( "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
4708 |
- disabled_tests+=( "rpl_gtid.rpl_gtid_stm_drop_table;90612;Known test failure" ) |
4709 |
- disabled_tests+=( "rpl_gtid.rpl_multi_source_mtr_includes;0;Known failure - no upstream bug yet" ) |
4710 |
- disabled_tests+=( "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware") |
4711 |
- disabled_tests+=( "x.connection;0;Known failure - no upstream bug yet" ) |
4712 |
- disabled_tests+=( "main.mysqlpump_basic_lz4;0;Extra tool output causes false positive" ) |
4713 |
- disabled_tests+=( "x.message_compressed_payload;0;False positive caused by protobuff-3.11+" ) |
4714 |
- disabled_tests+=( "x.message_protobuf_nested;0;False positive caused by protobuff-3.11+" ) |
4715 |
- |
4716 |
- local test_infos_str test_infos_arr |
4717 |
- for test_infos_str in "${disabled_tests[@]}" ; do |
4718 |
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" |
4719 |
- |
4720 |
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then |
4721 |
- die "Invalid test data set, not matching format: ${test_infos_str}" |
4722 |
- fi |
4723 |
- |
4724 |
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" |
4725 |
- done |
4726 |
- unset test_infos_str test_infos_arr |
4727 |
- |
4728 |
- # Try to increase file limits to increase test coverage |
4729 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
4730 |
- # Upper limit comes from parts.partition_* tests |
4731 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
4732 |
- |
4733 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
4734 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
4735 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
4736 |
- |
4737 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
4738 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
4739 |
- else |
4740 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
4741 |
- fi |
4742 |
- else |
4743 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
4744 |
- fi |
4745 |
- else |
4746 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
4747 |
- fi |
4748 |
- |
4749 |
- # run mysql-test tests |
4750 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
4751 |
- retstatus_tests=$? |
4752 |
- |
4753 |
- popd &>/dev/null || die |
4754 |
- |
4755 |
- # Cleanup is important for these testcases. |
4756 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
4757 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
4758 |
- |
4759 |
- local failures="" |
4760 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
4761 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
4762 |
- |
4763 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
4764 |
- einfo "Tests successfully completed" |
4765 |
-} |
4766 |
- |
4767 |
-src_install() { |
4768 |
- cmake-utils_src_install |
4769 |
- |
4770 |
- # Make sure the vars are correctly initialized |
4771 |
- mysql_init_vars |
4772 |
- |
4773 |
- # Convenience links |
4774 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
4775 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
4776 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
4777 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
4778 |
- |
4779 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
4780 |
- if [[ -d "${ED}/usr/data" ]] ; then |
4781 |
- rm -Rf "${ED}/usr/data" || die |
4782 |
- fi |
4783 |
- |
4784 |
- # Unless they explicitly specific USE=test, then do not install the |
4785 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
4786 |
- # validation of your database configuration after tuning it. |
4787 |
- if ! use test ; then |
4788 |
- rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test" |
4789 |
- fi |
4790 |
- |
4791 |
- # Configuration stuff |
4792 |
- einfo "Building default configuration ..." |
4793 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
4794 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
4795 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
4796 |
- eprefixify "${TMPDIR}/my.cnf" |
4797 |
- doins "${TMPDIR}/my.cnf" |
4798 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
4799 |
- cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
4800 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
4801 |
- doins "${TMPDIR}/50-distro-client.cnf" |
4802 |
- |
4803 |
- mycnf_src="my.cnf-8.0.distro-server" |
4804 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
4805 |
- "${FILESDIR}/${mycnf_src}" \ |
4806 |
- > "${TMPDIR}/my.cnf.ok" || die |
4807 |
- |
4808 |
- if use prefix ; then |
4809 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
4810 |
- "${TMPDIR}/my.cnf.ok" || die |
4811 |
- fi |
4812 |
- |
4813 |
- if use latin1 ; then |
4814 |
- sed -i \ |
4815 |
- -e "/character-set/s|utf8mb4|latin1|g" \ |
4816 |
- "${TMPDIR}/my.cnf.ok" || die |
4817 |
- fi |
4818 |
- |
4819 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
4820 |
- |
4821 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
4822 |
- |
4823 |
- #Remove mytop if perl is not selected |
4824 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
4825 |
- |
4826 |
- if use router ; then |
4827 |
- rm -rf \ |
4828 |
- "${ED}/usr/LICENSE.router" \ |
4829 |
- "${ED}/usr/README.router" \ |
4830 |
- "${ED}/usr/run" \ |
4831 |
- "${ED}/usr/var" \ |
4832 |
- || die |
4833 |
- fi |
4834 |
- |
4835 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
4836 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
4837 |
-} |
4838 |
- |
4839 |
-pkg_postinst() { |
4840 |
- # Make sure the vars are correctly initialized |
4841 |
- mysql_init_vars |
4842 |
- |
4843 |
- # Create log directory securely if it does not exist |
4844 |
- # NOTE: $MY_LOGDIR contains $EPREFIX by default |
4845 |
- [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" |
4846 |
- |
4847 |
- # Note about configuration change |
4848 |
- einfo |
4849 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
4850 |
- elog "to several files in /etc/mysql/mysql.d." |
4851 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
4852 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
4853 |
- elog "You may have as many files as needed and they are read alphabetically." |
4854 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
4855 |
- einfo |
4856 |
- |
4857 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
4858 |
- einfo |
4859 |
- elog "You might want to run:" |
4860 |
- elog " \"emerge --config =${CATEGORY}/${PF}\"" |
4861 |
- elog "if this is a new install." |
4862 |
- einfo |
4863 |
- else |
4864 |
- einfo |
4865 |
- elog "Upgrade process for ${PN}-8.x has changed. Please read" |
4866 |
- elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html" |
4867 |
- einfo |
4868 |
- fi |
4869 |
-} |
4870 |
- |
4871 |
-pkg_config() { |
4872 |
- _getoptval() { |
4873 |
- local section="$1" |
4874 |
- local flag="--${2}=" |
4875 |
- local extra_options="${3}" |
4876 |
- local cmd=( |
4877 |
- "${my_print_defaults_binary}" |
4878 |
- "${extra_options}" |
4879 |
- "${section}" |
4880 |
- ) |
4881 |
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) |
4882 |
- |
4883 |
- if [[ ${#results[@]} -gt 0 ]] ; then |
4884 |
- # When option is set multiple times only return last value |
4885 |
- echo "${results[-1]}" |
4886 |
- fi |
4887 |
- } |
4888 |
- |
4889 |
- _mktemp_dry() { |
4890 |
- # emktemp has no --dry-run option |
4891 |
- local template="${1}" |
4892 |
- |
4893 |
- if [[ -z "${template}" ]] ; then |
4894 |
- if [[ -z "${T}" ]] ; then |
4895 |
- template="/tmp/XXXXXXX" |
4896 |
- else |
4897 |
- template="${T}/XXXXXXX" |
4898 |
- fi |
4899 |
- fi |
4900 |
- |
4901 |
- local template_wo_X=${template//X/} |
4902 |
- local n_X |
4903 |
- let n_X=${#template}-${#template_wo_X} |
4904 |
- if [[ ${n_X} -lt 3 ]] ; then |
4905 |
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 |
4906 |
- return |
4907 |
- fi |
4908 |
- |
4909 |
- local attempts=0 |
4910 |
- local character tmpfile |
4911 |
- while [[ true ]] ; do |
4912 |
- let attempts=attempts+1 |
4913 |
- |
4914 |
- new_file= |
4915 |
- while read -n1 character ; do |
4916 |
- if [[ "${character}" == "X" ]] ; then |
4917 |
- tmpfile+="${RANDOM:0:1}" |
4918 |
- else |
4919 |
- tmpfile+="${character}" |
4920 |
- fi |
4921 |
- done < <(echo -n "${template}") |
4922 |
- |
4923 |
- if [[ ! -f "${tmpfile}" ]] |
4924 |
- then |
4925 |
- echo "${tmpfile}" |
4926 |
- return |
4927 |
- fi |
4928 |
- |
4929 |
- if [[ ${attempts} -ge 100 ]] ; then |
4930 |
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 |
4931 |
- return |
4932 |
- fi |
4933 |
- done |
4934 |
- } |
4935 |
- |
4936 |
- local mysqld_binary="${EROOT}/usr/sbin/mysqld" |
4937 |
- if [[ ! -x "${mysqld_binary}" ]] ; then |
4938 |
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
4939 |
- fi |
4940 |
- |
4941 |
- local mysql_binary="${EROOT}/usr/bin/mysql" |
4942 |
- if [[ ! -x "${mysql_binary}" ]] ; then |
4943 |
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
4944 |
- fi |
4945 |
- |
4946 |
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" |
4947 |
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then |
4948 |
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" |
4949 |
- fi |
4950 |
- |
4951 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
4952 |
- MYSQL_USER=mysql |
4953 |
- if use prefix ; then |
4954 |
- MYSQL_USER=$(id -u -n 2>/dev/null) |
4955 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
4956 |
- die "Failed to determine current username!" |
4957 |
- fi |
4958 |
- fi |
4959 |
- fi |
4960 |
- |
4961 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
4962 |
- MYSQL_GROUP=mysql |
4963 |
- if use prefix ; then |
4964 |
- MYSQL_GROUP=$(id -g -n 2>/dev/null) |
4965 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
4966 |
- die "Failed to determine current user groupname!" |
4967 |
- fi |
4968 |
- fi |
4969 |
- fi |
4970 |
- |
4971 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
4972 |
- local -x HOME="${EROOT}/root" |
4973 |
- |
4974 |
- # Make sure the vars are correctly initialized |
4975 |
- mysql_init_vars |
4976 |
- |
4977 |
- # Read currently set data directory |
4978 |
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
4979 |
- |
4980 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
4981 |
- # localhost. Also causes weird failures. |
4982 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
4983 |
- |
4984 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
4985 |
- die "Sorry, unable to find MY_DATADIR!" |
4986 |
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then |
4987 |
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" |
4988 |
- ewarn "Please rename or delete its content if you wish to initialize a new data directory." |
4989 |
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" |
4990 |
- fi |
4991 |
- |
4992 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
4993 |
- # These are dir+prefix |
4994 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
4995 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
4996 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
4997 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
4998 |
- |
4999 |
- # Create missing directories. |
5000 |
- # Always check if mysql user can write to directory even if we just |
5001 |
- # created directory because a parent directory might be not |
5002 |
- # accessible for that user. |
5003 |
- PID_DIR="${EROOT}/run/mysqld" |
5004 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
5005 |
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..." |
5006 |
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ |
5007 |
- || die "Failed to create PID directory '${PID_DIR}'!" |
5008 |
- fi |
5009 |
- |
5010 |
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" |
5011 |
- [[ -z "${_pid_dir_testfile}" ]] \ |
5012 |
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
5013 |
- |
5014 |
- if use prefix ; then |
5015 |
- touch "${_pid_dir_testfile}" &>/dev/null |
5016 |
- else |
5017 |
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null |
5018 |
- fi |
5019 |
- |
5020 |
- if [[ $? -ne 0 ]] ; then |
5021 |
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" |
5022 |
- else |
5023 |
- rm "${_pid_dir_testfile}" || die |
5024 |
- unset _pid_dir_testfile |
5025 |
- fi |
5026 |
- |
5027 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
5028 |
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." |
5029 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ |
5030 |
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" |
5031 |
- fi |
5032 |
- |
5033 |
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" |
5034 |
- [[ -z "${_my_datadir_testfile}" ]] \ |
5035 |
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
5036 |
- |
5037 |
- if use prefix ; then |
5038 |
- touch "${_my_datadir_testfile}" &>/dev/null |
5039 |
- else |
5040 |
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null |
5041 |
- fi |
5042 |
- |
5043 |
- if [[ $? -ne 0 ]] ; then |
5044 |
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" |
5045 |
- else |
5046 |
- rm "${_my_datadir_testfile}" || die |
5047 |
- unset _my_datadir_testfile |
5048 |
- fi |
5049 |
- |
5050 |
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then |
5051 |
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." |
5052 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ |
5053 |
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" |
5054 |
- fi |
5055 |
- |
5056 |
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then |
5057 |
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" |
5058 |
- [[ -z "${MYSQL_TMPDIR}" ]] \ |
5059 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" |
5060 |
- |
5061 |
- mkdir "${MYSQL_TMPDIR}" || die |
5062 |
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die |
5063 |
- fi |
5064 |
- |
5065 |
- # Now we need to test MYSQL_TMPDIR... |
5066 |
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" |
5067 |
- [[ -z "${_my_tmpdir_testfile}" ]] \ |
5068 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
5069 |
- |
5070 |
- if use prefix ; then |
5071 |
- touch "${_my_tmpdir_testfile}" &>/dev/null |
5072 |
- else |
5073 |
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null |
5074 |
- fi |
5075 |
- |
5076 |
- if [[ $? -ne 0 ]] ; then |
5077 |
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" |
5078 |
- else |
5079 |
- rm "${_my_tmpdir_testfile}" || die |
5080 |
- unset _my_tmpdir_testfile |
5081 |
- fi |
5082 |
- |
5083 |
- if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then |
5084 |
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." |
5085 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ |
5086 |
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" |
5087 |
- fi |
5088 |
- |
5089 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
5090 |
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" |
5091 |
- [[ -z "${_my_logbin_testfile}" ]] \ |
5092 |
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" |
5093 |
- |
5094 |
- if use prefix ; then |
5095 |
- touch "${_my_logbin_testfile}" &>/dev/null |
5096 |
- else |
5097 |
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null |
5098 |
- fi |
5099 |
- |
5100 |
- if [[ $? -ne 0 ]] ; then |
5101 |
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" |
5102 |
- else |
5103 |
- rm "${_my_logbin_testfile}" || die |
5104 |
- unset _my_logbin_testfile |
5105 |
- fi |
5106 |
- fi |
5107 |
- |
5108 |
- if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then |
5109 |
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." |
5110 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ |
5111 |
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" |
5112 |
- fi |
5113 |
- |
5114 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
5115 |
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" |
5116 |
- [[ -z "${_my_relaylog_testfile}" ]] \ |
5117 |
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" |
5118 |
- |
5119 |
- if use prefix ; then |
5120 |
- touch "${_my_relaylog_testfile}" &>/dev/null |
5121 |
- else |
5122 |
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null |
5123 |
- fi |
5124 |
- |
5125 |
- if [[ $? -ne 0 ]] ; then |
5126 |
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" |
5127 |
- else |
5128 |
- rm "${_my_relaylog_testfile}" || die |
5129 |
- unset _my_relaylog_testfile |
5130 |
- fi |
5131 |
- fi |
5132 |
- |
5133 |
- local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" |
5134 |
- if [[ -z "${mysql_install_log}" ]] ; then |
5135 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" |
5136 |
- else |
5137 |
- # make sure file is writable for MYSQL_USER... |
5138 |
- touch "${mysql_install_log}" || die |
5139 |
- chown ${MYSQL_USER} "${mysql_install_log}" || die |
5140 |
- fi |
5141 |
- |
5142 |
- local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" |
5143 |
- if [[ -z "${mysqld_logfile}" ]] ; then |
5144 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" |
5145 |
- else |
5146 |
- # make sure file is writable for MYSQL_USER... |
5147 |
- touch "${mysqld_logfile}" || die |
5148 |
- chown ${MYSQL_USER} "${mysqld_logfile}" || die |
5149 |
- fi |
5150 |
- |
5151 |
- echo "" |
5152 |
- einfo "Detected settings:" |
5153 |
- einfo "==================" |
5154 |
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}" |
5155 |
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" |
5156 |
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}" |
5157 |
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" |
5158 |
- |
5159 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
5160 |
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" |
5161 |
- fi |
5162 |
- |
5163 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
5164 |
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" |
5165 |
- fi |
5166 |
- |
5167 |
- einfo "PID DIR:\t\t\t\t${PID_DIR}" |
5168 |
- einfo "Install db log:\t\t\t${mysql_install_log}" |
5169 |
- einfo "Install server log:\t\t\t${mysqld_logfile}" |
5170 |
- |
5171 |
- local -a config_files |
5172 |
- |
5173 |
- local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" |
5174 |
- if [[ -f "${config_file}" ]] ; then |
5175 |
- config_files+=( "${config_file}" ) |
5176 |
- else |
5177 |
- ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..." |
5178 |
- fi |
5179 |
- |
5180 |
- config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" |
5181 |
- if [[ -f "${config_file}" ]] ; then |
5182 |
- config_files+=( "${config_file}" ) |
5183 |
- else |
5184 |
- ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..." |
5185 |
- fi |
5186 |
- |
5187 |
- if [[ ${#config_files[@]} -gt 0 ]] ; then |
5188 |
- if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then |
5189 |
- local user_answer |
5190 |
- |
5191 |
- echo |
5192 |
- einfo "Please select default authentication plugin (enter number or plugin name):" |
5193 |
- einfo "1) caching_sha2_password [MySQL 8.0 default]" |
5194 |
- einfo "2) mysql_native_password [MySQL 5.7 default]" |
5195 |
- einfo |
5196 |
- einfo "For details see:" |
5197 |
- einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" |
5198 |
- read -p " >" user_answer |
5199 |
- echo |
5200 |
- |
5201 |
- case "${user_answer}" in |
5202 |
- 1|caching_sha2_password) |
5203 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password |
5204 |
- ;; |
5205 |
- 2|mysql_native_password) |
5206 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password |
5207 |
- ;; |
5208 |
- '') |
5209 |
- die "No authentication plugin selected!" |
5210 |
- ;; |
5211 |
- *) |
5212 |
- die "Authentication plugin '${user_answer}' is unknown/unsupported!" |
5213 |
- ;; |
5214 |
- esac |
5215 |
- |
5216 |
- echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" |
5217 |
- |
5218 |
- unset user_answer |
5219 |
- fi |
5220 |
- |
5221 |
- local cfg_option cfg_option_tabs cfg_section |
5222 |
- for config_file in "${config_files[@]}" ; do |
5223 |
- cfg_option="default-authentication-plugin" |
5224 |
- cfg_section="mysqld" |
5225 |
- cfg_option_tabs="\t\t" |
5226 |
- if [[ "${config_file}" == *client.cnf ]] ; then |
5227 |
- cfg_option="default-auth" |
5228 |
- cfg_section="client" |
5229 |
- cfg_option_tabs="\t\t\t\t" |
5230 |
- fi |
5231 |
- |
5232 |
- if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then |
5233 |
- einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
5234 |
- sed -i \ |
5235 |
- -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ |
5236 |
- "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" |
5237 |
- else |
5238 |
- einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
5239 |
- sed -i \ |
5240 |
- -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ |
5241 |
- "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" |
5242 |
- fi |
5243 |
- done |
5244 |
- unset cfg_option cfg_option_tabs cfg_section |
5245 |
- fi |
5246 |
- unset config_files config_file |
5247 |
- |
5248 |
- echo |
5249 |
- |
5250 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
5251 |
- local tmp_mysqld_password_source= |
5252 |
- |
5253 |
- for tmp_mysqld_password_source in mysql client ; do |
5254 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
5255 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
5256 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
5257 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
5258 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
5259 |
- MYSQL_ROOT_PASSWORD= |
5260 |
- continue |
5261 |
- fi |
5262 |
- |
5263 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
5264 |
- break |
5265 |
- fi |
5266 |
- done |
5267 |
- |
5268 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
5269 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
5270 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
5271 |
- fi |
5272 |
- |
5273 |
- unset tmp_mysqld_password_source |
5274 |
- fi |
5275 |
- |
5276 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
5277 |
- local pwd1="a" |
5278 |
- local pwd2="b" |
5279 |
- |
5280 |
- echo |
5281 |
- einfo "No password for mysql 'root' user was specified via environment" |
5282 |
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" |
5283 |
- einfo "file like '${HOME}/.my.cnf'." |
5284 |
- einfo "To continue please provide a password for the mysql 'root' user" |
5285 |
- einfo "now on console:" |
5286 |
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" |
5287 |
- read -rsp " >" pwd1 ; echo |
5288 |
- |
5289 |
- einfo "Retype the password" |
5290 |
- read -rsp " >" pwd2 ; echo |
5291 |
- |
5292 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
5293 |
- die "Passwords are not the same!" |
5294 |
- fi |
5295 |
- |
5296 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
5297 |
- unset pwd1 pwd2 |
5298 |
- |
5299 |
- echo |
5300 |
- fi |
5301 |
- |
5302 |
- local -a mysqld_options |
5303 |
- |
5304 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
5305 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
5306 |
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) |
5307 |
- |
5308 |
- # Figure out which options we need to disable to do the setup |
5309 |
- local helpfile="${TMPDIR}/mysqld-help" |
5310 |
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
5311 |
- |
5312 |
- local opt optexp optfull |
5313 |
- for opt in host-cache name-resolve networking slave-start \ |
5314 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
5315 |
- log-slave-updates \ |
5316 |
- ; do |
5317 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
5318 |
- egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) |
5319 |
- done |
5320 |
- |
5321 |
- # Prepare timezones, see |
5322 |
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
5323 |
- local tz_sql="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" |
5324 |
- [[ -z "${tz_sql}" ]] \ |
5325 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" |
5326 |
- |
5327 |
- echo "USE mysql;" >"${tz_sql}" |
5328 |
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null |
5329 |
- if [[ $? -ne 0 ]] ; then |
5330 |
- die "mysql_tzinfo_to_sql failed!" |
5331 |
- fi |
5332 |
- |
5333 |
- # --initialize-insecure will not set root password |
5334 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
5335 |
- local cmd=( |
5336 |
- "${mysqld_binary}" |
5337 |
- "${mysqld_options[@]}" |
5338 |
- "--initialize-insecure" |
5339 |
- "--init-file='${tz_sql}'" |
5340 |
- "--basedir='${EROOT}/usr'" |
5341 |
- "--datadir='${MY_DATADIR}'" |
5342 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
5343 |
- "--log-error='${mysql_install_log}'" |
5344 |
- "--user=${MYSQL_USER}" |
5345 |
- ) |
5346 |
- |
5347 |
- einfo "Initializing ${PN} data directory: ${cmd[@]}" |
5348 |
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 |
5349 |
- |
5350 |
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then |
5351 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 |
5352 |
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" |
5353 |
- fi |
5354 |
- |
5355 |
- rm "${tz_sql}" || die |
5356 |
- |
5357 |
- local x=${RANDOM} |
5358 |
- local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" |
5359 |
- local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" |
5360 |
- unset x |
5361 |
- |
5362 |
- cmd=( |
5363 |
- "${mysqld_binary}" |
5364 |
- "${mysqld_options[@]}" |
5365 |
- "--basedir='${EROOT}/usr'" |
5366 |
- "--datadir='${MY_DATADIR}'" |
5367 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
5368 |
- --max_allowed_packet=8M |
5369 |
- --net_buffer_length=16K |
5370 |
- "--socket='${socket}'" |
5371 |
- "--pid-file='${pidfile}'" |
5372 |
- "--log-error='${mysqld_logfile}'" |
5373 |
- "--user=${MYSQL_USER}" |
5374 |
- ) |
5375 |
- |
5376 |
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}" |
5377 |
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & |
5378 |
- |
5379 |
- echo -n "Waiting for mysqld to accept connections " |
5380 |
- local maxtry=15 |
5381 |
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
5382 |
- maxtry=$((${maxtry}-1)) |
5383 |
- echo -n "." |
5384 |
- sleep 1 |
5385 |
- done |
5386 |
- |
5387 |
- if [[ -S "${socket}" ]] ; then |
5388 |
- # Even with a socket we don't know if mysqld will abort |
5389 |
- # start due to an error so just wait a little bit more... |
5390 |
- maxtry=5 |
5391 |
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
5392 |
- maxtry=$((${maxtry}-1)) |
5393 |
- echo -n "." |
5394 |
- sleep 1 |
5395 |
- done |
5396 |
- fi |
5397 |
- |
5398 |
- echo |
5399 |
- |
5400 |
- if [[ ! -S "${socket}" ]] ; then |
5401 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 |
5402 |
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" |
5403 |
- fi |
5404 |
- |
5405 |
- local mysql_logfile="${TMPDIR}/set_root_pw.log" |
5406 |
- touch "${mysql_logfile}" || die |
5407 |
- |
5408 |
- ebegin "Setting root password" |
5409 |
- # Do this from memory, as we don't want clear text passwords in temp files |
5410 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" |
5411 |
- cmd=( |
5412 |
- "${mysql_binary}" |
5413 |
- --no-defaults |
5414 |
- "--socket='${socket}'" |
5415 |
- -hlocalhost |
5416 |
- "-e \"${sql}\"" |
5417 |
- ) |
5418 |
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 |
5419 |
- local rc=$? |
5420 |
- eend ${rc} |
5421 |
- |
5422 |
- if [[ ${rc} -ne 0 ]] ; then |
5423 |
- # Poor man's solution which tries to avoid having password |
5424 |
- # in log. NOTE: sed can fail if user didn't follow advice |
5425 |
- # and included character which will require escaping... |
5426 |
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null |
5427 |
- |
5428 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" |
5429 |
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" |
5430 |
- fi |
5431 |
- |
5432 |
- # Stop the server |
5433 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
5434 |
- echo -n "Stopping the server " |
5435 |
- pkill -F "${pidfile}" &>/dev/null |
5436 |
- |
5437 |
- maxtry=10 |
5438 |
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do |
5439 |
- maxtry=$((${maxtry}-1)) |
5440 |
- echo -n "." |
5441 |
- sleep 1 |
5442 |
- done |
5443 |
- |
5444 |
- echo |
5445 |
- |
5446 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
5447 |
- # We somehow failed to stop server. |
5448 |
- # However, not a fatal error. Just warn the user. |
5449 |
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" |
5450 |
- fi |
5451 |
- fi |
5452 |
- |
5453 |
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" |
5454 |
-} |
5455 |
|
5456 |
diff --git a/dev-db/mysql/mysql-8.0.20-r1.ebuild b/dev-db/mysql/mysql-8.0.20-r1.ebuild |
5457 |
deleted file mode 100644 |
5458 |
index 70c3c6e5e87..00000000000 |
5459 |
--- a/dev-db/mysql/mysql-8.0.20-r1.ebuild |
5460 |
+++ /dev/null |
5461 |
@@ -1,1143 +0,0 @@ |
5462 |
-# Copyright 1999-2021 Gentoo Authors |
5463 |
-# Distributed under the terms of the GNU General Public License v2 |
5464 |
- |
5465 |
-EAPI="7" |
5466 |
- |
5467 |
-CMAKE_MAKEFILE_GENERATOR=emake |
5468 |
- |
5469 |
-inherit cmake-utils flag-o-matic linux-info \ |
5470 |
- multiprocessing prefix toolchain-funcs check-reqs |
5471 |
- |
5472 |
-MY_PV="${PV//_pre*}" |
5473 |
-MY_P="${PN}-${MY_PV}" |
5474 |
- |
5475 |
-# Patch version |
5476 |
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/mysql/${PN}-8.0.20-patches-01.tar.xz" |
5477 |
- |
5478 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-${MY_PV}.tar.gz |
5479 |
- https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-${MY_PV}.tar.gz |
5480 |
- http://downloads.mysql.com/archives/MySQL-8.0/${PN}-boost-${MY_PV}.tar.gz |
5481 |
- ${PATCH_SET}" |
5482 |
- |
5483 |
-HOMEPAGE="https://www.mysql.com/" |
5484 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
5485 |
-LICENSE="GPL-2" |
5486 |
-SLOT="8.0" |
5487 |
-IUSE="cjk cracklib debug jemalloc latin1 numa +perl profiling |
5488 |
- router selinux +server tcmalloc test" |
5489 |
- |
5490 |
-RESTRICT="!test? ( test )" |
5491 |
- |
5492 |
-REQUIRED_USE="?? ( tcmalloc jemalloc ) |
5493 |
- cjk? ( server ) |
5494 |
- jemalloc? ( server ) |
5495 |
- numa? ( server ) |
5496 |
- profiling? ( server ) |
5497 |
- router? ( server ) |
5498 |
- tcmalloc? ( server )" |
5499 |
- |
5500 |
-KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris" |
5501 |
- |
5502 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
5503 |
-# and we will run a mysql server during test phase |
5504 |
-S="${WORKDIR}/mysql" |
5505 |
- |
5506 |
-# Be warned, *DEPEND are version-dependant |
5507 |
-# These are used for both runtime and compiletime |
5508 |
-COMMON_DEPEND=" |
5509 |
- >=app-arch/lz4-0_p131:= |
5510 |
- sys-libs/ncurses:0= |
5511 |
- >=sys-libs/zlib-1.2.3:0= |
5512 |
- >=dev-libs/openssl-1.0.0:0= |
5513 |
- server? ( |
5514 |
- dev-libs/icu:= |
5515 |
- dev-libs/libevent:= |
5516 |
- >=dev-libs/protobuf-3.8:= |
5517 |
- net-libs/libtirpc:= |
5518 |
- cjk? ( app-text/mecab:= ) |
5519 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
5520 |
- kernel_linux? ( |
5521 |
- dev-libs/libaio:0= |
5522 |
- sys-process/procps:0= |
5523 |
- ) |
5524 |
- numa? ( sys-process/numactl ) |
5525 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
5526 |
- ) |
5527 |
-" |
5528 |
-DEPEND="${COMMON_DEPEND} |
5529 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
5530 |
- virtual/yacc |
5531 |
- server? ( net-libs/rpcsvc-proto ) |
5532 |
- test? ( |
5533 |
- acct-group/mysql acct-user/mysql |
5534 |
- dev-perl/JSON |
5535 |
- ) |
5536 |
-" |
5537 |
-RDEPEND="${COMMON_DEPEND} |
5538 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
5539 |
- !dev-db/mysql:0 |
5540 |
- !dev-db/mysql:5.7 |
5541 |
- selinux? ( sec-policy/selinux-mysql ) |
5542 |
- !prefix? ( |
5543 |
- acct-group/mysql acct-user/mysql |
5544 |
- dev-db/mysql-init-scripts |
5545 |
- ) |
5546 |
-" |
5547 |
-# For other stuff to bring us in |
5548 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
5549 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
5550 |
- |
5551 |
-CHECKREQS_DISK_BUILD="8G" |
5552 |
- |
5553 |
-mysql_init_vars() { |
5554 |
- : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
5555 |
- : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
5556 |
- : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
5557 |
- : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
5558 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
5559 |
- |
5560 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
5561 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
5562 |
- export MY_DATADIR |
5563 |
-} |
5564 |
- |
5565 |
-pkg_pretend() { |
5566 |
- [[ ${MERGE_TYPE} == binary ]] && return |
5567 |
- use server && check-reqs_pkg_pretend |
5568 |
-} |
5569 |
- |
5570 |
-pkg_setup() { |
5571 |
- [[ ${MERGE_TYPE} == binary ]] && return |
5572 |
- |
5573 |
- if has test ${FEATURES} ; then |
5574 |
- # Bug #213475 - MySQL _will_ object strenuously if your machine is named |
5575 |
- # localhost. Also causes weird failures. |
5576 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
5577 |
- |
5578 |
- if ! has userpriv ${FEATURES} ; then |
5579 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
5580 |
- fi |
5581 |
- |
5582 |
- local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) |
5583 |
- [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] \ |
5584 |
- && die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!" |
5585 |
- |
5586 |
- if use latin1 ; then |
5587 |
- # Upstream only supports tests with default charset |
5588 |
- die "Testing with USE=latin1 is not supported." |
5589 |
- fi |
5590 |
- fi |
5591 |
- |
5592 |
- if use kernel_linux ; then |
5593 |
- if use numa ; then |
5594 |
- linux-info_get_any_version |
5595 |
- |
5596 |
- local CONFIG_CHECK="~NUMA" |
5597 |
- |
5598 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
5599 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
5600 |
- |
5601 |
- check_extra_config |
5602 |
- fi |
5603 |
- fi |
5604 |
- |
5605 |
- use server && check-reqs_pkg_setup |
5606 |
-} |
5607 |
- |
5608 |
-src_unpack() { |
5609 |
- unpack ${A} |
5610 |
- |
5611 |
- mv -f "${WORKDIR}/${MY_P}" "${S}" || die |
5612 |
-} |
5613 |
- |
5614 |
-src_prepare() { |
5615 |
- eapply "${WORKDIR}"/mysql-patches |
5616 |
- |
5617 |
- eapply_user |
5618 |
- |
5619 |
- # Avoid rpm call which would trigger sandbox, #692368 |
5620 |
- sed -i \ |
5621 |
- -e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \ |
5622 |
- CMakeLists.txt || die |
5623 |
- |
5624 |
- if use jemalloc ; then |
5625 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
5626 |
- fi |
5627 |
- |
5628 |
- if use tcmalloc ; then |
5629 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
5630 |
- fi |
5631 |
- |
5632 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
5633 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
5634 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
5635 |
- fi |
5636 |
- |
5637 |
- # Remove man pages for client-lib tools we don't install |
5638 |
- rm \ |
5639 |
- man/my_print_defaults.1 \ |
5640 |
- man/perror.1 \ |
5641 |
- man/zlib_decompress.1 \ |
5642 |
- || die |
5643 |
- |
5644 |
- cmake-utils_src_prepare |
5645 |
-} |
5646 |
- |
5647 |
-src_configure() { |
5648 |
- # Bug #114895, bug #110149 |
5649 |
- filter-flags "-O" "-O[01]" |
5650 |
- |
5651 |
- append-cxxflags -felide-constructors |
5652 |
- |
5653 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
5654 |
- append-flags -fno-strict-aliasing |
5655 |
- |
5656 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
5657 |
- |
5658 |
- # debug hack wrt #497532 |
5659 |
- mycmakeargs=( |
5660 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
5661 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
5662 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
5663 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
5664 |
- -DINSTALL_BINDIR=bin |
5665 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
5666 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
5667 |
- -DINSTALL_INCLUDEDIR=include/mysql |
5668 |
- -DINSTALL_INFODIR=share/info |
5669 |
- -DINSTALL_LIBDIR=$(get_libdir) |
5670 |
- -DINSTALL_MANDIR=share/man |
5671 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
5672 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
5673 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
5674 |
- -DINSTALL_SBINDIR=sbin |
5675 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
5676 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
5677 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
5678 |
- # Using bundled editline to get CTRL+C working |
5679 |
- -DWITH_EDITLINE=bundled |
5680 |
- -DWITH_ZLIB=system |
5681 |
- -DWITH_SSL=system |
5682 |
- -DWITH_LIBWRAP=0 |
5683 |
- -DENABLED_LOCAL_INFILE=1 |
5684 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
5685 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
5686 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
5687 |
- # The build forces this to be defined when cross-compiling. We pass it |
5688 |
- # all the time for simplicity and to make sure it is actually correct. |
5689 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
5690 |
- -DCMAKE_POSITION_INDEPENDENT_CODE=ON |
5691 |
- -DWITH_CURL=system |
5692 |
- -DWITH_BOOST="${S}/boost" |
5693 |
- -DWITH_ROUTER=$(usex router ON OFF) |
5694 |
- ) |
5695 |
- |
5696 |
- if is-flagq -fno-lto ; then |
5697 |
- einfo "LTO disabled via {C,CXX,F,FC}FLAGS" |
5698 |
- mycmakeargs+=( -DWITH_LTO=OFF ) |
5699 |
- elif is-flagq -flto ; then |
5700 |
- einfo "LTO forced via {C,CXX,F,FC}FLAGS" |
5701 |
- myconf+=( -DWITH_LTO=ON ) |
5702 |
- else |
5703 |
- # Disable automagic |
5704 |
- myconf+=( -DWITH_LTO=OFF ) |
5705 |
- fi |
5706 |
- |
5707 |
- if use test ; then |
5708 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
5709 |
- else |
5710 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
5711 |
- fi |
5712 |
- |
5713 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
5714 |
- |
5715 |
- mycmakeargs+=( |
5716 |
- -DWITH_ICU=system |
5717 |
- -DWITH_LZ4=system |
5718 |
- # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex |
5719 |
- -DWITH_RAPIDJSON=bundled |
5720 |
- ) |
5721 |
- |
5722 |
- if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then |
5723 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
5724 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
5725 |
- ewarn "You MUST file bugs without these variables set." |
5726 |
- ewarn "Tests will probably fail!" |
5727 |
- |
5728 |
- mycmakeargs+=( |
5729 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
5730 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
5731 |
- ) |
5732 |
- elif use latin1 ; then |
5733 |
- mycmakeargs+=( |
5734 |
- -DDEFAULT_CHARSET=latin1 |
5735 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
5736 |
- ) |
5737 |
- else |
5738 |
- mycmakeargs+=( |
5739 |
- -DDEFAULT_CHARSET=utf8mb4 |
5740 |
- -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci |
5741 |
- ) |
5742 |
- fi |
5743 |
- |
5744 |
- if use server ; then |
5745 |
- mycmakeargs+=( |
5746 |
- -DWITH_EXTRA_CHARSETS=all |
5747 |
- -DWITH_DEBUG=$(usex debug) |
5748 |
- -DWITH_MECAB=$(usex cjk system OFF) |
5749 |
- -DWITH_LIBEVENT=system |
5750 |
- -DWITH_PROTOBUF=system |
5751 |
- -DWITH_NUMA=$(usex numa ON OFF) |
5752 |
- ) |
5753 |
- |
5754 |
- if use profiling ; then |
5755 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
5756 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
5757 |
- # "main.mysqld--help-notwin" test to fail |
5758 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
5759 |
- fi |
5760 |
- |
5761 |
- # Storage engines |
5762 |
- mycmakeargs+=( |
5763 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
5764 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
5765 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
5766 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
5767 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
5768 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
5769 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
5770 |
- -DWITH_INNODB_MEMCACHED=0 |
5771 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
5772 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
5773 |
- ) |
5774 |
- else |
5775 |
- mycmakeargs+=( |
5776 |
- -DWITHOUT_SERVER=1 |
5777 |
- -DWITH_SYSTEMD=no |
5778 |
- ) |
5779 |
- fi |
5780 |
- |
5781 |
- cmake-utils_src_configure |
5782 |
-} |
5783 |
- |
5784 |
-# Official test instructions: |
5785 |
-# ulimit -n 16500 && \ |
5786 |
-# USE='perl server' \ |
5787 |
-# FEATURES='test userpriv' \ |
5788 |
-# ebuild mysql-X.X.XX.ebuild \ |
5789 |
-# digest clean package |
5790 |
-src_test() { |
5791 |
- _disable_test() { |
5792 |
- local rawtestname bug reason |
5793 |
- rawtestname="${1}" ; shift |
5794 |
- bug="${1}" ; shift |
5795 |
- reason="${@}" |
5796 |
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" |
5797 |
- echo ${rawtestname} : BUG#${bug} ${reason} >> "${T}/disabled.def" |
5798 |
- } |
5799 |
- |
5800 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
5801 |
- local retstatus_unit |
5802 |
- local retstatus_tests |
5803 |
- |
5804 |
- # Run CTest (test-units) |
5805 |
- cmake-utils_src_test |
5806 |
- retstatus_unit=$? |
5807 |
- |
5808 |
- # Ensure that parallel runs don't die |
5809 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
5810 |
- |
5811 |
- if [[ -z "${MTR_PARALLEL}" ]] ; then |
5812 |
- local -x MTR_PARALLEL=$(makeopts_jobs) |
5813 |
- |
5814 |
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then |
5815 |
- # Running multiple tests in parallel usually require higher ulimit |
5816 |
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update |
5817 |
- # are known to hit timeout when system is busy. |
5818 |
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of |
5819 |
- # using "auto". |
5820 |
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" |
5821 |
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" |
5822 |
- einfo "${info_msg}" |
5823 |
- unset info_msg |
5824 |
- MTR_PARALLEL=4 |
5825 |
- fi |
5826 |
- else |
5827 |
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" |
5828 |
- fi |
5829 |
- |
5830 |
- # create directories because mysqladmin might run out of order |
5831 |
- mkdir -p "${T}"/var-tests{,/log} || die |
5832 |
- |
5833 |
- # Run mysql tests |
5834 |
- pushd "${TESTDIR}" &>/dev/null || die |
5835 |
- |
5836 |
- touch "${T}/disabled.def" |
5837 |
- |
5838 |
- local -a disabled_tests |
5839 |
- disabled_tests+=( "auth_sec.keyring_file_data_qa;0;Won't work with user privileges" ) |
5840 |
- disabled_tests+=( "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" ) |
5841 |
- disabled_tests+=( "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" ) |
5842 |
- disabled_tests+=( "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" ) |
5843 |
- disabled_tests+=( "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" ) |
5844 |
- disabled_tests+=( "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" ) |
5845 |
- disabled_tests+=( "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" ) |
5846 |
- disabled_tests+=( "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" ) |
5847 |
- disabled_tests+=( "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" ) |
5848 |
- disabled_tests+=( "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" ) |
5849 |
- disabled_tests+=( "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" ) |
5850 |
- disabled_tests+=( "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
5851 |
- disabled_tests+=( "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
5852 |
- disabled_tests+=( "main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
5853 |
- disabled_tests+=( "rpl_gtid.rpl_gtid_stm_drop_table;90612;Known test failure" ) |
5854 |
- disabled_tests+=( "rpl_gtid.rpl_multi_source_mtr_includes;0;Known failure - no upstream bug yet" ) |
5855 |
- disabled_tests+=( "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware") |
5856 |
- disabled_tests+=( "x.connection;0;Known failure - no upstream bug yet" ) |
5857 |
- disabled_tests+=( "main.mysqlpump_basic_lz4;0;Extra tool output causes false positive" ) |
5858 |
- disabled_tests+=( "x.message_compressed_payload;0;False positive caused by protobuff-3.11+" ) |
5859 |
- disabled_tests+=( "x.message_protobuf_nested;0;False positive caused by protobuff-3.11+" ) |
5860 |
- |
5861 |
- if ! hash zip 1>/dev/null 2>&1 ; then |
5862 |
- # no need to force dep app-arch/zip for one test |
5863 |
- disabled_tests+=( "innodb.partition_upgrade_create;0;Requires app-arch/zip" ) |
5864 |
- fi |
5865 |
- |
5866 |
- local test_infos_str test_infos_arr |
5867 |
- for test_infos_str in "${disabled_tests[@]}" ; do |
5868 |
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" |
5869 |
- |
5870 |
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then |
5871 |
- die "Invalid test data set, not matching format: ${test_infos_str}" |
5872 |
- fi |
5873 |
- |
5874 |
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" |
5875 |
- done |
5876 |
- unset test_infos_str test_infos_arr |
5877 |
- |
5878 |
- # Try to increase file limits to increase test coverage |
5879 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
5880 |
- # Upper limit comes from parts.partition_* tests |
5881 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
5882 |
- |
5883 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
5884 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
5885 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
5886 |
- |
5887 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
5888 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
5889 |
- else |
5890 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
5891 |
- fi |
5892 |
- else |
5893 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
5894 |
- fi |
5895 |
- else |
5896 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
5897 |
- fi |
5898 |
- |
5899 |
- # run mysql-test tests |
5900 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
5901 |
- retstatus_tests=$? |
5902 |
- |
5903 |
- popd &>/dev/null || die |
5904 |
- |
5905 |
- # Cleanup is important for these testcases. |
5906 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
5907 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
5908 |
- |
5909 |
- local failures="" |
5910 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
5911 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
5912 |
- |
5913 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
5914 |
- einfo "Tests successfully completed" |
5915 |
-} |
5916 |
- |
5917 |
-src_install() { |
5918 |
- cmake-utils_src_install |
5919 |
- |
5920 |
- # Make sure the vars are correctly initialized |
5921 |
- mysql_init_vars |
5922 |
- |
5923 |
- # Convenience links |
5924 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
5925 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
5926 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
5927 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
5928 |
- |
5929 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
5930 |
- if [[ -d "${ED}/usr/data" ]] ; then |
5931 |
- rm -Rf "${ED}/usr/data" || die |
5932 |
- fi |
5933 |
- |
5934 |
- # Unless they explicitly specific USE=test, then do not install the |
5935 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
5936 |
- # validation of your database configuration after tuning it. |
5937 |
- if ! use test ; then |
5938 |
- rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test" |
5939 |
- fi |
5940 |
- |
5941 |
- # Configuration stuff |
5942 |
- einfo "Building default configuration ..." |
5943 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
5944 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
5945 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
5946 |
- eprefixify "${TMPDIR}/my.cnf" |
5947 |
- doins "${TMPDIR}/my.cnf" |
5948 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
5949 |
- cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
5950 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
5951 |
- doins "${TMPDIR}/50-distro-client.cnf" |
5952 |
- |
5953 |
- mycnf_src="my.cnf-8.0.distro-server" |
5954 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
5955 |
- "${FILESDIR}/${mycnf_src}" \ |
5956 |
- > "${TMPDIR}/my.cnf.ok" || die |
5957 |
- |
5958 |
- if use prefix ; then |
5959 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
5960 |
- "${TMPDIR}/my.cnf.ok" || die |
5961 |
- fi |
5962 |
- |
5963 |
- if use latin1 ; then |
5964 |
- sed -i \ |
5965 |
- -e "/character-set/s|utf8mb4|latin1|g" \ |
5966 |
- "${TMPDIR}/my.cnf.ok" || die |
5967 |
- fi |
5968 |
- |
5969 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
5970 |
- |
5971 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
5972 |
- |
5973 |
- #Remove mytop if perl is not selected |
5974 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
5975 |
- |
5976 |
- if use router ; then |
5977 |
- rm -rf \ |
5978 |
- "${ED}/usr/LICENSE.router" \ |
5979 |
- "${ED}/usr/README.router" \ |
5980 |
- "${ED}/usr/run" \ |
5981 |
- "${ED}/usr/var" \ |
5982 |
- || die |
5983 |
- fi |
5984 |
- |
5985 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
5986 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
5987 |
-} |
5988 |
- |
5989 |
-pkg_postinst() { |
5990 |
- # Make sure the vars are correctly initialized |
5991 |
- mysql_init_vars |
5992 |
- |
5993 |
- # Create log directory securely if it does not exist |
5994 |
- # NOTE: $MY_LOGDIR contains $EPREFIX by default |
5995 |
- [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" |
5996 |
- |
5997 |
- # Note about configuration change |
5998 |
- einfo |
5999 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
6000 |
- elog "to several files in /etc/mysql/mysql.d." |
6001 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
6002 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
6003 |
- elog "You may have as many files as needed and they are read alphabetically." |
6004 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
6005 |
- einfo |
6006 |
- |
6007 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
6008 |
- einfo |
6009 |
- elog "You might want to run:" |
6010 |
- elog " \"emerge --config =${CATEGORY}/${PF}\"" |
6011 |
- elog "if this is a new install." |
6012 |
- einfo |
6013 |
- else |
6014 |
- einfo |
6015 |
- elog "Upgrade process for ${PN}-8.x has changed. Please read" |
6016 |
- elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html" |
6017 |
- einfo |
6018 |
- fi |
6019 |
-} |
6020 |
- |
6021 |
-pkg_config() { |
6022 |
- _getoptval() { |
6023 |
- local section="$1" |
6024 |
- local flag="--${2}=" |
6025 |
- local extra_options="${3}" |
6026 |
- local cmd=( |
6027 |
- "${my_print_defaults_binary}" |
6028 |
- "${extra_options}" |
6029 |
- "${section}" |
6030 |
- ) |
6031 |
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) |
6032 |
- |
6033 |
- if [[ ${#results[@]} -gt 0 ]] ; then |
6034 |
- # When option is set multiple times only return last value |
6035 |
- echo "${results[-1]}" |
6036 |
- fi |
6037 |
- } |
6038 |
- |
6039 |
- _mktemp_dry() { |
6040 |
- # emktemp has no --dry-run option |
6041 |
- local template="${1}" |
6042 |
- |
6043 |
- if [[ -z "${template}" ]] ; then |
6044 |
- if [[ -z "${T}" ]] ; then |
6045 |
- template="/tmp/XXXXXXX" |
6046 |
- else |
6047 |
- template="${T}/XXXXXXX" |
6048 |
- fi |
6049 |
- fi |
6050 |
- |
6051 |
- local template_wo_X=${template//X/} |
6052 |
- local n_X |
6053 |
- let n_X=${#template}-${#template_wo_X} |
6054 |
- if [[ ${n_X} -lt 3 ]] ; then |
6055 |
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 |
6056 |
- return |
6057 |
- fi |
6058 |
- |
6059 |
- local attempts=0 |
6060 |
- local character tmpfile |
6061 |
- while [[ true ]] ; do |
6062 |
- let attempts=attempts+1 |
6063 |
- |
6064 |
- new_file= |
6065 |
- while read -n1 character ; do |
6066 |
- if [[ "${character}" == "X" ]] ; then |
6067 |
- tmpfile+="${RANDOM:0:1}" |
6068 |
- else |
6069 |
- tmpfile+="${character}" |
6070 |
- fi |
6071 |
- done < <(echo -n "${template}") |
6072 |
- |
6073 |
- if [[ ! -f "${tmpfile}" ]] |
6074 |
- then |
6075 |
- echo "${tmpfile}" |
6076 |
- return |
6077 |
- fi |
6078 |
- |
6079 |
- if [[ ${attempts} -ge 100 ]] ; then |
6080 |
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 |
6081 |
- return |
6082 |
- fi |
6083 |
- done |
6084 |
- } |
6085 |
- |
6086 |
- local mysqld_binary="${EROOT}/usr/sbin/mysqld" |
6087 |
- if [[ ! -x "${mysqld_binary}" ]] ; then |
6088 |
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
6089 |
- fi |
6090 |
- |
6091 |
- local mysql_binary="${EROOT}/usr/bin/mysql" |
6092 |
- if [[ ! -x "${mysql_binary}" ]] ; then |
6093 |
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
6094 |
- fi |
6095 |
- |
6096 |
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" |
6097 |
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then |
6098 |
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" |
6099 |
- fi |
6100 |
- |
6101 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
6102 |
- MYSQL_USER=mysql |
6103 |
- if use prefix ; then |
6104 |
- MYSQL_USER=$(id -u -n 2>/dev/null) |
6105 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
6106 |
- die "Failed to determine current username!" |
6107 |
- fi |
6108 |
- fi |
6109 |
- fi |
6110 |
- |
6111 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
6112 |
- MYSQL_GROUP=mysql |
6113 |
- if use prefix ; then |
6114 |
- MYSQL_GROUP=$(id -g -n 2>/dev/null) |
6115 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
6116 |
- die "Failed to determine current user groupname!" |
6117 |
- fi |
6118 |
- fi |
6119 |
- fi |
6120 |
- |
6121 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
6122 |
- local -x HOME="${EROOT}/root" |
6123 |
- |
6124 |
- # Make sure the vars are correctly initialized |
6125 |
- mysql_init_vars |
6126 |
- |
6127 |
- # Read currently set data directory |
6128 |
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
6129 |
- |
6130 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
6131 |
- # localhost. Also causes weird failures. |
6132 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
6133 |
- |
6134 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
6135 |
- die "Sorry, unable to find MY_DATADIR!" |
6136 |
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then |
6137 |
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" |
6138 |
- ewarn "Please rename or delete its content if you wish to initialize a new data directory." |
6139 |
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" |
6140 |
- fi |
6141 |
- |
6142 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
6143 |
- # These are dir+prefix |
6144 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
6145 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
6146 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
6147 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
6148 |
- |
6149 |
- # Create missing directories. |
6150 |
- # Always check if mysql user can write to directory even if we just |
6151 |
- # created directory because a parent directory might be not |
6152 |
- # accessible for that user. |
6153 |
- PID_DIR="${EROOT}/run/mysqld" |
6154 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
6155 |
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..." |
6156 |
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ |
6157 |
- || die "Failed to create PID directory '${PID_DIR}'!" |
6158 |
- fi |
6159 |
- |
6160 |
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" |
6161 |
- [[ -z "${_pid_dir_testfile}" ]] \ |
6162 |
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
6163 |
- |
6164 |
- if use prefix ; then |
6165 |
- touch "${_pid_dir_testfile}" &>/dev/null |
6166 |
- else |
6167 |
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null |
6168 |
- fi |
6169 |
- |
6170 |
- if [[ $? -ne 0 ]] ; then |
6171 |
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" |
6172 |
- else |
6173 |
- rm "${_pid_dir_testfile}" || die |
6174 |
- unset _pid_dir_testfile |
6175 |
- fi |
6176 |
- |
6177 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
6178 |
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." |
6179 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ |
6180 |
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" |
6181 |
- fi |
6182 |
- |
6183 |
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" |
6184 |
- [[ -z "${_my_datadir_testfile}" ]] \ |
6185 |
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
6186 |
- |
6187 |
- if use prefix ; then |
6188 |
- touch "${_my_datadir_testfile}" &>/dev/null |
6189 |
- else |
6190 |
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null |
6191 |
- fi |
6192 |
- |
6193 |
- if [[ $? -ne 0 ]] ; then |
6194 |
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" |
6195 |
- else |
6196 |
- rm "${_my_datadir_testfile}" || die |
6197 |
- unset _my_datadir_testfile |
6198 |
- fi |
6199 |
- |
6200 |
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then |
6201 |
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." |
6202 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ |
6203 |
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" |
6204 |
- fi |
6205 |
- |
6206 |
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then |
6207 |
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" |
6208 |
- [[ -z "${MYSQL_TMPDIR}" ]] \ |
6209 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" |
6210 |
- |
6211 |
- mkdir "${MYSQL_TMPDIR}" || die |
6212 |
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die |
6213 |
- fi |
6214 |
- |
6215 |
- # Now we need to test MYSQL_TMPDIR... |
6216 |
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" |
6217 |
- [[ -z "${_my_tmpdir_testfile}" ]] \ |
6218 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
6219 |
- |
6220 |
- if use prefix ; then |
6221 |
- touch "${_my_tmpdir_testfile}" &>/dev/null |
6222 |
- else |
6223 |
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null |
6224 |
- fi |
6225 |
- |
6226 |
- if [[ $? -ne 0 ]] ; then |
6227 |
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" |
6228 |
- else |
6229 |
- rm "${_my_tmpdir_testfile}" || die |
6230 |
- unset _my_tmpdir_testfile |
6231 |
- fi |
6232 |
- |
6233 |
- if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then |
6234 |
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." |
6235 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ |
6236 |
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" |
6237 |
- fi |
6238 |
- |
6239 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
6240 |
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" |
6241 |
- [[ -z "${_my_logbin_testfile}" ]] \ |
6242 |
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" |
6243 |
- |
6244 |
- if use prefix ; then |
6245 |
- touch "${_my_logbin_testfile}" &>/dev/null |
6246 |
- else |
6247 |
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null |
6248 |
- fi |
6249 |
- |
6250 |
- if [[ $? -ne 0 ]] ; then |
6251 |
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" |
6252 |
- else |
6253 |
- rm "${_my_logbin_testfile}" || die |
6254 |
- unset _my_logbin_testfile |
6255 |
- fi |
6256 |
- fi |
6257 |
- |
6258 |
- if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then |
6259 |
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." |
6260 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ |
6261 |
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" |
6262 |
- fi |
6263 |
- |
6264 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
6265 |
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" |
6266 |
- [[ -z "${_my_relaylog_testfile}" ]] \ |
6267 |
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" |
6268 |
- |
6269 |
- if use prefix ; then |
6270 |
- touch "${_my_relaylog_testfile}" &>/dev/null |
6271 |
- else |
6272 |
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null |
6273 |
- fi |
6274 |
- |
6275 |
- if [[ $? -ne 0 ]] ; then |
6276 |
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" |
6277 |
- else |
6278 |
- rm "${_my_relaylog_testfile}" || die |
6279 |
- unset _my_relaylog_testfile |
6280 |
- fi |
6281 |
- fi |
6282 |
- |
6283 |
- local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" |
6284 |
- if [[ -z "${mysql_install_log}" ]] ; then |
6285 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" |
6286 |
- else |
6287 |
- # make sure file is writable for MYSQL_USER... |
6288 |
- touch "${mysql_install_log}" || die |
6289 |
- chown ${MYSQL_USER} "${mysql_install_log}" || die |
6290 |
- fi |
6291 |
- |
6292 |
- local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" |
6293 |
- if [[ -z "${mysqld_logfile}" ]] ; then |
6294 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" |
6295 |
- else |
6296 |
- # make sure file is writable for MYSQL_USER... |
6297 |
- touch "${mysqld_logfile}" || die |
6298 |
- chown ${MYSQL_USER} "${mysqld_logfile}" || die |
6299 |
- fi |
6300 |
- |
6301 |
- echo "" |
6302 |
- einfo "Detected settings:" |
6303 |
- einfo "==================" |
6304 |
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}" |
6305 |
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" |
6306 |
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}" |
6307 |
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" |
6308 |
- |
6309 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
6310 |
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" |
6311 |
- fi |
6312 |
- |
6313 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
6314 |
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" |
6315 |
- fi |
6316 |
- |
6317 |
- einfo "PID DIR:\t\t\t\t${PID_DIR}" |
6318 |
- einfo "Install db log:\t\t\t${mysql_install_log}" |
6319 |
- einfo "Install server log:\t\t\t${mysqld_logfile}" |
6320 |
- |
6321 |
- local -a config_files |
6322 |
- |
6323 |
- local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" |
6324 |
- if [[ -f "${config_file}" ]] ; then |
6325 |
- config_files+=( "${config_file}" ) |
6326 |
- else |
6327 |
- ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..." |
6328 |
- fi |
6329 |
- |
6330 |
- config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" |
6331 |
- if [[ -f "${config_file}" ]] ; then |
6332 |
- config_files+=( "${config_file}" ) |
6333 |
- else |
6334 |
- ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..." |
6335 |
- fi |
6336 |
- |
6337 |
- if [[ ${#config_files[@]} -gt 0 ]] ; then |
6338 |
- if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then |
6339 |
- local user_answer |
6340 |
- |
6341 |
- echo |
6342 |
- einfo "Please select default authentication plugin (enter number or plugin name):" |
6343 |
- einfo "1) caching_sha2_password [MySQL 8.0 default]" |
6344 |
- einfo "2) mysql_native_password [MySQL 5.7 default]" |
6345 |
- einfo |
6346 |
- einfo "For details see:" |
6347 |
- einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" |
6348 |
- read -p " >" user_answer |
6349 |
- echo |
6350 |
- |
6351 |
- case "${user_answer}" in |
6352 |
- 1|caching_sha2_password) |
6353 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password |
6354 |
- ;; |
6355 |
- 2|mysql_native_password) |
6356 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password |
6357 |
- ;; |
6358 |
- '') |
6359 |
- die "No authentication plugin selected!" |
6360 |
- ;; |
6361 |
- *) |
6362 |
- die "Authentication plugin '${user_answer}' is unknown/unsupported!" |
6363 |
- ;; |
6364 |
- esac |
6365 |
- |
6366 |
- echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" |
6367 |
- |
6368 |
- unset user_answer |
6369 |
- fi |
6370 |
- |
6371 |
- local cfg_option cfg_option_tabs cfg_section |
6372 |
- for config_file in "${config_files[@]}" ; do |
6373 |
- cfg_option="default-authentication-plugin" |
6374 |
- cfg_section="mysqld" |
6375 |
- cfg_option_tabs="\t\t" |
6376 |
- if [[ "${config_file}" == *client.cnf ]] ; then |
6377 |
- cfg_option="default-auth" |
6378 |
- cfg_section="client" |
6379 |
- cfg_option_tabs="\t\t\t\t" |
6380 |
- fi |
6381 |
- |
6382 |
- if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then |
6383 |
- einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
6384 |
- sed -i \ |
6385 |
- -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ |
6386 |
- "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" |
6387 |
- else |
6388 |
- einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
6389 |
- sed -i \ |
6390 |
- -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ |
6391 |
- "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" |
6392 |
- fi |
6393 |
- done |
6394 |
- unset cfg_option cfg_option_tabs cfg_section |
6395 |
- fi |
6396 |
- unset config_files config_file |
6397 |
- |
6398 |
- echo |
6399 |
- |
6400 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
6401 |
- local tmp_mysqld_password_source= |
6402 |
- |
6403 |
- for tmp_mysqld_password_source in mysql client ; do |
6404 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
6405 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
6406 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
6407 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
6408 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
6409 |
- MYSQL_ROOT_PASSWORD= |
6410 |
- continue |
6411 |
- fi |
6412 |
- |
6413 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
6414 |
- break |
6415 |
- fi |
6416 |
- done |
6417 |
- |
6418 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
6419 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
6420 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
6421 |
- fi |
6422 |
- |
6423 |
- unset tmp_mysqld_password_source |
6424 |
- fi |
6425 |
- |
6426 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
6427 |
- local pwd1="a" |
6428 |
- local pwd2="b" |
6429 |
- |
6430 |
- echo |
6431 |
- einfo "No password for mysql 'root' user was specified via environment" |
6432 |
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" |
6433 |
- einfo "file like '${HOME}/.my.cnf'." |
6434 |
- einfo "To continue please provide a password for the mysql 'root' user" |
6435 |
- einfo "now on console:" |
6436 |
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" |
6437 |
- read -rsp " >" pwd1 ; echo |
6438 |
- |
6439 |
- einfo "Retype the password" |
6440 |
- read -rsp " >" pwd2 ; echo |
6441 |
- |
6442 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
6443 |
- die "Passwords are not the same!" |
6444 |
- fi |
6445 |
- |
6446 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
6447 |
- unset pwd1 pwd2 |
6448 |
- |
6449 |
- echo |
6450 |
- fi |
6451 |
- |
6452 |
- local -a mysqld_options |
6453 |
- |
6454 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
6455 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
6456 |
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) |
6457 |
- |
6458 |
- # Figure out which options we need to disable to do the setup |
6459 |
- local helpfile="${TMPDIR}/mysqld-help" |
6460 |
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
6461 |
- |
6462 |
- local opt optexp optfull |
6463 |
- for opt in host-cache name-resolve networking slave-start \ |
6464 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
6465 |
- log-slave-updates \ |
6466 |
- ; do |
6467 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
6468 |
- egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) |
6469 |
- done |
6470 |
- |
6471 |
- # Prepare timezones, see |
6472 |
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
6473 |
- local tz_sql="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" |
6474 |
- [[ -z "${tz_sql}" ]] \ |
6475 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" |
6476 |
- |
6477 |
- echo "USE mysql;" >"${tz_sql}" |
6478 |
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null |
6479 |
- if [[ $? -ne 0 ]] ; then |
6480 |
- die "mysql_tzinfo_to_sql failed!" |
6481 |
- fi |
6482 |
- |
6483 |
- # --initialize-insecure will not set root password |
6484 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
6485 |
- local cmd=( |
6486 |
- "${mysqld_binary}" |
6487 |
- "${mysqld_options[@]}" |
6488 |
- "--initialize-insecure" |
6489 |
- "--init-file='${tz_sql}'" |
6490 |
- "--basedir='${EROOT}/usr'" |
6491 |
- "--datadir='${MY_DATADIR}'" |
6492 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
6493 |
- "--log-error='${mysql_install_log}'" |
6494 |
- "--user=${MYSQL_USER}" |
6495 |
- ) |
6496 |
- |
6497 |
- einfo "Initializing ${PN} data directory: ${cmd[@]}" |
6498 |
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 |
6499 |
- |
6500 |
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then |
6501 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 |
6502 |
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" |
6503 |
- fi |
6504 |
- |
6505 |
- rm "${tz_sql}" || die |
6506 |
- |
6507 |
- local x=${RANDOM} |
6508 |
- local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" |
6509 |
- local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" |
6510 |
- unset x |
6511 |
- |
6512 |
- cmd=( |
6513 |
- "${mysqld_binary}" |
6514 |
- "${mysqld_options[@]}" |
6515 |
- "--basedir='${EROOT}/usr'" |
6516 |
- "--datadir='${MY_DATADIR}'" |
6517 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
6518 |
- --max_allowed_packet=8M |
6519 |
- --net_buffer_length=16K |
6520 |
- "--socket='${socket}'" |
6521 |
- "--pid-file='${pidfile}'" |
6522 |
- "--log-error='${mysqld_logfile}'" |
6523 |
- "--user=${MYSQL_USER}" |
6524 |
- ) |
6525 |
- |
6526 |
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}" |
6527 |
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & |
6528 |
- |
6529 |
- echo -n "Waiting for mysqld to accept connections " |
6530 |
- local maxtry=15 |
6531 |
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
6532 |
- maxtry=$((${maxtry}-1)) |
6533 |
- echo -n "." |
6534 |
- sleep 1 |
6535 |
- done |
6536 |
- |
6537 |
- if [[ -S "${socket}" ]] ; then |
6538 |
- # Even with a socket we don't know if mysqld will abort |
6539 |
- # start due to an error so just wait a little bit more... |
6540 |
- maxtry=5 |
6541 |
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
6542 |
- maxtry=$((${maxtry}-1)) |
6543 |
- echo -n "." |
6544 |
- sleep 1 |
6545 |
- done |
6546 |
- fi |
6547 |
- |
6548 |
- echo |
6549 |
- |
6550 |
- if [[ ! -S "${socket}" ]] ; then |
6551 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 |
6552 |
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" |
6553 |
- fi |
6554 |
- |
6555 |
- local mysql_logfile="${TMPDIR}/set_root_pw.log" |
6556 |
- touch "${mysql_logfile}" || die |
6557 |
- |
6558 |
- ebegin "Setting root password" |
6559 |
- # Do this from memory, as we don't want clear text passwords in temp files |
6560 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" |
6561 |
- cmd=( |
6562 |
- "${mysql_binary}" |
6563 |
- --no-defaults |
6564 |
- "--socket='${socket}'" |
6565 |
- -hlocalhost |
6566 |
- "-e \"${sql}\"" |
6567 |
- ) |
6568 |
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 |
6569 |
- local rc=$? |
6570 |
- eend ${rc} |
6571 |
- |
6572 |
- if [[ ${rc} -ne 0 ]] ; then |
6573 |
- # Poor man's solution which tries to avoid having password |
6574 |
- # in log. NOTE: sed can fail if user didn't follow advice |
6575 |
- # and included character which will require escaping... |
6576 |
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null |
6577 |
- |
6578 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" |
6579 |
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" |
6580 |
- fi |
6581 |
- |
6582 |
- # Stop the server |
6583 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
6584 |
- echo -n "Stopping the server " |
6585 |
- pkill -F "${pidfile}" &>/dev/null |
6586 |
- |
6587 |
- maxtry=10 |
6588 |
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do |
6589 |
- maxtry=$((${maxtry}-1)) |
6590 |
- echo -n "." |
6591 |
- sleep 1 |
6592 |
- done |
6593 |
- |
6594 |
- echo |
6595 |
- |
6596 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
6597 |
- # We somehow failed to stop server. |
6598 |
- # However, not a fatal error. Just warn the user. |
6599 |
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" |
6600 |
- fi |
6601 |
- fi |
6602 |
- |
6603 |
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" |
6604 |
-} |
6605 |
|
6606 |
diff --git a/dev-db/mysql/mysql-8.0.21-r1.ebuild b/dev-db/mysql/mysql-8.0.21-r1.ebuild |
6607 |
deleted file mode 100644 |
6608 |
index d63f3416d34..00000000000 |
6609 |
--- a/dev-db/mysql/mysql-8.0.21-r1.ebuild |
6610 |
+++ /dev/null |
6611 |
@@ -1,1166 +0,0 @@ |
6612 |
-# Copyright 1999-2021 Gentoo Authors |
6613 |
-# Distributed under the terms of the GNU General Public License v2 |
6614 |
- |
6615 |
-EAPI="7" |
6616 |
- |
6617 |
-CMAKE_MAKEFILE_GENERATOR=emake |
6618 |
- |
6619 |
-inherit check-reqs cmake flag-o-matic linux-info \ |
6620 |
- multiprocessing prefix toolchain-funcs |
6621 |
- |
6622 |
-MY_PV="${PV//_pre*}" |
6623 |
-MY_P="${PN}-${MY_PV}" |
6624 |
- |
6625 |
-# Patch version |
6626 |
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/mysql/${PN}-8.0.21-patches-01.tar.xz" |
6627 |
- |
6628 |
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-${MY_PV}.tar.gz |
6629 |
- https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-${MY_PV}.tar.gz |
6630 |
- http://downloads.mysql.com/archives/MySQL-8.0/${PN}-boost-${MY_PV}.tar.gz |
6631 |
- ${PATCH_SET}" |
6632 |
- |
6633 |
-HOMEPAGE="https://www.mysql.com/" |
6634 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
6635 |
-LICENSE="GPL-2" |
6636 |
-SLOT="8.0" |
6637 |
-IUSE="cjk cracklib debug jemalloc latin1 numa +perl profiling |
6638 |
- router selinux +server tcmalloc test" |
6639 |
- |
6640 |
-RESTRICT="!test? ( test )" |
6641 |
- |
6642 |
-REQUIRED_USE="?? ( tcmalloc jemalloc ) |
6643 |
- cjk? ( server ) |
6644 |
- jemalloc? ( server ) |
6645 |
- numa? ( server ) |
6646 |
- profiling? ( server ) |
6647 |
- router? ( server ) |
6648 |
- tcmalloc? ( server )" |
6649 |
- |
6650 |
-KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris" |
6651 |
- |
6652 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
6653 |
-# and we will run a mysql server during test phase |
6654 |
-S="${WORKDIR}/mysql" |
6655 |
- |
6656 |
-# Be warned, *DEPEND are version-dependant |
6657 |
-# These are used for both runtime and compiletime |
6658 |
-COMMON_DEPEND=" |
6659 |
- >=app-arch/lz4-0_p131:= |
6660 |
- app-arch/zstd:= |
6661 |
- sys-libs/ncurses:0= |
6662 |
- >=sys-libs/zlib-1.2.3:0= |
6663 |
- >=dev-libs/openssl-1.0.0:0= |
6664 |
- server? ( |
6665 |
- dev-libs/icu:= |
6666 |
- dev-libs/libevent:=[ssl] |
6667 |
- >=dev-libs/protobuf-3.8:= |
6668 |
- net-libs/libtirpc:= |
6669 |
- cjk? ( app-text/mecab:= ) |
6670 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
6671 |
- kernel_linux? ( |
6672 |
- dev-libs/libaio:0= |
6673 |
- sys-process/procps:0= |
6674 |
- ) |
6675 |
- numa? ( sys-process/numactl ) |
6676 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
6677 |
- ) |
6678 |
-" |
6679 |
-DEPEND="${COMMON_DEPEND} |
6680 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
6681 |
- virtual/yacc |
6682 |
- server? ( net-libs/rpcsvc-proto ) |
6683 |
- test? ( |
6684 |
- acct-group/mysql acct-user/mysql |
6685 |
- dev-perl/JSON |
6686 |
- ) |
6687 |
-" |
6688 |
-RDEPEND="${COMMON_DEPEND} |
6689 |
- !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
6690 |
- !dev-db/mysql:0 |
6691 |
- !dev-db/mysql:5.7 |
6692 |
- selinux? ( sec-policy/selinux-mysql ) |
6693 |
- !prefix? ( |
6694 |
- acct-group/mysql acct-user/mysql |
6695 |
- dev-db/mysql-init-scripts |
6696 |
- ) |
6697 |
-" |
6698 |
-# For other stuff to bring us in |
6699 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
6700 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
6701 |
- |
6702 |
-mysql_init_vars() { |
6703 |
- : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
6704 |
- : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
6705 |
- : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
6706 |
- : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
6707 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
6708 |
- |
6709 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
6710 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
6711 |
- export MY_DATADIR |
6712 |
-} |
6713 |
- |
6714 |
-pkg_pretend() { |
6715 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
6716 |
- if use server ; then |
6717 |
- CHECKREQS_DISK_BUILD="3G" |
6718 |
- |
6719 |
- if has test $FEATURES ; then |
6720 |
- CHECKREQS_DISK_BUILD="9G" |
6721 |
- fi |
6722 |
- |
6723 |
- check-reqs_pkg_pretend |
6724 |
- fi |
6725 |
- fi |
6726 |
-} |
6727 |
- |
6728 |
-pkg_setup() { |
6729 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
6730 |
- CHECKREQS_DISK_BUILD="3G" |
6731 |
- |
6732 |
- if has test ${FEATURES} ; then |
6733 |
- CHECKREQS_DISK_BUILD="9G" |
6734 |
- |
6735 |
- # Bug #213475 - MySQL _will_ object strenuously if your machine is named |
6736 |
- # localhost. Also causes weird failures. |
6737 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
6738 |
- |
6739 |
- if ! has userpriv ${FEATURES} ; then |
6740 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
6741 |
- fi |
6742 |
- |
6743 |
- local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) |
6744 |
- [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] \ |
6745 |
- && die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!" |
6746 |
- |
6747 |
- if use latin1 ; then |
6748 |
- # Upstream only supports tests with default charset |
6749 |
- die "Testing with USE=latin1 is not supported." |
6750 |
- fi |
6751 |
- fi |
6752 |
- |
6753 |
- if use kernel_linux ; then |
6754 |
- if use numa ; then |
6755 |
- linux-info_get_any_version |
6756 |
- |
6757 |
- local CONFIG_CHECK="~NUMA" |
6758 |
- |
6759 |
- local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;" |
6760 |
- WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" |
6761 |
- |
6762 |
- check_extra_config |
6763 |
- fi |
6764 |
- fi |
6765 |
- |
6766 |
- use server && check-reqs_pkg_setup |
6767 |
- fi |
6768 |
-} |
6769 |
- |
6770 |
-src_unpack() { |
6771 |
- unpack ${A} |
6772 |
- |
6773 |
- mv -f "${WORKDIR}/${MY_P}" "${S}" || die |
6774 |
-} |
6775 |
- |
6776 |
-src_prepare() { |
6777 |
- eapply "${WORKDIR}"/mysql-patches |
6778 |
- |
6779 |
- # Avoid rpm call which would trigger sandbox, #692368 |
6780 |
- sed -i \ |
6781 |
- -e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \ |
6782 |
- CMakeLists.txt || die |
6783 |
- |
6784 |
- if use jemalloc ; then |
6785 |
- echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die |
6786 |
- fi |
6787 |
- |
6788 |
- if use tcmalloc ; then |
6789 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die |
6790 |
- fi |
6791 |
- |
6792 |
- # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux |
6793 |
- if [[ -d "${S}/support-files/SELinux" ]] ; then |
6794 |
- echo > "${S}/support-files/SELinux/CMakeLists.txt" || die |
6795 |
- fi |
6796 |
- |
6797 |
- # Remove man pages for client-lib tools we don't install |
6798 |
- rm \ |
6799 |
- man/my_print_defaults.1 \ |
6800 |
- man/perror.1 \ |
6801 |
- man/zlib_decompress.1 \ |
6802 |
- || die |
6803 |
- |
6804 |
- cmake_src_prepare |
6805 |
-} |
6806 |
- |
6807 |
-src_configure() { |
6808 |
- # Bug #114895, bug #110149 |
6809 |
- filter-flags "-O" "-O[01]" |
6810 |
- |
6811 |
- append-cxxflags -felide-constructors |
6812 |
- |
6813 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
6814 |
- append-flags -fno-strict-aliasing |
6815 |
- |
6816 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
6817 |
- |
6818 |
- # debug hack wrt #497532 |
6819 |
- mycmakeargs=( |
6820 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
6821 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
6822 |
- -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
6823 |
- -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
6824 |
- -DINSTALL_BINDIR=bin |
6825 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
6826 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
6827 |
- -DINSTALL_INCLUDEDIR=include/mysql |
6828 |
- -DINSTALL_INFODIR=share/info |
6829 |
- -DINSTALL_LIBDIR=$(get_libdir) |
6830 |
- -DINSTALL_MANDIR=share/man |
6831 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
6832 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
6833 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
6834 |
- -DINSTALL_SBINDIR=sbin |
6835 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" |
6836 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
6837 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
6838 |
- # Using bundled editline to get CTRL+C working |
6839 |
- -DWITH_EDITLINE=bundled |
6840 |
- -DWITH_ZLIB=system |
6841 |
- -DWITH_SSL=system |
6842 |
- -DWITH_LIBWRAP=0 |
6843 |
- -DENABLED_LOCAL_INFILE=1 |
6844 |
- -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
6845 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
6846 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
6847 |
- # The build forces this to be defined when cross-compiling. We pass it |
6848 |
- # all the time for simplicity and to make sure it is actually correct. |
6849 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
6850 |
- -DCMAKE_POSITION_INDEPENDENT_CODE=ON |
6851 |
- -DWITH_CURL=system |
6852 |
- -DWITH_BOOST="${S}/boost" |
6853 |
- -DWITH_ROUTER=$(usex router ON OFF) |
6854 |
- ) |
6855 |
- |
6856 |
- if is-flagq -fno-lto ; then |
6857 |
- einfo "LTO disabled via {C,CXX,F,FC}FLAGS" |
6858 |
- mycmakeargs+=( -DWITH_LTO=OFF ) |
6859 |
- elif is-flagq -flto ; then |
6860 |
- einfo "LTO forced via {C,CXX,F,FC}FLAGS" |
6861 |
- myconf+=( -DWITH_LTO=ON ) |
6862 |
- else |
6863 |
- # Disable automagic |
6864 |
- myconf+=( -DWITH_LTO=OFF ) |
6865 |
- fi |
6866 |
- |
6867 |
- if use test ; then |
6868 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test ) |
6869 |
- else |
6870 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
6871 |
- fi |
6872 |
- |
6873 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES ) |
6874 |
- |
6875 |
- mycmakeargs+=( |
6876 |
- -DWITH_ICU=system |
6877 |
- -DWITH_LZ4=system |
6878 |
- # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex |
6879 |
- -DWITH_RAPIDJSON=bundled |
6880 |
- -DWITH_ZSTD=system |
6881 |
- ) |
6882 |
- |
6883 |
- if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then |
6884 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
6885 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
6886 |
- ewarn "You MUST file bugs without these variables set." |
6887 |
- ewarn "Tests will probably fail!" |
6888 |
- |
6889 |
- mycmakeargs+=( |
6890 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
6891 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
6892 |
- ) |
6893 |
- elif use latin1 ; then |
6894 |
- mycmakeargs+=( |
6895 |
- -DDEFAULT_CHARSET=latin1 |
6896 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
6897 |
- ) |
6898 |
- else |
6899 |
- mycmakeargs+=( |
6900 |
- -DDEFAULT_CHARSET=utf8mb4 |
6901 |
- -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci |
6902 |
- ) |
6903 |
- fi |
6904 |
- |
6905 |
- if use server ; then |
6906 |
- mycmakeargs+=( |
6907 |
- -DWITH_EXTRA_CHARSETS=all |
6908 |
- -DWITH_DEBUG=$(usex debug) |
6909 |
- -DWITH_MECAB=$(usex cjk system OFF) |
6910 |
- -DWITH_LIBEVENT=system |
6911 |
- -DWITH_PROTOBUF=system |
6912 |
- -DWITH_NUMA=$(usex numa ON OFF) |
6913 |
- ) |
6914 |
- |
6915 |
- if use profiling ; then |
6916 |
- # Setting to OFF doesn't work: Once set, profiling options will be added |
6917 |
- # to `mysqld --help` output via sql/sys_vars.cc causing |
6918 |
- # "main.mysqld--help-notwin" test to fail |
6919 |
- mycmakeargs+=( -DENABLED_PROFILING=ON ) |
6920 |
- fi |
6921 |
- |
6922 |
- # Storage engines |
6923 |
- mycmakeargs+=( |
6924 |
- -DWITH_EXAMPLE_STORAGE_ENGINE=0 |
6925 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
6926 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
6927 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
6928 |
- -DWITH_FEDERATED_STORAGE_ENGINE=1 |
6929 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
6930 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
6931 |
- -DWITH_INNODB_MEMCACHED=0 |
6932 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
6933 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
6934 |
- ) |
6935 |
- else |
6936 |
- mycmakeargs+=( |
6937 |
- -DWITHOUT_SERVER=1 |
6938 |
- -DWITH_SYSTEMD=no |
6939 |
- ) |
6940 |
- fi |
6941 |
- |
6942 |
- cmake_src_configure |
6943 |
-} |
6944 |
- |
6945 |
-# Official test instructions: |
6946 |
-# ulimit -n 16500 && \ |
6947 |
-# USE='perl server' \ |
6948 |
-# FEATURES='test userpriv' \ |
6949 |
-# ebuild mysql-X.X.XX.ebuild \ |
6950 |
-# digest clean package |
6951 |
-src_test() { |
6952 |
- _disable_test() { |
6953 |
- local rawtestname bug reason |
6954 |
- rawtestname="${1}" ; shift |
6955 |
- bug="${1}" ; shift |
6956 |
- reason="${@}" |
6957 |
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" |
6958 |
- echo ${rawtestname} : BUG#${bug} ${reason} >> "${T}/disabled.def" |
6959 |
- } |
6960 |
- |
6961 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
6962 |
- local retstatus_unit |
6963 |
- local retstatus_tests |
6964 |
- |
6965 |
- # Run CTest (test-units) |
6966 |
- cmake_src_test |
6967 |
- retstatus_unit=$? |
6968 |
- |
6969 |
- # Ensure that parallel runs don't die |
6970 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
6971 |
- |
6972 |
- if [[ -z "${MTR_PARALLEL}" ]] ; then |
6973 |
- local -x MTR_PARALLEL=$(makeopts_jobs) |
6974 |
- |
6975 |
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then |
6976 |
- # Running multiple tests in parallel usually require higher ulimit |
6977 |
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update |
6978 |
- # are known to hit timeout when system is busy. |
6979 |
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of |
6980 |
- # using "auto". |
6981 |
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" |
6982 |
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" |
6983 |
- einfo "${info_msg}" |
6984 |
- unset info_msg |
6985 |
- MTR_PARALLEL=4 |
6986 |
- fi |
6987 |
- else |
6988 |
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" |
6989 |
- fi |
6990 |
- |
6991 |
- # create directories because mysqladmin might run out of order |
6992 |
- mkdir -p "${T}"/var-tests{,/log} || die |
6993 |
- |
6994 |
- # Run mysql tests |
6995 |
- pushd "${TESTDIR}" &>/dev/null || die |
6996 |
- |
6997 |
- touch "${T}/disabled.def" |
6998 |
- |
6999 |
- local -a disabled_tests |
7000 |
- disabled_tests+=( "auth_sec.keyring_file_data_qa;0;Won't work with user privileges" ) |
7001 |
- disabled_tests+=( "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" ) |
7002 |
- disabled_tests+=( "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" ) |
7003 |
- disabled_tests+=( "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" ) |
7004 |
- disabled_tests+=( "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" ) |
7005 |
- disabled_tests+=( "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" ) |
7006 |
- disabled_tests+=( "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" ) |
7007 |
- disabled_tests+=( "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" ) |
7008 |
- disabled_tests+=( "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" ) |
7009 |
- disabled_tests+=( "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" ) |
7010 |
- disabled_tests+=( "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" ) |
7011 |
- disabled_tests+=( "main.mysql_load_data_local_dir;0;Known test failure - no upstream bug yet" ) |
7012 |
- disabled_tests+=( "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
7013 |
- disabled_tests+=( "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
7014 |
- disabled_tests+=( "main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet" ) |
7015 |
- disabled_tests+=( "rpl_gtid.rpl_gtid_stm_drop_table;90612;Known test failure" ) |
7016 |
- disabled_tests+=( "rpl_gtid.rpl_multi_source_mtr_includes;0;Known failure - no upstream bug yet" ) |
7017 |
- disabled_tests+=( "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware") |
7018 |
- disabled_tests+=( "x.connection;0;Known failure - no upstream bug yet" ) |
7019 |
- disabled_tests+=( "main.mysqlpump_basic_lz4;0;Extra tool output causes false positive" ) |
7020 |
- disabled_tests+=( "x.message_compressed_payload;0;False positive caused by protobuff-3.11+" ) |
7021 |
- disabled_tests+=( "x.message_protobuf_nested;0;False positive caused by protobuff-3.11+" ) |
7022 |
- |
7023 |
- # Known test failures due to expired SSL certificates -- fixed in 8.0.22 |
7024 |
- disabled_tests+=( "auth_sec.admin_ssl_crl_crlpath;100055;Fixed in 8.0.22" ) |
7025 |
- disabled_tests+=( "auth_sec.admin_ssl_crl;100055;Fixed in 8.0.22" ) |
7026 |
- disabled_tests+=( "auth_sec.server_withssl_client_withssl;100055;Fixed in 8.0.22" ) |
7027 |
- disabled_tests+=( "main.ssl_crl_clients_valid;100055;Fixed in 8.0.22" ) |
7028 |
- disabled_tests+=( "main.ssl_crl;100055;Fixed in 8.0.22" ) |
7029 |
- disabled_tests+=( "main.ssl_crl_crlpath;100055;Fixed in 8.0.22" ) |
7030 |
- disabled_tests+=( "main.ssl_ca;100055;Fixed in 8.0.22" ) |
7031 |
- |
7032 |
- if ! hash zip 1>/dev/null 2>&1 ; then |
7033 |
- # no need to force dep app-arch/zip for one test |
7034 |
- disabled_tests+=( "innodb.discarded_partition_create;0;Requires app-arch/zip" ) |
7035 |
- disabled_tests+=( "innodb.partition_upgrade_create;0;Requires app-arch/zip" ) |
7036 |
- fi |
7037 |
- |
7038 |
- local test_infos_str test_infos_arr |
7039 |
- for test_infos_str in "${disabled_tests[@]}" ; do |
7040 |
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" |
7041 |
- |
7042 |
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then |
7043 |
- die "Invalid test data set, not matching format: ${test_infos_str}" |
7044 |
- fi |
7045 |
- |
7046 |
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" |
7047 |
- done |
7048 |
- unset test_infos_str test_infos_arr |
7049 |
- |
7050 |
- # Try to increase file limits to increase test coverage |
7051 |
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
7052 |
- # Upper limit comes from parts.partition_* tests |
7053 |
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
7054 |
- |
7055 |
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
7056 |
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
7057 |
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
7058 |
- |
7059 |
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
7060 |
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
7061 |
- else |
7062 |
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
7063 |
- fi |
7064 |
- else |
7065 |
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
7066 |
- fi |
7067 |
- else |
7068 |
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
7069 |
- fi |
7070 |
- |
7071 |
- # run mysql-test tests |
7072 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
7073 |
- retstatus_tests=$? |
7074 |
- |
7075 |
- popd &>/dev/null || die |
7076 |
- |
7077 |
- # Cleanup is important for these testcases. |
7078 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
7079 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
7080 |
- |
7081 |
- local failures="" |
7082 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
7083 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
7084 |
- |
7085 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
7086 |
- einfo "Tests successfully completed" |
7087 |
-} |
7088 |
- |
7089 |
-src_install() { |
7090 |
- cmake_src_install |
7091 |
- |
7092 |
- # Make sure the vars are correctly initialized |
7093 |
- mysql_init_vars |
7094 |
- |
7095 |
- # Convenience links |
7096 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
7097 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
7098 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
7099 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
7100 |
- |
7101 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
7102 |
- if [[ -d "${ED}/usr/data" ]] ; then |
7103 |
- rm -Rf "${ED}/usr/data" || die |
7104 |
- fi |
7105 |
- |
7106 |
- # Unless they explicitly specific USE=test, then do not install the |
7107 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
7108 |
- # validation of your database configuration after tuning it. |
7109 |
- if ! use test ; then |
7110 |
- rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test" |
7111 |
- fi |
7112 |
- |
7113 |
- # Configuration stuff |
7114 |
- einfo "Building default configuration ..." |
7115 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
7116 |
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
7117 |
- cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die |
7118 |
- eprefixify "${TMPDIR}/my.cnf" |
7119 |
- doins "${TMPDIR}/my.cnf" |
7120 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d" |
7121 |
- cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
7122 |
- eprefixify "${TMPDIR}/50-distro-client.cnf" |
7123 |
- doins "${TMPDIR}/50-distro-client.cnf" |
7124 |
- |
7125 |
- mycnf_src="my.cnf-8.0.distro-server" |
7126 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
7127 |
- "${FILESDIR}/${mycnf_src}" \ |
7128 |
- > "${TMPDIR}/my.cnf.ok" || die |
7129 |
- |
7130 |
- if use prefix ; then |
7131 |
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
7132 |
- "${TMPDIR}/my.cnf.ok" || die |
7133 |
- fi |
7134 |
- |
7135 |
- if use latin1 ; then |
7136 |
- sed -i \ |
7137 |
- -e "/character-set/s|utf8mb4|latin1|g" \ |
7138 |
- "${TMPDIR}/my.cnf.ok" || die |
7139 |
- fi |
7140 |
- |
7141 |
- eprefixify "${TMPDIR}/my.cnf.ok" |
7142 |
- |
7143 |
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
7144 |
- |
7145 |
- #Remove mytop if perl is not selected |
7146 |
- [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
7147 |
- |
7148 |
- if use router ; then |
7149 |
- rm -rf \ |
7150 |
- "${ED}/usr/LICENSE.router" \ |
7151 |
- "${ED}/usr/README.router" \ |
7152 |
- "${ED}/usr/run" \ |
7153 |
- "${ED}/usr/var" \ |
7154 |
- || die |
7155 |
- fi |
7156 |
- |
7157 |
- # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. |
7158 |
- find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die |
7159 |
-} |
7160 |
- |
7161 |
-pkg_postinst() { |
7162 |
- # Make sure the vars are correctly initialized |
7163 |
- mysql_init_vars |
7164 |
- |
7165 |
- # Create log directory securely if it does not exist |
7166 |
- # NOTE: $MY_LOGDIR contains $EPREFIX by default |
7167 |
- [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" |
7168 |
- |
7169 |
- # Note about configuration change |
7170 |
- einfo |
7171 |
- elog "This version of ${PN} reorganizes the configuration from a single my.cnf" |
7172 |
- elog "to several files in /etc/mysql/mysql.d." |
7173 |
- elog "Please backup any changes you made to /etc/mysql/my.cnf" |
7174 |
- elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension." |
7175 |
- elog "You may have as many files as needed and they are read alphabetically." |
7176 |
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
7177 |
- einfo |
7178 |
- |
7179 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
7180 |
- einfo |
7181 |
- elog "You might want to run:" |
7182 |
- elog " \"emerge --config =${CATEGORY}/${PF}\"" |
7183 |
- elog "if this is a new install." |
7184 |
- einfo |
7185 |
- else |
7186 |
- einfo |
7187 |
- elog "Upgrade process for ${PN}-8.x has changed. Please read" |
7188 |
- elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html" |
7189 |
- einfo |
7190 |
- fi |
7191 |
-} |
7192 |
- |
7193 |
-pkg_config() { |
7194 |
- _getoptval() { |
7195 |
- local section="$1" |
7196 |
- local flag="--${2}=" |
7197 |
- local extra_options="${3}" |
7198 |
- local cmd=( |
7199 |
- "${my_print_defaults_binary}" |
7200 |
- "${extra_options}" |
7201 |
- "${section}" |
7202 |
- ) |
7203 |
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) |
7204 |
- |
7205 |
- if [[ ${#results[@]} -gt 0 ]] ; then |
7206 |
- # When option is set multiple times only return last value |
7207 |
- echo "${results[-1]}" |
7208 |
- fi |
7209 |
- } |
7210 |
- |
7211 |
- _mktemp_dry() { |
7212 |
- # emktemp has no --dry-run option |
7213 |
- local template="${1}" |
7214 |
- |
7215 |
- if [[ -z "${template}" ]] ; then |
7216 |
- if [[ -z "${T}" ]] ; then |
7217 |
- template="/tmp/XXXXXXX" |
7218 |
- else |
7219 |
- template="${T}/XXXXXXX" |
7220 |
- fi |
7221 |
- fi |
7222 |
- |
7223 |
- local template_wo_X=${template//X/} |
7224 |
- local n_X |
7225 |
- let n_X=${#template}-${#template_wo_X} |
7226 |
- if [[ ${n_X} -lt 3 ]] ; then |
7227 |
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 |
7228 |
- return |
7229 |
- fi |
7230 |
- |
7231 |
- local attempts=0 |
7232 |
- local character tmpfile |
7233 |
- while [[ true ]] ; do |
7234 |
- let attempts=attempts+1 |
7235 |
- |
7236 |
- new_file= |
7237 |
- while read -n1 character ; do |
7238 |
- if [[ "${character}" == "X" ]] ; then |
7239 |
- tmpfile+="${RANDOM:0:1}" |
7240 |
- else |
7241 |
- tmpfile+="${character}" |
7242 |
- fi |
7243 |
- done < <(echo -n "${template}") |
7244 |
- |
7245 |
- if [[ ! -f "${tmpfile}" ]] |
7246 |
- then |
7247 |
- echo "${tmpfile}" |
7248 |
- return |
7249 |
- fi |
7250 |
- |
7251 |
- if [[ ${attempts} -ge 100 ]] ; then |
7252 |
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 |
7253 |
- return |
7254 |
- fi |
7255 |
- done |
7256 |
- } |
7257 |
- |
7258 |
- local mysqld_binary="${EROOT}/usr/sbin/mysqld" |
7259 |
- if [[ ! -x "${mysqld_binary}" ]] ; then |
7260 |
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
7261 |
- fi |
7262 |
- |
7263 |
- local mysql_binary="${EROOT}/usr/bin/mysql" |
7264 |
- if [[ ! -x "${mysql_binary}" ]] ; then |
7265 |
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" |
7266 |
- fi |
7267 |
- |
7268 |
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" |
7269 |
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then |
7270 |
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" |
7271 |
- fi |
7272 |
- |
7273 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
7274 |
- MYSQL_USER=mysql |
7275 |
- if use prefix ; then |
7276 |
- MYSQL_USER=$(id -u -n 2>/dev/null) |
7277 |
- if [[ -z "${MYSQL_USER}" ]] ; then |
7278 |
- die "Failed to determine current username!" |
7279 |
- fi |
7280 |
- fi |
7281 |
- fi |
7282 |
- |
7283 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
7284 |
- MYSQL_GROUP=mysql |
7285 |
- if use prefix ; then |
7286 |
- MYSQL_GROUP=$(id -g -n 2>/dev/null) |
7287 |
- if [[ -z "${MYSQL_GROUP}" ]] ; then |
7288 |
- die "Failed to determine current user groupname!" |
7289 |
- fi |
7290 |
- fi |
7291 |
- fi |
7292 |
- |
7293 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
7294 |
- local -x HOME="${EROOT}/root" |
7295 |
- |
7296 |
- # Make sure the vars are correctly initialized |
7297 |
- mysql_init_vars |
7298 |
- |
7299 |
- # Read currently set data directory |
7300 |
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
7301 |
- |
7302 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
7303 |
- # localhost. Also causes weird failures. |
7304 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
7305 |
- |
7306 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
7307 |
- die "Sorry, unable to find MY_DATADIR!" |
7308 |
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then |
7309 |
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" |
7310 |
- ewarn "Please rename or delete its content if you wish to initialize a new data directory." |
7311 |
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" |
7312 |
- fi |
7313 |
- |
7314 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
7315 |
- MYSQL_TMPDIR=${MYSQL_TMPDIR%/} |
7316 |
- # These are dir+prefix |
7317 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
7318 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
7319 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" |
7320 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
7321 |
- |
7322 |
- # Create missing directories. |
7323 |
- # Always check if mysql user can write to directory even if we just |
7324 |
- # created directory because a parent directory might be not |
7325 |
- # accessible for that user. |
7326 |
- PID_DIR="${EROOT}/run/mysqld" |
7327 |
- if [[ ! -d "${PID_DIR}" ]] ; then |
7328 |
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..." |
7329 |
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ |
7330 |
- || die "Failed to create PID directory '${PID_DIR}'!" |
7331 |
- fi |
7332 |
- |
7333 |
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" |
7334 |
- [[ -z "${_pid_dir_testfile}" ]] \ |
7335 |
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
7336 |
- |
7337 |
- if use prefix ; then |
7338 |
- touch "${_pid_dir_testfile}" &>/dev/null |
7339 |
- else |
7340 |
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null |
7341 |
- fi |
7342 |
- |
7343 |
- if [[ $? -ne 0 ]] ; then |
7344 |
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" |
7345 |
- else |
7346 |
- rm "${_pid_dir_testfile}" || die |
7347 |
- unset _pid_dir_testfile |
7348 |
- fi |
7349 |
- |
7350 |
- if [[ ! -d "${MY_DATADIR}" ]] ; then |
7351 |
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." |
7352 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ |
7353 |
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" |
7354 |
- fi |
7355 |
- |
7356 |
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" |
7357 |
- [[ -z "${_my_datadir_testfile}" ]] \ |
7358 |
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
7359 |
- |
7360 |
- if use prefix ; then |
7361 |
- touch "${_my_datadir_testfile}" &>/dev/null |
7362 |
- else |
7363 |
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null |
7364 |
- fi |
7365 |
- |
7366 |
- if [[ $? -ne 0 ]] ; then |
7367 |
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" |
7368 |
- else |
7369 |
- rm "${_my_datadir_testfile}" || die |
7370 |
- unset _my_datadir_testfile |
7371 |
- fi |
7372 |
- |
7373 |
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then |
7374 |
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." |
7375 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ |
7376 |
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" |
7377 |
- fi |
7378 |
- |
7379 |
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then |
7380 |
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" |
7381 |
- [[ -z "${MYSQL_TMPDIR}" ]] \ |
7382 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" |
7383 |
- |
7384 |
- mkdir "${MYSQL_TMPDIR}" || die |
7385 |
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die |
7386 |
- fi |
7387 |
- |
7388 |
- # Now we need to test MYSQL_TMPDIR... |
7389 |
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" |
7390 |
- [[ -z "${_my_tmpdir_testfile}" ]] \ |
7391 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" |
7392 |
- |
7393 |
- if use prefix ; then |
7394 |
- touch "${_my_tmpdir_testfile}" &>/dev/null |
7395 |
- else |
7396 |
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null |
7397 |
- fi |
7398 |
- |
7399 |
- if [[ $? -ne 0 ]] ; then |
7400 |
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" |
7401 |
- else |
7402 |
- rm "${_my_tmpdir_testfile}" || die |
7403 |
- unset _my_tmpdir_testfile |
7404 |
- fi |
7405 |
- |
7406 |
- if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then |
7407 |
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." |
7408 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ |
7409 |
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" |
7410 |
- fi |
7411 |
- |
7412 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
7413 |
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" |
7414 |
- [[ -z "${_my_logbin_testfile}" ]] \ |
7415 |
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" |
7416 |
- |
7417 |
- if use prefix ; then |
7418 |
- touch "${_my_logbin_testfile}" &>/dev/null |
7419 |
- else |
7420 |
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null |
7421 |
- fi |
7422 |
- |
7423 |
- if [[ $? -ne 0 ]] ; then |
7424 |
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" |
7425 |
- else |
7426 |
- rm "${_my_logbin_testfile}" || die |
7427 |
- unset _my_logbin_testfile |
7428 |
- fi |
7429 |
- fi |
7430 |
- |
7431 |
- if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then |
7432 |
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." |
7433 |
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ |
7434 |
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" |
7435 |
- fi |
7436 |
- |
7437 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
7438 |
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" |
7439 |
- [[ -z "${_my_relaylog_testfile}" ]] \ |
7440 |
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" |
7441 |
- |
7442 |
- if use prefix ; then |
7443 |
- touch "${_my_relaylog_testfile}" &>/dev/null |
7444 |
- else |
7445 |
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null |
7446 |
- fi |
7447 |
- |
7448 |
- if [[ $? -ne 0 ]] ; then |
7449 |
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" |
7450 |
- else |
7451 |
- rm "${_my_relaylog_testfile}" || die |
7452 |
- unset _my_relaylog_testfile |
7453 |
- fi |
7454 |
- fi |
7455 |
- |
7456 |
- local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" |
7457 |
- if [[ -z "${mysql_install_log}" ]] ; then |
7458 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" |
7459 |
- else |
7460 |
- # make sure file is writable for MYSQL_USER... |
7461 |
- touch "${mysql_install_log}" || die |
7462 |
- chown ${MYSQL_USER} "${mysql_install_log}" || die |
7463 |
- fi |
7464 |
- |
7465 |
- local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" |
7466 |
- if [[ -z "${mysqld_logfile}" ]] ; then |
7467 |
- die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" |
7468 |
- else |
7469 |
- # make sure file is writable for MYSQL_USER... |
7470 |
- touch "${mysqld_logfile}" || die |
7471 |
- chown ${MYSQL_USER} "${mysqld_logfile}" || die |
7472 |
- fi |
7473 |
- |
7474 |
- echo "" |
7475 |
- einfo "Detected settings:" |
7476 |
- einfo "==================" |
7477 |
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}" |
7478 |
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" |
7479 |
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}" |
7480 |
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" |
7481 |
- |
7482 |
- if [[ -n "${MYSQL_LOG_BIN}" ]] ; then |
7483 |
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" |
7484 |
- fi |
7485 |
- |
7486 |
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then |
7487 |
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" |
7488 |
- fi |
7489 |
- |
7490 |
- einfo "PID DIR:\t\t\t\t${PID_DIR}" |
7491 |
- einfo "Install db log:\t\t\t${mysql_install_log}" |
7492 |
- einfo "Install server log:\t\t\t${mysqld_logfile}" |
7493 |
- |
7494 |
- local -a config_files |
7495 |
- |
7496 |
- local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" |
7497 |
- if [[ -f "${config_file}" ]] ; then |
7498 |
- config_files+=( "${config_file}" ) |
7499 |
- else |
7500 |
- ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..." |
7501 |
- fi |
7502 |
- |
7503 |
- config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" |
7504 |
- if [[ -f "${config_file}" ]] ; then |
7505 |
- config_files+=( "${config_file}" ) |
7506 |
- else |
7507 |
- ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..." |
7508 |
- fi |
7509 |
- |
7510 |
- if [[ ${#config_files[@]} -gt 0 ]] ; then |
7511 |
- if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then |
7512 |
- local user_answer |
7513 |
- |
7514 |
- echo |
7515 |
- einfo "Please select default authentication plugin (enter number or plugin name):" |
7516 |
- einfo "1) caching_sha2_password [MySQL 8.0 default]" |
7517 |
- einfo "2) mysql_native_password [MySQL 5.7 default]" |
7518 |
- einfo |
7519 |
- einfo "For details see:" |
7520 |
- einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" |
7521 |
- read -p " >" user_answer |
7522 |
- echo |
7523 |
- |
7524 |
- case "${user_answer}" in |
7525 |
- 1|caching_sha2_password) |
7526 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password |
7527 |
- ;; |
7528 |
- 2|mysql_native_password) |
7529 |
- MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password |
7530 |
- ;; |
7531 |
- '') |
7532 |
- die "No authentication plugin selected!" |
7533 |
- ;; |
7534 |
- *) |
7535 |
- die "Authentication plugin '${user_answer}' is unknown/unsupported!" |
7536 |
- ;; |
7537 |
- esac |
7538 |
- |
7539 |
- echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" |
7540 |
- |
7541 |
- unset user_answer |
7542 |
- fi |
7543 |
- |
7544 |
- local cfg_option cfg_option_tabs cfg_section |
7545 |
- for config_file in "${config_files[@]}" ; do |
7546 |
- cfg_option="default-authentication-plugin" |
7547 |
- cfg_section="mysqld" |
7548 |
- cfg_option_tabs="\t\t" |
7549 |
- if [[ "${config_file}" == *client.cnf ]] ; then |
7550 |
- cfg_option="default-auth" |
7551 |
- cfg_section="client" |
7552 |
- cfg_option_tabs="\t\t\t\t" |
7553 |
- fi |
7554 |
- |
7555 |
- if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then |
7556 |
- einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
7557 |
- sed -i \ |
7558 |
- -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ |
7559 |
- "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" |
7560 |
- else |
7561 |
- einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." |
7562 |
- sed -i \ |
7563 |
- -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ |
7564 |
- "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" |
7565 |
- fi |
7566 |
- done |
7567 |
- unset cfg_option cfg_option_tabs cfg_section |
7568 |
- fi |
7569 |
- unset config_files config_file |
7570 |
- |
7571 |
- echo |
7572 |
- |
7573 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
7574 |
- local tmp_mysqld_password_source= |
7575 |
- |
7576 |
- for tmp_mysqld_password_source in mysql client ; do |
7577 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
7578 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
7579 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
7580 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then |
7581 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
7582 |
- MYSQL_ROOT_PASSWORD= |
7583 |
- continue |
7584 |
- fi |
7585 |
- |
7586 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
7587 |
- break |
7588 |
- fi |
7589 |
- done |
7590 |
- |
7591 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
7592 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then |
7593 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
7594 |
- fi |
7595 |
- |
7596 |
- unset tmp_mysqld_password_source |
7597 |
- fi |
7598 |
- |
7599 |
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then |
7600 |
- local pwd1="a" |
7601 |
- local pwd2="b" |
7602 |
- |
7603 |
- echo |
7604 |
- einfo "No password for mysql 'root' user was specified via environment" |
7605 |
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" |
7606 |
- einfo "file like '${HOME}/.my.cnf'." |
7607 |
- einfo "To continue please provide a password for the mysql 'root' user" |
7608 |
- einfo "now on console:" |
7609 |
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" |
7610 |
- read -rsp " >" pwd1 ; echo |
7611 |
- |
7612 |
- einfo "Retype the password" |
7613 |
- read -rsp " >" pwd2 ; echo |
7614 |
- |
7615 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
7616 |
- die "Passwords are not the same!" |
7617 |
- fi |
7618 |
- |
7619 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
7620 |
- unset pwd1 pwd2 |
7621 |
- |
7622 |
- echo |
7623 |
- fi |
7624 |
- |
7625 |
- local -a mysqld_options |
7626 |
- |
7627 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
7628 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
7629 |
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) |
7630 |
- |
7631 |
- # Figure out which options we need to disable to do the setup |
7632 |
- local helpfile="${TMPDIR}/mysqld-help" |
7633 |
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
7634 |
- |
7635 |
- local opt optexp optfull |
7636 |
- for opt in host-cache name-resolve networking slave-start \ |
7637 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
7638 |
- log-slave-updates \ |
7639 |
- ; do |
7640 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
7641 |
- egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) |
7642 |
- done |
7643 |
- |
7644 |
- # Prepare timezones, see |
7645 |
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
7646 |
- local tz_sql="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" |
7647 |
- [[ -z "${tz_sql}" ]] \ |
7648 |
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" |
7649 |
- |
7650 |
- echo "USE mysql;" >"${tz_sql}" |
7651 |
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null |
7652 |
- if [[ $? -ne 0 ]] ; then |
7653 |
- die "mysql_tzinfo_to_sql failed!" |
7654 |
- fi |
7655 |
- |
7656 |
- # --initialize-insecure will not set root password |
7657 |
- # --initialize would set a random one in the log which we don't need as we set it ourselves |
7658 |
- local cmd=( |
7659 |
- "${mysqld_binary}" |
7660 |
- "${mysqld_options[@]}" |
7661 |
- "--initialize-insecure" |
7662 |
- "--init-file='${tz_sql}'" |
7663 |
- "--basedir='${EROOT}/usr'" |
7664 |
- "--datadir='${MY_DATADIR}'" |
7665 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
7666 |
- "--log-error='${mysql_install_log}'" |
7667 |
- "--user=${MYSQL_USER}" |
7668 |
- ) |
7669 |
- |
7670 |
- einfo "Initializing ${PN} data directory: ${cmd[@]}" |
7671 |
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 |
7672 |
- |
7673 |
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then |
7674 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 |
7675 |
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" |
7676 |
- fi |
7677 |
- |
7678 |
- rm "${tz_sql}" || die |
7679 |
- |
7680 |
- local x=${RANDOM} |
7681 |
- local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" |
7682 |
- local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" |
7683 |
- unset x |
7684 |
- |
7685 |
- cmd=( |
7686 |
- "${mysqld_binary}" |
7687 |
- "${mysqld_options[@]}" |
7688 |
- "--basedir='${EROOT}/usr'" |
7689 |
- "--datadir='${MY_DATADIR}'" |
7690 |
- "--tmpdir='${MYSQL_TMPDIR}'" |
7691 |
- --max_allowed_packet=8M |
7692 |
- --net_buffer_length=16K |
7693 |
- "--socket='${socket}'" |
7694 |
- "--pid-file='${pidfile}'" |
7695 |
- "--log-error='${mysqld_logfile}'" |
7696 |
- "--user=${MYSQL_USER}" |
7697 |
- ) |
7698 |
- |
7699 |
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}" |
7700 |
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & |
7701 |
- |
7702 |
- echo -n "Waiting for mysqld to accept connections " |
7703 |
- local maxtry=15 |
7704 |
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
7705 |
- maxtry=$((${maxtry}-1)) |
7706 |
- echo -n "." |
7707 |
- sleep 1 |
7708 |
- done |
7709 |
- |
7710 |
- if [[ -S "${socket}" ]] ; then |
7711 |
- # Even with a socket we don't know if mysqld will abort |
7712 |
- # start due to an error so just wait a little bit more... |
7713 |
- maxtry=5 |
7714 |
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do |
7715 |
- maxtry=$((${maxtry}-1)) |
7716 |
- echo -n "." |
7717 |
- sleep 1 |
7718 |
- done |
7719 |
- fi |
7720 |
- |
7721 |
- echo |
7722 |
- |
7723 |
- if [[ ! -S "${socket}" ]] ; then |
7724 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 |
7725 |
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" |
7726 |
- fi |
7727 |
- |
7728 |
- local mysql_logfile="${TMPDIR}/set_root_pw.log" |
7729 |
- touch "${mysql_logfile}" || die |
7730 |
- |
7731 |
- ebegin "Setting root password" |
7732 |
- # Do this from memory, as we don't want clear text passwords in temp files |
7733 |
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" |
7734 |
- cmd=( |
7735 |
- "${mysql_binary}" |
7736 |
- --no-defaults |
7737 |
- "--socket='${socket}'" |
7738 |
- -hlocalhost |
7739 |
- "-e \"${sql}\"" |
7740 |
- ) |
7741 |
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 |
7742 |
- local rc=$? |
7743 |
- eend ${rc} |
7744 |
- |
7745 |
- if [[ ${rc} -ne 0 ]] ; then |
7746 |
- # Poor man's solution which tries to avoid having password |
7747 |
- # in log. NOTE: sed can fail if user didn't follow advice |
7748 |
- # and included character which will require escaping... |
7749 |
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null |
7750 |
- |
7751 |
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" |
7752 |
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" |
7753 |
- fi |
7754 |
- |
7755 |
- # Stop the server |
7756 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
7757 |
- echo -n "Stopping the server " |
7758 |
- pkill -F "${pidfile}" &>/dev/null |
7759 |
- |
7760 |
- maxtry=10 |
7761 |
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do |
7762 |
- maxtry=$((${maxtry}-1)) |
7763 |
- echo -n "." |
7764 |
- sleep 1 |
7765 |
- done |
7766 |
- |
7767 |
- echo |
7768 |
- |
7769 |
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then |
7770 |
- # We somehow failed to stop server. |
7771 |
- # However, not a fatal error. Just warn the user. |
7772 |
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" |
7773 |
- fi |
7774 |
- fi |
7775 |
- |
7776 |
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" |
7777 |
-} |