summaryrefslogtreecommitdiff
path: root/dev-db/mariadb
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-03-20 00:40:44 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-03-20 00:40:44 +0000
commit4cbcc855382a06088e2f016f62cafdbcb7e40665 (patch)
tree356496503d52354aa6d9f2d36126302fed5f3a73 /dev-db/mariadb
parentfcc5224904648a8e6eb528d7603154160a20022f (diff)
gentoo resync : 20.03.2022
Diffstat (limited to 'dev-db/mariadb')
-rw-r--r--dev-db/mariadb/Manifest48
-rw-r--r--dev-db/mariadb/mariadb-10.2.38-r2.ebuild1292
-rw-r--r--dev-db/mariadb/mariadb-10.2.39-r1.ebuild1292
-rw-r--r--dev-db/mariadb/mariadb-10.2.40.ebuild1314
-rw-r--r--dev-db/mariadb/mariadb-10.2.41.ebuild2
-rw-r--r--dev-db/mariadb/mariadb-10.3.29-r2.ebuild1284
-rw-r--r--dev-db/mariadb/mariadb-10.3.30-r1.ebuild1284
-rw-r--r--dev-db/mariadb/mariadb-10.3.31.ebuild1306
-rw-r--r--dev-db/mariadb/mariadb-10.3.32.ebuild2
-rw-r--r--dev-db/mariadb/mariadb-10.4.19-r2.ebuild1305
-rw-r--r--dev-db/mariadb/mariadb-10.4.20-r1.ebuild1305
-rw-r--r--dev-db/mariadb/mariadb-10.4.21.ebuild1327
-rw-r--r--dev-db/mariadb/mariadb-10.4.22.ebuild2
-rw-r--r--dev-db/mariadb/mariadb-10.5.10-r2.ebuild1299
-rw-r--r--dev-db/mariadb/mariadb-10.5.11-r1.ebuild1299
-rw-r--r--dev-db/mariadb/mariadb-10.5.12.ebuild1321
-rw-r--r--dev-db/mariadb/mariadb-10.5.13.ebuild2
-rw-r--r--dev-db/mariadb/mariadb-10.6.5-r1.ebuild6
18 files changed, 13 insertions, 15677 deletions
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
index 0a43d7dbaf0f..a8019a58f0db 100644
--- a/dev-db/mariadb/Manifest
+++ b/dev-db/mariadb/Manifest
@@ -1,55 +1,19 @@
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.2.38-patches-01.tar.xz 5796 BLAKE2B 51a574eab28c16394e3e953654d31f9d6fe88f55292ccaea35b0463d122a749ed52cb8d5e19f14b0d630bf22381ee0bddcf1e1b80c1445a82b931dd9461339ac SHA512 48fcfdb685bac516ee3388fc05adce5b53bbb42bee7b3681a887c76c63cb71b671d4089721a9b16f281496be9e9a87a556d44e4a6834c96345c6ada900dc9fe8
-DIST mariadb-10.2.38.tar.gz 74250852 BLAKE2B 5d75a38d7d892d93c5971713a4ab47c2803c03934ba301ea239b0a7565692272339ca0c3360a7bd533adcfef1af392c906b8f0136c18a25f5a1dd6127c8a6902 SHA512 4918a04877e16a0d33baca61b7c207b21b646df3be5e9ac125cb65404c0c6d6706b054106f437acfeef402238b35018a3cd764ceb31144a98791137c44e273a9
-DIST mariadb-10.2.39-patches-01.tar.xz 5804 BLAKE2B 08d763d87f877870737a972748d15dceca920f341e004aa8ed401864db4208eee4b0896cea413bc27990f0405b202eba2d2e49849a574bcec1f8618962b09c67 SHA512 2e26f3dbd504672c1504a4313581ecf05383bb62e2cc23d51109b5b8bb02ba5cf951541617b26581806994769587ed5978e42e8e6b4daf271045df66148f53c7
-DIST mariadb-10.2.39.tar.gz 74253393 BLAKE2B 15a8f23817cf6a22fc0c2caa81865349c2dd93e3c7ffeaace58746cee376940db453cbec02a6bf65d344c18dfd342604e6f54de255cff10fe7d4a5bc5f7e1f9b SHA512 4ccdbf9bcedd3205834be963f00eb85e318aeba97765574674f60f8356a83591e7904685d72a2ad34111dd7a705ee6c4d5f0b2be4fea7a008a36907ff645da49
-DIST mariadb-10.2.40-patches-01.tar.xz 5804 BLAKE2B 0efbd0c3ab107808644e2bd34a7c7d9347f337c769d9cc5bb2827af660d009ac490d78c084e2e5104271fbbcd65c8532d5460793bfa4a74910f532fa7dff33e4 SHA512 66a7960a6827ea32dbcf0390d40614e4b8edd8114a1e472f96cff01c075020466d84f9d9783c3f2e418ac341d84332c060bd4d63840979be3ebdfd3b5ef08eee
-DIST mariadb-10.2.40.tar.gz 74275587 BLAKE2B ab310b19425e3631c9090fa919e8867c7c8f62ffab69b36851aee9ab40aa18814dc50ae185d1c0832c79785d25a82177aa92bb6614cdb49359ec1acd7105e08b SHA512 8d3438c5044fc63e02d3e49f5fdd3561ad0a3f3ac29673d05fc71dfdceefb7cdcb6dd623d18fb222e9552ede4dc3d9b6e413d3ef40d86054a36b4b3a6433eee2
DIST mariadb-10.2.41-patches-01.tar.xz 5840 BLAKE2B bfc1404ef7a856e1588caf6ac4b61514125752b298adc7d7b575f5106b052b33a0344a51c0b0974a4664ee13059be30d31d2a12436009a39f34567124ee81ce6 SHA512 3105d291d22a9085dd92c516f0af999786d78328e8a8970a000c7be9d2df211e544c798ba9882a6da94abcddbb4cf16d100c5e1ccda6dc98e7a16c2ca5914bff
DIST mariadb-10.2.41.tar.gz 74358994 BLAKE2B ca7fedebac0ce05bbc0797e58347041b098878fe565b5f3ae8ac149b30eca9188335e5e4afbc158f644888de13a5bc264916c77e315b5f489b2449342bf46f8a SHA512 d6f04d5866c6179c8df796dcf2407fa6289f7b9a57590e6ac793518dd805da7799e76f1031579b74e03dad6adcbcd204dd80394a68ac0105fcecaacea64b74e1
-DIST mariadb-10.3.29-patches-01.tar.xz 5280 BLAKE2B 262c8f89508d915a13c3c309c885af68ff044ba28b4c3d631a5be90b709c882fa3cf521380c9d2a2f7695477d7bcd364ccb98d90750e524deb0aa0daddb94bde SHA512 95d04edf54b722ed7022bd2b915d722ae4153eb2c12a3d6c499469be0de4d03582226ef525be9e9af265674ef31ce2376442a09c583222c64ad9994ddc51c8b7
-DIST mariadb-10.3.29.tar.gz 73261682 BLAKE2B 81ac5c7d1ad343c7d1c6788dafe07c45ec096d975a3197c6a6940da60a4a73383dff18e15d1940f1248dc34f290603629e95fbeca31c0749c5b0ae2b3de92b8f SHA512 fe868cde5ac3536ff5bbf34f235253c79e897e61bb34f7fdaca8fa8fcdb83e4a19c615beab27d3fdb5daee64ac0c8f36ec7e8089a9422c8540f7e92b1999a769
-DIST mariadb-10.3.30-patches-01.tar.xz 5300 BLAKE2B 14a0110477a5b3ade80ba05cfc038cfa0761b06e8a58f4ff69d39a9c1d59ec3fd323d7401fc7bd76a99dfcd4c8369d04d5eb1313d5ce20d2f57b10d2e0f6ff5d SHA512 a546908147f664189053d201d3d3d3dcaf81956bcd7348b1385bb1046636ec189a95f7bbe80839eba7a09b378475af6971af6d9e6bc72fad7d01ea139119ba42
-DIST mariadb-10.3.30.tar.gz 73266479 BLAKE2B 4f2911fed8f470e60f98f3aff044bb7979e32ec86a13d8ed8ca36cd8f3e1b45b541412de0f1b53bda252dfa2c4e3d2dd2a718a94d44b632a1f3e569be4f37753 SHA512 742c30b3ebc0b6d36b98d4e7a7fb511098142e72d8f42cbfa73a0bdea2059be17e790fbda4732329bbd99e4b50b13cf18e8122964a473e0b62170ab869eca8fc
-DIST mariadb-10.3.31-patches-01.tar.xz 5304 BLAKE2B 145bf6185edccc726549479ec1e75a1796c405811316de2d6bf02564c4398ae82978204c3a6329ed1742b1b91e9c80043574370ff23571fa9cead899f8ac71cc SHA512 e59605938eeb1373e84a15f6c501bcd1ad5fc92b75e67b5d93da77066b5cf7ecd77db7cb684de494a6ba98574473aa484be1b6dbe4edfbc482a391fefd12dffa
-DIST mariadb-10.3.31.tar.gz 73298653 BLAKE2B ca0532c1adf830d8d364938ca3c89b9d162aa4e75ceeaf1455085f0a3bbe8eba5bdfdf13a5800ab82f2517e93c746db7402462d5b334fb6fe823629d7feab790 SHA512 29878ea381d6a6b188cb6ab9f81e218f34dba0e85e5eb1929a6cc72904f1b629dea89bfdde4dc83b5fc5a735f46114a193184bceb43fe30336244d3018a45c19
DIST mariadb-10.3.32-patches-01.tar.xz 4388 BLAKE2B e84de23ff97e0fcff9867bbba615f8054cf1dd015b44aa5d64bca38e150daf66d4e5149b1408485330af3e49006865c5d598797199cca1d74a31d77df2715627 SHA512 fdf36b310823b15ccb2fb921d694998ce076442ef4086a88b76ebc81c7ef778099c5dfddf1152bb54bf653c9f99a335502e9a34ee200846bd6ee14d407ae127e
DIST mariadb-10.3.32.tar.gz 73389214 BLAKE2B 476d293f41804e2124859019c25df1bb93509741e8893939978af9ca6b83dfe238c3079bef0023281a1e2a0b89cb63d9a3de8d8a540ddbb96463f3914490d5ac SHA512 d74c8bdf9cc8126385e1ca69c098e2bd8543de292d36c6c88ffc8228430fd246386f675089e7a1a11c830a947efde755845eda279dfb202c89c641962edf43cd
-DIST mariadb-10.4.19-patches-01.tar.xz 5288 BLAKE2B b97a8b2c55ad2b78b4f27dbab3893c777e15ef237fc66a9ef62d391772caaada3e23949a63ae170aa72e4b07f9bf34f32da72614756bdbe0712efe6c39f0da59 SHA512 e26b12230b965fe0facfd447a815a88fe8edaaeb8e209cc53df2d76c580dacdab59afb09c09ef471fb0b46c0cde8eeed84f3eff851751316eb12f06de235d52f
-DIST mariadb-10.4.19.tar.gz 82042449 BLAKE2B 6137c84852b6b770efa908b49f03ca52726a537bda410b324ed388a82667bf0e3ff37cbb62d6a541ca39ce4841efa861553c7cead11030dc9deacdeb7cdb0d5f SHA512 837bd4e46e2033d0e996c33125c50b98e141e4c31cf4753a4bd1a7bd1e6a25ebe2a0ea7c8061d29f3c635e24d8e4bf2bbca62ea3b0089bde6576c39ffc6f5e28
-DIST mariadb-10.4.20-patches-01.tar.xz 5308 BLAKE2B 0f725743d78c3bcc8ca86a365b84ff797e17454adadb14e122bf94e04bd1a433e63c6f41eba21cb705ec7e9e64333e9ee597cff7001d5b8248f826093618f37c SHA512 2050e0bc3acbb9026c0a2cb8a5b00ff618f12ee7b6474bf0ed918d4d018c624eb4c40894172bbf31b135a73059d2e27efcda742a23010303a54aadf76fa26af5
-DIST mariadb-10.4.20.tar.gz 82043644 BLAKE2B e116be643f7243cf5c09611c79c60cb109dd2b69b4c1f06d7f2492858afdc3bf55e4568a7ed212a6458a3cf5a092d4e0d87e0a2ff6e71af9923e4b33c843a79f SHA512 ce8e0691981b39de380276cea5d553a9968d9f6ef19f54395128f01d611499f3fc203651b8d7cb56697c6ee55f5f515c960d7700738cdc50f228df7443505112
-DIST mariadb-10.4.21-patches-01.tar.xz 5312 BLAKE2B 0520313f2431cdf7c779d04ff9c8473eb89d054bacd98e9e325bce735ee7a311458020a4dfb1e032dde7a32d33126a9502bab2f54e7a19acbb70e077181830e1 SHA512 ceb0272fa9ce936d4601e93af3692222f5d6a9110a084e4a75a5d23432ddadf703bf9bab94ec08b2a65cb4e00eaed23c1958c40b6d140afa2fa47e961644e7a8
-DIST mariadb-10.4.21.tar.gz 84809537 BLAKE2B 85edfecbda9a9d47c0bb8efa3e86d9df473849dbd10f9348814598e8cce848a6727850c5d5a3fce54c04a81ea5de09f86cdced87a72dcf2ed7fa480d7bf81228 SHA512 2be398cd80f0b8c938ab310f47ccd410f0209f8308bfc202014b71aee3f0bea7f535d1eceb82a4407202d9732c77874d773c6f13e54cf556fc79ed0d49390345
DIST mariadb-10.4.22-patches-01.tar.xz 4388 BLAKE2B 0e615ddc4db93daa1f4ef1d8755b97502bb19b0ece0fc0d6d8620cb69a7db2df81ef5a06fc0a6b0f7b61fdb5431f919da99afa8068b064d905cdeaa95df807f0 SHA512 7bfff381b7fd19d12f64caaaa7d598ee476e286def9be9acd6f808784ecd47e715f222bd07fd05cd24b3342053f46c22d03041413a6a55b7194d1a5c66b0c03a
DIST mariadb-10.4.22.tar.gz 84916052 BLAKE2B f5f7623101cfac6b209a95de20ee737ce0afa574766340471a30ddb81abacaf2acf3809d54ecb62f9377f924b11fac04faa770802c2bdc8dc10e3286b1c8e648 SHA512 e505a56346cfcaf5b8fba80abad6b2ce819dd410f6e6f36e290ad4127aaa9fb580264c28068f9f9e04c3a2fcccd101ef73d2bf5944aedde6b2d4369163fb9248
-DIST mariadb-10.5.10-patches-01.tar.xz 5944 BLAKE2B ce374e58b7730d45a8dbca4cccd459c1660182d6aed4ac54f06139e28ec254d4993b2135b2774e08eee740099803398a25b28ce9d227702bffab1867f1725fc2 SHA512 9d41b7796c5e43d037e75eb8d6c9b570a9b3d72166f832d3d0831646b2ec8c838fe94eb8eab8c6e427e96640287d58f7eca2c653a3c503bf01240c9f7c60a8c5
-DIST mariadb-10.5.10.tar.gz 99019617 BLAKE2B 85b5c43ae9eeb1dbf9ff7935d4cf4bddbd18cadeffb79a3bff172b4522e196c7ac8916c63a6750d0b3b910c6f0f933213b3b4f6c7bf0d43bbb07714ed9337750 SHA512 93dd1405f8b31989e130dee5b7d4a0b447aa0e017fb9ee02c792c52142d84d1103e8fd591101d72deda1ac65b10c48053582f6e61bd1757e6aa92e42d98c56cd
-DIST mariadb-10.5.11-patches-01.tar.xz 5960 BLAKE2B a198083d6dd9d16723dc40a0c6fea9c900c766ef22f59b1c7b6b65f6cbf441cda08da7701b89625bcab3022fa00226b84deb215aede41c05195ce9cb9b218530 SHA512 d7c642f64ee013006e4880ed50b6d2b7d00c53f3d3bd29eb939689a4f78e05dce82e3258e80fc22b9e266c5beb09df2323dee94b994d2a913e8f8b6a675ac7bb
-DIST mariadb-10.5.11.tar.gz 99037098 BLAKE2B 7eb5b91e34f3098df7a801becd614a99b2124d3e0b3cee28533a7197293317cba28d88ad112ce5f2d6e8d971ac7fdbca1e120e3e1746f2e6a57c359fe7c68457 SHA512 5ccb3f3d7cedf5ff79dd8d9304f0b7f3eb99a5558b446d1baf24cabe20c709360e2c99a737024793918fd6c23fc5a9bb83ffddfb5549310774d07294a3bbddf4
-DIST mariadb-10.5.12-patches-01.tar.xz 5996 BLAKE2B 202804c0c41e8f646f1430f387e65390afc66d76daaf89a453cddfcfa65847f1026e2db6c70b1b16803cd0719107dbc7d4611e35bbb21486e04b2130d9d30f66 SHA512 8d84ce7601a14a3b37e87dd50414f59898724eac7f8ca93332b9c6d1ad6060ac58d61e8972451065b196fa8b6d671be03c280c95a92baa71786191e054ee67c2
-DIST mariadb-10.5.12.tar.gz 101914615 BLAKE2B 98910fee3ae7c300ab1cee7b9373695f642b1ace88f8a3136da3a565a97810754633a7479d863e324b6b94969356df7bb92e7fbc6e9b90a1e8a77c4c1d52b659 SHA512 c732c2033304f273900b3dcf21936e28aebb147316fcabc7efdc43b75bc47c198daacfaaae082b997d4e695139d2aeaa2619bd29935f1b6f0aa25b9b9cde9ae5
DIST mariadb-10.5.13-patches-01.tar.xz 5012 BLAKE2B 34a5af415737f71750a8fa47de4f2119e31723686f000a7f99f9892a0a12fbd2be3c7bb635197b131691d73ae663e34c1b010b154d62e1ea16535265f96200f1 SHA512 71e7940558fa863835ef86f04c48c4a1ca927dee0d9ae94fcb32facde857dfef1757ae96b5a738653c341fa19a67916b0b3a03ce473020edd5c8b52ccedc0bea
DIST mariadb-10.5.13.tar.gz 102047279 BLAKE2B be91ebbd05b72d8046eaea73075510e160d7985b2766f64a1cdd3e5bbad1f4eebe9f371caf070a0e9fab605a90588539a4011ea4b2e4243ea4fd8f299ee836fd SHA512 5d5ac04a3c8099a982cacb98dd4c162966fc7957e11c28e8b5645e49ffcf0513b9c8956f43d215c37e5eaa34aa8db6c71cfe993c89d62cab123021ee83169e7f
-DIST mariadb-10.6.5-patches-03.tar.xz 5128 BLAKE2B 7fec0af808eae048eb05098d1f41a82c8bec78f58e6d550660ac32d0c8b554827085dca6bf9256db75fe445e087295a69507ee58bbe2ae7c186bd6843531d1e5 SHA512 3905d46873b0b72363d6eae658fa0df3ac1600391dd6ddf2d834bbe7a62faabae32c88f452f6d00d2a39ab4e3bd57c401f40608a9b6cb213992ade97067b1f85
+DIST mariadb-10.6.5-patches-04.tar.xz 5916 BLAKE2B c9a6d087057ce732cfe7789255d2a5106baefc70b4bfcfc6806c0165ae7b56d440e88c5c4b0aa10a8f0c1b9478826f1dc89a785ffec76764b8bd4e824960edf6 SHA512 29b22e99a6be137e5c2832f5c781bfbbacee40b716089e24150ac72198f59a8a3f46b6a056ee4d02588a06d32ed9c3b815a59c302c48b493afe9a21a7d4a884d
DIST mariadb-10.6.5.tar.gz 85061860 BLAKE2B 668fe327e6a46c66bc0b77339d71279cc8bfe468d1e634035e639e88aabaa09ea27aa50e3b9d27728a275e1e7861e8db1209d372d751084ea486ad31f6f1fd29 SHA512 5aafe0a8d5ae54a6f798a6fd0cf922521f5b8e54ef5fb5c7db1cf798a7755f5910bb0b8a6c371cb8253dfb48f4ebca0becd6eb543b68473d564d2092df3185a1
-EBUILD mariadb-10.2.38-r2.ebuild 41778 BLAKE2B 77d309bc1784385c3cdb0ae708b9b90cd9daaf1fabdd8f60b725df068ea79a49e5c84af6e1658225526e3f18f3edde00d63dd784a1a5f8ca49d4ebeeb78933fe SHA512 a2bc372c1c360ad73832ce826dee5a0c8503f705cca5074da2880c17c616ac3821f84fb89d947cf3221a531a45e93b49607cafe859bc82210d5042248ecbd8c4
-EBUILD mariadb-10.2.39-r1.ebuild 41784 BLAKE2B b3597c2c2b4319978241d00e4852d9dbe971d32c9e075761be880847b72fa50d21c2af2755bd30c1c6bf0caf1060d2011a1f5bf3cc7cb9e2abc91738801f6b0c SHA512 713f4069a1b782e366481048eaf5d63b801ad88f6d0b2b260be9c4ee58fd643d6d72cb6dd06668726ac1e99bc18689d900178ee11ef11639a71d1dc9d53fd6ff
-EBUILD mariadb-10.2.40.ebuild 42592 BLAKE2B 43a4239ca6eea4bfc0518abb857e7ffa77e4d1b05a7a6b3939e73547d7009c88adfb5e7bbaf8bcbf0b40d6b2fb34c2bb700e840957c06267053fd825324724ff SHA512 54b49150dde6a02607cf8e0a1189d057235e6067cfdbc45d4ec1c7494ac2bac18010d409e67c56f9125809b1426bd12ebcc75f23ab7ef830bbfdb37b612ab774
-EBUILD mariadb-10.2.41.ebuild 42512 BLAKE2B 4fae5d5575cbc72f36859c2b63f65bd3e4ff096e7d5df6342851b33c7cfd556eb34503fb475ff8c183d7ac96133eced3d53821009739634ebfb9fa9ba7e9833d SHA512 d9f9149c2ad1b0ef627b61b5ecd156e7d44dbb960118545dd79e5e582734649837ed522e349594dcf0ddf9f20581466fb9ec206add94ac79f9b7cc4731c71bfc
-EBUILD mariadb-10.3.29-r2.ebuild 41335 BLAKE2B 60449bf1e598d7609b866ca9bbfb82d226daf01f2f70bba17cad02780ec1acc2f82417d44dcd0cccf2ac5f92feae1e42264af1cecd2c2bf0414a1c4d0bbc7cf8 SHA512 34f26dceb1ad04ac26b4d4c059efe61d3674885206ddb568e0a0abf17985a0d449db3b91c89ecc17835863bcd7c8a9ca0a56fcabbc5d8e482e643fa7126d03b5
-EBUILD mariadb-10.3.30-r1.ebuild 41340 BLAKE2B 0fa156292226a79bcb122fbea9c62e03ccfec5f5fefa55d9942d77a136c5ae6f09fd9cbbc9e3a64ad582a44a0739975ae454233d89fdc55e7d295b39c16dd498 SHA512 821bdf1efd994c7de8416fd602675d252f150f7bf0607dcfb7b1b34b63dd4bdb787bf69655736acf9cc979b6b6ddc777d77dbb961ce7185477d528d4e4f13ef8
-EBUILD mariadb-10.3.31.ebuild 42148 BLAKE2B 6bf255bf0b57037a7f4621f986671cbe89b77fd7031af422af76d6955961f132bce09a3b018faf18ffeb194a92c73a7c24622a1921de321ac4a093a488644396 SHA512 fdf1f08c54b2926eb72ce4bc791dbaf2f6244343fd4ed2a9afc5ec114c241a19c672e37b4ec7e03f72354897c86325a1196d63aeb6a91213f90cf5a226474705
-EBUILD mariadb-10.3.32.ebuild 42068 BLAKE2B a269a248d3576335950ebd6302f6d7269acd2f62edd82d46f8cb0d55f28ae60fec44f91cd0f4b1d03a323e05130718cfe2a3c25ef06edb014631a81fc7e024ad SHA512 11bb05a0d4cf1e0d0b9ff7f551fde73933c96d2e31e89034f986e8c2076cbc69971d62459981742aeece97f2d0ce288b49e5b4252c95d9a9d8161fb7d2ee8c04
-EBUILD mariadb-10.4.19-r2.ebuild 42046 BLAKE2B b6f4beddbd27d517e09677ea35f5d8830be5db1283617404ef8fe92c0cf64dfd637c01b1ee8c0f5a96b2bf830df9eafbf4f819edd6375704a1e661e1a02dbd68 SHA512 185c4f71b319c038c90018f5621a674669261da26bcff1890ac9c5780e2c2e2d9efc388fa78753fc491930f0a54f35f256d187c8ef19030b5c8a478deb390b53
-EBUILD mariadb-10.4.20-r1.ebuild 42052 BLAKE2B d4aa73577cf7e76b59fb2b3317b73236124f2c7b941287c75bbe1e5f7fd337187e7e0e1f04cb4a29e9f58d5046cc3c8788fca6f30471f002e4447c27edaaf38b SHA512 4cdae3c948cfaa9dc28935a7fcb8ba3963ca554568d75c89f579f1ccc17abfd4b1246327f5e60b6e38113bd6cc3d85e99a1c832ea0b79af3bad75f8b93e51977
-EBUILD mariadb-10.4.21.ebuild 42860 BLAKE2B ff39ce3452746c749bb0c09340aebb0ad8487ad6b3b9b2d01b17efe4799087e3d05b1947520151fa0a57a925792c2c7a0f8d2fbae93808115fb2dcd42c0ff641 SHA512 1f076a734e32619184271a4df62ccb8296bd332854ef2a82e8044f5f4f00a2021be9047af45751d1b6ba7a1a8c271d16efbfc189a2a004c5619636fd14f085d2
-EBUILD mariadb-10.4.22.ebuild 42780 BLAKE2B d573691ade55ba4959f81878d8d36e7c120eab2e553e54dab2c2a2518302db4a55f668a2f3851af43d9c60f2482e5de4568f30da1896c3b899975538ca6f1c5d SHA512 e726094f3224c7c024a7e8c2018ed28c17f6daebb994dedbfd7305a94bd25f5d30d197227e56db5cf8cc84c61a08c369940e89b6a06da32fdbf99b2e9182bb8a
-EBUILD mariadb-10.5.10-r2.ebuild 41471 BLAKE2B 1f4e6991cd21db2470d24a90dd8c0757c961bb42a9f2ac9a17756398f9ec9d7f543c84ba045f332fb2cedc900bd8f14f8bbd17ee4f68b9ce6867bb5068c917fd SHA512 d720b727d1b56074dffd0928ca2463a19a90a124266127f416fff095f551f0d83449e486c01fd0322fd77c0955f1481c023e2764220057b2d5841440b26d230a
-EBUILD mariadb-10.5.11-r1.ebuild 41476 BLAKE2B 3a73afbfcea1aa38f8d13f1db6f0707a4cb43b9bf407f93cefe433c893f504c88047f4ce7924912c8e6a238f5dd00d5fa6cada2d4214c814254ab27de3782d03 SHA512 0af663e45d2291d129962c96d66243d0a999b02bf573ed0e1d80e5f784df39c9d19575e5a5ecd74d547205fb033eadab3311fb18afc6e9d1a661bc96b9e6955f
-EBUILD mariadb-10.5.12.ebuild 42291 BLAKE2B 1639d616cdf556ef65f227d0caef6ad8fa100d0058cd7afdbccd3e49934cbf583fe02884396ef84fe64065fa616cd767b91a155345980c617d2070853a7db59c SHA512 cfbf194886a021e4e86c182f53de095231ddeb823efafb0274f0903e9aba55a114ecf7a469ac53427ab0529a1b3c921a0a1218f9895df5d4809275f9eafb6750
-EBUILD mariadb-10.5.13.ebuild 42475 BLAKE2B 49728d94135da9ddb1b39a296f99b815baad49f699f9d1fc1e82c677c43d6a5df6f4616279547a0dd5758bc5cfd6055d0f0778c1f5214398f8b25c7234cb36f7 SHA512 57aabe40950a413501810d52d3c615cfc3c709e3b8daa7c38d12f6e25f6e303c38629fc92f81cb8eadf8974330821176b82388db483b5facb6e5d37a9a65dc6e
-EBUILD mariadb-10.6.5-r1.ebuild 42708 BLAKE2B 5bf33b0b4f8d5a40cdb4f1535a82cdd7e6e6c37c89e43bb18b6980ad0e43d28e1f75a2fb0a78dd428712406031ee2bbc7daf6d3e1101a102c3bd9bbfd9e499ef SHA512 42d141f9639c923a049f1156ef5e3fc5f86780643d87c825d08a8bddbe4af55e04d4d26b7cb2687df404922eab5da08d879718b78d7feb024f15f8839486253f
+EBUILD mariadb-10.2.41.ebuild 42510 BLAKE2B c4e0ca2ae8b7a704d618184a8ab8f07227a7095e27d1fbff6143754dc15381e4ccead56798397c0fada861c19e588934ed034317259e2767885a89ec913148f9 SHA512 d758b92e8e6f21aa17e37a7e3e024678218c81f47f2bf9dc3887f81148975ab668cdf3286f6fdb7bfabdff31605abcc252a37aaafbfa9ad3c3fabd6b4874187f
+EBUILD mariadb-10.3.32.ebuild 42066 BLAKE2B ad56df5c13fedf2cf70eeab9fafd59475a021afa0f4ce61a9607b5ab7643bfadc6c38b8533e99c7b0ecc486adc120bd1a79ae427203319e82221669135d2de60 SHA512 a27514318ec1fb5b3b5af20b2ecc07ea5eaf19fc2df7aa62c6010aa495072c4f13c661638c6a38c147e61494274277488bfe8b7fd38f1c71c49c74ef373e7cf3
+EBUILD mariadb-10.4.22.ebuild 42778 BLAKE2B 1ab09da26a26770d3f36671525b453736b36a2bd0c3de3f701ae1671b3bbdf8b7ec71f7ec566f38d9cd041b3d6b4b4d381e302205566915a7967ad58b98331da SHA512 69f0f5912b4e289043cc18643b86e06292ec0bdb81369c799322cb28b6dedb9ff9d75fd2b9180c0a262bc1768f37a5ba50b69f0173d9a40dfd0de53fbaca27fa
+EBUILD mariadb-10.5.13.ebuild 42473 BLAKE2B 2c72e46b1a263b580ae7e7595290c2d14d1f49bbad2065129e6cbd947a73ad80deb5f43cdbeac9a07bcc84dacd1298eb2aee8dea06f9f75ecdfae86bd302b2d2 SHA512 0b22a5a9f2a5e8ca06b0fe51587f1deac05de9183790dafd1ec65c2d6f330d3ee18d95c94c21a51a9544e2b6a8a47d4a914cc0b797f3f3a36d333a43fddff716
+EBUILD mariadb-10.6.5-r1.ebuild 42720 BLAKE2B ecbb8f58c4fe84595e41b1cd610e226a03e54affe6c0459e5a93621241cb5d3efea771336f4f7a32dcff2b5e554665a84c9a9351a550a5762d52003a5eae3b86 SHA512 04d120d8012e70c34f656d8e4516d8de549dfa73f9df1b0ef6cf2afd543a003a452744183a27e9991354f22286bc28894074af74fc1f9a37309ccf11df04bef7
MISC metadata.xml 2626 BLAKE2B d545d75827f63ac4ff1ab5eafd559b36ef44d0d5059dcdd5cbbb162d42e3a5117ff09c2c2eba82af10bc2f6c53e366f5f0b6a9c744c35d76b8bab12c6e517b64 SHA512 adf783a34647eb8299041d9125ec290377fc17b910e9f1660a33ccacd0a380cc4cd338f55f34e958ddfab1aa6dba85e25033b0dfe8dbc8fed4656ad5df63f6d8
diff --git a/dev-db/mariadb/mariadb-10.2.38-r2.ebuild b/dev-db/mariadb/mariadb-10.2.38-r2.ebuild
deleted file mode 100644
index 10dffe82e51c..000000000000
--- a/dev-db/mariadb/mariadb-10.2.38-r2.ebuild
+++ /dev/null
@@ -1,1292 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.2.38-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="10.2/${SUBSLOT:-0}"
-IUSE="+backup bindist client-libs 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 sst-xtrabackup 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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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.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
- !<virtual/mysql-5.6-r11
- ${COMMON_DEPEND}
- server? (
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-25*
- sst-rsync? ( sys-process/lsof )
- sst-mariabackup? ( net-misc/socat[ssl] )
- sst-xtrabackup? ( 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
-# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
- server? (
- galera? (
- sst-xtrabackup? (
- || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup )
- )
- )
- )"
-
-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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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 jemalloc)" >> "${S}/sql/CMakeLists.txt"
- elif use tcmalloc; then
- echo "TARGET_LINK_LIBRARIES(mysqld 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 )
- 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
- 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 galera_recovery.sh script
- sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
- scripts/galera_recovery.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]"
-
- 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
- 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_JEMALLOC=$(usex jemalloc system)
- -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=share/mariadb
- -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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.grant;0;Sporadically failing test" )
- disabled_tests+=( "main.join_cache;0;Sporadically failing test" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- 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" )
-
- 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" )
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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"
- 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
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-
- # Here we need to see if the implementation switched client libraries
- # We check if this is a new instance of the package and a client library already exists
- local SHOW_ABI_MESSAGE libpath
- if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
- libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
- elog "Due to ABI changes when switching between different client libraries,"
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
- elog "Please run: revdep-rebuild --library ${libpath}"
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
- fi
-}
-
-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
- 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 use sst-xtrabackup ; then
- ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup"
- ewarn "as an SST is broken by default beginning with 10.2.19 with the setting"
- ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead."
- ewarn "sst-xtrabackup is being removed in 10.3 and higher."
- 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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"
- "--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.2.39-r1.ebuild b/dev-db/mariadb/mariadb-10.2.39-r1.ebuild
deleted file mode 100644
index ba2de3f4555d..000000000000
--- a/dev-db/mariadb/mariadb-10.2.39-r1.ebuild
+++ /dev/null
@@ -1,1292 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.2.39-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="10.2/${SUBSLOT:-0}"
-IUSE="+backup bindist client-libs 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 sst-xtrabackup 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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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.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
- !<virtual/mysql-5.6-r11
- ${COMMON_DEPEND}
- server? (
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-25*
- sst-rsync? ( sys-process/lsof )
- sst-mariabackup? ( net-misc/socat[ssl] )
- sst-xtrabackup? ( 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
-# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
- server? (
- galera? (
- sst-xtrabackup? (
- || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup )
- )
- )
- )"
-
-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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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 jemalloc)" >> "${S}/sql/CMakeLists.txt"
- elif use tcmalloc; then
- echo "TARGET_LINK_LIBRARIES(mysqld 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 )
- 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
- 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 galera_recovery.sh script
- sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
- scripts/galera_recovery.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]"
-
- 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
- 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_JEMALLOC=$(usex jemalloc system)
- -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=share/mariadb
- -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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.grant;0;Sporadically failing test" )
- disabled_tests+=( "main.join_cache;0;Sporadically failing test" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- 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" )
-
- 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" )
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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"
- 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
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-
- # Here we need to see if the implementation switched client libraries
- # We check if this is a new instance of the package and a client library already exists
- local SHOW_ABI_MESSAGE libpath
- if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
- libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
- elog "Due to ABI changes when switching between different client libraries,"
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
- elog "Please run: revdep-rebuild --library ${libpath}"
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
- fi
-}
-
-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
- 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 use sst-xtrabackup ; then
- ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup"
- ewarn "as an SST is broken by default beginning with 10.2.19 with the setting"
- ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead."
- ewarn "sst-xtrabackup is being removed in 10.3 and higher."
- 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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"
- "--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.2.40.ebuild b/dev-db/mariadb/mariadb-10.2.40.ebuild
deleted file mode 100644
index f16835bae6e8..000000000000
--- a/dev-db/mariadb/mariadb-10.2.40.ebuild
+++ /dev/null
@@ -1,1314 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.2.40-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="10.2/${SUBSLOT:-0}"
-IUSE="+backup bindist client-libs 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 sst-xtrabackup 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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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.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
- !<virtual/mysql-5.6-r11
- ${COMMON_DEPEND}
- server? (
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-25*
- sst-rsync? ( sys-process/lsof )
- sst-mariabackup? ( net-misc/socat[ssl] )
- sst-xtrabackup? ( 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
-# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
- server? (
- galera? (
- sst-xtrabackup? (
- || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup )
- )
- )
- )"
-
-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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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 jemalloc)" >> "${S}/sql/CMakeLists.txt"
- elif use tcmalloc; then
- echo "TARGET_LINK_LIBRARIES(mysqld 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 )
- 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
- 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 galera_recovery.sh script
- sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
- scripts/galera_recovery.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]"
-
- 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
- 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_JEMALLOC=$(usex jemalloc system)
- -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=share/mariadb
- -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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.grant;0;Sporadically failing test" )
- disabled_tests+=( "main.join_cache;0;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+=( "mariabackup.*;0;Broken test suite" )
- 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" )
-
- 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" )
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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"
- 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
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-
- # Here we need to see if the implementation switched client libraries
- # We check if this is a new instance of the package and a client library already exists
- local SHOW_ABI_MESSAGE libpath
- if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
- libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
- elog "Due to ABI changes when switching between different client libraries,"
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
- elog "Please run: revdep-rebuild --library ${libpath}"
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
- fi
-}
-
-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
- 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 use sst-xtrabackup ; then
- ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup"
- ewarn "as an SST is broken by default beginning with 10.2.19 with the setting"
- ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead."
- ewarn "sst-xtrabackup is being removed in 10.3 and higher."
- 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}"
- egrep -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"
- "--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.2.41.ebuild b/dev-db/mariadb/mariadb-10.2.41.ebuild
index f0462da46138..07432fcb1966 100644
--- a/dev-db/mariadb/mariadb-10.2.41.ebuild
+++ b/dev-db/mariadb/mariadb-10.2.41.ebuild
@@ -32,7 +32,7 @@ REQUIRED_USE="jdbc? ( extraengine server !static )
?? ( 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"
+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
diff --git a/dev-db/mariadb/mariadb-10.3.29-r2.ebuild b/dev-db/mariadb/mariadb-10.3.29-r2.ebuild
deleted file mode 100644
index 49a93e90db69..000000000000
--- a/dev-db/mariadb/mariadb-10.3.29-r2.ebuild
+++ /dev/null
@@ -1,1284 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.3.29-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="10.3/${SUBSLOT:-0}"
-IUSE="+backup bindist client-libs 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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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.4
- !dev-db/mariadb:10.5
- !dev-db/mariadb:10.6
- !dev-db/mariadb:10.7
- !dev-db/mariadb:10.8
- !<virtual/mysql-5.6-r11
- ${COMMON_DEPEND}
- server? (
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-25*
- 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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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 galera_recovery.sh script
- sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
- scripts/galera_recovery.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]"
-
- 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
- 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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.grant;0;Sporadically failing test" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- 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" )
-
- 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" )
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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"
- 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 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
-
- # Here we need to see if the implementation switched client libraries
- # We check if this is a new instance of the package and a client library already exists
- local SHOW_ABI_MESSAGE libpath
- if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
- libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
- elog "Due to ABI changes when switching between different client libraries,"
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
- elog "Please run: revdep-rebuild --library ${libpath}"
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
- fi
-}
-
-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
- 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
- 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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.3.30-r1.ebuild b/dev-db/mariadb/mariadb-10.3.30-r1.ebuild
deleted file mode 100644
index 127792eaa5ae..000000000000
--- a/dev-db/mariadb/mariadb-10.3.30-r1.ebuild
+++ /dev/null
@@ -1,1284 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.3.30-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="10.3/${SUBSLOT:-0}"
-IUSE="+backup bindist client-libs 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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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.4
- !dev-db/mariadb:10.5
- !dev-db/mariadb:10.6
- !dev-db/mariadb:10.7
- !dev-db/mariadb:10.8
- !<virtual/mysql-5.6-r11
- ${COMMON_DEPEND}
- server? (
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-25*
- 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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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 galera_recovery.sh script
- sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
- scripts/galera_recovery.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]"
-
- 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
- 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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.grant;0;Sporadically failing test" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- 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" )
-
- 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" )
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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"
- 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 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
-
- # Here we need to see if the implementation switched client libraries
- # We check if this is a new instance of the package and a client library already exists
- local SHOW_ABI_MESSAGE libpath
- if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
- libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
- elog "Due to ABI changes when switching between different client libraries,"
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
- elog "Please run: revdep-rebuild --library ${libpath}"
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
- fi
-}
-
-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
- 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
- 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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.3.31.ebuild b/dev-db/mariadb/mariadb-10.3.31.ebuild
deleted file mode 100644
index 5247b5977d40..000000000000
--- a/dev-db/mariadb/mariadb-10.3.31.ebuild
+++ /dev/null
@@ -1,1306 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.3.31-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="10.3/${SUBSLOT:-0}"
-IUSE="+backup bindist client-libs 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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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.4
- !dev-db/mariadb:10.5
- !dev-db/mariadb:10.6
- !dev-db/mariadb:10.7
- !dev-db/mariadb:10.8
- !<virtual/mysql-5.6-r11
- ${COMMON_DEPEND}
- server? (
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-25*
- 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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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 galera_recovery.sh script
- sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
- scripts/galera_recovery.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]"
-
- 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
- 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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.grant;0;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+=( "mariabackup.*;0;Broken test suite" )
- 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" )
-
- 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" )
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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"
- 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 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
-
- # Here we need to see if the implementation switched client libraries
- # We check if this is a new instance of the package and a client library already exists
- local SHOW_ABI_MESSAGE libpath
- if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
- libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
- elog "Due to ABI changes when switching between different client libraries,"
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
- elog "Please run: revdep-rebuild --library ${libpath}"
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
- fi
-}
-
-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
- 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
- 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}"
- egrep -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.3.32.ebuild b/dev-db/mariadb/mariadb-10.3.32.ebuild
index fed581f1e375..728b1468ce48 100644
--- a/dev-db/mariadb/mariadb-10.3.32.ebuild
+++ b/dev-db/mariadb/mariadb-10.3.32.ebuild
@@ -32,7 +32,7 @@ REQUIRED_USE="jdbc? ( extraengine server !static )
?? ( 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"
+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
diff --git a/dev-db/mariadb/mariadb-10.4.19-r2.ebuild b/dev-db/mariadb/mariadb-10.4.19-r2.ebuild
deleted file mode 100644
index a022272908c6..000000000000
--- a/dev-db/mariadb/mariadb-10.4.19-r2.ebuild
+++ /dev/null
@@ -1,1305 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.4.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="10.4/${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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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
- !<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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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.20-r1.ebuild b/dev-db/mariadb/mariadb-10.4.20-r1.ebuild
deleted file mode 100644
index 2dbab9b520ed..000000000000
--- a/dev-db/mariadb/mariadb-10.4.20-r1.ebuild
+++ /dev/null
@@ -1,1305 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.4.20-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="10.4/${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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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
- !<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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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.21.ebuild b/dev-db/mariadb/mariadb-10.4.21.ebuild
deleted file mode 100644
index 51df17fb22e3..000000000000
--- a/dev-db/mariadb/mariadb-10.4.21.ebuild
+++ /dev/null
@@ -1,1327 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.4.21-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="10.4/${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/sed-4
- >=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-1.0.0:0=
- )
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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
- !<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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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' \
-# 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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 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}"
- egrep -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.22.ebuild b/dev-db/mariadb/mariadb-10.4.22.ebuild
index 6a62a063bfd4..86a99becb060 100644
--- a/dev-db/mariadb/mariadb-10.4.22.ebuild
+++ b/dev-db/mariadb/mariadb-10.4.22.ebuild
@@ -32,7 +32,7 @@ REQUIRED_USE="jdbc? ( extraengine server !static )
?? ( 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"
+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
diff --git a/dev-db/mariadb/mariadb-10.5.10-r2.ebuild b/dev-db/mariadb/mariadb-10.5.10-r2.ebuild
deleted file mode 100644
index a65e0a19d7e3..000000000000
--- a/dev-db/mariadb/mariadb-10.5.10-r2.ebuild
+++ /dev/null
@@ -1,1299 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.5.10-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="10.5/${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 ~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/sed-4
- >=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:0=
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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
- !<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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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.11-r1.ebuild b/dev-db/mariadb/mariadb-10.5.11-r1.ebuild
deleted file mode 100644
index 8d65c3817e33..000000000000
--- a/dev-db/mariadb/mariadb-10.5.11-r1.ebuild
+++ /dev/null
@@ -1,1299 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.5.11-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="10.5/${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 ~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/sed-4
- >=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:0=
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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
- !<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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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.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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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 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 flag="--${2}="
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
- local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
-
- if [[ ${#results[@]} -gt 0 ]] ; then
- # When option is set multiple times only return last value
- echo "${results[-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 [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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 [[ -n "${MYSQL_LOG_BIN}" ]] ; then
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
- 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}"
- egrep -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.12.ebuild b/dev-db/mariadb/mariadb-10.5.12.ebuild
deleted file mode 100644
index 7333e139eaa1..000000000000
--- a/dev-db/mariadb/mariadb-10.5.12.ebuild
+++ /dev/null
@@ -1,1321 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-SUBSLOT="18"
-
-JAVA_PKG_OPT_USE="jdbc"
-
-inherit eutils systemd flag-o-matic prefix toolchain-funcs \
- multiprocessing java-pkg-opt-2 cmake
-
-# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.5.12-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="10.5/${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/sed-4
- >=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:0=
- 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-1.40.0:0= 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="virtual/yacc
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-"
-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
- !<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
- local GCC_MAJOR_SET=$(gcc-major-version)
- local GCC_MINOR_SET=$(gcc-minor-version)
-
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
- # non x86{,_64} arches
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
- eerror "${PN} needs to be built with gcc-4.7 or later."
- eerror "Please use gcc-config to switch to gcc-4.7 or later version."
- die
- fi
-
- 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_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
- 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_unit
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
- # Run CTest (test-units)
- cmake_src_test
- retstatus_unit=$?
-
- # 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
-
- 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_unit -eq 0 ]] || failures="${failures} test-unit"
- [[ $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 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}"
- egrep -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.13.ebuild b/dev-db/mariadb/mariadb-10.5.13.ebuild
index 5d08dca8e812..e3059b38d543 100644
--- a/dev-db/mariadb/mariadb-10.5.13.ebuild
+++ b/dev-db/mariadb/mariadb-10.5.13.ebuild
@@ -31,7 +31,7 @@ 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"
+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
diff --git a/dev-db/mariadb/mariadb-10.6.5-r1.ebuild b/dev-db/mariadb/mariadb-10.6.5-r1.ebuild
index a266a6e8a5eb..acbdffe60dd4 100644
--- a/dev-db/mariadb/mariadb-10.6.5-r1.ebuild
+++ b/dev-db/mariadb/mariadb-10.6.5-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
@@ -10,10 +10,10 @@ inherit eutils systemd flag-o-matic prefix toolchain-funcs \
multiprocessing java-pkg-opt-2 cmake
# Patch version
-PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.6.5-patches-03.tar.xz"
+PATCH_SET=( https://dev.gentoo.org/~{whissi,dlan}/dist/${PN}/${PN}-10.6.5-patches-04.tar.xz )
SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
+ ${PATCH_SET[@]}"
HOMEPAGE="https://mariadb.org/"
DESCRIPTION="An enhanced, drop-in replacement for MySQL"