summaryrefslogtreecommitdiff
path: root/dev-db
diff options
context:
space:
mode:
Diffstat (limited to 'dev-db')
-rw-r--r--dev-db/Manifest.gzbin15232 -> 15229 bytes
-rw-r--r--dev-db/mariadb/Manifest12
-rw-r--r--dev-db/mariadb/files/mariadb-10.6.12-gcc-13.patch44
-rw-r--r--dev-db/mariadb/mariadb-10.11.1.ebuild1319
-rw-r--r--dev-db/mariadb/mariadb-10.4.28.ebuild1313
-rw-r--r--dev-db/mariadb/mariadb-10.5.19.ebuild1320
-rw-r--r--dev-db/mariadb/mariadb-10.6.12.ebuild1323
-rw-r--r--dev-db/mydumper/Manifest7
-rw-r--r--dev-db/mydumper/files/mydumper-0.13.1-atomic.patch26
-rw-r--r--dev-db/mydumper/mydumper-0.11.5.2.ebuild49
-rw-r--r--dev-db/mydumper/mydumper-0.13.1.2.ebuild (renamed from dev-db/mydumper/mydumper-0.12.1.ebuild)6
-rw-r--r--dev-db/phpmyadmin/Manifest2
-rw-r--r--dev-db/phpmyadmin/phpmyadmin-5.2.1.ebuild60
13 files changed, 5425 insertions, 56 deletions
diff --git a/dev-db/Manifest.gz b/dev-db/Manifest.gz
index 218d2686f986..be48c476312f 100644
--- a/dev-db/Manifest.gz
+++ b/dev-db/Manifest.gz
Binary files differ
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
index e0052644fa19..db997dc81c37 100644
--- a/dev-db/mariadb/Manifest
+++ b/dev-db/mariadb/Manifest
@@ -1,28 +1,40 @@
AUX mariadb-10.6.11-gcc-13.patch 2093 BLAKE2B a61c373848b63123af5760e07c03f919c0dabe2cf2225ef5a1e6de38fc814b597ac8db35dd9cfeaa0425cd2d3fb43b79ba11839e852cb074fe12612868afec1e SHA512 257fdaa306e2fc52174dcf36472383482116e2957f834f9228ad250837e86e8b57fd892153cf0c94b1fb0fd42d6ef6da69402089cf9795835d8a82fffa9b5496
AUX mariadb-10.6.11-gssapi.patch 1824 BLAKE2B 5d0fefad9ff2d35d06dc4df3bcdd08a737a6f5ab7492673102c031c0e88fdd3fd7eeef977fb4128be170b9c948850e6a69a6d11f972d234cf49f2ea742838478 SHA512 0acee9c539782f11480b8e274576bb3b06cc7b2a914fee2d8f85fb692700b014da1f47e08f5f36d5ed264c9b5f820a123791de5b010fdc25f194dc215e890162
AUX mariadb-10.6.11-include.patch 2044 BLAKE2B 050729672c228818658f45b02ef5a70a8153eb43b7729569edcd7b0c9420a5b16a57359f153862232c634a817a21d0d6a20028104ef5cfdc53f3de25e7e63425 SHA512 cb8150274538fd2e3c26f9fde8fdbf0e8c31c2c26efe9e99ca97d984ae17fe967aabf315c7aee4d2659c3c477eaac604afc948f44de7475ee248cd502dac0fa5
+AUX mariadb-10.6.12-gcc-13.patch 1145 BLAKE2B 592d1699bf538c7cccac59ba694b5dce981204b89726549541a487b11a2faf6a94d581c10aa366272c3b651d3bfa3ca6d0d72d77eabc1e2f9d6f64380496ee17 SHA512 a6c6f10c67eebd03bfd484325d9b6b2ffd0130af84df10a07fd86ab7682ca927b3aeca6f1fd939e743b082c08136d6fd5041949518cd36a6ee1b2fcc434a99a2
AUX my.cnf-10.2 140 BLAKE2B 3a56b7e38c3dc00215cae4bdc3270e30e85299d3290c0c995a611e4b8b15e66f40d6ac40ab18369e7863742ab6eda94259be5a7f363a26020c6fce28a7582e94 SHA512 85c650670e364f5f71842d9ab07b59c5de6e26e774e7192102562e56f94ed5f8fbc487cef31c134209c22b72fde38f7f53b7279cead97a8af608436d1ecc8857
AUX my.cnf.distro-client 643 BLAKE2B 5ffd286907ee28c92c85bbcc9a6266555733f1115f2d6b8009183dba6939b978ae8d1b8e0a53e672b8e1a1f621650399231723603fc5f96ef7218db84236e176 SHA512 801f6ab8be3110bb4dc38eaa4367715b8d342b69cadfe13dff987ef6c3aedb67d19449f8f2483e63df5d8b444ca30701b0d96f85e211de6b1e3db923b029acbc
AUX my.cnf.distro-server 998 BLAKE2B a7f2977a96d394cb7e24d72d82a1c21095c4b55607e5ca4a2c10619278796c328931a5ec076c15b60afef370c2e5da02ca0c628f330e876b4d2c984eeb54df5f SHA512 d9ab6f7fdfe08e6c242f84410ec680ef6aa6778c4bd55fee67c644e1a7d997446d8ef2129be6fc9833d16fe40cf17e09cdf0cf015f06bb145bbf9cfecb51e882
+DIST mariadb-10.11.1-patches-01.tar.xz 5240 BLAKE2B af13dfe4de4dff670550ce8e7d55df9905cb66c88adafa662eff684d64e2f137b5912afc3051334811e9a178087f02f684cfbbf2d68d999325cb0c293b4ab08f SHA512 34281a5e5d26d7284e2032ee298b0e9ee7ece5880ba204763013d4abba3eea81df9d6c928c5388c6ff5cec2cb972545ef105940165e936c252179e5c6db5e37a
+DIST mariadb-10.11.1.tar.gz 96005902 BLAKE2B d9bb2d91dee1a17012da808f384fe9b8cfe628bb2fe567e131b0fcff72e4bb81f793502627dc12613b4cd6f1e459442722512e634d032aca01fa84fcb1041b85 SHA512 8d327adca024535ced5cffb2c9e8c9feaa346b9e52834cf24b0ad1df2b4da62d2d026d18daf8a534838a6bbcdf9b2d00f6d1384defd8f45258784ea2cc9928e9
DIST mariadb-10.3.36-patches-01.tar.xz 4548 BLAKE2B 24ae803afe38f406a37380e4d49d7e8434b7b549c9633fdd24bd35a23bf8b5d72fa6e8174c4ddc8dda9a994bd2fd2feecddcb5650029067dcbc578ea525e48cb SHA512 8fd0c6ed0fe6c99ff2219c1f4a6abe24050f91bcf808e1bcc0be3e194244440d5fe5717a0dc4c4c3ef12642b9d722197b780f9fb999ed8770a748d2c0e40ea4b
DIST mariadb-10.3.36.tar.gz 73944352 BLAKE2B 75090969802783de59ed73338a9a77c70f4dafa14b03334edd5f48593c89b39e752548f34c81875e93263c0b7f2648e83962ef568b07ea11160faf880a9800ed SHA512 321b4c48fcea4413eb239c4904c806306de660f2844edfa1d2a2a15213db287070d0f923db976588dfe329559d565bd98bddef3aaf8f14502f8c3db2ee27757a
DIST mariadb-10.3.37.tar.gz 74314608 BLAKE2B cef3218cb48aeba788289888bcd642ddc3cf690151c5754eea8df907204547681cdbbf251b9100cd5df0ccd18359c6c42c9314959a729d42bdad1c42a283006b SHA512 24df11d03a5a445fbdcd6240ff7036854678d79db12edc79f4db8d36204e2ea37e3716d4d07bee235fd0bc95b308a12dec4dc5517e3c01fa4967e0a076b7c65a
DIST mariadb-10.4.26-patches-01.tar.xz 4528 BLAKE2B 0e1683ca254fa4beb06239c377f241e6db2306b386d125491ea39dddbe82c9471f1dc7c26001f2c5ba105913f1ec707ce43482e9581b807723a8690c26fc6e6e SHA512 7b54419ea7a974bc275c72770e63d37e116a2724ed5ce404a04acb622a95ae652f9a81c2ece0dd3d1ea41401dd5428627af19f7689fd01eb68471309ef4400f7
DIST mariadb-10.4.26.tar.gz 96095606 BLAKE2B 313e3e9561bf2805327141bf1d1e0834e6e3997bb1cd523452555b23ecfc1dddcb91e53478113dff56486bb77d172211c16c9e375d7e451f6af2346de338d3db SHA512 4dadd786f902eb4fec702a863b790215b284eb5d6ecce2cb550e97e055ec4d21ef383f08938020ebbdf3a9150e1d4412817c2fa24f36e907deb0fe5b4ce96cb0
DIST mariadb-10.4.27.tar.gz 94348724 BLAKE2B 3e34b66f645798fbb48def30177f95afaff985c7a4f0063e58131f08f7599053a65c9cd9da9940d986ace1e5b78abd8e4885d990b9705e4c10093040df510239 SHA512 22865451b0e3caaa6c886f68292af95c02eb18c37d545998eccda952f125c0983ecb358f4deebaebb9a5ed30cfd947e8a1457760f0d985e7b738c03437ed26a2
+DIST mariadb-10.4.28.tar.gz 94731133 BLAKE2B d0419368f3eb73af3e49adf72bfb21f8f763b6a6aef3035b3eceeb0557dfff72df662f80a8147ce2c80c5a776f7aad8bb15a146739cc16b64878b5b2f153336e SHA512 2d66380dd65aa85bf8a142fee18faecef10562c5c31e17f429afad9dba5a2b373b5b400da2bd42e5d78b7f01f3393ea0a46e0ed17ec1e0820f42f7b838f56f0d
DIST mariadb-10.5.17-patches-01.tar.xz 5124 BLAKE2B 74976beee48142294d1dcab73e9cdad40392619115184ab5da5553d28b9a10e415711fac84c4290affe301abe0047c99c5a31ce9dfd58c923cfa15346b9c5acc SHA512 b3ffc4a227fcb4a85575fd093b399810c433686a97518cb0d2b47d61c623bbb760b40c5c9d7752fdbb24e3e41740e8a85c3096f6269c80f6ecc2ffc73d5ee94b
DIST mariadb-10.5.17.tar.gz 113314849 BLAKE2B 6b2efabc620f38d3b0d35930aa4c9b2e63f01d106de57056b5e4b8d629c5669ac1e64d120ce9cd77d3ddd857eeee9630af3dcb52fe6db9c7f7413248b748d4ef SHA512 5a68126aac7072bed549404c89f7215bc47dede8f72559076988469372b96523a800fd6bbf11ff3003a277ee30788ca99a21507b7d7e2b7e98437ca70b5ca0fc
DIST mariadb-10.5.18.tar.gz 111568643 BLAKE2B 39067475c00c456d0cb5e79eef063665db81ec98216b0c1969428edd7d5651d44186eb01d301aa4a7322845e401e3667f54128bd8aced2a88783c8a397ae19c1 SHA512 1fe13db1c0b66d2bc0c4d80e2c278f6e64027aaeebebfa5a179bd8ca92ae135ae53b72ed26c9b6d35b35fd2ad2a3cb390fd5ee0715b22d4bfafe773f950d804c
+DIST mariadb-10.5.19-patches-01.tar.xz 5156 BLAKE2B 9e764f11dc5ed1babb2b34122f70e90e3ca8765a6f5860fb70e71bbca69311656645b7178332df7d8c2cbd57264d3418a2707558fc2ec332b031e600b545af01 SHA512 ccbb3d64eedce9abb76a40b7658b19487a669f585c95138590e47e1e47fe84e761a20d733ce1c8a413099d23bc52f032e8ac20644d9508e31982d418058c963b
+DIST mariadb-10.5.19.tar.gz 111958233 BLAKE2B 0dd89fe0a838710d7307e3bc293f31232ad3c2c36d48c2899fb46b4fab87234f401224a07ff3da921370fdace3f3c972782c419be3479ab686fa46d31f8ca8b4 SHA512 4a72ca4dfee0d3fa5432495f62c7eb03addc067e2f023b1ebe32bd1d3a0687c2c61c3316c0c4f690db4f74559bce668c6accbe137d906a52116db2bb2f454699
DIST mariadb-10.6.10-patches-01.tar.xz 5240 BLAKE2B 4c41bbb5a81ecca3e9ccbdfb0861189575e5b3edfb1019465c8dbceee641a8bbeb3e54f061ff3ec44fb5ff3bca960419893429897db4a919177c390b44ef7e49 SHA512 aee039f5e771c840e2a5bb6f6f5fcbec06c0bbd7fd5ce155f0e6f3694595d5d2a0e38f25972c328fc9f69dd68354434e40c5e9a7b2d509d7ea795e097a57864d
DIST mariadb-10.6.10.tar.gz 96453293 BLAKE2B 889d141ab9e0e9a0cd3fc9b191a15192170029a5fddcff8ebfe482cc3cfdfec6307c014fe09719c7c254a3941034f53ee7ff6187f3d502e3f3edb4d586dff8f3 SHA512 912219878e2201280f5927ee8a34dafe83ac2c3ce8c6fa3d90731d10fd693c369872aff840edc8329b82c53e9908fbdb1ba731ba140e2b99048edb5eb21f22c4
DIST mariadb-10.6.11.tar.gz 94742041 BLAKE2B cb5ff7a9b44814cb56f715c92f9d136070872889c0fe2d27987f62f75b1c787ef4ece81ae8bad9a944cbb4c4416fc23587fdab366ad1181b319eb3a0bf40f91a SHA512 4b9e8e16651329f53eb19670dcc7f5dbb11ba84c28cca35bc7d216c5504b6db698ab65ce42c30a34ab967c1b14e6637c511ac4b49f2613b01f6dd615288cba98
+DIST mariadb-10.6.12-patches-01.tar.xz 5120 BLAKE2B 5c5b25be056edf2ea665ed2ceca3af7012c9d4b07a09c8e5c892a7495a83bb297bdae3b779048b83919791d118f6a4e938284f0db4580cc864b855eee400a88b SHA512 ef6c468bf28a00d5424aa12e9c2909eec4f77e74ce9d128404824fd6b9d48a7cac7fbcfb623d3af279a810af1d0b0b3f30a1651599ed0a04f972ff1f6d0b5c7a
+DIST mariadb-10.6.12.tar.gz 95085449 BLAKE2B e915601e53c9ebb8c0f2b0536d6adb9bc4a0268fd0e5808ff851f33e6c49571e4edb66ef6c11511a65331a292c8431cd71be75d5ffd786830b14f3b843d210f2 SHA512 f6d5178ce2a4d755367bb805f23e849824ee4c982a01a114c35a13d250a9b3b2a93ac9b745fb3685fd9e6b44deff0b5c936b43e5441d3af8a300881109db0549
+EBUILD mariadb-10.11.1.ebuild 42481 BLAKE2B 6f0758680a05c9e9fa1ae3bf0098e85dc1bfa6159ff24fad7edbd6a03e56dcc110f73851f747955b6d2ac0ee50541ae8f3b8931a4d339fdb8e2cae680e4e1894 SHA512 a357f36a9f39c1b651e1c1b530c507a1a7a0144d3308326bb446cfa714a4eff7c4055f1f767ec07e60c77f3a8534d7bdb8ad73b90afabcc1221e318796d16e28
EBUILD mariadb-10.3.36.ebuild 41419 BLAKE2B 00a841bc6de179190f6af3123b89c3712a537ba67aee42a47a182e2b082b05cbcf7b33f9e912b85add54928494c25727c3ea84d0f9cea18ac9704e8438b38dc0 SHA512 5bd208084ce7c822c3d8d1b273fae6091b9c85c15489749330b5a482718c6e0b0de42d7fb5c32a4ef06b9c2f113e51d483d3618436108f27f1af0561fb3592b3
EBUILD mariadb-10.3.37.ebuild 41426 BLAKE2B b58b1162bb9f5dde79884ba90702008b0cf82367a1c20bf1424ec95f31661eaac7d268103b50f85fb17faa96170fc65f9e220cfc3a9c41ff70ae6a4d48af5842 SHA512 a755b3fea4ae45cd1c09f59ce9406e9b8e337adc7e0273873b6f1dffa524284358239d5fa7f24e12634cda69d16fe3a88154041795e67fc13db974e4e7610468
EBUILD mariadb-10.4.26.ebuild 42122 BLAKE2B 046fb8f4bbfb13965ddd0afc1cfd1cba2428097cdab29a55177535a868c0706a54194aa63ce5ab43d506056b1986e1cca08b70a8c5ff00e0075f652017187c0c SHA512 d1aefeea448aa1d74bd97470ef3ad6e3d350e133cd4f174416968bd3d7893d25b46ebfdd5c1bfd54e26a4472c44bccc000d831ed265877626baa444bff242373
EBUILD mariadb-10.4.27.ebuild 42121 BLAKE2B 332f5d61f789e607c0bc450a458bdbf13d0b5279e4e95d8f728bcbc4fb2e23a4110c42e51d176890986c6b932a49b8c2dac139bc9d505f998cc49139a6a73794 SHA512 a82b294eccc8272ae0d370af0245238c15e162660827aa03f22a2d26e7c84ba42c3e23e5bb58adbcc92e5bcfcd70034e82b377b4db8592e974ec2167101b86b1
+EBUILD mariadb-10.4.28.ebuild 42269 BLAKE2B 5b009cd1dd176d54ae71ce9b5a090aee411446653f403f0c54bb393b8ea5d4c254114b3ba503b08e7bf4d7144d2786cb14520202b9dbb17ae524d79c67a2963c SHA512 6d319614bb3c23a07ed6cfccd96abe59d97e93293e6a47483b9af650010a66fa9d4aa7228244ca43a12e220445ca4a3f431c9625344e897d4595be72cda6562a
EBUILD mariadb-10.5.17.ebuild 42081 BLAKE2B 78a2d0e5d55394399a2cb0ecb7b28b96536be282b02e2c57b7f0bda52a7c44478df2f8acd65f269601c2034b34967f2309608ad0bd396aed6557daffd5f35621 SHA512 be00feae76cca07d7c91b9ac66b7d29ef0fbe8d4fc88d2d03be2c6f584ae18be8825b89f55d99e1d573d49e60b77c3e1557aa4745f0ed3df7fde37a82eb7b014
EBUILD mariadb-10.5.18.ebuild 42080 BLAKE2B 5252ab1695c80057ec24db41f895791b11c55732c883998e3d358fffcd40e67786062dea8912c914b59ab73309f560639a37f989aa8c90ef9d23fe30f22e1a5f SHA512 bc3430bb2cf0b67e098079ff3ac1454de26dfe8265c1fc1f76044bf826baa8f3e374b02ec80a0fd89cb92cf9d75bc67dadd4014f9517675db99870d4c42531f0
+EBUILD mariadb-10.5.19.ebuild 42228 BLAKE2B 2d7655aa1a3f2a589131db5defaab07eb4a4121fe63d82a9d176954a69a56846ca248ef3937dd229ace224d1d4d1c9035f1f24c688042969bf04cd4a99673ae9 SHA512 762dc0e7d64039b3c5061808c9edae6bc9593e18e965c6262d15104ddfbb489fe28b56cebed2775befe6f8f4f8c35d58da77a619c7a77db059dfd0f32ab7790f
EBUILD mariadb-10.6.10.ebuild 42456 BLAKE2B 6fd2ff41d538b30d3ad992bb6f5c3b2779f682b4cb9e705af23cf3a2b0b415f12efb442b6df261340ac7a039d9cfd14a5a33ef5b34dae658e76016c92b83ab59 SHA512 907c6d104a68980120ca44d7720404cbc05c8694e21219d035597207ab12c0479cebf9d94ad076f4839ab2f639bba9b4a1984547d5aab8d7eb037b48dd39962d
EBUILD mariadb-10.6.11-r1.ebuild 42588 BLAKE2B fd14c0c3c3fe8ee227422ef8671e5d2d0d9f23b07fba63f851602e170589972dd96083362f606972ad05bb20f98a491169e2340047c452972a898239cf0c20cc SHA512 116c63f89a51517d45f4cbaccb7b1af0f07ce83d7812d42fb7aae9df92a66d727b62d410fa61e0f279ecc9615da2ec829bed8ecca7f74687732549347d8bf0a7
EBUILD mariadb-10.6.11.ebuild 42609 BLAKE2B 2de2fdba1eb102f6d547a7c9a7c69a479977e80e5a95a4532af1698a7d4479c818d042f472fcc0ebf2b011c479b5c3b49b36720c3c0833f1b3430239de62b4b8 SHA512 ef7a52a60548a9a91eadef928aeaaad5e103da4b97cbd12c64868d490dc02f6c28851cfd4787334e1d87ecc2b026eae5cef00759df4f182edb3bd249738bf460
+EBUILD mariadb-10.6.12.ebuild 42636 BLAKE2B db1138afe85d6c24b2dbadfc3d98b28a99784f6ccf45b861a7939338a256653b52eaa5dce1823203421bbbb3b41ae3155deee09695e95d414f5b1bbce4a91c50 SHA512 aadeac9f92d568bd514c89aa0c69d75a90cb555d4e483abc263c154ce729aad194c46ba6ea2e5433dcf55a915f1222f7595696627d37d90f7b61b461bf4c9298
MISC metadata.xml 2602 BLAKE2B 7d388158062c76f40bca2feba53f292bbdab51cf0c3dba59ce2b74c3dedcb07cd7d4f1b5b52f7bf42c814dfc817a0670fcd8e39dccb2395337b46be98deda258 SHA512 a53f2612f8aea11cf7037847dc6f8b2acc87f710778b1bc18d7e1821c95061c1b08deefd3019789810eea2e5445b50c604b8686f3d491397793be3cbf86a35be
diff --git a/dev-db/mariadb/files/mariadb-10.6.12-gcc-13.patch b/dev-db/mariadb/files/mariadb-10.6.12-gcc-13.patch
new file mode 100644
index 000000000000..e1b18bee6791
--- /dev/null
+++ b/dev-db/mariadb/files/mariadb-10.6.12-gcc-13.patch
@@ -0,0 +1,44 @@
+https://github.com/facebook/rocksdb/pull/11118
+https://github.com/facebook/rocksdb/commit/bda8d93ba95f34aa91ae8578fe7d3454f3324f6a
+
+--- a/storage/rocksdb/rocksdb/db/compaction/compaction_iteration_stats.h
++++ b/storage/rocksdb/rocksdb/db/compaction/compaction_iteration_stats.h
+@@ -5,6 +5,8 @@
+
+ #pragma once
+
++#include <cstdint>
++
+ #include "rocksdb/rocksdb_namespace.h"
+
+ struct CompactionIterationStats {
+--- a/storage/rocksdb/rocksdb/include/rocksdb/utilities/checkpoint.h
++++ b/storage/rocksdb/rocksdb/include/rocksdb/utilities/checkpoint.h
+@@ -8,6 +8,7 @@
+ #pragma once
+ #ifndef ROCKSDB_LITE
+
++#include <cstdint>
+ #include <string>
+ #include <vector>
+ #include "rocksdb/status.h"
+--- a/storage/rocksdb/rocksdb/table/block_based/data_block_hash_index.h
++++ b/storage/rocksdb/rocksdb/table/block_based/data_block_hash_index.h
+@@ -5,6 +5,7 @@
+
+ #pragma once
+
++#include <cstdint>
+ #include <string>
+ #include <vector>
+
+--- a/storage/rocksdb/rocksdb/util/string_util.h
++++ b/storage/rocksdb/rocksdb/util/string_util.h
+@@ -6,6 +6,7 @@
+
+ #pragma once
+
++#include <cstdint>
+ #include <sstream>
+ #include <string>
+ #include <unordered_map>
diff --git a/dev-db/mariadb/mariadb-10.11.1.ebuild b/dev-db/mariadb/mariadb-10.11.1.ebuild
new file mode 100644
index 000000000000..a44a08b76b80
--- /dev/null
+++ b/dev-db/mariadb/mariadb-10.11.1.ebuild
@@ -0,0 +1,1319 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+SUBSLOT="18"
+
+JAVA_PKG_OPT_USE="jdbc"
+
+inherit systemd flag-o-matic prefix toolchain-funcs \
+ multiprocessing java-pkg-opt-2 cmake
+
+HOMEPAGE="https://mariadb.org/"
+SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
+ https://github.com/hydrapolic/gentoo-dist/raw/master/mariadb/mariadb-10.11.1-patches-01.tar.xz"
+
+DESCRIPTION="An enhanced, drop-in replacement for MySQL"
+LICENSE="GPL-2 LGPL-2.1+"
+SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
+IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
+ sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
+ test xml yassl"
+
+RESTRICT="!bindist? ( bindist ) !test? ( test )"
+
+REQUIRED_USE="jdbc? ( extraengine server !static )
+ ?? ( tcmalloc jemalloc )
+ static? ( yassl !pam )"
+
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
+KEYWORDS=""
+
+# Shorten the path because the socket path length must be shorter than 107 chars
+# and we will run a mysql server during test phase
+S="${WORKDIR}/mysql"
+
+# Be warned, *DEPEND are version-dependant
+# These are used for both runtime and compiletime
+COMMON_DEPEND="
+ dev-libs/libfmt:=
+ >=dev-libs/libpcre2-10.34:=
+ >=sys-apps/texinfo-4.7-r1
+ sys-libs/ncurses:0=
+ >=sys-libs/zlib-1.2.3:0=
+ virtual/libcrypt:=
+ !bindist? (
+ sys-libs/binutils-libs:0=
+ >=sys-libs/readline-4.1:0=
+ )
+ jemalloc? ( dev-libs/jemalloc:0= )
+ kerberos? ( virtual/krb5 )
+ kernel_linux? (
+ dev-libs/libaio:0=
+ sys-libs/liburing:=
+ sys-process/procps:0=
+ )
+ server? (
+ app-arch/bzip2
+ app-arch/xz-utils
+ backup? ( app-arch/libarchive:0= )
+ columnstore? (
+ app-arch/snappy
+ dev-libs/boost:=
+ dev-libs/libxml2:2=
+ )
+ cracklib? ( sys-libs/cracklib:0= )
+ extraengine? (
+ odbc? ( dev-db/unixODBC:0= )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ innodb-lz4? ( app-arch/lz4 )
+ innodb-lzo? ( dev-libs/lzo )
+ innodb-snappy? ( app-arch/snappy )
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
+ numa? ( sys-process/numactl )
+ oqgraph? (
+ dev-libs/boost:=
+ dev-libs/judy:0=
+ )
+ pam? ( sys-libs/pam:0= )
+ s3? ( net-misc/curl )
+ systemd? ( sys-apps/systemd:= )
+ )
+ systemtap? ( >=dev-util/systemtap-1.3:0= )
+ tcmalloc? ( dev-util/google-perftools:0= )
+ yassl? ( net-libs/gnutls:0= )
+ !yassl? (
+ >=dev-libs/openssl-1.0.0:0=
+ )
+"
+BDEPEND="app-alternatives/yacc"
+DEPEND="${COMMON_DEPEND}
+ server? (
+ extraengine? ( jdbc? ( >=virtual/jdk-1.8 ) )
+ test? ( acct-group/mysql acct-user/mysql )
+ )
+ static? ( sys-libs/ncurses[static-libs] )
+"
+RDEPEND="${COMMON_DEPEND}
+ !dev-db/mysql !dev-db/percona-server
+ !dev-db/mariadb:10.3
+ !dev-db/mariadb:10.4
+ !dev-db/mariadb:10.5
+ !dev-db/mariadb:10.6
+ !dev-db/mariadb:10.7
+ !dev-db/mariadb:10.8
+ !dev-db/mariadb:10.9
+ !dev-db/mariadb:10.10
+ !dev-db/mariadb:11.0
+ selinux? ( sec-policy/selinux-mysql )
+ server? (
+ columnstore? ( dev-db/mariadb-connector-c )
+ extraengine? ( jdbc? ( >=virtual/jre-1.8 ) )
+ galera? (
+ sys-apps/iproute2
+ =sys-cluster/galera-26*
+ sst-rsync? ( sys-process/lsof )
+ sst-mariabackup? ( net-misc/socat[ssl] )
+ )
+ !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
+ )
+"
+# For other stuff to bring us in
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
+
+mysql_init_vars() {
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=""
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
+ MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
+ | sed -e 's/.*=\s*//' \
+ | tail -n1)
+ fi
+ fi
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR="${MY_LOCALSTATEDIR}"
+ einfo "Using default MY_DATADIR"
+ fi
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}"
+
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
+ if [[ -e "${MY_DATADIR}" ]] ; then
+ # If you get this and you're wondering about it, see bug #207636
+ elog "MySQL datadir found in ${MY_DATADIR}"
+ elog "A new one will not be created."
+ PREVIOUS_DATADIR="yes"
+ else
+ PREVIOUS_DATADIR="no"
+ fi
+ export PREVIOUS_DATADIR
+ fi
+ else
+ if [[ ${EBUILD_PHASE} == "config" ]]; then
+ local new_MY_DATADIR
+ new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
+ ewarn "MySQL MY_DATADIR has changed"
+ ewarn "from ${MY_DATADIR}"
+ ewarn "to ${new_MY_DATADIR}"
+ MY_DATADIR="${new_MY_DATADIR}"
+ fi
+ fi
+ fi
+
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR
+ export MY_LOCALSTATEDIR MY_LOGDIR
+ export MY_DATADIR
+}
+
+pkg_setup() {
+ if [[ ${MERGE_TYPE} != binary ]] ; then
+ if has test ${FEATURES} ; then
+ # Bug #213475 - MySQL _will_ object strenuously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if ! has userpriv ${FEATURES} ; then
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+ fi
+ fi
+ fi
+
+ java-pkg-opt-2_pkg_setup
+}
+
+src_unpack() {
+ unpack ${A}
+
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
+}
+
+src_prepare() {
+ eapply "${WORKDIR}"/mariadb-patches
+ eapply "${FILESDIR}"/${PN}-10.6.11-gssapi.patch
+ eapply "${FILESDIR}"/${PN}-10.6.11-include.patch
+ eapply "${FILESDIR}"/${PN}-10.6.12-gcc-13.patch
+
+ eapply_user
+
+ _disable_plugin() {
+ echo > "${S}/plugin/${1}/CMakeLists.txt" || die
+ }
+ _disable_engine() {
+ echo > "${S}/storage/${1}/CMakeLists.txt" || die
+ }
+
+ if use jemalloc; then
+ echo "TARGET_LINK_LIBRARIES(mariadbd LINK_PUBLIC jemalloc)" >> "${S}/sql/CMakeLists.txt"
+ elif use tcmalloc; then
+ echo "TARGET_LINK_LIBRARIES(mariadbd LINK_PUBLIC tcmalloc)" >> "${S}/sql/CMakeLists.txt"
+ fi
+
+ local plugin
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
+ locale_info qc_info server_audit sql_errlog auth_ed25519 )
+ local test_plugins=( audit_null auth_examples daemon_example fulltext
+ debug_key_management example_key_management versioning )
+ if ! use server; then # These plugins are for the server
+ for plugin in "${server_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ fi
+
+ if ! use test; then # These plugins are only used during testing
+ for plugin in "${test_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ _disable_engine test_sql_discovery
+ echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die
+ fi
+
+ _disable_engine example
+
+ if ! use oqgraph ; then # avoids extra library checks
+ _disable_engine oqgraph
+ fi
+
+ if use mroonga ; then
+ # Remove the bundled groonga
+ # There is no CMake flag, it simply checks for existance
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
+ else
+ _disable_engine mroonga
+ fi
+
+ # Fix static bindings in galera replication
+ sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \
+ "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die
+ sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \
+ "${S}"/wsrep-lib/src/CMakeLists.txt || die
+
+ # Fix galera_recovery.sh script
+ sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
+ scripts/galera_recovery.sh || die
+
+ sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \
+ "${S}"/scripts/mysql_install_db.sh || die
+
+ cmake_src_prepare
+ java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+ # bug 508724 mariadb cannot use ld.gold
+ tc-ld-disable-gold
+ # Bug #114895, bug #110149
+ filter-flags "-O" "-O[01]"
+
+ # It fails on alpha without this
+ use alpha && append-ldflags "-Wl,--no-relax"
+
+ append-cxxflags -felide-constructors
+
+ # bug #283926, with GCC4.4, this is required to get correct behavior.
+ append-flags -fno-strict-aliasing
+
+ CMAKE_BUILD_TYPE="RelWithDebInfo"
+
+ # debug hack wrt #497532
+ local mycmakeargs=(
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql"
+ -DINSTALL_BINDIR=bin
+ -DINSTALL_DOCDIR=share/doc/${PF}
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF}
+ -DINSTALL_INCLUDEDIR=include/mysql
+ -DINSTALL_INFODIR=share/info
+ -DINSTALL_LIBDIR=$(get_libdir)
+ -DINSTALL_MANDIR=share/man
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
+ -DINSTALL_SCRIPTDIR=bin
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
+ -DINSTALL_SBINDIR=sbin
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
+ -DWITH_COMMENT="Gentoo Linux ${PF}"
+ -DWITH_UNIT_TESTS=$(usex test ON OFF)
+ -DWITH_LIBEDIT=0
+ -DWITH_ZLIB=system
+ -DWITHOUT_LIBWRAP=1
+ -DENABLED_LOCAL_INFILE=1
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0
+ -DWITH_DEFAULT_FEATURE_SET=0
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
+ # The build forces this to be defined when cross-compiling. We pass it
+ # all the time for simplicity and to make sure it is actually correct.
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
+ -DCONC_WITH_EXTERNAL_ZLIB=YES
+ -DWITH_EXTERNAL_ZLIB=YES
+ -DSUFFIX_INSTALL_DIR=""
+ -DWITH_UNITTEST=OFF
+ -DWITHOUT_CLIENTLIBS=YES
+ -DCLIENT_PLUGIN_DIALOG=OFF
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
+ )
+ if use test ; then
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
+ else
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
+ fi
+
+ if ! use yassl ; then
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
+ else
+ mycmakeargs+=( -DWITH_SSL=bundled )
+ fi
+
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
+ mycmakeargs+=(
+ -DWITH_READLINE=$(usex bindist 1 0)
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
+ -DENABLE_DTRACE=$(usex systemtap)
+ )
+
+ if use server ; then
+ # Connect and Federated{,X} must be treated special
+ # otherwise they will not be built as plugins
+ if ! use extraengine ; then
+ mycmakeargs+=(
+ -DPLUGIN_CONNECT=NO
+ -DPLUGIN_FEDERATED=NO
+ -DPLUGIN_FEDERATEDX=NO
+ )
+ fi
+
+ mycmakeargs+=(
+ -DWITH_PCRE=system
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO)
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
+ -DPLUGIN_AWS_KEY_MANAGEMENT=NO
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO)
+ -DPLUGIN_S3=$(usex s3 YES NO)
+ -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO)
+ -DCONNECT_WITH_MYSQL=1
+ -DCONNECT_WITH_LIBXML2=$(usex xml)
+ -DCONNECT_WITH_ODBC=$(usex odbc)
+ -DCONNECT_WITH_JDBC=$(usex jdbc)
+ # Build failure and autodep wrt bug 639144
+ -DCONNECT_WITH_MONGO=OFF
+ -DWITH_WSREP=$(usex galera)
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DWITH_MARIABACKUP=$(usex backup ON OFF)
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF)
+ -DINSTALL_SQLBENCHDIR=""
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
+ # systemd is only linked to for server notification
+ -DWITH_SYSTEMD=$(usex systemd yes no)
+ -DWITH_NUMA=$(usex numa ON OFF)
+ )
+
+ if use test ; then
+ # This is needed for the new client lib which tests a real, open server
+ mycmakeargs+=( -DSKIP_TESTS=ON )
+ fi
+
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
+ ewarn "You MUST file bugs without these variables set."
+
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
+ )
+
+ elif ! use latin1 ; then
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=utf8mb4
+ -DDEFAULT_COLLATION=utf8mb4_unicode_520_ci
+ )
+ else
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=latin1
+ -DDEFAULT_COLLATION=latin1_swedish_ci
+ )
+ fi
+ mycmakeargs+=(
+ -DEXTRA_CHARSETS=all
+ -DMYSQL_USER=mysql
+ -DDISABLE_SHARED=$(usex static YES NO)
+ -DWITH_DEBUG=$(usex debug)
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DWITH_PROFILING=$(usex profiling)
+ )
+
+ if use static; then
+ mycmakeargs+=( -DWITH_PIC=1 )
+ fi
+
+ if use jemalloc || use tcmalloc ; then
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
+ fi
+
+ # Storage engines
+ mycmakeargs+=(
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1
+ -DWITH_CSV_STORAGE_ENGINE=1
+ -DWITH_HEAP_STORAGE_ENGINE=1
+ -DWITH_INNOBASE_STORAGE_ENGINE=1
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1
+ -DWITH_MYISAM_STORAGE_ENGINE=1
+ -DWITH_PARTITION_STORAGE_ENGINE=1
+ )
+ else
+ mycmakeargs+=(
+ -DWITHOUT_SERVER=1
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DEXTRA_CHARSETS=none
+ -DINSTALL_SQLBENCHDIR=
+ -DWITH_SYSTEMD=no
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_compile() {
+ cmake_src_compile
+}
+
+# Official test instructions:
+# USE='extraengine perl server' \
+# FEATURES='test userpriv' \
+# ebuild mariadb-X.X.XX.ebuild \
+# digest clean package
+src_test() {
+ _disable_test() {
+ local rawtestname bug reason
+ rawtestname="${1}" ; shift
+ bug="${1}" ; shift
+ reason="${@}"
+ ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
+ echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
+ }
+
+ local TESTDIR="${BUILD_DIR}/mysql-test"
+ local retstatus_tests
+
+ if ! use server ; then
+ einfo "Skipping server tests due to minimal build."
+ return 0
+ fi
+
+ # Ensure that parallel runs don't die
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
+
+ if [[ -z "${MTR_PARALLEL}" ]] ; then
+ local -x MTR_PARALLEL=$(makeopts_jobs)
+
+ if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
+ # Running multiple tests in parallel usually require higher ulimit
+ # and fs.aio-max-nr setting. In addition, tests like main.multi_update
+ # are known to hit timeout when system is busy.
+ # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
+ # using "auto".
+ local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
+ info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
+ einfo "${info_msg}"
+ unset info_msg
+ MTR_PARALLEL=4
+ fi
+ else
+ einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
+ fi
+
+ # Try to increase file limits to increase test coverage
+ if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
+ # Upper limit comes from parts.partition_* tests
+ ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
+
+ if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
+ # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
+ ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
+
+ if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
+ ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
+ else
+ einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
+ fi
+
+ # create directories because mysqladmin might run out of order
+ mkdir -p "${T}"/var-tests{,/log} || die
+
+ if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
+ touch "${S}"/mysql-test/unstable-tests || die
+ fi
+
+ cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
+
+ local -a disabled_tests
+ disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
+ disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "main.gis;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
+ disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
+ disabled_tests+=( "main.mysql_upgrade;27044;Sporadically failing test" )
+ disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
+ disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
+ disabled_tests+=( "mariabackup.*;0;Broken test suite" )
+ disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
+ disabled_tests+=( "perfschema.prepared_statements;0;Broken test suite" )
+ disabled_tests+=( "perfschema.privilege_table_io;27045;Sporadically failing test" )
+ disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
+ disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
+ disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
+ disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
+ disabled_tests+=( "spider.*;0;Fails with network sandbox" )
+ disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
+
+ if ! use latin1 ; then
+ disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
+ disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
+ disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
+ disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
+ fi
+
+ local test_infos_str test_infos_arr
+ for test_infos_str in "${disabled_tests[@]}" ; do
+ IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
+
+ if [[ ${#test_infos_arr[@]} != 3 ]] ; then
+ die "Invalid test data set, not matching format: ${test_infos_str}"
+ fi
+
+ _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
+ done
+ unset test_infos_str test_infos_arr
+
+ # run mysql-test tests
+ pushd "${TESTDIR}" &>/dev/null || die
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
+ retstatus_tests=$?
+
+ popd &>/dev/null || die
+
+ # Cleanup is important for these testcases.
+ pkill -9 -f "${S}/ndb" 2>/dev/null
+ pkill -9 -f "${S}/sql" 2>/dev/null
+
+ local failures=""
+ [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
+
+ [[ -z "${failures}" ]] || die "Test failures: ${failures}"
+ einfo "Tests successfully completed"
+}
+
+src_install() {
+ cmake_src_install
+
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die
+ fi
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Convenience links
+ einfo "Making Convenience links for mysqlcheck multi-call binary"
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair"
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize"
+
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
+ if [[ -d "${ED}/usr/data" ]] ; then
+ rm -Rf "${ED}/usr/data" || die
+ fi
+
+ # Unless they explicitly specific USE=test, then do not install the
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a
+ # validation of your database configuration after tuning it.
+ if ! use test ; then
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
+ fi
+
+ # Configuration stuff
+ einfo "Building default configuration ..."
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}"
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
+ eprefixify "${TMPDIR}/my.cnf"
+ doins "${TMPDIR}/my.cnf"
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+ eprefixify "${TMPDIR}/50-distro-client.cnf"
+ doins "${TMPDIR}/50-distro-client.cnf"
+
+ if use server ; then
+ mycnf_src="my.cnf.distro-server"
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
+ "${FILESDIR}/${mycnf_src}" \
+ > "${TMPDIR}/my.cnf.ok" || die
+ if use prefix ; then
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ if use latin1 ; then
+ sed -i \
+ -e "/character-set/s|utf8|latin1|g" \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ eprefixify "${TMPDIR}/my.cnf.ok"
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
+
+ einfo "Including support files and sample configurations"
+ docinto "support-files"
+ local script
+ for script in \
+ "${S}"/support-files/magic
+ do
+ [[ -f "$script" ]] && dodoc "${script}"
+ done
+
+ docinto "scripts"
+ for script in "${S}"/scripts/mysql* ; do
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
+ done
+ # Manually install supporting files that conflict with other packages
+ # but are needed for galera and initial installation
+ exeinto /usr/libexec/mariadb
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
+
+ if use pam ; then
+ keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
+ fi
+ fi
+
+ # Conflicting files
+ conflicting_files=()
+
+ # We prefer my_print_defaults from dev-db/mysql-connector-c
+ conflicting_files=( "${ED}/usr/share/man/man1/my_print_defaults.1" )
+
+ # Remove bundled mytop in favor of dev-db/mytop
+ conflicting_files+=( "${ED}/usr/bin/mytop" )
+ conflicting_files+=( "${ED}/usr/share/man/man1/mytop.1" )
+
+ local conflicting_file
+ for conflicting_file in "${conflicting_files[@]}" ; do
+ if [[ -e "${conflicting_file}" ]] ; then
+ rm -v "${conflicting_file}" || die
+ fi
+ done
+
+ # Fix a dangling symlink when galera is not built
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
+ fi
+
+ # Remove dangling symlink
+ rm "${ED}/usr/$(get_libdir)/libmariadb.a" || die
+
+ # Remove broken SST scripts that are incompatible
+ local scriptremove
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
+ rm "${ED}/usr/bin/${scriptremove}" || die
+ fi
+ done
+}
+
+pkg_preinst() {
+ java-pkg-opt-2_pkg_preinst
+}
+
+pkg_postinst() {
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Create log directory securely if it does not exist
+ [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
+
+ if use server ; then
+ if use pam; then
+ einfo
+ elog "This install includes the PAM authentication plugin."
+ elog "To activate and configure the PAM plugin, please read:"
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
+ einfo
+ chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
+ fi
+
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+ einfo
+ elog "You might want to run:"
+ elog "\"emerge --config =${CATEGORY}/${PF}\""
+ elog "if this is a new install."
+ elog
+ elog "If you are switching server implentations, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ else
+ einfo
+ elog "If you are upgrading major versions, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ fi
+
+ if use galera ; then
+ einfo
+ elog "Be sure to edit the my.cnf file to activate your cluster settings."
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
+ elog "The first time the cluster is activated, you should add"
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
+ elog "This option should then be removed for subsequent starts."
+ einfo
+ if [[ -n "${REPLACING_VERSIONS}" ]] ; then
+ local rver
+ for rver in ${REPLACING_VERSIONS} ; do
+ if ver_test "${rver}" -lt "10.4.0" ; then
+ ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
+ ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
+ ewarn "for more information"
+ fi
+ done
+ fi
+ fi
+ fi
+
+ # Note about configuration change
+ einfo
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf"
+ elog "to several files in /etc/mysql/${PN}.d."
+ elog "Please backup any changes you made to /etc/mysql/my.cnf"
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
+ elog "You may have as many files as needed and they are read alphabetically."
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
+ einfo
+}
+
+pkg_config() {
+ _getoptval() {
+ local section="${1}"
+ local option="--${2}"
+ local extra_options="${3}"
+ local cmd=(
+ "${my_print_defaults_binary}"
+ "${extra_options}"
+ "${section}"
+ )
+
+ local values=()
+ local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
+ for parameter in "${parameters[@]}"
+ do
+ # my_print_defaults guarantees output of options, one per line,
+ # in the form that they would be specified on the command line.
+ # So checking for --option=* should be safe.
+ case ${parameter} in
+ ${option}=*)
+ values+=( "${parameter#*=}" )
+ ;;
+ esac
+ done
+
+ if [[ ${#values[@]} -gt 0 ]] ; then
+ # Option could have been set multiple times
+ # in which case only the last occurrence
+ # contains the current value
+ echo "${values[-1]}"
+ fi
+ }
+
+ _mktemp_dry() {
+ # emktemp has no --dry-run option
+ local template="${1}"
+
+ if [[ -z "${template}" ]] ; then
+ if [[ -z "${T}" ]] ; then
+ template="/tmp/XXXXXXX"
+ else
+ template="${T}/XXXXXXX"
+ fi
+ fi
+
+ local template_wo_X=${template//X/}
+ local n_X
+ let n_X=${#template}-${#template_wo_X}
+ if [[ ${n_X} -lt 3 ]] ; then
+ echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
+ return
+ fi
+
+ local attempts=0
+ local character tmpfile
+ while [[ true ]] ; do
+ let attempts=attempts+1
+
+ new_file=
+ while read -n1 character ; do
+ if [[ "${character}" == "X" ]] ; then
+ tmpfile+="${RANDOM:0:1}"
+ else
+ tmpfile+="${character}"
+ fi
+ done < <(echo -n "${template}")
+
+ if [[ ! -f "${tmpfile}" ]]
+ then
+ echo "${tmpfile}"
+ return
+ fi
+
+ if [[ ${attempts} -ge 100 ]] ; then
+ echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
+ return
+ fi
+ done
+ }
+
+ local mysql_binary="${EROOT}/usr/bin/mysql"
+ if [[ ! -x "${mysql_binary}" ]] ; then
+ die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysqld_binary="${EROOT}/usr/sbin/mysqld"
+ if [[ ! -x "${mysqld_binary}" ]] ; then
+ die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
+ if [[ ! -x "${mysql_install_db_binary}" ]] ; then
+ die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
+ if [[ ! -x "${my_print_defaults_binary}" ]] ; then
+ die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
+ fi
+
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ MYSQL_USER=mysql
+ if use prefix ; then
+ MYSQL_USER=$(id -u -n 2>/dev/null)
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ die "Failed to determine current username!"
+ fi
+ fi
+ fi
+
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ MYSQL_GROUP=mysql
+ if use prefix ; then
+ MYSQL_GROUP=$(id -g -n 2>/dev/null)
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ die "Failed to determine current user groupname!"
+ fi
+ fi
+ fi
+
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf
+ local -x HOME="${EROOT}/root"
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Read currently set data directory
+ MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ die "Sorry, unable to find MY_DATADIR!"
+ elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
+ ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
+ ewarn "Please rename or delete its content if you wish to initialize a new data directory."
+ die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
+ fi
+
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
+ # These are dir+prefix
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
+
+ # Create missing directories.
+ # Always check if mysql user can write to directory even if we just
+ # created directory because a parent directory might be not
+ # accessible for that user.
+ PID_DIR="${EROOT}/run/mysqld"
+ if [[ ! -d "${PID_DIR}" ]] ; then
+ einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
+ install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
+ || die "Failed to create PID directory '${PID_DIR}'!"
+ fi
+
+ local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_pid_dir_testfile}" ]] \
+ && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_pid_dir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
+ else
+ rm "${_pid_dir_testfile}" || die
+ unset _pid_dir_testfile
+ fi
+
+ if [[ ! -d "${MY_DATADIR}" ]] ; then
+ einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
+ || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
+ fi
+
+ local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_datadir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_datadir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
+ else
+ rm "${_my_datadir_testfile}" || die
+ unset _my_datadir_testfile
+ fi
+
+ if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
+ einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
+ || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
+ fi
+
+ if [[ -z "${MYSQL_TMPDIR}" ]] ; then
+ MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
+ [[ -z "${MYSQL_TMPDIR}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
+
+ mkdir "${MYSQL_TMPDIR}" || die
+ chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
+ fi
+
+ # Now we need to test MYSQL_TMPDIR...
+ local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_tmpdir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_tmpdir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
+ else
+ rm "${_my_tmpdir_testfile}" || die
+ unset _my_tmpdir_testfile
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
+ # Only create directory when MYSQL_LOG_BIN is an absolute path
+ einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
+ || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Only test when MYSQL_LOG_BIN is an absolute path
+ local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_logbin_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_logbin_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
+ else
+ rm "${_my_logbin_testfile}" || die
+ unset _my_logbin_testfile
+ fi
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
+ # Only create directory when MYSQL_RELAY_LOG is an absolute path
+ einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
+ || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Only test when MYSQL_RELAY_LOG is an absolute path
+ local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_relaylog_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_relaylog_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
+ else
+ rm "${_my_relaylog_testfile}" || die
+ unset _my_relaylog_testfile
+ fi
+ fi
+
+ local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
+ [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
+
+ # Limit access
+ chmod 0770 "${SETUP_TMPDIR}" || die
+ chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
+
+ local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
+ local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
+
+ echo ""
+ einfo "Detected settings:"
+ einfo "=================="
+ einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
+ einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
+ einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
+ einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Absolute path for binary log files specified
+ einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Absolute path for relay log files specified
+ einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
+ fi
+
+ einfo "PID DIR:\t\t\t\t${PID_DIR}"
+ einfo "Install db log:\t\t\t${mysql_install_log}"
+ einfo "Install server log:\t\t\t${mysqld_logfile}"
+
+ echo
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local tmp_mysqld_password_source=
+
+ for tmp_mysqld_password_source in mysql client ; do
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
+ MYSQL_ROOT_PASSWORD=
+ continue
+ fi
+
+ einfo "Found password in '${tmp_mysqld_password_source}' section!"
+ break
+ fi
+ done
+
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
+ fi
+
+ unset tmp_mysqld_password_source
+ fi
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local pwd1="a"
+ local pwd2="b"
+
+ echo
+ einfo "No password for mysql 'root' user was specified via environment"
+ einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
+ einfo "file like '${HOME}/.my.cnf'."
+ einfo "To continue please provide a password for the mysql 'root' user"
+ einfo "now on console:"
+ ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
+ read -rsp " >" pwd1 ; echo
+
+ einfo "Retype the password"
+ read -rsp " >" pwd2 ; echo
+
+ if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
+ die "Passwords are not the same!"
+ fi
+
+ MYSQL_ROOT_PASSWORD="${pwd1}"
+ unset pwd1 pwd2
+
+ echo
+ fi
+
+ local -a mysqld_options
+
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first,
+ # see http://bugs.mysql.com/bug.php?id=31312
+ use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
+
+ # Figure out which options we need to disable to do the setup
+ local helpfile="${TMPDIR}/mysqld-help"
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
+
+ local opt optexp optfull
+ for opt in host-cache name-resolve networking slave-start \
+ federated ssl log-bin relay-log slow-query-log external-locking \
+ log-slave-updates \
+ ; do
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
+ grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
+ done
+
+ # Prepare timezones, see
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
+ local tz_sql="${SETUP_TMPDIR}/tz.sql"
+
+ echo "USE mysql;" >"${tz_sql}"
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
+ if [[ $? -ne 0 ]] ; then
+ die "mysql_tzinfo_to_sql failed!"
+ fi
+
+ local cmd=(
+ "${mysql_install_db_binary}"
+ "${mysqld_options[@]}"
+ "--init-file='${tz_sql}'"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ "--log-error='${mysql_install_log}'"
+ "--rpm"
+ "--cross-bootstrap"
+ "--skip-test-db"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Initializing ${PN} data directory: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
+
+ if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
+ die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
+ fi
+
+ local x=${RANDOM}
+ local socket="${PID_DIR}/mysqld.${x}.sock"
+ [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
+ local pidfile="${PID_DIR}/mysqld.${x}.pid"
+ [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
+ unset x
+
+ cmd=(
+ "${mysqld_binary}"
+ "${mysqld_options[@]}"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ --max_allowed_packet=8M
+ --net_buffer_length=16K
+ "--socket='${socket}'"
+ "--pid-file='${pidfile}'"
+ "--log-error='${mysqld_logfile}'"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
+
+ echo -n "Waiting for mysqld to accept connections "
+ local maxtry=15
+ while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ if [[ -S "${socket}" ]] ; then
+ # Even with a socket we don't know if mysqld will abort
+ # start due to an error so just wait a little bit more...
+ maxtry=5
+ while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+ fi
+
+ echo
+
+ if [[ ! -S "${socket}" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
+ die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
+ fi
+
+ local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
+ touch "${mysql_logfile}" || die
+
+ ebegin "Setting root password"
+ # Do this from memory, as we don't want clear text passwords in temp files
+ local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
+ cmd=(
+ "${mysql_binary}"
+ --no-defaults
+ "--socket='${socket}'"
+ -hlocalhost
+ "-e \"${sql}\""
+ )
+ eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
+ local rc=$?
+ eend ${rc}
+
+ if [[ ${rc} -ne 0 ]] ; then
+ # Poor man's solution which tries to avoid having password
+ # in log. NOTE: sed can fail if user didn't follow advice
+ # and included character which will require escaping...
+ sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
+
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
+ die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
+ fi
+
+ # Stop the server
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ echo -n "Stopping the server "
+ pkill -F "${pidfile}" &>/dev/null
+
+ maxtry=10
+ while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ echo
+
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ # We somehow failed to stop server.
+ # However, not a fatal error. Just warn the user.
+ ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
+ fi
+ fi
+
+ rm -r "${SETUP_TMPDIR}" || die
+
+ einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
+}
diff --git a/dev-db/mariadb/mariadb-10.4.28.ebuild b/dev-db/mariadb/mariadb-10.4.28.ebuild
new file mode 100644
index 000000000000..0314edf3a4b5
--- /dev/null
+++ b/dev-db/mariadb/mariadb-10.4.28.ebuild
@@ -0,0 +1,1313 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+SUBSLOT="18"
+
+JAVA_PKG_OPT_USE="jdbc"
+
+inherit systemd flag-o-matic prefix toolchain-funcs \
+ multiprocessing java-pkg-opt-2 cmake
+
+# Patch version
+PATCH_SET="https://github.com/hydrapolic/gentoo-dist/raw/master/mariadb/mariadb-10.4.26-patches-01.tar.xz"
+
+SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
+ ${PATCH_SET}"
+
+HOMEPAGE="https://mariadb.org/"
+DESCRIPTION="An enhanced, drop-in replacement for MySQL"
+LICENSE="GPL-2 LGPL-2.1+"
+SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
+IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
+ sst-rsync sst-mariabackup static systemd systemtap tcmalloc
+ test tokudb xml yassl"
+
+RESTRICT="!bindist? ( bindist ) !test? ( test )"
+
+REQUIRED_USE="jdbc? ( extraengine server !static )
+ server? ( tokudb? ( jemalloc !tcmalloc ) )
+ ?? ( tcmalloc jemalloc )
+ static? ( yassl !pam )"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
+
+# Shorten the path because the socket path length must be shorter than 107 chars
+# and we will run a mysql server during test phase
+S="${WORKDIR}/mysql"
+
+# Be warned, *DEPEND are version-dependant
+# These are used for both runtime and compiletime
+COMMON_DEPEND="
+ kernel_linux? (
+ sys-process/procps:0=
+ dev-libs/libaio:0=
+ )
+ >=sys-apps/texinfo-4.7-r1
+ jemalloc? ( dev-libs/jemalloc:0= )
+ tcmalloc? ( dev-util/google-perftools:0= )
+ systemtap? ( >=dev-util/systemtap-1.3:0= )
+ >=sys-libs/zlib-1.2.3:0=
+ kerberos? ( virtual/krb5 )
+ yassl? ( net-libs/gnutls:0= )
+ !yassl? (
+ <dev-libs/openssl-3:=
+ )
+ sys-libs/ncurses:0=
+ !bindist? (
+ sys-libs/binutils-libs:0=
+ >=sys-libs/readline-4.1:0=
+ )
+ server? (
+ backup? ( app-arch/libarchive:0= )
+ cracklib? ( sys-libs/cracklib:0= )
+ extraengine? (
+ odbc? ( dev-db/unixODBC:0= )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ innodb-lz4? ( app-arch/lz4 )
+ innodb-lzo? ( dev-libs/lzo )
+ innodb-snappy? ( app-arch/snappy )
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
+ numa? ( sys-process/numactl )
+ oqgraph? (
+ dev-libs/boost:=
+ dev-libs/judy:0=
+ )
+ pam? ( sys-libs/pam:0= )
+ systemd? ( sys-apps/systemd:= )
+ tokudb? ( app-arch/snappy )
+ )
+ >=dev-libs/libpcre-8.41-r1:3=
+ virtual/libcrypt:=
+"
+BDEPEND="app-alternatives/yacc"
+DEPEND="static? ( sys-libs/ncurses[static-libs] )
+ server? (
+ extraengine? ( jdbc? ( >=virtual/jdk-1.8 ) )
+ test? ( acct-group/mysql acct-user/mysql )
+ )
+ ${COMMON_DEPEND}"
+RDEPEND="selinux? ( sec-policy/selinux-mysql )
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
+ !dev-db/mariadb:0
+ !dev-db/mariadb:5.5
+ !dev-db/mariadb:10.1
+ !dev-db/mariadb:10.2
+ !dev-db/mariadb:10.3
+ !dev-db/mariadb:10.5
+ !dev-db/mariadb:10.6
+ !dev-db/mariadb:10.7
+ !dev-db/mariadb:10.8
+ !dev-db/mariadb:10.9
+ !dev-db/mariadb:10.10
+ !dev-db/mariadb:10.11
+ !dev-db/mariadb:11.0
+ !<virtual/mysql-5.6-r11
+ !<virtual/libmysqlclient-18-r1
+ ${COMMON_DEPEND}
+ server? (
+ galera? (
+ sys-apps/iproute2
+ =sys-cluster/galera-26*
+ sst-rsync? ( sys-process/lsof )
+ sst-mariabackup? ( net-misc/socat[ssl] )
+ )
+ !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
+ extraengine? ( jdbc? ( >=virtual/jre-1.8 ) )
+ )
+"
+# For other stuff to bring us in
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
+
+mysql_init_vars() {
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=""
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
+ MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
+ | sed -e 's/.*=\s*//' \
+ | tail -n1)
+ fi
+ fi
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR="${MY_LOCALSTATEDIR}"
+ einfo "Using default MY_DATADIR"
+ fi
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}"
+
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
+ if [[ -e "${MY_DATADIR}" ]] ; then
+ # If you get this and you're wondering about it, see bug #207636
+ elog "MySQL datadir found in ${MY_DATADIR}"
+ elog "A new one will not be created."
+ PREVIOUS_DATADIR="yes"
+ else
+ PREVIOUS_DATADIR="no"
+ fi
+ export PREVIOUS_DATADIR
+ fi
+ else
+ if [[ ${EBUILD_PHASE} == "config" ]]; then
+ local new_MY_DATADIR
+ new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
+ ewarn "MySQL MY_DATADIR has changed"
+ ewarn "from ${MY_DATADIR}"
+ ewarn "to ${new_MY_DATADIR}"
+ MY_DATADIR="${new_MY_DATADIR}"
+ fi
+ fi
+ fi
+
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR
+ export MY_LOCALSTATEDIR MY_LOGDIR
+ export MY_DATADIR
+}
+
+pkg_setup() {
+ if [[ ${MERGE_TYPE} != binary ]] ; then
+ if has test ${FEATURES} ; then
+ # Bug #213475 - MySQL _will_ object strenuously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if ! has userpriv ${FEATURES} ; then
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+ fi
+ fi
+ fi
+
+ java-pkg-opt-2_pkg_setup
+}
+
+src_unpack() {
+ unpack ${A}
+
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
+}
+
+src_prepare() {
+ eapply "${WORKDIR}"/mariadb-patches
+ eapply "${FILESDIR}"/${PN}-10.6.11-gssapi.patch
+ eapply "${FILESDIR}"/${PN}-10.6.12-gcc-13.patch
+
+ eapply_user
+
+ _disable_plugin() {
+ echo > "${S}/plugin/${1}/CMakeLists.txt" || die
+ }
+ _disable_engine() {
+ echo > "${S}/storage/${1}/CMakeLists.txt" || die
+ }
+
+ if use jemalloc; then
+ echo "TARGET_LINK_LIBRARIES(mysqld LINK_PUBLIC jemalloc)" >> "${S}/sql/CMakeLists.txt"
+ elif use tcmalloc; then
+ echo "TARGET_LINK_LIBRARIES(mysqld LINK_PUBLIC tcmalloc)" >> "${S}/sql/CMakeLists.txt"
+ fi
+
+ # Don't build bundled xz-utils for tokudb
+ echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
+
+ local plugin
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
+ locale_info qc_info server_audit sql_errlog auth_ed25519 )
+ local test_plugins=( audit_null auth_examples daemon_example fulltext
+ debug_key_management example_key_management versioning )
+ if ! use server; then # These plugins are for the server
+ for plugin in "${server_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ fi
+
+ if ! use test; then # These plugins are only used during testing
+ for plugin in "${test_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ _disable_engine test_sql_discovery
+ echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die
+ fi
+
+ _disable_engine example
+
+ if ! use oqgraph ; then # avoids extra library checks
+ _disable_engine oqgraph
+ fi
+
+ if use mroonga ; then
+ # Remove the bundled groonga
+ # There is no CMake flag, it simply checks for existance
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
+ else
+ _disable_engine mroonga
+ fi
+
+ # Fix static bindings in galera replication
+ sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \
+ "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die
+ sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \
+ "${S}"/wsrep-lib/src/CMakeLists.txt || die
+
+ # Fix galera_recovery.sh script
+ sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
+ scripts/galera_recovery.sh || die
+
+ sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \
+ "${S}"/scripts/mysql_install_db.sh || die
+
+ cmake_src_prepare
+ java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+ # bug 508724 mariadb cannot use ld.gold
+ tc-ld-disable-gold
+ # Bug #114895, bug #110149
+ filter-flags "-O" "-O[01]"
+
+ # It fails on alpha without this
+ use alpha && append-ldflags "-Wl,--no-relax"
+
+ append-cxxflags -felide-constructors
+
+ # bug #283926, with GCC4.4, this is required to get correct behavior.
+ append-flags -fno-strict-aliasing
+
+ CMAKE_BUILD_TYPE="RelWithDebInfo"
+
+ # debug hack wrt #497532
+ local mycmakeargs=(
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql"
+ -DINSTALL_BINDIR=bin
+ -DINSTALL_DOCDIR=share/doc/${PF}
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF}
+ -DINSTALL_INCLUDEDIR=include/mysql
+ -DINSTALL_INFODIR=share/info
+ -DINSTALL_LIBDIR=$(get_libdir)
+ -DINSTALL_MANDIR=share/man
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
+ -DINSTALL_SCRIPTDIR=bin
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
+ -DINSTALL_SBINDIR=sbin
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
+ -DWITH_COMMENT="Gentoo Linux ${PF}"
+ -DWITH_UNIT_TESTS=$(usex test ON OFF)
+ -DWITH_LIBEDIT=0
+ -DWITH_ZLIB=system
+ -DWITHOUT_LIBWRAP=1
+ -DENABLED_LOCAL_INFILE=1
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0
+ -DWITH_DEFAULT_FEATURE_SET=0
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
+ # The build forces this to be defined when cross-compiling. We pass it
+ # all the time for simplicity and to make sure it is actually correct.
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
+ -DCONC_WITH_EXTERNAL_ZLIB=YES
+ -DWITH_EXTERNAL_ZLIB=YES
+ -DSUFFIX_INSTALL_DIR=""
+ -DWITH_UNITTEST=OFF
+ -DWITHOUT_CLIENTLIBS=YES
+ -DCLIENT_PLUGIN_DIALOG=OFF
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
+ )
+ if use test ; then
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
+ else
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
+ fi
+
+ if ! use yassl ; then
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
+ else
+ mycmakeargs+=( -DWITH_SSL=bundled )
+ fi
+
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
+ mycmakeargs+=(
+ -DWITH_READLINE=$(usex bindist 1 0)
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
+ -DENABLE_DTRACE=$(usex systemtap)
+ )
+
+ if use server ; then
+ # Connect and Federated{,X} must be treated special
+ # otherwise they will not be built as plugins
+ if ! use extraengine ; then
+ mycmakeargs+=(
+ -DPLUGIN_CONNECT=NO
+ -DPLUGIN_FEDERATED=NO
+ -DPLUGIN_FEDERATEDX=NO
+ )
+ fi
+
+ mycmakeargs+=(
+ -DWITH_PCRE=system
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO)
+ -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
+ -DPLUGIN_AWS_KEY_MANAGEMENT=NO
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
+ -DPLUGIN_CASSANDRA=NO
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO)
+ -DCONNECT_WITH_MYSQL=1
+ -DCONNECT_WITH_LIBXML2=$(usex xml)
+ -DCONNECT_WITH_ODBC=$(usex odbc)
+ -DCONNECT_WITH_JDBC=$(usex jdbc)
+ # Build failure and autodep wrt bug 639144
+ -DCONNECT_WITH_MONGO=OFF
+ -DWITH_WSREP=$(usex galera)
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DWITH_MARIABACKUP=$(usex backup ON OFF)
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF)
+ -DINSTALL_SQLBENCHDIR=""
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
+ # systemd is only linked to for server notification
+ -DWITH_SYSTEMD=$(usex systemd yes no)
+ -DWITH_NUMA=$(usex numa ON OFF)
+ )
+
+ # Workaround for MDEV-14524
+ use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
+
+ if use test ; then
+ # This is needed for the new client lib which tests a real, open server
+ mycmakeargs+=( -DSKIP_TESTS=ON )
+ fi
+
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
+ ewarn "You MUST file bugs without these variables set."
+
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
+ )
+
+ elif ! use latin1 ; then
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=utf8
+ -DDEFAULT_COLLATION=utf8_general_ci
+ )
+ else
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=latin1
+ -DDEFAULT_COLLATION=latin1_swedish_ci
+ )
+ fi
+ mycmakeargs+=(
+ -DEXTRA_CHARSETS=all
+ -DMYSQL_USER=mysql
+ -DDISABLE_SHARED=$(usex static YES NO)
+ -DWITH_DEBUG=$(usex debug)
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DWITH_PROFILING=$(usex profiling)
+ )
+
+ if use static; then
+ mycmakeargs+=( -DWITH_PIC=1 )
+ fi
+
+ if use jemalloc || use tcmalloc ; then
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
+ fi
+
+ # Storage engines
+ mycmakeargs+=(
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1
+ -DWITH_CSV_STORAGE_ENGINE=1
+ -DWITH_HEAP_STORAGE_ENGINE=1
+ -DWITH_INNOBASE_STORAGE_ENGINE=1
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1
+ -DWITH_MYISAM_STORAGE_ENGINE=1
+ -DWITH_PARTITION_STORAGE_ENGINE=1
+ )
+ else
+ mycmakeargs+=(
+ -DWITHOUT_SERVER=1
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DEXTRA_CHARSETS=none
+ -DINSTALL_SQLBENCHDIR=
+ -DWITH_SYSTEMD=no
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_compile() {
+ cmake_src_compile
+}
+
+# Official test instructions:
+# USE='extraengine perl server xml' \
+# FEATURES='test userpriv' \
+# ebuild mariadb-X.X.XX.ebuild \
+# digest clean package
+src_test() {
+ _disable_test() {
+ local rawtestname bug reason
+ rawtestname="${1}" ; shift
+ bug="${1}" ; shift
+ reason="${@}"
+ ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
+ echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
+ }
+
+ local TESTDIR="${BUILD_DIR}/mysql-test"
+ local retstatus_tests
+
+ if ! use server ; then
+ einfo "Skipping server tests due to minimal build."
+ return 0
+ fi
+
+ # Ensure that parallel runs don't die
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
+
+ if [[ -z "${MTR_PARALLEL}" ]] ; then
+ local -x MTR_PARALLEL=$(makeopts_jobs)
+
+ if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
+ # Running multiple tests in parallel usually require higher ulimit
+ # and fs.aio-max-nr setting. In addition, tests like main.multi_update
+ # are known to hit timeout when system is busy.
+ # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
+ # using "auto".
+ local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
+ info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
+ einfo "${info_msg}"
+ unset info_msg
+ MTR_PARALLEL=4
+ fi
+ else
+ einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
+ fi
+
+ # Try to increase file limits to increase test coverage
+ if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
+ # Upper limit comes from parts.partition_* tests
+ ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
+
+ if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
+ # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
+ ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
+
+ if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
+ ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
+ else
+ einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
+ fi
+
+ # create directories because mysqladmin might run out of order
+ mkdir -p "${T}"/var-tests{,/log} || die
+
+ if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
+ touch "${S}"/mysql-test/unstable-tests || die
+ fi
+
+ cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
+
+ local -a disabled_tests
+ disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
+ disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
+ disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
+ disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
+ disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
+ disabled_tests+=( "mariabackup.*;0;Broken test suite" )
+ disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
+ disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
+ disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
+ disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
+ disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
+ disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
+
+ if ! use latin1 ; then
+ disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
+ disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
+ disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
+ disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
+ fi
+
+ local test_infos_str test_infos_arr
+ for test_infos_str in "${disabled_tests[@]}" ; do
+ IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
+
+ if [[ ${#test_infos_arr[@]} != 3 ]] ; then
+ die "Invalid test data set, not matching format: ${test_infos_str}"
+ fi
+
+ _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
+ done
+ unset test_infos_str test_infos_arr
+
+ # run mysql-test tests
+ pushd "${TESTDIR}" &>/dev/null || die
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
+ retstatus_tests=$?
+
+ popd &>/dev/null || die
+
+ # Cleanup is important for these testcases.
+ pkill -9 -f "${S}/ndb" 2>/dev/null
+ pkill -9 -f "${S}/sql" 2>/dev/null
+
+ local failures=""
+ [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
+
+ [[ -z "${failures}" ]] || die "Test failures: ${failures}"
+ einfo "Tests successfully completed"
+}
+
+src_install() {
+ cmake_src_install
+
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die
+ fi
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Convenience links
+ einfo "Making Convenience links for mysqlcheck multi-call binary"
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair"
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize"
+
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
+ if [[ -d "${ED}/usr/data" ]] ; then
+ rm -Rf "${ED}/usr/data" || die
+ fi
+
+ # Unless they explicitly specific USE=test, then do not install the
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a
+ # validation of your database configuration after tuning it.
+ if ! use test ; then
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
+ fi
+
+ # Configuration stuff
+ einfo "Building default configuration ..."
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}"
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
+ eprefixify "${TMPDIR}/my.cnf"
+ doins "${TMPDIR}/my.cnf"
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+ eprefixify "${TMPDIR}/50-distro-client.cnf"
+ doins "${TMPDIR}/50-distro-client.cnf"
+
+ if use server ; then
+ mycnf_src="my.cnf.distro-server"
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
+ "${FILESDIR}/${mycnf_src}" \
+ > "${TMPDIR}/my.cnf.ok" || die
+ if use prefix ; then
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ if use latin1 ; then
+ sed -i \
+ -e "/character-set/s|utf8|latin1|g" \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ eprefixify "${TMPDIR}/my.cnf.ok"
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
+
+ einfo "Including support files and sample configurations"
+ docinto "support-files"
+ local script
+ for script in \
+ "${S}"/support-files/magic
+ do
+ [[ -f "$script" ]] && dodoc "${script}"
+ done
+
+ docinto "scripts"
+ for script in "${S}"/scripts/mysql* ; do
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
+ done
+ # Manually install supporting files that conflict with other packages
+ # but are needed for galera and initial installation
+ exeinto /usr/libexec/mariadb
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
+
+ if use pam ; then
+ keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
+ fi
+ fi
+
+ # Remove bundled mytop in favor of dev-db/mytop
+ local mytop_file
+ for mytop_file in \
+ "${ED}/usr/bin/mytop" \
+ "${ED}/usr/share/man/man1/mytop.1" \
+ ; do
+ if [[ -e "${mytop_file}" ]] ; then
+ rm -v "${mytop_file}" || die
+ fi
+ done
+
+ # Fix a dangling symlink when galera is not built
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
+ fi
+
+ # Remove dangling symlink
+ rm "${ED}/usr/$(get_libdir)/libmariadb.a" || die
+
+ # Remove broken SST scripts that are incompatible
+ local scriptremove
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
+ rm "${ED}/usr/bin/${scriptremove}" || die
+ fi
+ done
+}
+
+pkg_preinst() {
+ java-pkg-opt-2_pkg_preinst
+}
+
+pkg_postinst() {
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Create log directory securely if it does not exist
+ [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
+
+ if use server ; then
+ if use pam; then
+ einfo
+ elog "This install includes the PAM authentication plugin."
+ elog "To activate and configure the PAM plugin, please read:"
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
+ einfo
+ chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
+ fi
+
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+ einfo
+ elog "You might want to run:"
+ elog "\"emerge --config =${CATEGORY}/${PF}\""
+ elog "if this is a new install."
+ elog
+ elog "If you are switching server implentations, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ else
+ einfo
+ elog "If you are upgrading major versions, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ fi
+
+ if use galera ; then
+ einfo
+ elog "Be sure to edit the my.cnf file to activate your cluster settings."
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
+ elog "The first time the cluster is activated, you should add"
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
+ elog "This option should then be removed for subsequent starts."
+ einfo
+ if [[ -n "${REPLACING_VERSIONS}" ]] ; then
+ local rver
+ for rver in ${REPLACING_VERSIONS} ; do
+ if ver_test "${rver}" -lt "10.4.0" ; then
+ ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
+ ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
+ ewarn "for more information"
+ fi
+ done
+ fi
+ fi
+ fi
+
+ # Note about configuration change
+ einfo
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf"
+ elog "to several files in /etc/mysql/${PN}.d."
+ elog "Please backup any changes you made to /etc/mysql/my.cnf"
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
+ elog "You may have as many files as needed and they are read alphabetically."
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
+ einfo
+}
+
+pkg_config() {
+ _getoptval() {
+ local section="${1}"
+ local option="--${2}"
+ local extra_options="${3}"
+ local cmd=(
+ "${my_print_defaults_binary}"
+ "${extra_options}"
+ "${section}"
+ )
+
+ local values=()
+ local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
+ for parameter in "${parameters[@]}"
+ do
+ # my_print_defaults guarantees output of options, one per line,
+ # in the form that they would be specified on the command line.
+ # So checking for --option=* should be safe.
+ case ${parameter} in
+ ${option}=*)
+ values+=( "${parameter#*=}" )
+ ;;
+ esac
+ done
+
+ if [[ ${#values[@]} -gt 0 ]] ; then
+ # Option could have been set multiple times
+ # in which case only the last occurrence
+ # contains the current value
+ echo "${values[-1]}"
+ fi
+ }
+
+ _mktemp_dry() {
+ # emktemp has no --dry-run option
+ local template="${1}"
+
+ if [[ -z "${template}" ]] ; then
+ if [[ -z "${T}" ]] ; then
+ template="/tmp/XXXXXXX"
+ else
+ template="${T}/XXXXXXX"
+ fi
+ fi
+
+ local template_wo_X=${template//X/}
+ local n_X
+ let n_X=${#template}-${#template_wo_X}
+ if [[ ${n_X} -lt 3 ]] ; then
+ echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
+ return
+ fi
+
+ local attempts=0
+ local character tmpfile
+ while [[ true ]] ; do
+ let attempts=attempts+1
+
+ new_file=
+ while read -n1 character ; do
+ if [[ "${character}" == "X" ]] ; then
+ tmpfile+="${RANDOM:0:1}"
+ else
+ tmpfile+="${character}"
+ fi
+ done < <(echo -n "${template}")
+
+ if [[ ! -f "${tmpfile}" ]]
+ then
+ echo "${tmpfile}"
+ return
+ fi
+
+ if [[ ${attempts} -ge 100 ]] ; then
+ echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
+ return
+ fi
+ done
+ }
+
+ local mysql_binary="${EROOT}/usr/bin/mysql"
+ if [[ ! -x "${mysql_binary}" ]] ; then
+ die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysqld_binary="${EROOT}/usr/sbin/mysqld"
+ if [[ ! -x "${mysqld_binary}" ]] ; then
+ die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
+ if [[ ! -x "${mysql_install_db_binary}" ]] ; then
+ die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
+ if [[ ! -x "${my_print_defaults_binary}" ]] ; then
+ die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
+ fi
+
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ MYSQL_USER=mysql
+ if use prefix ; then
+ MYSQL_USER=$(id -u -n 2>/dev/null)
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ die "Failed to determine current username!"
+ fi
+ fi
+ fi
+
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ MYSQL_GROUP=mysql
+ if use prefix ; then
+ MYSQL_GROUP=$(id -g -n 2>/dev/null)
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ die "Failed to determine current user groupname!"
+ fi
+ fi
+ fi
+
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf
+ local -x HOME="${EROOT}/root"
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Read currently set data directory
+ MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ die "Sorry, unable to find MY_DATADIR!"
+ elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
+ ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
+ ewarn "Please rename or delete its content if you wish to initialize a new data directory."
+ die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
+ fi
+
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
+ # These are dir+prefix
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
+
+ # Create missing directories.
+ # Always check if mysql user can write to directory even if we just
+ # created directory because a parent directory might be not
+ # accessible for that user.
+ PID_DIR="${EROOT}/run/mysqld"
+ if [[ ! -d "${PID_DIR}" ]] ; then
+ einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
+ install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
+ || die "Failed to create PID directory '${PID_DIR}'!"
+ fi
+
+ local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_pid_dir_testfile}" ]] \
+ && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_pid_dir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
+ else
+ rm "${_pid_dir_testfile}" || die
+ unset _pid_dir_testfile
+ fi
+
+ if [[ ! -d "${MY_DATADIR}" ]] ; then
+ einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
+ || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
+ fi
+
+ local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_datadir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_datadir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
+ else
+ rm "${_my_datadir_testfile}" || die
+ unset _my_datadir_testfile
+ fi
+
+ if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
+ einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
+ || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
+ fi
+
+ if [[ -z "${MYSQL_TMPDIR}" ]] ; then
+ MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
+ [[ -z "${MYSQL_TMPDIR}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
+
+ mkdir "${MYSQL_TMPDIR}" || die
+ chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
+ fi
+
+ # Now we need to test MYSQL_TMPDIR...
+ local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_tmpdir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_tmpdir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
+ else
+ rm "${_my_tmpdir_testfile}" || die
+ unset _my_tmpdir_testfile
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
+ # Only create directory when MYSQL_LOG_BIN is an absolute path
+ einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
+ || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Only test when MYSQL_LOG_BIN is an absolute path
+ local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_logbin_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_logbin_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
+ else
+ rm "${_my_logbin_testfile}" || die
+ unset _my_logbin_testfile
+ fi
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
+ # Only create directory when MYSQL_RELAY_LOG is an absolute path
+ einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
+ || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Only test when MYSQL_RELAY_LOG is an absolute path
+ local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_relaylog_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_relaylog_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
+ else
+ rm "${_my_relaylog_testfile}" || die
+ unset _my_relaylog_testfile
+ fi
+ fi
+
+ local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
+ [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
+
+ # Limit access
+ chmod 0770 "${SETUP_TMPDIR}" || die
+ chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
+
+ local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
+ local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
+
+ echo ""
+ einfo "Detected settings:"
+ einfo "=================="
+ einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
+ einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
+ einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
+ einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Absolute path for binary log files specified
+ einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Absolute path for relay log files specified
+ einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
+ fi
+
+ einfo "PID DIR:\t\t\t\t${PID_DIR}"
+ einfo "Install db log:\t\t\t${mysql_install_log}"
+ einfo "Install server log:\t\t\t${mysqld_logfile}"
+
+ echo
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local tmp_mysqld_password_source=
+
+ for tmp_mysqld_password_source in mysql client ; do
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
+ MYSQL_ROOT_PASSWORD=
+ continue
+ fi
+
+ einfo "Found password in '${tmp_mysqld_password_source}' section!"
+ break
+ fi
+ done
+
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
+ fi
+
+ unset tmp_mysqld_password_source
+ fi
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local pwd1="a"
+ local pwd2="b"
+
+ echo
+ einfo "No password for mysql 'root' user was specified via environment"
+ einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
+ einfo "file like '${HOME}/.my.cnf'."
+ einfo "To continue please provide a password for the mysql 'root' user"
+ einfo "now on console:"
+ ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
+ read -rsp " >" pwd1 ; echo
+
+ einfo "Retype the password"
+ read -rsp " >" pwd2 ; echo
+
+ if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
+ die "Passwords are not the same!"
+ fi
+
+ MYSQL_ROOT_PASSWORD="${pwd1}"
+ unset pwd1 pwd2
+
+ echo
+ fi
+
+ local -a mysqld_options
+
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first,
+ # see http://bugs.mysql.com/bug.php?id=31312
+ use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
+
+ # Figure out which options we need to disable to do the setup
+ local helpfile="${TMPDIR}/mysqld-help"
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
+
+ local opt optexp optfull
+ for opt in host-cache name-resolve networking slave-start \
+ federated ssl log-bin relay-log slow-query-log external-locking \
+ log-slave-updates \
+ ; do
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
+ grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
+ done
+
+ # Prepare timezones, see
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
+ local tz_sql="${SETUP_TMPDIR}/tz.sql"
+
+ echo "USE mysql;" >"${tz_sql}"
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
+ if [[ $? -ne 0 ]] ; then
+ die "mysql_tzinfo_to_sql failed!"
+ fi
+
+ local cmd=(
+ "${mysql_install_db_binary}"
+ "${mysqld_options[@]}"
+ "--init-file='${tz_sql}'"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ "--log-error='${mysql_install_log}'"
+ "--rpm"
+ "--cross-bootstrap"
+ "--skip-test-db"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Initializing ${PN} data directory: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
+
+ if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
+ die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
+ fi
+
+ local x=${RANDOM}
+ local socket="${PID_DIR}/mysqld.${x}.sock"
+ [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
+ local pidfile="${PID_DIR}/mysqld.${x}.pid"
+ [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
+ unset x
+
+ cmd=(
+ "${mysqld_binary}"
+ "${mysqld_options[@]}"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ --max_allowed_packet=8M
+ --net_buffer_length=16K
+ "--socket='${socket}'"
+ "--pid-file='${pidfile}'"
+ "--log-error='${mysqld_logfile}'"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
+
+ echo -n "Waiting for mysqld to accept connections "
+ local maxtry=15
+ while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ if [[ -S "${socket}" ]] ; then
+ # Even with a socket we don't know if mysqld will abort
+ # start due to an error so just wait a little bit more...
+ maxtry=5
+ while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+ fi
+
+ echo
+
+ if [[ ! -S "${socket}" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
+ die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
+ fi
+
+ local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
+ touch "${mysql_logfile}" || die
+
+ ebegin "Setting root password"
+ # Do this from memory, as we don't want clear text passwords in temp files
+ local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
+ cmd=(
+ "${mysql_binary}"
+ --no-defaults
+ "--socket='${socket}'"
+ -hlocalhost
+ "-e \"${sql}\""
+ )
+ eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
+ local rc=$?
+ eend ${rc}
+
+ if [[ ${rc} -ne 0 ]] ; then
+ # Poor man's solution which tries to avoid having password
+ # in log. NOTE: sed can fail if user didn't follow advice
+ # and included character which will require escaping...
+ sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
+
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
+ die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
+ fi
+
+ # Stop the server
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ echo -n "Stopping the server "
+ pkill -F "${pidfile}" &>/dev/null
+
+ maxtry=10
+ while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ echo
+
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ # We somehow failed to stop server.
+ # However, not a fatal error. Just warn the user.
+ ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
+ fi
+ fi
+
+ rm -r "${SETUP_TMPDIR}" || die
+
+ einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
+}
diff --git a/dev-db/mariadb/mariadb-10.5.19.ebuild b/dev-db/mariadb/mariadb-10.5.19.ebuild
new file mode 100644
index 000000000000..40f8490bb7fa
--- /dev/null
+++ b/dev-db/mariadb/mariadb-10.5.19.ebuild
@@ -0,0 +1,1320 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+SUBSLOT="18"
+
+JAVA_PKG_OPT_USE="jdbc"
+
+inherit systemd flag-o-matic prefix toolchain-funcs \
+ multiprocessing java-pkg-opt-2 cmake
+
+# Patch version
+PATCH_SET="https://github.com/hydrapolic/gentoo-dist/raw/master/mariadb/mariadb-10.5.19-patches-01.tar.xz"
+
+SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
+ ${PATCH_SET}"
+
+HOMEPAGE="https://mariadb.org/"
+DESCRIPTION="An enhanced, drop-in replacement for MySQL"
+LICENSE="GPL-2 LGPL-2.1+"
+SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
+IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
+ sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
+ test xml yassl"
+
+RESTRICT="!bindist? ( bindist ) !test? ( test )"
+
+REQUIRED_USE="jdbc? ( extraengine server !static )
+ ?? ( tcmalloc jemalloc )
+ static? ( yassl !pam )"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
+
+# Shorten the path because the socket path length must be shorter than 107 chars
+# and we will run a mysql server during test phase
+S="${WORKDIR}/mysql"
+
+# Be warned, *DEPEND are version-dependant
+# These are used for both runtime and compiletime
+COMMON_DEPEND="
+ >=dev-libs/libpcre2-10.34:=
+ >=sys-apps/texinfo-4.7-r1
+ sys-libs/ncurses:0=
+ >=sys-libs/zlib-1.2.3:0=
+ virtual/libcrypt:=
+ !bindist? (
+ sys-libs/binutils-libs:0=
+ >=sys-libs/readline-4.1:0=
+ )
+ jemalloc? ( dev-libs/jemalloc:0= )
+ kerberos? ( virtual/krb5 )
+ kernel_linux? (
+ sys-process/procps:0=
+ dev-libs/libaio:0=
+ )
+ server? (
+ app-arch/bzip2
+ app-arch/xz-utils
+ backup? ( app-arch/libarchive:0= )
+ columnstore? (
+ app-arch/snappy
+ dev-libs/boost:=
+ dev-libs/libxml2:2=
+ )
+ cracklib? ( sys-libs/cracklib:0= )
+ extraengine? (
+ odbc? ( dev-db/unixODBC:0= )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ innodb-lz4? ( app-arch/lz4 )
+ innodb-lzo? ( dev-libs/lzo )
+ innodb-snappy? ( app-arch/snappy )
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
+ numa? ( sys-process/numactl )
+ oqgraph? (
+ dev-libs/boost:=
+ dev-libs/judy:0=
+ )
+ pam? ( sys-libs/pam:0= )
+ s3? ( net-misc/curl )
+ systemd? ( sys-apps/systemd:= )
+ )
+ systemtap? ( >=dev-util/systemtap-1.3:0= )
+ tcmalloc? ( dev-util/google-perftools:0= )
+ yassl? ( net-libs/gnutls:0= )
+ !yassl? (
+ <dev-libs/openssl-3:=
+ )
+"
+BDEPEND="app-alternatives/yacc"
+DEPEND="${COMMON_DEPEND}
+ server? (
+ extraengine? ( jdbc? ( >=virtual/jdk-1.8 ) )
+ test? ( acct-group/mysql acct-user/mysql )
+ )
+ static? ( sys-libs/ncurses[static-libs] )
+"
+RDEPEND="${COMMON_DEPEND}
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
+ !dev-db/mariadb:0
+ !dev-db/mariadb:5.5
+ !dev-db/mariadb:10.1
+ !dev-db/mariadb:10.2
+ !dev-db/mariadb:10.3
+ !dev-db/mariadb:10.4
+ !dev-db/mariadb:10.6
+ !dev-db/mariadb:10.7
+ !dev-db/mariadb:10.8
+ !dev-db/mariadb:10.9
+ !dev-db/mariadb:10.10
+ !dev-db/mariadb:10.11
+ !dev-db/mariadb:11.0
+ !<virtual/mysql-5.6-r11
+ !<virtual/libmysqlclient-18-r1
+ selinux? ( sec-policy/selinux-mysql )
+ server? (
+ columnstore? ( dev-db/mariadb-connector-c )
+ extraengine? ( jdbc? ( >=virtual/jre-1.8 ) )
+ galera? (
+ sys-apps/iproute2
+ =sys-cluster/galera-26*
+ sst-rsync? ( sys-process/lsof )
+ sst-mariabackup? ( net-misc/socat[ssl] )
+ )
+ !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
+ )
+"
+# For other stuff to bring us in
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
+
+mysql_init_vars() {
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=""
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
+ MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
+ | sed -e 's/.*=\s*//' \
+ | tail -n1)
+ fi
+ fi
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR="${MY_LOCALSTATEDIR}"
+ einfo "Using default MY_DATADIR"
+ fi
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}"
+
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
+ if [[ -e "${MY_DATADIR}" ]] ; then
+ # If you get this and you're wondering about it, see bug #207636
+ elog "MySQL datadir found in ${MY_DATADIR}"
+ elog "A new one will not be created."
+ PREVIOUS_DATADIR="yes"
+ else
+ PREVIOUS_DATADIR="no"
+ fi
+ export PREVIOUS_DATADIR
+ fi
+ else
+ if [[ ${EBUILD_PHASE} == "config" ]]; then
+ local new_MY_DATADIR
+ new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
+ ewarn "MySQL MY_DATADIR has changed"
+ ewarn "from ${MY_DATADIR}"
+ ewarn "to ${new_MY_DATADIR}"
+ MY_DATADIR="${new_MY_DATADIR}"
+ fi
+ fi
+ fi
+
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR
+ export MY_LOCALSTATEDIR MY_LOGDIR
+ export MY_DATADIR
+}
+
+pkg_setup() {
+ if [[ ${MERGE_TYPE} != binary ]] ; then
+ if has test ${FEATURES} ; then
+ # Bug #213475 - MySQL _will_ object strenuously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if ! has userpriv ${FEATURES} ; then
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+ fi
+ fi
+ fi
+
+ java-pkg-opt-2_pkg_setup
+}
+
+src_unpack() {
+ unpack ${A}
+
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
+}
+
+src_prepare() {
+ eapply "${WORKDIR}"/mariadb-patches
+ eapply "${FILESDIR}"/${PN}-10.6.11-gssapi.patch
+ eapply "${FILESDIR}"/${PN}-10.6.12-gcc-13.patch
+
+ eapply_user
+
+ _disable_plugin() {
+ echo > "${S}/plugin/${1}/CMakeLists.txt" || die
+ }
+ _disable_engine() {
+ echo > "${S}/storage/${1}/CMakeLists.txt" || die
+ }
+
+ if use jemalloc; then
+ echo "TARGET_LINK_LIBRARIES(mariadbd LINK_PUBLIC jemalloc)" >> "${S}/sql/CMakeLists.txt"
+ elif use tcmalloc; then
+ echo "TARGET_LINK_LIBRARIES(mariadbd LINK_PUBLIC tcmalloc)" >> "${S}/sql/CMakeLists.txt"
+ fi
+
+ local plugin
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
+ locale_info qc_info server_audit sql_errlog auth_ed25519 )
+ local test_plugins=( audit_null auth_examples daemon_example fulltext
+ debug_key_management example_key_management versioning )
+ if ! use server; then # These plugins are for the server
+ for plugin in "${server_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ fi
+
+ if ! use test; then # These plugins are only used during testing
+ for plugin in "${test_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ _disable_engine test_sql_discovery
+ echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die
+ fi
+
+ _disable_engine example
+
+ if ! use oqgraph ; then # avoids extra library checks
+ _disable_engine oqgraph
+ fi
+
+ if use mroonga ; then
+ # Remove the bundled groonga
+ # There is no CMake flag, it simply checks for existance
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
+ else
+ _disable_engine mroonga
+ fi
+
+ # Fix static bindings in galera replication
+ sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \
+ "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die
+ sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \
+ "${S}"/wsrep-lib/src/CMakeLists.txt || die
+
+ # Fix galera_recovery.sh script
+ sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
+ scripts/galera_recovery.sh || die
+
+ sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \
+ "${S}"/scripts/mysql_install_db.sh || die
+
+ cmake_src_prepare
+ java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+ # bug 508724 mariadb cannot use ld.gold
+ tc-ld-disable-gold
+ # Bug #114895, bug #110149
+ filter-flags "-O" "-O[01]"
+
+ # It fails on alpha without this
+ use alpha && append-ldflags "-Wl,--no-relax"
+
+ append-cxxflags -felide-constructors
+
+ # bug #283926, with GCC4.4, this is required to get correct behavior.
+ append-flags -fno-strict-aliasing
+
+ CMAKE_BUILD_TYPE="RelWithDebInfo"
+
+ # debug hack wrt #497532
+ local mycmakeargs=(
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql"
+ -DINSTALL_BINDIR=bin
+ -DINSTALL_DOCDIR=share/doc/${PF}
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF}
+ -DINSTALL_INCLUDEDIR=include/mysql
+ -DINSTALL_INFODIR=share/info
+ -DINSTALL_LIBDIR=$(get_libdir)
+ -DINSTALL_MANDIR=share/man
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
+ -DINSTALL_SCRIPTDIR=bin
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
+ -DINSTALL_SBINDIR=sbin
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
+ -DWITH_COMMENT="Gentoo Linux ${PF}"
+ -DWITH_UNIT_TESTS=$(usex test ON OFF)
+ -DWITH_LIBEDIT=0
+ -DWITH_ZLIB=system
+ -DWITHOUT_LIBWRAP=1
+ -DENABLED_LOCAL_INFILE=1
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0
+ -DWITH_DEFAULT_FEATURE_SET=0
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
+ # The build forces this to be defined when cross-compiling. We pass it
+ # all the time for simplicity and to make sure it is actually correct.
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
+ -DCONC_WITH_EXTERNAL_ZLIB=YES
+ -DWITH_EXTERNAL_ZLIB=YES
+ -DSUFFIX_INSTALL_DIR=""
+ -DWITH_UNITTEST=OFF
+ -DWITHOUT_CLIENTLIBS=YES
+ -DCLIENT_PLUGIN_DIALOG=OFF
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
+ )
+ if use test ; then
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
+ else
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
+ fi
+
+ if ! use yassl ; then
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
+ else
+ mycmakeargs+=( -DWITH_SSL=bundled )
+ fi
+
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
+ mycmakeargs+=(
+ -DWITH_READLINE=$(usex bindist 1 0)
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
+ -DENABLE_DTRACE=$(usex systemtap)
+ )
+
+ if use server ; then
+ # Connect and Federated{,X} must be treated special
+ # otherwise they will not be built as plugins
+ if ! use extraengine ; then
+ mycmakeargs+=(
+ -DPLUGIN_CONNECT=NO
+ -DPLUGIN_FEDERATED=NO
+ -DPLUGIN_FEDERATEDX=NO
+ )
+ fi
+
+ mycmakeargs+=(
+ -DWITH_PCRE=system
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO)
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
+ -DPLUGIN_AWS_KEY_MANAGEMENT=NO
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
+ -DPLUGIN_CASSANDRA=NO
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO)
+ -DPLUGIN_S3=$(usex s3 YES NO)
+ -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO)
+ -DCONNECT_WITH_MYSQL=1
+ -DCONNECT_WITH_LIBXML2=$(usex xml)
+ -DCONNECT_WITH_ODBC=$(usex odbc)
+ -DCONNECT_WITH_JDBC=$(usex jdbc)
+ # Build failure and autodep wrt bug 639144
+ -DCONNECT_WITH_MONGO=OFF
+ -DWITH_WSREP=$(usex galera)
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DWITH_MARIABACKUP=$(usex backup ON OFF)
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF)
+ -DINSTALL_SQLBENCHDIR=""
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
+ # systemd is only linked to for server notification
+ -DWITH_SYSTEMD=$(usex systemd yes no)
+ -DWITH_NUMA=$(usex numa ON OFF)
+ )
+
+ if use test ; then
+ # This is needed for the new client lib which tests a real, open server
+ mycmakeargs+=( -DSKIP_TESTS=ON )
+ fi
+
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
+ ewarn "You MUST file bugs without these variables set."
+
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
+ )
+
+ elif ! use latin1 ; then
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=utf8
+ -DDEFAULT_COLLATION=utf8_general_ci
+ )
+ else
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=latin1
+ -DDEFAULT_COLLATION=latin1_swedish_ci
+ )
+ fi
+ mycmakeargs+=(
+ -DEXTRA_CHARSETS=all
+ -DMYSQL_USER=mysql
+ -DDISABLE_SHARED=$(usex static YES NO)
+ -DWITH_DEBUG=$(usex debug)
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DWITH_PROFILING=$(usex profiling)
+ )
+
+ if use static; then
+ mycmakeargs+=( -DWITH_PIC=1 )
+ fi
+
+ if use jemalloc || use tcmalloc ; then
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
+ fi
+
+ # Storage engines
+ mycmakeargs+=(
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1
+ -DWITH_CSV_STORAGE_ENGINE=1
+ -DWITH_HEAP_STORAGE_ENGINE=1
+ -DWITH_INNOBASE_STORAGE_ENGINE=1
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1
+ -DWITH_MYISAM_STORAGE_ENGINE=1
+ -DWITH_PARTITION_STORAGE_ENGINE=1
+ )
+ else
+ mycmakeargs+=(
+ -DWITHOUT_SERVER=1
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DEXTRA_CHARSETS=none
+ -DINSTALL_SQLBENCHDIR=
+ -DWITH_SYSTEMD=no
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_compile() {
+ cmake_src_compile
+}
+
+# Official test instructions:
+# USE='extraengine perl server' \
+# FEATURES='test userpriv' \
+# ebuild mariadb-X.X.XX.ebuild \
+# digest clean package
+src_test() {
+ _disable_test() {
+ local rawtestname bug reason
+ rawtestname="${1}" ; shift
+ bug="${1}" ; shift
+ reason="${@}"
+ ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
+ echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
+ }
+
+ local TESTDIR="${BUILD_DIR}/mysql-test"
+ local retstatus_tests
+
+ if ! use server ; then
+ einfo "Skipping server tests due to minimal build."
+ return 0
+ fi
+
+ # Ensure that parallel runs don't die
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
+
+ if [[ -z "${MTR_PARALLEL}" ]] ; then
+ local -x MTR_PARALLEL=$(makeopts_jobs)
+
+ if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
+ # Running multiple tests in parallel usually require higher ulimit
+ # and fs.aio-max-nr setting. In addition, tests like main.multi_update
+ # are known to hit timeout when system is busy.
+ # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
+ # using "auto".
+ local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
+ info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
+ einfo "${info_msg}"
+ unset info_msg
+ MTR_PARALLEL=4
+ fi
+ else
+ einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
+ fi
+
+ # Try to increase file limits to increase test coverage
+ if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
+ # Upper limit comes from parts.partition_* tests
+ ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
+
+ if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
+ # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
+ ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
+
+ if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
+ ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
+ else
+ einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
+ fi
+
+ # create directories because mysqladmin might run out of order
+ mkdir -p "${T}"/var-tests{,/log} || die
+
+ if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
+ touch "${S}"/mysql-test/unstable-tests || die
+ fi
+
+ cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
+
+ local -a disabled_tests
+ disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
+ disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
+ disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
+ disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
+ disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
+ disabled_tests+=( "mariabackup.*;0;Broken test suite" )
+ disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
+ disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
+ disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
+ disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
+ disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
+ disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
+
+ if ! use latin1 ; then
+ disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
+ disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
+ disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
+ disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
+ fi
+
+ local test_infos_str test_infos_arr
+ for test_infos_str in "${disabled_tests[@]}" ; do
+ IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
+
+ if [[ ${#test_infos_arr[@]} != 3 ]] ; then
+ die "Invalid test data set, not matching format: ${test_infos_str}"
+ fi
+
+ _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
+ done
+ unset test_infos_str test_infos_arr
+
+ # run mysql-test tests
+ pushd "${TESTDIR}" &>/dev/null || die
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
+ retstatus_tests=$?
+
+ popd &>/dev/null || die
+
+ # Cleanup is important for these testcases.
+ pkill -9 -f "${S}/ndb" 2>/dev/null
+ pkill -9 -f "${S}/sql" 2>/dev/null
+
+ local failures=""
+ [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
+
+ [[ -z "${failures}" ]] || die "Test failures: ${failures}"
+ einfo "Tests successfully completed"
+}
+
+src_install() {
+ cmake_src_install
+
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die
+ fi
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Convenience links
+ einfo "Making Convenience links for mysqlcheck multi-call binary"
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair"
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize"
+
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
+ if [[ -d "${ED}/usr/data" ]] ; then
+ rm -Rf "${ED}/usr/data" || die
+ fi
+
+ # Unless they explicitly specific USE=test, then do not install the
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a
+ # validation of your database configuration after tuning it.
+ if ! use test ; then
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
+ fi
+
+ # Configuration stuff
+ einfo "Building default configuration ..."
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}"
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
+ eprefixify "${TMPDIR}/my.cnf"
+ doins "${TMPDIR}/my.cnf"
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+ eprefixify "${TMPDIR}/50-distro-client.cnf"
+ doins "${TMPDIR}/50-distro-client.cnf"
+
+ if use server ; then
+ mycnf_src="my.cnf.distro-server"
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
+ "${FILESDIR}/${mycnf_src}" \
+ > "${TMPDIR}/my.cnf.ok" || die
+ if use prefix ; then
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ if use latin1 ; then
+ sed -i \
+ -e "/character-set/s|utf8|latin1|g" \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ eprefixify "${TMPDIR}/my.cnf.ok"
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
+
+ einfo "Including support files and sample configurations"
+ docinto "support-files"
+ local script
+ for script in \
+ "${S}"/support-files/magic
+ do
+ [[ -f "$script" ]] && dodoc "${script}"
+ done
+
+ docinto "scripts"
+ for script in "${S}"/scripts/mysql* ; do
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
+ done
+ # Manually install supporting files that conflict with other packages
+ # but are needed for galera and initial installation
+ exeinto /usr/libexec/mariadb
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
+
+ if use pam ; then
+ keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
+ fi
+ fi
+
+ # Conflicting files
+ conflicting_files=()
+
+ # We prefer my_print_defaults from dev-db/mysql-connector-c
+ conflicting_files=( "${ED}/usr/share/man/man1/my_print_defaults.1" )
+
+ # Remove bundled mytop in favor of dev-db/mytop
+ conflicting_files+=( "${ED}/usr/bin/mytop" )
+ conflicting_files+=( "${ED}/usr/share/man/man1/mytop.1" )
+
+ local conflicting_file
+ for conflicting_file in "${conflicting_files[@]}" ; do
+ if [[ -e "${conflicting_file}" ]] ; then
+ rm -v "${conflicting_file}" || die
+ fi
+ done
+
+ # Fix a dangling symlink when galera is not built
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
+ fi
+
+ # Remove dangling symlink
+ rm "${ED}/usr/$(get_libdir)/libmariadb.a" || die
+
+ # Remove broken SST scripts that are incompatible
+ local scriptremove
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
+ rm "${ED}/usr/bin/${scriptremove}" || die
+ fi
+ done
+}
+
+pkg_preinst() {
+ java-pkg-opt-2_pkg_preinst
+}
+
+pkg_postinst() {
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Create log directory securely if it does not exist
+ [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
+
+ if use server ; then
+ if use pam; then
+ einfo
+ elog "This install includes the PAM authentication plugin."
+ elog "To activate and configure the PAM plugin, please read:"
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
+ einfo
+ chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
+ fi
+
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+ einfo
+ elog "You might want to run:"
+ elog "\"emerge --config =${CATEGORY}/${PF}\""
+ elog "if this is a new install."
+ elog
+ elog "If you are switching server implentations, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ else
+ einfo
+ elog "If you are upgrading major versions, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ fi
+
+ if use galera ; then
+ einfo
+ elog "Be sure to edit the my.cnf file to activate your cluster settings."
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
+ elog "The first time the cluster is activated, you should add"
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
+ elog "This option should then be removed for subsequent starts."
+ einfo
+ if [[ -n "${REPLACING_VERSIONS}" ]] ; then
+ local rver
+ for rver in ${REPLACING_VERSIONS} ; do
+ if ver_test "${rver}" -lt "10.4.0" ; then
+ ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
+ ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
+ ewarn "for more information"
+ fi
+ done
+ fi
+ fi
+ fi
+
+ # Note about configuration change
+ einfo
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf"
+ elog "to several files in /etc/mysql/${PN}.d."
+ elog "Please backup any changes you made to /etc/mysql/my.cnf"
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
+ elog "You may have as many files as needed and they are read alphabetically."
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
+ einfo
+}
+
+pkg_config() {
+ _getoptval() {
+ local section="${1}"
+ local option="--${2}"
+ local extra_options="${3}"
+ local cmd=(
+ "${my_print_defaults_binary}"
+ "${extra_options}"
+ "${section}"
+ )
+
+ local values=()
+ local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
+ for parameter in "${parameters[@]}"
+ do
+ # my_print_defaults guarantees output of options, one per line,
+ # in the form that they would be specified on the command line.
+ # So checking for --option=* should be safe.
+ case ${parameter} in
+ ${option}=*)
+ values+=( "${parameter#*=}" )
+ ;;
+ esac
+ done
+
+ if [[ ${#values[@]} -gt 0 ]] ; then
+ # Option could have been set multiple times
+ # in which case only the last occurrence
+ # contains the current value
+ echo "${values[-1]}"
+ fi
+ }
+
+ _mktemp_dry() {
+ # emktemp has no --dry-run option
+ local template="${1}"
+
+ if [[ -z "${template}" ]] ; then
+ if [[ -z "${T}" ]] ; then
+ template="/tmp/XXXXXXX"
+ else
+ template="${T}/XXXXXXX"
+ fi
+ fi
+
+ local template_wo_X=${template//X/}
+ local n_X
+ let n_X=${#template}-${#template_wo_X}
+ if [[ ${n_X} -lt 3 ]] ; then
+ echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
+ return
+ fi
+
+ local attempts=0
+ local character tmpfile
+ while [[ true ]] ; do
+ let attempts=attempts+1
+
+ new_file=
+ while read -n1 character ; do
+ if [[ "${character}" == "X" ]] ; then
+ tmpfile+="${RANDOM:0:1}"
+ else
+ tmpfile+="${character}"
+ fi
+ done < <(echo -n "${template}")
+
+ if [[ ! -f "${tmpfile}" ]]
+ then
+ echo "${tmpfile}"
+ return
+ fi
+
+ if [[ ${attempts} -ge 100 ]] ; then
+ echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
+ return
+ fi
+ done
+ }
+
+ local mysql_binary="${EROOT}/usr/bin/mysql"
+ if [[ ! -x "${mysql_binary}" ]] ; then
+ die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysqld_binary="${EROOT}/usr/sbin/mysqld"
+ if [[ ! -x "${mysqld_binary}" ]] ; then
+ die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
+ if [[ ! -x "${mysql_install_db_binary}" ]] ; then
+ die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
+ if [[ ! -x "${my_print_defaults_binary}" ]] ; then
+ die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
+ fi
+
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ MYSQL_USER=mysql
+ if use prefix ; then
+ MYSQL_USER=$(id -u -n 2>/dev/null)
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ die "Failed to determine current username!"
+ fi
+ fi
+ fi
+
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ MYSQL_GROUP=mysql
+ if use prefix ; then
+ MYSQL_GROUP=$(id -g -n 2>/dev/null)
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ die "Failed to determine current user groupname!"
+ fi
+ fi
+ fi
+
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf
+ local -x HOME="${EROOT}/root"
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Read currently set data directory
+ MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ die "Sorry, unable to find MY_DATADIR!"
+ elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
+ ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
+ ewarn "Please rename or delete its content if you wish to initialize a new data directory."
+ die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
+ fi
+
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
+ # These are dir+prefix
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
+
+ # Create missing directories.
+ # Always check if mysql user can write to directory even if we just
+ # created directory because a parent directory might be not
+ # accessible for that user.
+ PID_DIR="${EROOT}/run/mysqld"
+ if [[ ! -d "${PID_DIR}" ]] ; then
+ einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
+ install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
+ || die "Failed to create PID directory '${PID_DIR}'!"
+ fi
+
+ local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_pid_dir_testfile}" ]] \
+ && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_pid_dir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
+ else
+ rm "${_pid_dir_testfile}" || die
+ unset _pid_dir_testfile
+ fi
+
+ if [[ ! -d "${MY_DATADIR}" ]] ; then
+ einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
+ || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
+ fi
+
+ local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_datadir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_datadir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
+ else
+ rm "${_my_datadir_testfile}" || die
+ unset _my_datadir_testfile
+ fi
+
+ if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
+ einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
+ || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
+ fi
+
+ if [[ -z "${MYSQL_TMPDIR}" ]] ; then
+ MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
+ [[ -z "${MYSQL_TMPDIR}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
+
+ mkdir "${MYSQL_TMPDIR}" || die
+ chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
+ fi
+
+ # Now we need to test MYSQL_TMPDIR...
+ local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_tmpdir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_tmpdir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
+ else
+ rm "${_my_tmpdir_testfile}" || die
+ unset _my_tmpdir_testfile
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
+ # Only create directory when MYSQL_LOG_BIN is an absolute path
+ einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
+ || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Only test when MYSQL_LOG_BIN is an absolute path
+ local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_logbin_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_logbin_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
+ else
+ rm "${_my_logbin_testfile}" || die
+ unset _my_logbin_testfile
+ fi
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
+ # Only create directory when MYSQL_RELAY_LOG is an absolute path
+ einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
+ || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Only test when MYSQL_RELAY_LOG is an absolute path
+ local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_relaylog_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_relaylog_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
+ else
+ rm "${_my_relaylog_testfile}" || die
+ unset _my_relaylog_testfile
+ fi
+ fi
+
+ local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
+ [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
+
+ # Limit access
+ chmod 0770 "${SETUP_TMPDIR}" || die
+ chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
+
+ local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
+ local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
+
+ echo ""
+ einfo "Detected settings:"
+ einfo "=================="
+ einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
+ einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
+ einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
+ einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Absolute path for binary log files specified
+ einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Absolute path for relay log files specified
+ einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
+ fi
+
+ einfo "PID DIR:\t\t\t\t${PID_DIR}"
+ einfo "Install db log:\t\t\t${mysql_install_log}"
+ einfo "Install server log:\t\t\t${mysqld_logfile}"
+
+ echo
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local tmp_mysqld_password_source=
+
+ for tmp_mysqld_password_source in mysql client ; do
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
+ MYSQL_ROOT_PASSWORD=
+ continue
+ fi
+
+ einfo "Found password in '${tmp_mysqld_password_source}' section!"
+ break
+ fi
+ done
+
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
+ fi
+
+ unset tmp_mysqld_password_source
+ fi
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local pwd1="a"
+ local pwd2="b"
+
+ echo
+ einfo "No password for mysql 'root' user was specified via environment"
+ einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
+ einfo "file like '${HOME}/.my.cnf'."
+ einfo "To continue please provide a password for the mysql 'root' user"
+ einfo "now on console:"
+ ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
+ read -rsp " >" pwd1 ; echo
+
+ einfo "Retype the password"
+ read -rsp " >" pwd2 ; echo
+
+ if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
+ die "Passwords are not the same!"
+ fi
+
+ MYSQL_ROOT_PASSWORD="${pwd1}"
+ unset pwd1 pwd2
+
+ echo
+ fi
+
+ local -a mysqld_options
+
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first,
+ # see http://bugs.mysql.com/bug.php?id=31312
+ use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
+
+ # Figure out which options we need to disable to do the setup
+ local helpfile="${TMPDIR}/mysqld-help"
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
+
+ local opt optexp optfull
+ for opt in host-cache name-resolve networking slave-start \
+ federated ssl log-bin relay-log slow-query-log external-locking \
+ log-slave-updates \
+ ; do
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
+ grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
+ done
+
+ # Prepare timezones, see
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
+ local tz_sql="${SETUP_TMPDIR}/tz.sql"
+
+ echo "USE mysql;" >"${tz_sql}"
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
+ if [[ $? -ne 0 ]] ; then
+ die "mysql_tzinfo_to_sql failed!"
+ fi
+
+ local cmd=(
+ "${mysql_install_db_binary}"
+ "${mysqld_options[@]}"
+ "--init-file='${tz_sql}'"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ "--log-error='${mysql_install_log}'"
+ "--rpm"
+ "--cross-bootstrap"
+ "--skip-test-db"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Initializing ${PN} data directory: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
+
+ if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
+ die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
+ fi
+
+ local x=${RANDOM}
+ local socket="${PID_DIR}/mysqld.${x}.sock"
+ [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
+ local pidfile="${PID_DIR}/mysqld.${x}.pid"
+ [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
+ unset x
+
+ cmd=(
+ "${mysqld_binary}"
+ "${mysqld_options[@]}"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ --max_allowed_packet=8M
+ --net_buffer_length=16K
+ "--socket='${socket}'"
+ "--pid-file='${pidfile}'"
+ "--log-error='${mysqld_logfile}'"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
+
+ echo -n "Waiting for mysqld to accept connections "
+ local maxtry=15
+ while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ if [[ -S "${socket}" ]] ; then
+ # Even with a socket we don't know if mysqld will abort
+ # start due to an error so just wait a little bit more...
+ maxtry=5
+ while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+ fi
+
+ echo
+
+ if [[ ! -S "${socket}" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
+ die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
+ fi
+
+ local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
+ touch "${mysql_logfile}" || die
+
+ ebegin "Setting root password"
+ # Do this from memory, as we don't want clear text passwords in temp files
+ local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
+ cmd=(
+ "${mysql_binary}"
+ --no-defaults
+ "--socket='${socket}'"
+ -hlocalhost
+ "-e \"${sql}\""
+ )
+ eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
+ local rc=$?
+ eend ${rc}
+
+ if [[ ${rc} -ne 0 ]] ; then
+ # Poor man's solution which tries to avoid having password
+ # in log. NOTE: sed can fail if user didn't follow advice
+ # and included character which will require escaping...
+ sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
+
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
+ die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
+ fi
+
+ # Stop the server
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ echo -n "Stopping the server "
+ pkill -F "${pidfile}" &>/dev/null
+
+ maxtry=10
+ while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ echo
+
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ # We somehow failed to stop server.
+ # However, not a fatal error. Just warn the user.
+ ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
+ fi
+ fi
+
+ rm -r "${SETUP_TMPDIR}" || die
+
+ einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
+}
diff --git a/dev-db/mariadb/mariadb-10.6.12.ebuild b/dev-db/mariadb/mariadb-10.6.12.ebuild
new file mode 100644
index 000000000000..5b8eb8830c99
--- /dev/null
+++ b/dev-db/mariadb/mariadb-10.6.12.ebuild
@@ -0,0 +1,1323 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+SUBSLOT="18"
+
+JAVA_PKG_OPT_USE="jdbc"
+
+inherit systemd flag-o-matic prefix toolchain-funcs \
+ multiprocessing java-pkg-opt-2 cmake
+
+HOMEPAGE="https://mariadb.org/"
+SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
+ https://github.com/hydrapolic/gentoo-dist/raw/master/mariadb/mariadb-10.6.12-patches-01.tar.xz"
+
+DESCRIPTION="An enhanced, drop-in replacement for MySQL"
+LICENSE="GPL-2 LGPL-2.1+"
+SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
+IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
+ sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
+ test xml yassl"
+
+RESTRICT="!bindist? ( bindist ) !test? ( test )"
+
+REQUIRED_USE="jdbc? ( extraengine server !static )
+ ?? ( tcmalloc jemalloc )
+ static? ( yassl !pam )"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
+
+# Shorten the path because the socket path length must be shorter than 107 chars
+# and we will run a mysql server during test phase
+S="${WORKDIR}/mysql"
+
+# Be warned, *DEPEND are version-dependant
+# These are used for both runtime and compiletime
+COMMON_DEPEND="
+ >=dev-libs/libpcre2-10.34:=
+ >=sys-apps/texinfo-4.7-r1
+ sys-libs/ncurses:0=
+ >=sys-libs/zlib-1.2.3:0=
+ virtual/libcrypt:=
+ !bindist? (
+ sys-libs/binutils-libs:0=
+ >=sys-libs/readline-4.1:0=
+ )
+ jemalloc? ( dev-libs/jemalloc:0= )
+ kerberos? ( virtual/krb5 )
+ kernel_linux? (
+ dev-libs/libaio:0=
+ sys-libs/liburing:=
+ sys-process/procps:0=
+ )
+ server? (
+ app-arch/bzip2
+ app-arch/xz-utils
+ backup? ( app-arch/libarchive:0= )
+ columnstore? (
+ app-arch/snappy
+ dev-libs/boost:=
+ dev-libs/libxml2:2=
+ )
+ cracklib? ( sys-libs/cracklib:0= )
+ extraengine? (
+ odbc? ( dev-db/unixODBC:0= )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ innodb-lz4? ( app-arch/lz4 )
+ innodb-lzo? ( dev-libs/lzo )
+ innodb-snappy? ( app-arch/snappy )
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
+ numa? ( sys-process/numactl )
+ oqgraph? (
+ dev-libs/boost:=
+ dev-libs/judy:0=
+ )
+ pam? ( sys-libs/pam:0= )
+ s3? ( net-misc/curl )
+ systemd? ( sys-apps/systemd:= )
+ )
+ systemtap? ( >=dev-util/systemtap-1.3:0= )
+ tcmalloc? ( dev-util/google-perftools:0= )
+ yassl? ( net-libs/gnutls:0= )
+ !yassl? (
+ >=dev-libs/openssl-1.0.0:0=
+ )
+"
+BDEPEND="app-alternatives/yacc"
+DEPEND="${COMMON_DEPEND}
+ server? (
+ extraengine? ( jdbc? ( >=virtual/jdk-1.8 ) )
+ test? ( acct-group/mysql acct-user/mysql )
+ )
+ static? ( sys-libs/ncurses[static-libs] )
+"
+RDEPEND="${COMMON_DEPEND}
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
+ !dev-db/mariadb:0
+ !dev-db/mariadb:5.5
+ !dev-db/mariadb:10.1
+ !dev-db/mariadb:10.2
+ !dev-db/mariadb:10.3
+ !dev-db/mariadb:10.4
+ !dev-db/mariadb:10.5
+ !dev-db/mariadb:10.7
+ !dev-db/mariadb:10.8
+ !dev-db/mariadb:10.9
+ !dev-db/mariadb:10.10
+ !dev-db/mariadb:10.11
+ !dev-db/mariadb:11.0
+ !<virtual/mysql-5.6-r11
+ !<virtual/libmysqlclient-18-r1
+ selinux? ( sec-policy/selinux-mysql )
+ server? (
+ columnstore? ( dev-db/mariadb-connector-c )
+ extraengine? ( jdbc? ( >=virtual/jre-1.8 ) )
+ galera? (
+ sys-apps/iproute2
+ =sys-cluster/galera-26*
+ sst-rsync? ( sys-process/lsof )
+ sst-mariabackup? ( net-misc/socat[ssl] )
+ )
+ !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
+ )
+"
+# For other stuff to bring us in
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
+
+mysql_init_vars() {
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=""
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
+ MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
+ | sed -e 's/.*=\s*//' \
+ | tail -n1)
+ fi
+ fi
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ MY_DATADIR="${MY_LOCALSTATEDIR}"
+ einfo "Using default MY_DATADIR"
+ fi
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}"
+
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
+ if [[ -e "${MY_DATADIR}" ]] ; then
+ # If you get this and you're wondering about it, see bug #207636
+ elog "MySQL datadir found in ${MY_DATADIR}"
+ elog "A new one will not be created."
+ PREVIOUS_DATADIR="yes"
+ else
+ PREVIOUS_DATADIR="no"
+ fi
+ export PREVIOUS_DATADIR
+ fi
+ else
+ if [[ ${EBUILD_PHASE} == "config" ]]; then
+ local new_MY_DATADIR
+ new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1)
+
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
+ ewarn "MySQL MY_DATADIR has changed"
+ ewarn "from ${MY_DATADIR}"
+ ewarn "to ${new_MY_DATADIR}"
+ MY_DATADIR="${new_MY_DATADIR}"
+ fi
+ fi
+ fi
+
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR
+ export MY_LOCALSTATEDIR MY_LOGDIR
+ export MY_DATADIR
+}
+
+pkg_setup() {
+ if [[ ${MERGE_TYPE} != binary ]] ; then
+ if has test ${FEATURES} ; then
+ # Bug #213475 - MySQL _will_ object strenuously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if ! has userpriv ${FEATURES} ; then
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+ fi
+ fi
+ fi
+
+ java-pkg-opt-2_pkg_setup
+}
+
+src_unpack() {
+ unpack ${A}
+
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
+}
+
+src_prepare() {
+ eapply "${WORKDIR}"/mariadb-patches
+ eapply "${FILESDIR}"/${PN}-10.6.11-gssapi.patch
+ eapply "${FILESDIR}"/${PN}-10.6.11-include.patch
+ eapply "${FILESDIR}"/${PN}-10.6.12-gcc-13.patch
+
+ eapply_user
+
+ _disable_plugin() {
+ echo > "${S}/plugin/${1}/CMakeLists.txt" || die
+ }
+ _disable_engine() {
+ echo > "${S}/storage/${1}/CMakeLists.txt" || die
+ }
+
+ if use jemalloc; then
+ echo "TARGET_LINK_LIBRARIES(mariadbd LINK_PUBLIC jemalloc)" >> "${S}/sql/CMakeLists.txt"
+ elif use tcmalloc; then
+ echo "TARGET_LINK_LIBRARIES(mariadbd LINK_PUBLIC tcmalloc)" >> "${S}/sql/CMakeLists.txt"
+ fi
+
+ local plugin
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
+ locale_info qc_info server_audit sql_errlog auth_ed25519 )
+ local test_plugins=( audit_null auth_examples daemon_example fulltext
+ debug_key_management example_key_management versioning )
+ if ! use server; then # These plugins are for the server
+ for plugin in "${server_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ fi
+
+ if ! use test; then # These plugins are only used during testing
+ for plugin in "${test_plugins[@]}" ; do
+ _disable_plugin "${plugin}"
+ done
+ _disable_engine test_sql_discovery
+ echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die
+ fi
+
+ _disable_engine example
+
+ if ! use oqgraph ; then # avoids extra library checks
+ _disable_engine oqgraph
+ fi
+
+ if use mroonga ; then
+ # Remove the bundled groonga
+ # There is no CMake flag, it simply checks for existance
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
+ else
+ _disable_engine mroonga
+ fi
+
+ # Fix static bindings in galera replication
+ sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \
+ "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die
+ sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \
+ "${S}"/wsrep-lib/src/CMakeLists.txt || die
+
+ # Fix galera_recovery.sh script
+ sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
+ scripts/galera_recovery.sh || die
+
+ sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \
+ "${S}"/scripts/mysql_install_db.sh || die
+
+ cmake_src_prepare
+ java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+ # bug 508724 mariadb cannot use ld.gold
+ tc-ld-disable-gold
+ # Bug #114895, bug #110149
+ filter-flags "-O" "-O[01]"
+
+ # It fails on alpha without this
+ use alpha && append-ldflags "-Wl,--no-relax"
+
+ append-cxxflags -felide-constructors
+
+ # bug #283926, with GCC4.4, this is required to get correct behavior.
+ append-flags -fno-strict-aliasing
+
+ CMAKE_BUILD_TYPE="RelWithDebInfo"
+
+ # debug hack wrt #497532
+ local mycmakeargs=(
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql"
+ -DINSTALL_BINDIR=bin
+ -DINSTALL_DOCDIR=share/doc/${PF}
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF}
+ -DINSTALL_INCLUDEDIR=include/mysql
+ -DINSTALL_INFODIR=share/info
+ -DINSTALL_LIBDIR=$(get_libdir)
+ -DINSTALL_MANDIR=share/man
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
+ -DINSTALL_SCRIPTDIR=bin
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
+ -DINSTALL_SBINDIR=sbin
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
+ -DWITH_COMMENT="Gentoo Linux ${PF}"
+ -DWITH_UNIT_TESTS=$(usex test ON OFF)
+ -DWITH_LIBEDIT=0
+ -DWITH_ZLIB=system
+ -DWITHOUT_LIBWRAP=1
+ -DENABLED_LOCAL_INFILE=1
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0
+ -DWITH_DEFAULT_FEATURE_SET=0
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
+ # The build forces this to be defined when cross-compiling. We pass it
+ # all the time for simplicity and to make sure it is actually correct.
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
+ -DCONC_WITH_EXTERNAL_ZLIB=YES
+ -DWITH_EXTERNAL_ZLIB=YES
+ -DSUFFIX_INSTALL_DIR=""
+ -DWITH_UNITTEST=OFF
+ -DWITHOUT_CLIENTLIBS=YES
+ -DCLIENT_PLUGIN_DIALOG=OFF
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
+ )
+ if use test ; then
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
+ else
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
+ fi
+
+ if ! use yassl ; then
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
+ else
+ mycmakeargs+=( -DWITH_SSL=bundled )
+ fi
+
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
+ mycmakeargs+=(
+ -DWITH_READLINE=$(usex bindist 1 0)
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
+ -DENABLE_DTRACE=$(usex systemtap)
+ )
+
+ if use server ; then
+ # Connect and Federated{,X} must be treated special
+ # otherwise they will not be built as plugins
+ if ! use extraengine ; then
+ mycmakeargs+=(
+ -DPLUGIN_CONNECT=NO
+ -DPLUGIN_FEDERATED=NO
+ -DPLUGIN_FEDERATEDX=NO
+ )
+ fi
+
+ mycmakeargs+=(
+ -DWITH_PCRE=system
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO)
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
+ -DPLUGIN_AWS_KEY_MANAGEMENT=NO
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO)
+ -DPLUGIN_S3=$(usex s3 YES NO)
+ -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO)
+ -DCONNECT_WITH_MYSQL=1
+ -DCONNECT_WITH_LIBXML2=$(usex xml)
+ -DCONNECT_WITH_ODBC=$(usex odbc)
+ -DCONNECT_WITH_JDBC=$(usex jdbc)
+ # Build failure and autodep wrt bug 639144
+ -DCONNECT_WITH_MONGO=OFF
+ -DWITH_WSREP=$(usex galera)
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
+ -DWITH_MARIABACKUP=$(usex backup ON OFF)
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF)
+ -DINSTALL_SQLBENCHDIR=""
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
+ # systemd is only linked to for server notification
+ -DWITH_SYSTEMD=$(usex systemd yes no)
+ -DWITH_NUMA=$(usex numa ON OFF)
+ )
+
+ if use test ; then
+ # This is needed for the new client lib which tests a real, open server
+ mycmakeargs+=( -DSKIP_TESTS=ON )
+ fi
+
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
+ ewarn "You MUST file bugs without these variables set."
+
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
+ )
+
+ elif ! use latin1 ; then
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=utf8mb4
+ -DDEFAULT_COLLATION=utf8mb4_unicode_520_ci
+ )
+ else
+ mycmakeargs+=(
+ -DDEFAULT_CHARSET=latin1
+ -DDEFAULT_COLLATION=latin1_swedish_ci
+ )
+ fi
+ mycmakeargs+=(
+ -DEXTRA_CHARSETS=all
+ -DMYSQL_USER=mysql
+ -DDISABLE_SHARED=$(usex static YES NO)
+ -DWITH_DEBUG=$(usex debug)
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DWITH_PROFILING=$(usex profiling)
+ )
+
+ if use static; then
+ mycmakeargs+=( -DWITH_PIC=1 )
+ fi
+
+ if use jemalloc || use tcmalloc ; then
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
+ fi
+
+ # Storage engines
+ mycmakeargs+=(
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1
+ -DWITH_CSV_STORAGE_ENGINE=1
+ -DWITH_HEAP_STORAGE_ENGINE=1
+ -DWITH_INNOBASE_STORAGE_ENGINE=1
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1
+ -DWITH_MYISAM_STORAGE_ENGINE=1
+ -DWITH_PARTITION_STORAGE_ENGINE=1
+ )
+ else
+ mycmakeargs+=(
+ -DWITHOUT_SERVER=1
+ -DWITH_EMBEDDED_SERVER=OFF
+ -DEXTRA_CHARSETS=none
+ -DINSTALL_SQLBENCHDIR=
+ -DWITH_SYSTEMD=no
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_compile() {
+ cmake_src_compile
+}
+
+# Official test instructions:
+# USE='extraengine perl server' \
+# FEATURES='test userpriv' \
+# ebuild mariadb-X.X.XX.ebuild \
+# digest clean package
+src_test() {
+ _disable_test() {
+ local rawtestname bug reason
+ rawtestname="${1}" ; shift
+ bug="${1}" ; shift
+ reason="${@}"
+ ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
+ echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
+ }
+
+ local TESTDIR="${BUILD_DIR}/mysql-test"
+ local retstatus_tests
+
+ if ! use server ; then
+ einfo "Skipping server tests due to minimal build."
+ return 0
+ fi
+
+ # Ensure that parallel runs don't die
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
+
+ if [[ -z "${MTR_PARALLEL}" ]] ; then
+ local -x MTR_PARALLEL=$(makeopts_jobs)
+
+ if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
+ # Running multiple tests in parallel usually require higher ulimit
+ # and fs.aio-max-nr setting. In addition, tests like main.multi_update
+ # are known to hit timeout when system is busy.
+ # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
+ # using "auto".
+ local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
+ info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
+ einfo "${info_msg}"
+ unset info_msg
+ MTR_PARALLEL=4
+ fi
+ else
+ einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
+ fi
+
+ # Try to increase file limits to increase test coverage
+ if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
+ # Upper limit comes from parts.partition_* tests
+ ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
+
+ if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
+ # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
+ ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
+
+ if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
+ ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
+ else
+ einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
+ fi
+ else
+ einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
+ fi
+
+ # create directories because mysqladmin might run out of order
+ mkdir -p "${T}"/var-tests{,/log} || die
+
+ if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
+ touch "${S}"/mysql-test/unstable-tests || die
+ fi
+
+ cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
+
+ local -a disabled_tests
+ disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
+ disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "main.gis;25095;Known rounding error with latest AMD processors" )
+ disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
+ disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
+ disabled_tests+=( "main.mysql_upgrade;27044;Sporadically failing test" )
+ disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
+ disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
+ disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
+ disabled_tests+=( "mariabackup.*;0;Broken test suite" )
+ disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
+ disabled_tests+=( "perfschema.prepared_statements;0;Broken test suite" )
+ disabled_tests+=( "perfschema.privilege_table_io;27045;Sporadically failing test" )
+ disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
+ disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
+ disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
+ disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
+ disabled_tests+=( "spider.*;0;Fails with network sandbox" )
+ disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
+
+ if ! use latin1 ; then
+ disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
+ disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
+ disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
+ disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
+ disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
+ fi
+
+ local test_infos_str test_infos_arr
+ for test_infos_str in "${disabled_tests[@]}" ; do
+ IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
+
+ if [[ ${#test_infos_arr[@]} != 3 ]] ; then
+ die "Invalid test data set, not matching format: ${test_infos_str}"
+ fi
+
+ _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
+ done
+ unset test_infos_str test_infos_arr
+
+ # run mysql-test tests
+ pushd "${TESTDIR}" &>/dev/null || die
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
+ retstatus_tests=$?
+
+ popd &>/dev/null || die
+
+ # Cleanup is important for these testcases.
+ pkill -9 -f "${S}/ndb" 2>/dev/null
+ pkill -9 -f "${S}/sql" 2>/dev/null
+
+ local failures=""
+ [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
+
+ [[ -z "${failures}" ]] || die "Test failures: ${failures}"
+ einfo "Tests successfully completed"
+}
+
+src_install() {
+ cmake_src_install
+
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die
+ fi
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Convenience links
+ einfo "Making Convenience links for mysqlcheck multi-call binary"
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair"
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize"
+
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
+ if [[ -d "${ED}/usr/data" ]] ; then
+ rm -Rf "${ED}/usr/data" || die
+ fi
+
+ # Unless they explicitly specific USE=test, then do not install the
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a
+ # validation of your database configuration after tuning it.
+ if ! use test ; then
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
+ fi
+
+ # Configuration stuff
+ einfo "Building default configuration ..."
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}"
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
+ eprefixify "${TMPDIR}/my.cnf"
+ doins "${TMPDIR}/my.cnf"
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+ eprefixify "${TMPDIR}/50-distro-client.cnf"
+ doins "${TMPDIR}/50-distro-client.cnf"
+
+ if use server ; then
+ mycnf_src="my.cnf.distro-server"
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
+ "${FILESDIR}/${mycnf_src}" \
+ > "${TMPDIR}/my.cnf.ok" || die
+ if use prefix ; then
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ if use latin1 ; then
+ sed -i \
+ -e "/character-set/s|utf8|latin1|g" \
+ "${TMPDIR}/my.cnf.ok" || die
+ fi
+ eprefixify "${TMPDIR}/my.cnf.ok"
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
+
+ einfo "Including support files and sample configurations"
+ docinto "support-files"
+ local script
+ for script in \
+ "${S}"/support-files/magic
+ do
+ [[ -f "$script" ]] && dodoc "${script}"
+ done
+
+ docinto "scripts"
+ for script in "${S}"/scripts/mysql* ; do
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
+ done
+ # Manually install supporting files that conflict with other packages
+ # but are needed for galera and initial installation
+ exeinto /usr/libexec/mariadb
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
+
+ if use pam ; then
+ keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
+ fi
+ fi
+
+ # Conflicting files
+ conflicting_files=()
+
+ # We prefer my_print_defaults from dev-db/mysql-connector-c
+ conflicting_files=( "${ED}/usr/share/man/man1/my_print_defaults.1" )
+
+ # Remove bundled mytop in favor of dev-db/mytop
+ conflicting_files+=( "${ED}/usr/bin/mytop" )
+ conflicting_files+=( "${ED}/usr/share/man/man1/mytop.1" )
+
+ local conflicting_file
+ for conflicting_file in "${conflicting_files[@]}" ; do
+ if [[ -e "${conflicting_file}" ]] ; then
+ rm -v "${conflicting_file}" || die
+ fi
+ done
+
+ # Fix a dangling symlink when galera is not built
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
+ fi
+
+ # Remove dangling symlink
+ rm "${ED}/usr/$(get_libdir)/libmariadb.a" || die
+
+ # Remove broken SST scripts that are incompatible
+ local scriptremove
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
+ rm "${ED}/usr/bin/${scriptremove}" || die
+ fi
+ done
+}
+
+pkg_preinst() {
+ java-pkg-opt-2_pkg_preinst
+}
+
+pkg_postinst() {
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Create log directory securely if it does not exist
+ [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
+
+ if use server ; then
+ if use pam; then
+ einfo
+ elog "This install includes the PAM authentication plugin."
+ elog "To activate and configure the PAM plugin, please read:"
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
+ einfo
+ chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
+ fi
+
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+ einfo
+ elog "You might want to run:"
+ elog "\"emerge --config =${CATEGORY}/${PF}\""
+ elog "if this is a new install."
+ elog
+ elog "If you are switching server implentations, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ else
+ einfo
+ elog "If you are upgrading major versions, you should run the"
+ elog "mysql_upgrade tool."
+ einfo
+ fi
+
+ if use galera ; then
+ einfo
+ elog "Be sure to edit the my.cnf file to activate your cluster settings."
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
+ elog "The first time the cluster is activated, you should add"
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
+ elog "This option should then be removed for subsequent starts."
+ einfo
+ if [[ -n "${REPLACING_VERSIONS}" ]] ; then
+ local rver
+ for rver in ${REPLACING_VERSIONS} ; do
+ if ver_test "${rver}" -lt "10.4.0" ; then
+ ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
+ ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
+ ewarn "for more information"
+ fi
+ done
+ fi
+ fi
+ fi
+
+ # Note about configuration change
+ einfo
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf"
+ elog "to several files in /etc/mysql/${PN}.d."
+ elog "Please backup any changes you made to /etc/mysql/my.cnf"
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
+ elog "You may have as many files as needed and they are read alphabetically."
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
+ einfo
+}
+
+pkg_config() {
+ _getoptval() {
+ local section="${1}"
+ local option="--${2}"
+ local extra_options="${3}"
+ local cmd=(
+ "${my_print_defaults_binary}"
+ "${extra_options}"
+ "${section}"
+ )
+
+ local values=()
+ local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
+ for parameter in "${parameters[@]}"
+ do
+ # my_print_defaults guarantees output of options, one per line,
+ # in the form that they would be specified on the command line.
+ # So checking for --option=* should be safe.
+ case ${parameter} in
+ ${option}=*)
+ values+=( "${parameter#*=}" )
+ ;;
+ esac
+ done
+
+ if [[ ${#values[@]} -gt 0 ]] ; then
+ # Option could have been set multiple times
+ # in which case only the last occurrence
+ # contains the current value
+ echo "${values[-1]}"
+ fi
+ }
+
+ _mktemp_dry() {
+ # emktemp has no --dry-run option
+ local template="${1}"
+
+ if [[ -z "${template}" ]] ; then
+ if [[ -z "${T}" ]] ; then
+ template="/tmp/XXXXXXX"
+ else
+ template="${T}/XXXXXXX"
+ fi
+ fi
+
+ local template_wo_X=${template//X/}
+ local n_X
+ let n_X=${#template}-${#template_wo_X}
+ if [[ ${n_X} -lt 3 ]] ; then
+ echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
+ return
+ fi
+
+ local attempts=0
+ local character tmpfile
+ while [[ true ]] ; do
+ let attempts=attempts+1
+
+ new_file=
+ while read -n1 character ; do
+ if [[ "${character}" == "X" ]] ; then
+ tmpfile+="${RANDOM:0:1}"
+ else
+ tmpfile+="${character}"
+ fi
+ done < <(echo -n "${template}")
+
+ if [[ ! -f "${tmpfile}" ]]
+ then
+ echo "${tmpfile}"
+ return
+ fi
+
+ if [[ ${attempts} -ge 100 ]] ; then
+ echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
+ return
+ fi
+ done
+ }
+
+ local mysql_binary="${EROOT}/usr/bin/mysql"
+ if [[ ! -x "${mysql_binary}" ]] ; then
+ die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysqld_binary="${EROOT}/usr/sbin/mysqld"
+ if [[ ! -x "${mysqld_binary}" ]] ; then
+ die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
+ if [[ ! -x "${mysql_install_db_binary}" ]] ; then
+ die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+ fi
+
+ local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
+ if [[ ! -x "${my_print_defaults_binary}" ]] ; then
+ die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
+ fi
+
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ MYSQL_USER=mysql
+ if use prefix ; then
+ MYSQL_USER=$(id -u -n 2>/dev/null)
+ if [[ -z "${MYSQL_USER}" ]] ; then
+ die "Failed to determine current username!"
+ fi
+ fi
+ fi
+
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ MYSQL_GROUP=mysql
+ if use prefix ; then
+ MYSQL_GROUP=$(id -g -n 2>/dev/null)
+ if [[ -z "${MYSQL_GROUP}" ]] ; then
+ die "Failed to determine current user groupname!"
+ fi
+ fi
+ fi
+
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf
+ local -x HOME="${EROOT}/root"
+
+ # Make sure the vars are correctly initialized
+ mysql_init_vars
+
+ # Read currently set data directory
+ MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named
+ # localhost. Also causes weird failures.
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+ if [[ -z "${MY_DATADIR}" ]] ; then
+ die "Sorry, unable to find MY_DATADIR!"
+ elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
+ ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
+ ewarn "Please rename or delete its content if you wish to initialize a new data directory."
+ die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
+ fi
+
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
+ # These are dir+prefix
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
+
+ # Create missing directories.
+ # Always check if mysql user can write to directory even if we just
+ # created directory because a parent directory might be not
+ # accessible for that user.
+ PID_DIR="${EROOT}/run/mysqld"
+ if [[ ! -d "${PID_DIR}" ]] ; then
+ einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
+ install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
+ || die "Failed to create PID directory '${PID_DIR}'!"
+ fi
+
+ local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_pid_dir_testfile}" ]] \
+ && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_pid_dir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
+ else
+ rm "${_pid_dir_testfile}" || die
+ unset _pid_dir_testfile
+ fi
+
+ if [[ ! -d "${MY_DATADIR}" ]] ; then
+ einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
+ || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
+ fi
+
+ local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_datadir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_datadir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
+ else
+ rm "${_my_datadir_testfile}" || die
+ unset _my_datadir_testfile
+ fi
+
+ if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
+ einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
+ || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
+ fi
+
+ if [[ -z "${MYSQL_TMPDIR}" ]] ; then
+ MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
+ [[ -z "${MYSQL_TMPDIR}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
+
+ mkdir "${MYSQL_TMPDIR}" || die
+ chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
+ fi
+
+ # Now we need to test MYSQL_TMPDIR...
+ local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_tmpdir_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_tmpdir_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
+ else
+ rm "${_my_tmpdir_testfile}" || die
+ unset _my_tmpdir_testfile
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
+ # Only create directory when MYSQL_LOG_BIN is an absolute path
+ einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
+ || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
+ fi
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Only test when MYSQL_LOG_BIN is an absolute path
+ local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_logbin_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_logbin_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
+ else
+ rm "${_my_logbin_testfile}" || die
+ unset _my_logbin_testfile
+ fi
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
+ # Only create directory when MYSQL_RELAY_LOG is an absolute path
+ einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
+ install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
+ || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Only test when MYSQL_RELAY_LOG is an absolute path
+ local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
+ [[ -z "${_my_relaylog_testfile}" ]] \
+ && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+ if use prefix ; then
+ touch "${_my_relaylog_testfile}" &>/dev/null
+ else
+ su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
+ else
+ rm "${_my_relaylog_testfile}" || die
+ unset _my_relaylog_testfile
+ fi
+ fi
+
+ local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
+ [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
+
+ # Limit access
+ chmod 0770 "${SETUP_TMPDIR}" || die
+ chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
+
+ local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
+ local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
+
+ echo ""
+ einfo "Detected settings:"
+ einfo "=================="
+ einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
+ einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
+ einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
+ einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
+
+ if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
+ # Absolute path for binary log files specified
+ einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
+ fi
+
+ if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
+ # Absolute path for relay log files specified
+ einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
+ fi
+
+ einfo "PID DIR:\t\t\t\t${PID_DIR}"
+ einfo "Install db log:\t\t\t${mysql_install_log}"
+ einfo "Install server log:\t\t\t${mysqld_logfile}"
+
+ echo
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local tmp_mysqld_password_source=
+
+ for tmp_mysqld_password_source in mysql client ; do
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
+ MYSQL_ROOT_PASSWORD=
+ continue
+ fi
+
+ einfo "Found password in '${tmp_mysqld_password_source}' section!"
+ break
+ fi
+ done
+
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
+ fi
+
+ unset tmp_mysqld_password_source
+ fi
+
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+ local pwd1="a"
+ local pwd2="b"
+
+ echo
+ einfo "No password for mysql 'root' user was specified via environment"
+ einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
+ einfo "file like '${HOME}/.my.cnf'."
+ einfo "To continue please provide a password for the mysql 'root' user"
+ einfo "now on console:"
+ ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
+ read -rsp " >" pwd1 ; echo
+
+ einfo "Retype the password"
+ read -rsp " >" pwd2 ; echo
+
+ if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
+ die "Passwords are not the same!"
+ fi
+
+ MYSQL_ROOT_PASSWORD="${pwd1}"
+ unset pwd1 pwd2
+
+ echo
+ fi
+
+ local -a mysqld_options
+
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first,
+ # see http://bugs.mysql.com/bug.php?id=31312
+ use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
+
+ # Figure out which options we need to disable to do the setup
+ local helpfile="${TMPDIR}/mysqld-help"
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
+
+ local opt optexp optfull
+ for opt in host-cache name-resolve networking slave-start \
+ federated ssl log-bin relay-log slow-query-log external-locking \
+ log-slave-updates \
+ ; do
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
+ grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
+ done
+
+ # Prepare timezones, see
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
+ local tz_sql="${SETUP_TMPDIR}/tz.sql"
+
+ echo "USE mysql;" >"${tz_sql}"
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
+ if [[ $? -ne 0 ]] ; then
+ die "mysql_tzinfo_to_sql failed!"
+ fi
+
+ local cmd=(
+ "${mysql_install_db_binary}"
+ "${mysqld_options[@]}"
+ "--init-file='${tz_sql}'"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ "--log-error='${mysql_install_log}'"
+ "--rpm"
+ "--cross-bootstrap"
+ "--skip-test-db"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Initializing ${PN} data directory: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
+
+ if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
+ die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
+ fi
+
+ local x=${RANDOM}
+ local socket="${PID_DIR}/mysqld.${x}.sock"
+ [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
+ local pidfile="${PID_DIR}/mysqld.${x}.pid"
+ [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
+ unset x
+
+ cmd=(
+ "${mysqld_binary}"
+ "${mysqld_options[@]}"
+ "--basedir='${EROOT}/usr'"
+ "--datadir='${MY_DATADIR}'"
+ "--tmpdir='${MYSQL_TMPDIR}'"
+ --max_allowed_packet=8M
+ --net_buffer_length=16K
+ "--socket='${socket}'"
+ "--pid-file='${pidfile}'"
+ "--log-error='${mysqld_logfile}'"
+ "--user=${MYSQL_USER}"
+ )
+
+ einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
+ eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
+
+ echo -n "Waiting for mysqld to accept connections "
+ local maxtry=15
+ while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ if [[ -S "${socket}" ]] ; then
+ # Even with a socket we don't know if mysqld will abort
+ # start due to an error so just wait a little bit more...
+ maxtry=5
+ while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+ fi
+
+ echo
+
+ if [[ ! -S "${socket}" ]] ; then
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
+ die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
+ fi
+
+ local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
+ touch "${mysql_logfile}" || die
+
+ ebegin "Setting root password"
+ # Do this from memory, as we don't want clear text passwords in temp files
+ local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
+ cmd=(
+ "${mysql_binary}"
+ --no-defaults
+ "--socket='${socket}'"
+ -hlocalhost
+ "-e \"${sql}\""
+ )
+ eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
+ local rc=$?
+ eend ${rc}
+
+ if [[ ${rc} -ne 0 ]] ; then
+ # Poor man's solution which tries to avoid having password
+ # in log. NOTE: sed can fail if user didn't follow advice
+ # and included character which will require escaping...
+ sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
+
+ grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
+ die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
+ fi
+
+ # Stop the server
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ echo -n "Stopping the server "
+ pkill -F "${pidfile}" &>/dev/null
+
+ maxtry=10
+ while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
+ maxtry=$((${maxtry}-1))
+ echo -n "."
+ sleep 1
+ done
+
+ echo
+
+ if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+ # We somehow failed to stop server.
+ # However, not a fatal error. Just warn the user.
+ ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
+ fi
+ fi
+
+ rm -r "${SETUP_TMPDIR}" || die
+
+ einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
+}
diff --git a/dev-db/mydumper/Manifest b/dev-db/mydumper/Manifest
index 58533b6855ee..47aac675c280 100644
--- a/dev-db/mydumper/Manifest
+++ b/dev-db/mydumper/Manifest
@@ -1,10 +1,9 @@
AUX mydumper-0.10.5-atomic.patch 955 BLAKE2B 9405d3b1272bd913e7d570142fee01533323c18238e5a3f62205b3bd54da6c1d36df4adefbfffa1abfe8ccd51e28483ec48a7cb41058f9285f25625273d78c0e SHA512 82cadd013ccfd338f48ff109e58c64e74244fd922495b4cf764ed13408ef182694edee2ddcaf31fbe32e29ec7c4ef4d526613f8aeab3d23570ecd8469c3035d5
-DIST mydumper-0.11.5-2.tar.gz 110088 BLAKE2B c9e2f56ce7cc206f311ba00fd82e96479cd0313d99260ae27130489b5aa02e0b465c96900e41e9eb017d68022501bf327495ae39c8a64b330dc1072b3fb5ca9b SHA512 f600c086c7e3402c3d35070709c5968e30046be5fc351e67dca05d2d7c48565e68ccbba08cf01195aa4d2ae3f2bdf8df84338d4f44a40504b583959fb67e72d8
-DIST mydumper-0.12.1.tar.gz 114268 BLAKE2B d8fd459c645e0a8c7f978f0b948b534d3e602489ffdee926cc61d2f77053506c0b73a26b1dd89fc206dc9e7dea4b0c5cc848de6dbcceecf68450e5be9928be28 SHA512 90466520af4c26478b963a70ac9614889decae743fb40c3f5b6438b1e6db11ef284bd077288a0afa2aa02c93e9df32711d948cd868a7030d5215c2c7f5f96405
+AUX mydumper-0.13.1-atomic.patch 965 BLAKE2B 789b72fc49a8362466b7081ea6f112d373ebfb428959be96bbf4f9a7dc42366f90d574040a3aed9d32af29074fcda1da96850522d78f8f11c32d925a40d80348 SHA512 4bf764fb119a9c6fd2ab106e20259b48c526729a49ebbb93b3d27e483170ebbb849dcd2af1599ce41ee3ff26233735fbc02f39a8402b0d526f224cdb148663f8
DIST mydumper-0.12.5-3.tar.gz 131104 BLAKE2B 436c92474c498f17e7cfd723d7dbdd9f56f0a3cd42be88233dcfee6a2768ff49c795bb232e5f4bad1d6d9eb5e1cedf7fa812bc3dbc7a4eeb8fbb4894034a5960 SHA512 03c4a219877c61a3659561afd37ba095030edd0f44f922de51d4801a08cf6dc17c5fc8864f9b47d4d7c70a94bd2f814192ab1fa66f174e27d5d0e8a3a09a6b02
DIST mydumper-0.12.7-3.tar.gz 136449 BLAKE2B 99906443c4195f1a43d11875156ccb943efea44c90d1e7b9a6fb3427ab87562dbf429b789d28ba285d6b8b6e0a13c279f34548b43ee28525636a01a4eaa86833 SHA512 266214d8ab11fb82ad64100cde8d57a873740bd2f14f5026eddbb25e196294a7533252e8f13ba57fa4224c5cac9914debca452efe68eea58d576282f8ba53f65
-EBUILD mydumper-0.11.5.2.ebuild 1104 BLAKE2B c9fa788e14d3d615da06cf9981442b0d1519ce116258462b73a77ce0d28dad1577e0da5ee0e9eb5a960b59a952a375633888f655716c78cdb76b4a16a9bcd728 SHA512 ff607256bd05bf3f3995963d6be4a9b850085a635752fd4e3fb9c6216136d0ab3a685eb17cc15cce901b1ac451b09f53a193c276d653130cce12be55789702c7
-EBUILD mydumper-0.12.1.ebuild 1103 BLAKE2B daed3504d8b4c475023b331b13bd57f2c76488fac0dc7011f0e5dbb5b4e2b451f7dd22fb89f93494b367b9506e5727bcf3b147119a0af2e235941ec26e08d5ad SHA512 3fc55c2a7af21182f1804fa1d212f741c271ed86a0c53156f0902060a27e68a78afe035ca70b5f3f394f1b360517159f68ecd0d75c42f06754b57db38b2a11c6
+DIST mydumper-0.13.1-2.tar.gz 154913 BLAKE2B 9c44ca368737fc87ed6138756909721dbdbddeb9ccef78b536dfe705da8e4a73ad5e084d08fef795c7535c33d47b25e631ce66f3c2638058fae2d37cb36b3a13 SHA512 6b6e411896e2527d02a1a7ecd4d6c6103f8bad0a67f41aea4ccd66285a86a9ba8dd0663f163a27f38a6130c9caf69bb3b9b9c5ae36a196de4ac03aff4dd87424
EBUILD mydumper-0.12.5.3.ebuild 1102 BLAKE2B b0f68ddea15fd9e5224b87613a1007ce83dfa9af24c3a077ae952b0e72cafd1a166758a84179823327bba00a32ba640aac8804c669a39a306b6c0459d2386663 SHA512 5ca36b18540d946bb272892b350e456eec535d98fa9093614960bc943e63e35531d169586e8b5b8c232bb903a25c667838778420e778584e632b7873e2fa028b
EBUILD mydumper-0.12.7.3.ebuild 1103 BLAKE2B daed3504d8b4c475023b331b13bd57f2c76488fac0dc7011f0e5dbb5b4e2b451f7dd22fb89f93494b367b9506e5727bcf3b147119a0af2e235941ec26e08d5ad SHA512 3fc55c2a7af21182f1804fa1d212f741c271ed86a0c53156f0902060a27e68a78afe035ca70b5f3f394f1b360517159f68ecd0d75c42f06754b57db38b2a11c6
+EBUILD mydumper-0.13.1.2.ebuild 1105 BLAKE2B d401546fad771932df8fc54f844f19aecc905f96cad038b14c6c034dcedc226f1665a7695c2d0a271058445adc517ca69bc7c652a61efbddf23bb915724d00bb SHA512 ff460f8119a4c27caa07387ff6d4fee39cc55f293159abc6d3aa1a29e4a4a8510738f3dc7101e563c4cecdc0bfd6cef4c366ed0c15dbb95bb81ea54be74fd5c1
MISC metadata.xml 479 BLAKE2B a45a9746e2f5be11c4cd992e81135c8b39fa494c105f1f3c01586482b635596f1384690d0d1bfa3f08b8e33d1bd64b625fba07f410b8a8220a9a19f7f048f2dd SHA512 b0f20f8fb1b5eb3771d9a59869a3a28b0011642721dd12b5545b4f80456556f2f7a9da3b4b69c85cfae666534bad6143ae437b43b45179544626455a03b9218a
diff --git a/dev-db/mydumper/files/mydumper-0.13.1-atomic.patch b/dev-db/mydumper/files/mydumper-0.13.1-atomic.patch
new file mode 100644
index 000000000000..587d06804a53
--- /dev/null
+++ b/dev-db/mydumper/files/mydumper-0.13.1-atomic.patch
@@ -0,0 +1,26 @@
+diff --git a/cmake/modules/FindMySQL.cmake b/cmake/modules/FindMySQL.cmake
+index 2908251..109f0da 100644
+--- a/cmake/modules/FindMySQL.cmake
++++ b/cmake/modules/FindMySQL.cmake
+@@ -85,20 +85,7 @@ find_path(MYSQL_INCLUDE_DIR mysql.h
+
+ set(TMP_MYSQL_LIBRARIES "")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .so .lib .so.1 .dylib .a .tbd)
+-foreach(MY_LIB ${MYSQL_ADD_LIBRARIES})
+- find_library("MYSQL_LIBRARIES_${MY_LIB}" NAMES ${MY_LIB}
+- HINTS
+- ${MYSQL_ADD_LIBRARY_PATH}
+- /usr/lib/mysql
+- /usr/lib
+- /usr/local/lib
+- /usr/local/lib/mysql
+- /usr/local/mysql/lib
+- )
+- list(APPEND TMP_MYSQL_LIBRARIES "${MYSQL_LIBRARIES_${MY_LIB}}")
+-endforeach(MY_LIB ${MYSQL_ADD_LIBRARIES})
+-
+-set(MYSQL_LIBRARIES ${TMP_MYSQL_LIBRARIES} CACHE FILEPATH INTERNAL)
++set(MYSQL_LIBRARIES ${MYSQL_ADD_LIBRARIES} CACHE FILEPATH INTERNAL)
+
+ if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
+ set(MYSQL_FOUND TRUE CACHE INTERNAL "MySQL found")
diff --git a/dev-db/mydumper/mydumper-0.11.5.2.ebuild b/dev-db/mydumper/mydumper-0.11.5.2.ebuild
deleted file mode 100644
index ae2803f27c16..000000000000
--- a/dev-db/mydumper/mydumper-0.11.5.2.ebuild
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="8"
-
-inherit cmake
-
-MY_PV="$(ver_rs 3 -)"
-MY_P="${PN}-${MY_PV}"
-
-DESCRIPTION="A high-performance multi-threaded backup (and restore) toolset for MySQL"
-HOMEPAGE="https://github.com/maxbube/mydumper"
-SRC_URI="https://github.com/maxbube/mydumper/archive/v${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
-S="${WORKDIR}/${MY_P}"
-
-LICENSE="GPL-3+"
-SLOT="0"
-KEYWORDS="amd64 ~x86"
-IUSE="doc"
-
-RDEPEND="app-arch/zstd
- dev-db/mysql-connector-c:=
- dev-libs/glib:2
- dev-libs/libpcre
- dev-libs/openssl:=
- sys-libs/zlib:="
-DEPEND="${RDEPEND}"
-BDEPEND="virtual/pkgconfig
- doc? ( dev-python/sphinx )"
-
-PATCHES=(
- "${FILESDIR}/${PN}-0.10.5-atomic.patch" #654314
-)
-
-src_prepare() {
- # respect user cflags; do not expand ${CMAKE_C_FLAGS} (!)
- sed -i -e 's|-O3 -g -Werror|${CMAKE_C_FLAGS}|' CMakeLists.txt || die
-
- # fix doc install path
- sed -i -e "s|share/doc/mydumper|share/doc/${PF}|" docs/CMakeLists.txt || die
-
- cmake_src_prepare
-}
-
-src_configure() {
- local mycmakeargs=(-DBUILD_DOCS=$(usex doc))
-
- cmake_src_configure
-}
diff --git a/dev-db/mydumper/mydumper-0.12.1.ebuild b/dev-db/mydumper/mydumper-0.13.1.2.ebuild
index e4e2ef8601ec..bcf83752cc30 100644
--- a/dev-db/mydumper/mydumper-0.12.1.ebuild
+++ b/dev-db/mydumper/mydumper-0.13.1.2.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=8
+EAPI="8"
inherit cmake
@@ -29,7 +29,7 @@ BDEPEND="virtual/pkgconfig
doc? ( dev-python/sphinx )"
PATCHES=(
- "${FILESDIR}/${PN}-0.10.5-atomic.patch" #654314
+ "${FILESDIR}/${PN}-0.13.1-atomic.patch" #654314
)
src_prepare() {
diff --git a/dev-db/phpmyadmin/Manifest b/dev-db/phpmyadmin/Manifest
index ed3783736652..f643bb2adc28 100644
--- a/dev-db/phpmyadmin/Manifest
+++ b/dev-db/phpmyadmin/Manifest
@@ -1,4 +1,6 @@
AUX postinstall-en-3.1.txt 1160 BLAKE2B 0aa21601490830f93a784c1a3c09b90986d606d0086b128b37d6598c946e9ebe43f575f12ca5ee571db8520841a2c08624b567b721567d26ee02e1e3c4c9124e SHA512 7b50ab9f9e3a828bd9bff600550ea97712c28804467ab5900a52710d4adb0581fe33155a965dd3956fcd36cc153b1a18a1f001d88ac52d70c8288faf695f01ec
DIST phpMyAdmin-5.2.0-all-languages.tar.xz 7078212 BLAKE2B 184c5f1ca0d9fee4812d7f7847f7142887f39103cc629acd08183986f71a3069bfb89750c0e03f4a3a20d2ee767d37a281b14ec8d0ad50f44321620b0735023a SHA512 69658f94908e279e80f7cb76ac108090d704f27bc3f3206ff7d69c0aac4119ee42696ce66f98be6bc11e3532ca0d47916c1a2a8c915c3af6d1e5be6aa1d925a5
+DIST phpMyAdmin-5.2.1-all-languages.tar.xz 7461668 BLAKE2B bdb95b643c2ba39e406b7c8c01c071a5e8596e15570f68033a439076309c26fd444689bb0acea05ce8c47f913f0c3c30b4f593ad916d081de4b369dd6aef4573 SHA512 8b440d90d887fa0391810732cad2b4bf502f0e045324e1f159cb06e34dae4268febaef0a6a8ac0e58d0cb0f945f3497354313585f80555f199c609de378ca873
EBUILD phpmyadmin-5.2.0.ebuild 1538 BLAKE2B 617bb473722dddfdfcbc6bff3c93788b53254d7c9a599fd253f6cd18fecf35d87862dd1c7e2fdf0aaf97da7d928fef8f960a3350222080bf6ac6de325854f399 SHA512 f9e5dbaa727aef4618a2fc9418ace2b5f5934b76f178edccac368c3ddfc9d6eb9db93bc5abd7225192ac0fcba201f845d02fc529b0b4ca22597b4c805122f027
+EBUILD phpmyadmin-5.2.1.ebuild 1542 BLAKE2B 70dc76b1e0f20c8a3daa334e6a5fc27b094a0540d6d98098521bb8c805ee273317bd0fe3d923292a24f2c99531467823e788ec91f01bacdf386c823203107ce2 SHA512 2312b0cd73c5ccd953cb5bf2f0b5aa4de04b882803701786ad2fa0d0c2b4e78dd4226bbd965422664b54f02d2d67919bca7cd44b62f38f646f1d4ce534cd40dc
MISC metadata.xml 601 BLAKE2B e801b91970bce82840f935f553483de1a5b6367366b57b0387c63e3ff29582678781bd5a50032499426b0573ae5cbbd70dce7db75368376c703fc605dd739c64 SHA512 9a0985a8bbeeadbc3813a98654bcd996eb9843e623c4a00a77cb92b693357e8fbde384ac19eb56c41e57d411841a93ea458373e564a4cbaf090ce97ca987c459
diff --git a/dev-db/phpmyadmin/phpmyadmin-5.2.1.ebuild b/dev-db/phpmyadmin/phpmyadmin-5.2.1.ebuild
new file mode 100644
index 000000000000..582e38711c9d
--- /dev/null
+++ b/dev-db/phpmyadmin/phpmyadmin-5.2.1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit webapp
+
+MY_PV=${PV/_/-}
+MY_PN="phpMyAdmin"
+MY_P="${MY_PN}-${MY_PV}-all-languages"
+
+DESCRIPTION="Web-based administration for MySQL database in PHP"
+HOMEPAGE="https://www.phpmyadmin.net/"
+SRC_URI="https://files.phpmyadmin.net/${MY_PN}/${MY_PV}/${MY_P}.tar.xz"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="GPL-2"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~ppc-macos ~x64-macos"
+IUSE="setup"
+
+RDEPEND="
+ dev-lang/php[ctype,filter,json(+),session,ssl,unicode]
+ || (
+ dev-lang/php[mysqli]
+ dev-lang/php[mysql]
+ )
+ virtual/httpd-php:*
+"
+
+need_httpd_cgi
+
+pkg_setup() {
+ webapp_pkg_setup
+}
+
+src_install() {
+ webapp_src_preinst
+
+ dodoc README RELEASE-DATE-${MY_PV} ChangeLog
+ rm -f LICENSE README* RELEASE-DATE-${MY_PV}
+
+ if ! use setup; then
+ rm -rf setup || die "Cannot remove setup utility"
+ elog "The phpMyAdmin setup utility has been removed."
+ elog "It is a regular target of various exploits. If you need it, set USE=setup."
+ else
+ elog "You should consider disabling the setup USE flag"
+ elog "to exclude the setup utility if you don't use it."
+ elog "It regularly is the target of various exploits."
+ fi
+
+ insinto "${MY_HTDOCSDIR#${EPREFIX}}"
+ doins -r .
+
+ webapp_configfile "${MY_HTDOCSDIR#${EPREFIX}}"/libraries/config.default.php
+ webapp_serverowned "${MY_HTDOCSDIR#${EPREFIX}}"/libraries/config.default.php
+
+ webapp_postinst_txt en "${FILESDIR}"/postinstall-en-3.1.txt
+ webapp_src_install
+}