summaryrefslogtreecommitdiff
path: root/dev-db/mariadb
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-07-15 07:41:50 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-07-15 07:41:50 +0100
commitb3f2504c1d05b5999b74b2135860fc721e3adf68 (patch)
treee11656067365c7d474553833d6202ed04d3324a5 /dev-db/mariadb
parente0fdb8199de0e7a9b7c72d7f38d2e3ddaecdacd0 (diff)
gentoo auto-resync : 15:07:2022 - 07:41:50
Diffstat (limited to 'dev-db/mariadb')
-rw-r--r--dev-db/mariadb/Manifest22
-rw-r--r--dev-db/mariadb/mariadb-10.2.41.ebuild1289
-rw-r--r--dev-db/mariadb/mariadb-10.2.43.ebuild1292
-rw-r--r--dev-db/mariadb/mariadb-10.3.32.ebuild1281
-rw-r--r--dev-db/mariadb/mariadb-10.3.34.ebuild1284
-rw-r--r--dev-db/mariadb/mariadb-10.4.22.ebuild1302
-rw-r--r--dev-db/mariadb/mariadb-10.5.13.ebuild1309
-rw-r--r--dev-db/mariadb/mariadb-10.5.15.ebuild1309
-rw-r--r--dev-db/mariadb/mariadb-10.6.5-r1.ebuild1311
-rw-r--r--dev-db/mariadb/mariadb-10.6.8.ebuild1316
10 files changed, 0 insertions, 11715 deletions
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
index 7ab0c94e502a..ea6abbedb8f0 100644
--- a/dev-db/mariadb/Manifest
+++ b/dev-db/mariadb/Manifest
@@ -2,41 +2,19 @@ AUX mariadb-10.6.8-openssl3.patch 16434 BLAKE2B a7e1a1224cfafc4963104e688fd83053
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.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.2.43-patches-01.tar.xz 5940 BLAKE2B f8658b799485942c4415b39667436edc91f7264dc08a10acbc83e145c4aabb2df925c9488ebe3e342f6bbb47afac4c20cc3bcc3a571b1104940064a858868a4a SHA512 1634600a53274b62f894351f58bc12600fe6e358280091dfa53b87ca656670dfc414d57e053582ce4a7caca4631a865bfe1bc37d541352aec268948cf8deadbc
-DIST mariadb-10.2.43.tar.gz 74415871 BLAKE2B c29e4983705de38beb099443441e8e37b2f984a970455d690b1cf1f704e9b5e2f94d34b676fb8fdc368d62a01be2f5c66b0c01838015aa08f353ba46714b94b1 SHA512 0ce2edd9f9f977ed02245123e4ed900b118707b4bef7cbc897c094a2de29ea1ae32b8288e6a1b81ba7029370f9ae8f19e6aa7ed963fd7165d8859713fd366d31
DIST mariadb-10.2.44.tar.gz 74425890 BLAKE2B 1a5d41ebf209dec54aa68a935ad4c6bac528aa7f8def64efea2bd146011daea0a701276ea037282b927b41b063f86f2cf4667c5d3309cd03a5489074ed351505 SHA512 29b17abfe82667053c3137e4e70e12854dab1312376fe8bdcfc76bf105aa3cddae49bcb07cc607a9c8f0a336bd8e537c6f57e2cdbbd06e48a45d125e3bb006a6
-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.3.34-patches-01.tar.xz 4696 BLAKE2B 36643b83f773a10180d5f94b4318c19abd441550701ca9e98ff8b7adf037648032023bb93c03efd58e25a650df5650e9b76ee8237cd3b61523f69521e505e643 SHA512 d33c52ad39e249daaae52fde09334f49285212aeb691f3caa7bf8776f95e82eff54bd6a942f24276aa7d945bd030d73e3b1f0ba15f9217236115bd448697d62c
-DIST mariadb-10.3.34.tar.gz 73455446 BLAKE2B 7737c6f01cb1c9b38d51f9dd390898d835113aca3b17fd0f478f578807e8f65c2cd20a65f96e27b073d4531215b6223a4b5cee307b72d2a9a3ddb45af0ba9680 SHA512 46d4575ec1afb68510652a4bb31ca5ce83a2f5f61048a6e9c1487b0ba58f079465a8b72518d44043cd42c631b19ff50b5498584676ac6473705b138fe3300741
DIST mariadb-10.3.35.tar.gz 73496487 BLAKE2B 3ab05276fc22098be11ce8e2f5c9323c05c28b7617b31655506fe97131cccebe70a525dda0856b05c8196fabf50243865adf91ed6914ca750bbdf27c915767e8 SHA512 9355de944eccef4e0bc01b19ffc3c0c72cf88befae7385c6f0ee1ea47dbd98d23f6bb46af9c140acc48d9d9613552870684bc0b7ca1f3cff1dc09c1a2c801573
-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.4.25-patches-01.tar.xz 4496 BLAKE2B f710bed49c53bda4cd1bfc8cc8bbde8588a5600a25aba62f90be61e78879729b6b34ec18bfc0729f8330b9fc9858079e2d924c2b72080b86c73b85a9294f2894 SHA512 5545b6fa879ba99c38b52b5c4e1347efea0f1fd098c8593388a6e9c11ae7ffbca5ebe69a3c418420f49a0a7671bf26102dd2dc024fd60e8f9072ae920a16cb58
DIST mariadb-10.4.25.tar.gz 88680777 BLAKE2B 993ed640ad579c2726ae241165d024a87fff580a4461fedee7c41a2bd70d668ed56b31219032096b4bd264543d6a93457947422b8a1384d3d3b94e7ca2f6ecb4 SHA512 27ad62985e19c877623d1512adcbec44e714ca50da9d303eab12bc2ad67dcae45d48a1aa010ad554341c46a1c5db7ee26c14570b9fa55fb71caf9979dd12671e
-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.5.15-patches-01.tar.xz 5116 BLAKE2B 57759c61e672668be8ed991ca023007a4e0c10b2352cc621e88b825097cfde3eb83078804af7afaaa0c6f47900c34046773141a9e3dc3c220b33ecc16435784d SHA512 e3d21b3499ec9f6b5fd32978a6a779ecaca671cccadf241700207a1a3822a6b05ba2e13e1a6cb20e4d5fe4e6db6e5f46e9af650c736bdc3e3de9a4d8bad7ce19
-DIST mariadb-10.5.15.tar.gz 102803624 BLAKE2B 1a983bffdbfaf58c3adfb1789e10b3506b958a2c362226fd38cc9898a5584681640286a2bdbebb1c0e7e75a042276fe549224e38fbc49aef2c493f307ec7e935 SHA512 ea3d99fd9ad8adc8187fb5d722ff16cde90c7cca4b3572e410814ae39e0246b7a83b4dc1e72f95de58c1c12a9563fb524dcca2dd1fb8f595cc41625a2fb0af76
DIST mariadb-10.5.16.tar.gz 105798374 BLAKE2B fc8ba002a876cd9d357c9762e531082f22380480f8713d3f3882c29ad31c6b14065079b6cdde2e698382d2be668e9e7af2d900b93cd976e8fa27e876f33acff4 SHA512 28cea63cc3c5e1b236fb13593285e5d4b9aac5eaf259784e760def42bca8b09954510d39014a7a7c9e8656d61f5995a356df2f2ebb0df2696dd739ff3de5865d
-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
DIST mariadb-10.6.8-patches-01.tar.xz 5220 BLAKE2B 0ad1caecbd05defd9d60e3c438cb0f36dfe7db5fa78e08f43cdd298613cb34691c013f7c44f6bddd39a56f0bf267d257e116defeea5022635b3b6e9b105e0eae SHA512 4cbc527b7307417e0cbf3056487e688474183f0db223ea9107d9a911ef1594691344f2b283402b45ddbc82e29023f0545301a8407f9711f7d8242e3001e3f095
DIST mariadb-10.6.8.tar.gz 88794744 BLAKE2B 1cd036bc686864b497d04454388d9366261f6cc69ad233ab3783063a893c8814ca6c95166415c5b76f2bec2462bffe0bc44d3543502932d03805e972f63b6abc SHA512 b4327000eb3e5fc75bbd78de9890b0464217a432c8aac744948af94e092ffeef1f101885b81ec49029900a92b0018838e46efcf225056a9b06f35a04ecf26aab
-EBUILD mariadb-10.2.41.ebuild 41722 BLAKE2B 6a320f2bbf23254f59ec1a7942fc69af22eb298bc815b67542aa8ea6821298e9b9cd06f6160af97ad8a1aacf9e00e0ae25a8bcd4ea347f0fe47f0b3a717b2d51 SHA512 74bd2b651639788da037dc29f8941cbd5a1288a7070ddfe34b49fc85ccc719e4d3782f494102725f372e77a0586d356839588690ba770aa4c0a933760b12d855
-EBUILD mariadb-10.2.43.ebuild 41827 BLAKE2B 78703e7246f3114173cea7a65d356e9ce14aa457d6ad65303a57e38508c33fc97ed863cc6c04bd50208c65714c4514005fb02bc1690f2dc25919f253f0c276b0 SHA512 d78e155ebfd6deb56eb5cc850b1e9e259f693b1d342ca5609658822894cd882a5106997aabb633c96ae19763fe6f27a68967e19902d98ae3b7b861e9ff1fc076
EBUILD mariadb-10.2.44.ebuild 41821 BLAKE2B 8e115a6d92da8e7bd2524ac2ba54d320d5fe3a3ed5eaac9f1519f688081d73ecd4849ad8cde03acc667aba9f8c3c62858b90496f638a0707dbbfa992bf04ba50 SHA512 d74fe7a447813412eb7c23c2d743f654e4a9da931e5ca292c7b3233fb6cc1e7307fe058fcb4425fc65ec6881b3f88e65e890a3b125a2fd52c6015397bbf528f9
-EBUILD mariadb-10.3.32.ebuild 41278 BLAKE2B fd829e8b4119ff990040dae55853283025e1dfb1ab6ef6bb5f7d8690db8bf855a2823f614c66e3931ed637dd4d989822f2af6078510d98ce647f09b941d48ca4 SHA512 c8aee5b7b186878b8bbb0eaaca250edc7a3a3338043e9779dfd05751b280277341b2ae2713d69cf26093e4bfc3933899d7d41dc734d7e8fdc7823c272ae01287
-EBUILD mariadb-10.3.34.ebuild 41396 BLAKE2B e64f159078378c7046e31873b2f96f197276c0165487c4fdc7384bdf44eaee96a129859f4eace337e92a4325c3a3599a98406b130a351c8133bdef0e50f1c35a SHA512 d92a66730217edaa2c2d908cbe67d02f82d78f8745c863d056c93e9f4c6b608ff2635af54082771619a39cd0a38e2f0bdbd57f4d5d17d3449eedb1742bc77aac
EBUILD mariadb-10.3.35.ebuild 41390 BLAKE2B ad0329879589464dcb5d78f72dd272d317083801e91657adce2ecfd83fc33eab4df2db825062ac7868d16b6a55efbd0c4dbff8b6a5e73dcbb4e300d7757dd50b SHA512 66920c06144f2f6aa51ebe8fbe63512c634ae0ab48fb459be8e3382b55ae6be9197c1e78c81192d1df184b829ad0b75d516db9170d527ed19a64a75bca2390a2
-EBUILD mariadb-10.4.22.ebuild 41990 BLAKE2B 3a0266b734ac8ff8d7df3842f777832324693d1e20874201a790387e9861565ac7f79ed6ab69e7312473e0acdf0887413e91d2c47fd7bbe63cdb1ebae8455c44 SHA512 af6bb938294c01c76634117c8f61db13b26f871993a8e4db77929da796c21c86f2a39c7073facde22c23cae42c45e1714091f477afe057d6cdd63d3e80c8f1ac
EBUILD mariadb-10.4.25.ebuild 42093 BLAKE2B 5bbd6c073a9f2622a30076d4f6076d285b3512647ed6776324609b8783899bbf30ff9a605533af8483f8c4b56e03554945bf65be4a20249d1ac7911cacd19fc2 SHA512 0e7758b84fca35471f7adb86db64e36fabad31df5b09e755eda736229914722a4c402e5f6699f0e8d04d47c55b3f10ed6d9ca1023a1dbcd406f8a7e7d60ca30c
-EBUILD mariadb-10.5.13.ebuild 41954 BLAKE2B 6e079c434881a7cd4281312ab08f984b02e50e07b163a8dbe9607895dff2b8d7cad621174d3dbb1f7335e90c3b14f41c73d61e7a74e4c385c81061791d05ea5f SHA512 bd3e7fa4f267883081ff9f010f2d27aa0911bdf42595df4a5621d60277193fb258892e2b753ff3d889603617f847dde3cbe44a637a4eb156e395373f4ff9cfb2
-EBUILD mariadb-10.5.15.ebuild 41981 BLAKE2B 2b2ce60bf6c0c0bf96acd44f688b35cc3aa5175d3beed4f44ffca1e9024debed6f0cf51f39d00efd48ab6aad7e97b59a5bc2c6f5e7b73ac4e4e98601b162f935 SHA512 18659af551211a19002afaee74d86139d7fd9a493c55860e34127590f3bb727021126a520c3b98034e5bc48bafd7a42223df9766ffd56f981a569f227bbfff6a
EBUILD mariadb-10.5.16.ebuild 42053 BLAKE2B b3311e24a222efd20268730a5ce77870a7e37914d4bd5fd32e2a5df27a65b9c3871b8344f3c71e3d16776f222074b973d37b53305b8e856b1d5728742dadc5ea SHA512 e2b5ee6ed0d9260741965a26bf5024ccc28f03cf437e98572d39fa0bc40e5f8a5e350667bc90c6c7ffb698869eca381ae5f8ad9b5864dd92e9067217fd464c6f
-EBUILD mariadb-10.6.5-r1.ebuild 42201 BLAKE2B becb5a9c579ff36d32fb60df69ea8da42f54663e70b460d6f8146b33a79978aae10bd7f4cea0099dd897345f3b23dd6033b7e1cf6da9008ca428d0c916880ea2 SHA512 162ee90865966e39bbb68f4f813c3a2de97e594ae7ffb010824b384d19baa9719da47113dacf1efe9785795a3efaec7dfd362036271f6cadde66e14106506084
EBUILD mariadb-10.6.8-r1.ebuild 42469 BLAKE2B 5087d9d4dbc11213df0af353e3046e740c88c6a3c9c1f4d5febfd456ced53b004495b049f6e8da613ea1f23d1d87c35ba6fdf86754c615273084e9fc66c78b1a SHA512 eef9b10c174cf7717fcc6533c97093ecbaea04a8497a60b287798e66d187eaf5a51bb97bc5ef8ad1ae999b478f9d8a810480aef1b2d58aa5d45c1f3c1ceb2610
-EBUILD mariadb-10.6.8.ebuild 42426 BLAKE2B a1d23eaa919f50d0dd1727d5fd50771df9290bb5cc4ea3e3ab308b8be2c4ed360ca00337498017eebdaeeada09ff27e4e9d0690feebf29d5aa400cb167fcd474 SHA512 0ccd2d518a3caf722fd67d57fadb5453153cbd7c8e75e673163c98daa595e3e04be84580bae0f830c40ba570805fa69e19a0d79b8f6f1088d7032b33c59f7e0d
MISC metadata.xml 2626 BLAKE2B d545d75827f63ac4ff1ab5eafd559b36ef44d0d5059dcdd5cbbb162d42e3a5117ff09c2c2eba82af10bc2f6c53e366f5f0b6a9c744c35d76b8bab12c6e517b64 SHA512 adf783a34647eb8299041d9125ec290377fc17b910e9f1660a33ccacd0a380cc4cd338f55f34e958ddfab1aa6dba85e25033b0dfe8dbc8fed4656ad5df63f6d8
diff --git a/dev-db/mariadb/mariadb-10.2.41.ebuild b/dev-db/mariadb/mariadb-10.2.41.ebuild
deleted file mode 100644
index 43001d345c8a..000000000000
--- a/dev-db/mariadb/mariadb-10.2.41.ebuild
+++ /dev/null
@@ -1,1289 +0,0 @@
-# Copyright 1999-2022 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.41-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist 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"
-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
- 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_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.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_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}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--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.43.ebuild b/dev-db/mariadb/mariadb-10.2.43.ebuild
deleted file mode 100644
index 9bf1ab562571..000000000000
--- a/dev-db/mariadb/mariadb-10.2.43.ebuild
+++ /dev/null
@@ -1,1292 +0,0 @@
-# Copyright 1999-2022 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://github.com/hydrapolic/gentoo-dist/raw/master/${PN}/${PN}-10.2.43-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist 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"
-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
- 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 xml' \
-# FEATURES='test userpriv' \
-# ebuild mariadb-X.X.XX.ebuild \
-# digest clean package
-src_test() {
- _disable_test() {
- local rawtestname bug reason
- rawtestname="${1}" ; shift
- bug="${1}" ; shift
- reason="${@}"
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
- echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
- }
-
- local TESTDIR="${BUILD_DIR}/mysql-test"
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.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_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 dangling symlink
- rm "${ED}/usr/$(get_libdir)/libmariadb.a" || die
-}
-
-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}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--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
deleted file mode 100644
index b87897821608..000000000000
--- a/dev-db/mariadb/mariadb-10.3.32.ebuild
+++ /dev/null
@@ -1,1281 +0,0 @@
-# Copyright 1999-2022 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.32-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist 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"
-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
- 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_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.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_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}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--skip-test-db"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Initializing ${PN} data directory: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
-
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
- fi
-
- local x=${RANDOM}
- local socket="${PID_DIR}/mysqld.${x}.sock"
- [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
- local pidfile="${PID_DIR}/mysqld.${x}.pid"
- [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
- unset x
-
- cmd=(
- "${mysqld_binary}"
- "${mysqld_options[@]}"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- --max_allowed_packet=8M
- --net_buffer_length=16K
- "--socket='${socket}'"
- "--pid-file='${pidfile}'"
- "--log-error='${mysqld_logfile}'"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
-
- echo -n "Waiting for mysqld to accept connections "
- local maxtry=15
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- if [[ -S "${socket}" ]] ; then
- # Even with a socket we don't know if mysqld will abort
- # start due to an error so just wait a little bit more...
- maxtry=5
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
- fi
-
- echo
-
- if [[ ! -S "${socket}" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
- fi
-
- local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
- touch "${mysql_logfile}" || die
-
- ebegin "Setting root password"
- # Do this from memory, as we don't want clear text passwords in temp files
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
- cmd=(
- "${mysql_binary}"
- --no-defaults
- "--socket='${socket}'"
- -hlocalhost
- "-e \"${sql}\""
- )
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
- local rc=$?
- eend ${rc}
-
- if [[ ${rc} -ne 0 ]] ; then
- # Poor man's solution which tries to avoid having password
- # in log. NOTE: sed can fail if user didn't follow advice
- # and included character which will require escaping...
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
-
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
- fi
-
- # Stop the server
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- echo -n "Stopping the server "
- pkill -F "${pidfile}" &>/dev/null
-
- maxtry=10
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- echo
-
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- # We somehow failed to stop server.
- # However, not a fatal error. Just warn the user.
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
- fi
- fi
-
- rm -r "${SETUP_TMPDIR}" || die
-
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
-}
diff --git a/dev-db/mariadb/mariadb-10.3.34.ebuild b/dev-db/mariadb/mariadb-10.3.34.ebuild
deleted file mode 100644
index 0a94bc13dd36..000000000000
--- a/dev-db/mariadb/mariadb-10.3.34.ebuild
+++ /dev/null
@@ -1,1284 +0,0 @@
-# Copyright 1999-2022 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://github.com/hydrapolic/gentoo-dist/raw/master/${PN}/${PN}-10.3.34-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist 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 !extraengine !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"
-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
- 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 xml' \
-# FEATURES='test userpriv' \
-# ebuild mariadb-X.X.XX.ebuild \
-# digest clean package
-src_test() {
- _disable_test() {
- local rawtestname bug reason
- rawtestname="${1}" ; shift
- bug="${1}" ; shift
- reason="${@}"
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
- echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
- }
-
- local TESTDIR="${BUILD_DIR}/mysql-test"
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.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_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
-
- # Remove dangling symlink
- rm "${ED}/usr/$(get_libdir)/libmariadb.a" || die
-}
-
-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}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--skip-test-db"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Initializing ${PN} data directory: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
-
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
- fi
-
- local x=${RANDOM}
- local socket="${PID_DIR}/mysqld.${x}.sock"
- [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
- local pidfile="${PID_DIR}/mysqld.${x}.pid"
- [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
- unset x
-
- cmd=(
- "${mysqld_binary}"
- "${mysqld_options[@]}"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- --max_allowed_packet=8M
- --net_buffer_length=16K
- "--socket='${socket}'"
- "--pid-file='${pidfile}'"
- "--log-error='${mysqld_logfile}'"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
-
- echo -n "Waiting for mysqld to accept connections "
- local maxtry=15
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- if [[ -S "${socket}" ]] ; then
- # Even with a socket we don't know if mysqld will abort
- # start due to an error so just wait a little bit more...
- maxtry=5
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
- fi
-
- echo
-
- if [[ ! -S "${socket}" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
- fi
-
- local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
- touch "${mysql_logfile}" || die
-
- ebegin "Setting root password"
- # Do this from memory, as we don't want clear text passwords in temp files
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
- cmd=(
- "${mysql_binary}"
- --no-defaults
- "--socket='${socket}'"
- -hlocalhost
- "-e \"${sql}\""
- )
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
- local rc=$?
- eend ${rc}
-
- if [[ ${rc} -ne 0 ]] ; then
- # Poor man's solution which tries to avoid having password
- # in log. NOTE: sed can fail if user didn't follow advice
- # and included character which will require escaping...
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
-
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
- fi
-
- # Stop the server
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- echo -n "Stopping the server "
- pkill -F "${pidfile}" &>/dev/null
-
- maxtry=10
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- echo
-
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- # We somehow failed to stop server.
- # However, not a fatal error. Just warn the user.
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
- fi
- fi
-
- rm -r "${SETUP_TMPDIR}" || die
-
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
-}
diff --git a/dev-db/mariadb/mariadb-10.4.22.ebuild b/dev-db/mariadb/mariadb-10.4.22.ebuild
deleted file mode 100644
index 14def683d3a6..000000000000
--- a/dev-db/mariadb/mariadb-10.4.22.ebuild
+++ /dev/null
@@ -1,1302 +0,0 @@
-# Copyright 1999-2022 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.22-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4
- innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
- numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
- sst-rsync sst-mariabackup static systemd systemtap tcmalloc
- test tokudb xml yassl"
-
-RESTRICT="!bindist? ( bindist ) !test? ( test )"
-
-REQUIRED_USE="jdbc? ( extraengine server !static )
- server? ( tokudb? ( jemalloc !tcmalloc ) )
- ?? ( tcmalloc jemalloc )
- static? ( yassl !pam )"
-
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
-
-# Shorten the path because the socket path length must be shorter than 107 chars
-# and we will run a mysql server during test phase
-S="${WORKDIR}/mysql"
-
-# Be warned, *DEPEND are version-dependant
-# These are used for both runtime and compiletime
-COMMON_DEPEND="
- kernel_linux? (
- sys-process/procps:0=
- dev-libs/libaio:0=
- )
- >=sys-apps/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"
-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
- 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_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
- disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
- disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
- disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
- disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
- disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
-
- if ! use latin1 ; then
- disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
- disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
- disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
- disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
- disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
- fi
-
- local test_infos_str test_infos_arr
- for test_infos_str in "${disabled_tests[@]}" ; do
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
-
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then
- die "Invalid test data set, not matching format: ${test_infos_str}"
- fi
-
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
- done
- unset test_infos_str test_infos_arr
-
- # run mysql-test tests
- pushd "${TESTDIR}" &>/dev/null || die
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
- retstatus_tests=$?
-
- popd &>/dev/null || die
-
- # Cleanup is important for these testcases.
- pkill -9 -f "${S}/ndb" 2>/dev/null
- pkill -9 -f "${S}/sql" 2>/dev/null
-
- local failures=""
- [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
-
- [[ -z "${failures}" ]] || die "Test failures: ${failures}"
- einfo "Tests successfully completed"
-}
-
-src_install() {
- cmake_src_install
-
- # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
- if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
- rm "${ED}/usr/include/mysql/server/private/config.h" || die
- fi
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Convenience links
- einfo "Making Convenience links for mysqlcheck multi-call binary"
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
- dosym "mysqlcheck" "/usr/bin/mysqlrepair"
- dosym "mysqlcheck" "/usr/bin/mysqloptimize"
-
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
- if [[ -d "${ED}/usr/data" ]] ; then
- rm -Rf "${ED}/usr/data" || die
- fi
-
- # Unless they explicitly specific USE=test, then do not install the
- # testsuite. It DOES have a use to be installed, esp. when you want to do a
- # validation of your database configuration after tuning it.
- if ! use test ; then
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
- fi
-
- # Configuration stuff
- einfo "Building default configuration ..."
- insinto "${MY_SYSCONFDIR#${EPREFIX}}"
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
- cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
- eprefixify "${TMPDIR}/my.cnf"
- doins "${TMPDIR}/my.cnf"
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
- eprefixify "${TMPDIR}/50-distro-client.cnf"
- doins "${TMPDIR}/50-distro-client.cnf"
-
- if use server ; then
- mycnf_src="my.cnf.distro-server"
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
- "${FILESDIR}/${mycnf_src}" \
- > "${TMPDIR}/my.cnf.ok" || die
- if use prefix ; then
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- if use latin1 ; then
- sed -i \
- -e "/character-set/s|utf8|latin1|g" \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- eprefixify "${TMPDIR}/my.cnf.ok"
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
-
- einfo "Including support files and sample configurations"
- docinto "support-files"
- local script
- for script in \
- "${S}"/support-files/magic
- do
- [[ -f "$script" ]] && dodoc "${script}"
- done
-
- docinto "scripts"
- for script in "${S}"/scripts/mysql* ; do
- [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
- done
- # Manually install supporting files that conflict with other packages
- # but are needed for galera and initial installation
- exeinto /usr/libexec/mariadb
- doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
-
- if use pam ; then
- keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
- fi
- fi
-
- # Remove bundled mytop in favor of dev-db/mytop
- local mytop_file
- for mytop_file in \
- "${ED}/usr/bin/mytop" \
- "${ED}/usr/share/man/man1/mytop.1" \
- ; do
- if [[ -e "${mytop_file}" ]] ; then
- rm -v "${mytop_file}" || die
- fi
- done
-
- # Fix a dangling symlink when galera is not built
- if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
- rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
- fi
-
- # Remove broken SST scripts that are incompatible
- local scriptremove
- for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
- if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
- rm "${ED}/usr/bin/${scriptremove}" || die
- fi
- done
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-}
-
-pkg_postinst() {
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Create log directory securely if it does not exist
- [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
-
- if use server ; then
- if use pam; then
- einfo
- elog "This install includes the PAM authentication plugin."
- elog "To activate and configure the PAM plugin, please read:"
- elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
- einfo
- chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
- fi
-
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then
- einfo
- elog "You might want to run:"
- elog "\"emerge --config =${CATEGORY}/${PF}\""
- elog "if this is a new install."
- elog
- elog "If you are switching server implentations, you should run the"
- elog "mysql_upgrade tool."
- einfo
- else
- einfo
- elog "If you are upgrading major versions, you should run the"
- elog "mysql_upgrade tool."
- einfo
- fi
-
- if use galera ; then
- einfo
- elog "Be sure to edit the my.cnf file to activate your cluster settings."
- elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
- elog "The first time the cluster is activated, you should add"
- elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
- elog "This option should then be removed for subsequent starts."
- einfo
- if [[ -n "${REPLACING_VERSIONS}" ]] ; then
- local rver
- for rver in ${REPLACING_VERSIONS} ; do
- if ver_test "${rver}" -lt "10.4.0" ; then
- ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
- ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
- ewarn "for more information"
- fi
- done
- fi
- fi
- fi
-
- # Note about configuration change
- einfo
- elog "This version of mariadb reorganizes the configuration from a single my.cnf"
- elog "to several files in /etc/mysql/${PN}.d."
- elog "Please backup any changes you made to /etc/mysql/my.cnf"
- elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
- elog "You may have as many files as needed and they are read alphabetically."
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
- einfo
-}
-
-pkg_config() {
- _getoptval() {
- local section="${1}"
- local option="--${2}"
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
-
- local values=()
- local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
- for parameter in "${parameters[@]}"
- do
- # my_print_defaults guarantees output of options, one per line,
- # in the form that they would be specified on the command line.
- # So checking for --option=* should be safe.
- case ${parameter} in
- ${option}=*)
- values+=( "${parameter#*=}" )
- ;;
- esac
- done
-
- if [[ ${#values[@]} -gt 0 ]] ; then
- # Option could have been set multiple times
- # in which case only the last occurrence
- # contains the current value
- echo "${values[-1]}"
- fi
- }
-
- _mktemp_dry() {
- # emktemp has no --dry-run option
- local template="${1}"
-
- if [[ -z "${template}" ]] ; then
- if [[ -z "${T}" ]] ; then
- template="/tmp/XXXXXXX"
- else
- template="${T}/XXXXXXX"
- fi
- fi
-
- local template_wo_X=${template//X/}
- local n_X
- let n_X=${#template}-${#template_wo_X}
- if [[ ${n_X} -lt 3 ]] ; then
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
- return
- fi
-
- local attempts=0
- local character tmpfile
- while [[ true ]] ; do
- let attempts=attempts+1
-
- new_file=
- while read -n1 character ; do
- if [[ "${character}" == "X" ]] ; then
- tmpfile+="${RANDOM:0:1}"
- else
- tmpfile+="${character}"
- fi
- done < <(echo -n "${template}")
-
- if [[ ! -f "${tmpfile}" ]]
- then
- echo "${tmpfile}"
- return
- fi
-
- if [[ ${attempts} -ge 100 ]] ; then
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
- return
- fi
- done
- }
-
- local mysql_binary="${EROOT}/usr/bin/mysql"
- if [[ ! -x "${mysql_binary}" ]] ; then
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysqld_binary="${EROOT}/usr/sbin/mysqld"
- if [[ ! -x "${mysqld_binary}" ]] ; then
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
- if [[ ! -x "${mysql_install_db_binary}" ]] ; then
- die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
- fi
-
- if [[ -z "${MYSQL_USER}" ]] ; then
- MYSQL_USER=mysql
- if use prefix ; then
- MYSQL_USER=$(id -u -n 2>/dev/null)
- if [[ -z "${MYSQL_USER}" ]] ; then
- die "Failed to determine current username!"
- fi
- fi
- fi
-
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- MYSQL_GROUP=mysql
- if use prefix ; then
- MYSQL_GROUP=$(id -g -n 2>/dev/null)
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- die "Failed to determine current user groupname!"
- fi
- fi
- fi
-
- # my_print_defaults needs to read stuff in $HOME/.my.cnf
- local -x HOME="${EROOT}/root"
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Read currently set data directory
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
-
- # Bug #213475 - MySQL _will_ object strenously if your machine is named
- # localhost. Also causes weird failures.
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
- if [[ -z "${MY_DATADIR}" ]] ; then
- die "Sorry, unable to find MY_DATADIR!"
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
- ewarn "Please rename or delete its content if you wish to initialize a new data directory."
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
- fi
-
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
- # These are dir+prefix
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
-
- # Create missing directories.
- # Always check if mysql user can write to directory even if we just
- # created directory because a parent directory might be not
- # accessible for that user.
- PID_DIR="${EROOT}/run/mysqld"
- if [[ ! -d "${PID_DIR}" ]] ; then
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
- || die "Failed to create PID directory '${PID_DIR}'!"
- fi
-
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_pid_dir_testfile}" ]] \
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_pid_dir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
- else
- rm "${_pid_dir_testfile}" || die
- unset _pid_dir_testfile
- fi
-
- if [[ ! -d "${MY_DATADIR}" ]] ; then
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
- fi
-
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_datadir_testfile}" ]] \
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_datadir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
- else
- rm "${_my_datadir_testfile}" || die
- unset _my_datadir_testfile
- fi
-
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
- fi
-
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
- [[ -z "${MYSQL_TMPDIR}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
-
- mkdir "${MYSQL_TMPDIR}" || die
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
- fi
-
- # Now we need to test MYSQL_TMPDIR...
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_tmpdir_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_tmpdir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
- else
- rm "${_my_tmpdir_testfile}" || die
- unset _my_tmpdir_testfile
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- # Only create directory when MYSQL_LOG_BIN is an absolute path
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Only test when MYSQL_LOG_BIN is an absolute path
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_logbin_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_logbin_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
- else
- rm "${_my_logbin_testfile}" || die
- unset _my_logbin_testfile
- fi
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- # Only create directory when MYSQL_RELAY_LOG is an absolute path
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Only test when MYSQL_RELAY_LOG is an absolute path
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_relaylog_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_relaylog_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
- else
- rm "${_my_relaylog_testfile}" || die
- unset _my_relaylog_testfile
- fi
- fi
-
- local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
- [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
-
- # Limit access
- chmod 0770 "${SETUP_TMPDIR}" || die
- chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
-
- local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
- local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
-
- echo ""
- einfo "Detected settings:"
- einfo "=================="
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Absolute path for binary log files specified
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Absolute path for relay log files specified
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
- fi
-
- einfo "PID DIR:\t\t\t\t${PID_DIR}"
- einfo "Install db log:\t\t\t${mysql_install_log}"
- einfo "Install server log:\t\t\t${mysqld_logfile}"
-
- echo
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local tmp_mysqld_password_source=
-
- for tmp_mysqld_password_source in mysql client ; do
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
- MYSQL_ROOT_PASSWORD=
- continue
- fi
-
- einfo "Found password in '${tmp_mysqld_password_source}' section!"
- break
- fi
- done
-
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
- fi
-
- unset tmp_mysqld_password_source
- fi
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local pwd1="a"
- local pwd2="b"
-
- echo
- einfo "No password for mysql 'root' user was specified via environment"
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
- einfo "file like '${HOME}/.my.cnf'."
- einfo "To continue please provide a password for the mysql 'root' user"
- einfo "now on console:"
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
- read -rsp " >" pwd1 ; echo
-
- einfo "Retype the password"
- read -rsp " >" pwd2 ; echo
-
- if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
- die "Passwords are not the same!"
- fi
-
- MYSQL_ROOT_PASSWORD="${pwd1}"
- unset pwd1 pwd2
-
- echo
- fi
-
- local -a mysqld_options
-
- # Fix bug 446200. Don't reference host my.cnf, needs to come first,
- # see http://bugs.mysql.com/bug.php?id=31312
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
-
- # Figure out which options we need to disable to do the setup
- local helpfile="${TMPDIR}/mysqld-help"
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
-
- local opt optexp optfull
- for opt in host-cache name-resolve networking slave-start \
- federated ssl log-bin relay-log slow-query-log external-locking \
- log-slave-updates \
- ; do
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--skip-test-db"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Initializing ${PN} data directory: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
-
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
- fi
-
- local x=${RANDOM}
- local socket="${PID_DIR}/mysqld.${x}.sock"
- [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
- local pidfile="${PID_DIR}/mysqld.${x}.pid"
- [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
- unset x
-
- cmd=(
- "${mysqld_binary}"
- "${mysqld_options[@]}"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- --max_allowed_packet=8M
- --net_buffer_length=16K
- "--socket='${socket}'"
- "--pid-file='${pidfile}'"
- "--log-error='${mysqld_logfile}'"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
-
- echo -n "Waiting for mysqld to accept connections "
- local maxtry=15
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- if [[ -S "${socket}" ]] ; then
- # Even with a socket we don't know if mysqld will abort
- # start due to an error so just wait a little bit more...
- maxtry=5
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
- fi
-
- echo
-
- if [[ ! -S "${socket}" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
- fi
-
- local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
- touch "${mysql_logfile}" || die
-
- ebegin "Setting root password"
- # Do this from memory, as we don't want clear text passwords in temp files
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
- cmd=(
- "${mysql_binary}"
- --no-defaults
- "--socket='${socket}'"
- -hlocalhost
- "-e \"${sql}\""
- )
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
- local rc=$?
- eend ${rc}
-
- if [[ ${rc} -ne 0 ]] ; then
- # Poor man's solution which tries to avoid having password
- # in log. NOTE: sed can fail if user didn't follow advice
- # and included character which will require escaping...
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
-
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
- fi
-
- # Stop the server
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- echo -n "Stopping the server "
- pkill -F "${pidfile}" &>/dev/null
-
- maxtry=10
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- echo
-
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- # We somehow failed to stop server.
- # However, not a fatal error. Just warn the user.
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
- fi
- fi
-
- rm -r "${SETUP_TMPDIR}" || die
-
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
-}
diff --git a/dev-db/mariadb/mariadb-10.5.13.ebuild b/dev-db/mariadb/mariadb-10.5.13.ebuild
deleted file mode 100644
index cac5f2acfa61..000000000000
--- a/dev-db/mariadb/mariadb-10.5.13.ebuild
+++ /dev/null
@@ -1,1309 +0,0 @@
-# Copyright 1999-2022 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.13-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
- innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
- numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
- sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
- test xml yassl"
-
-RESTRICT="!bindist? ( bindist ) !test? ( test )"
-
-REQUIRED_USE="jdbc? ( extraengine server !static )
- ?? ( tcmalloc jemalloc )
- static? ( yassl !pam )"
-
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
-
-# Shorten the path because the socket path length must be shorter than 107 chars
-# and we will run a mysql server during test phase
-S="${WORKDIR}/mysql"
-
-# Be warned, *DEPEND are version-dependant
-# These are used for both runtime and compiletime
-COMMON_DEPEND="
- >=dev-libs/libpcre2-10.34:=
- >=sys-apps/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"
-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
- 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_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
- disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
- disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
- disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
- disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
- disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
-
- if ! use latin1 ; then
- disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
- disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
- disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
- disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
- disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
- fi
-
- local test_infos_str test_infos_arr
- for test_infos_str in "${disabled_tests[@]}" ; do
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
-
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then
- die "Invalid test data set, not matching format: ${test_infos_str}"
- fi
-
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
- done
- unset test_infos_str test_infos_arr
-
- # run mysql-test tests
- pushd "${TESTDIR}" &>/dev/null || die
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
- retstatus_tests=$?
-
- popd &>/dev/null || die
-
- # Cleanup is important for these testcases.
- pkill -9 -f "${S}/ndb" 2>/dev/null
- pkill -9 -f "${S}/sql" 2>/dev/null
-
- local failures=""
- [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
-
- [[ -z "${failures}" ]] || die "Test failures: ${failures}"
- einfo "Tests successfully completed"
-}
-
-src_install() {
- cmake_src_install
-
- # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
- if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
- rm "${ED}/usr/include/mysql/server/private/config.h" || die
- fi
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Convenience links
- einfo "Making Convenience links for mysqlcheck multi-call binary"
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
- dosym "mysqlcheck" "/usr/bin/mysqlrepair"
- dosym "mysqlcheck" "/usr/bin/mysqloptimize"
-
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
- if [[ -d "${ED}/usr/data" ]] ; then
- rm -Rf "${ED}/usr/data" || die
- fi
-
- # Unless they explicitly specific USE=test, then do not install the
- # testsuite. It DOES have a use to be installed, esp. when you want to do a
- # validation of your database configuration after tuning it.
- if ! use test ; then
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
- fi
-
- # Configuration stuff
- einfo "Building default configuration ..."
- insinto "${MY_SYSCONFDIR#${EPREFIX}}"
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
- cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
- eprefixify "${TMPDIR}/my.cnf"
- doins "${TMPDIR}/my.cnf"
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
- eprefixify "${TMPDIR}/50-distro-client.cnf"
- doins "${TMPDIR}/50-distro-client.cnf"
-
- if use server ; then
- mycnf_src="my.cnf.distro-server"
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
- "${FILESDIR}/${mycnf_src}" \
- > "${TMPDIR}/my.cnf.ok" || die
- if use prefix ; then
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- if use latin1 ; then
- sed -i \
- -e "/character-set/s|utf8|latin1|g" \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- eprefixify "${TMPDIR}/my.cnf.ok"
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
-
- einfo "Including support files and sample configurations"
- docinto "support-files"
- local script
- for script in \
- "${S}"/support-files/magic
- do
- [[ -f "$script" ]] && dodoc "${script}"
- done
-
- docinto "scripts"
- for script in "${S}"/scripts/mysql* ; do
- [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
- done
- # Manually install supporting files that conflict with other packages
- # but are needed for galera and initial installation
- exeinto /usr/libexec/mariadb
- doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
-
- if use pam ; then
- keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
- fi
- fi
-
- # Conflicting files
- conflicting_files=()
-
- # We prefer my_print_defaults from dev-db/mysql-connector-c
- conflicting_files=( "${ED}/usr/share/man/man1/my_print_defaults.1" )
-
- # Remove bundled mytop in favor of dev-db/mytop
- conflicting_files+=( "${ED}/usr/bin/mytop" )
- conflicting_files+=( "${ED}/usr/share/man/man1/mytop.1" )
-
- local conflicting_file
- for conflicting_file in "${conflicting_files[@]}" ; do
- if [[ -e "${conflicting_file}" ]] ; then
- rm -v "${conflicting_file}" || die
- fi
- done
-
- # Fix a dangling symlink when galera is not built
- if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
- rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
- fi
-
- # Remove broken SST scripts that are incompatible
- local scriptremove
- for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
- if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
- rm "${ED}/usr/bin/${scriptremove}" || die
- fi
- done
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-}
-
-pkg_postinst() {
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Create log directory securely if it does not exist
- [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
-
- if use server ; then
- if use pam; then
- einfo
- elog "This install includes the PAM authentication plugin."
- elog "To activate and configure the PAM plugin, please read:"
- elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
- einfo
- chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
- fi
-
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then
- einfo
- elog "You might want to run:"
- elog "\"emerge --config =${CATEGORY}/${PF}\""
- elog "if this is a new install."
- elog
- elog "If you are switching server implentations, you should run the"
- elog "mysql_upgrade tool."
- einfo
- else
- einfo
- elog "If you are upgrading major versions, you should run the"
- elog "mysql_upgrade tool."
- einfo
- fi
-
- if use galera ; then
- einfo
- elog "Be sure to edit the my.cnf file to activate your cluster settings."
- elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
- elog "The first time the cluster is activated, you should add"
- elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
- elog "This option should then be removed for subsequent starts."
- einfo
- if [[ -n "${REPLACING_VERSIONS}" ]] ; then
- local rver
- for rver in ${REPLACING_VERSIONS} ; do
- if ver_test "${rver}" -lt "10.4.0" ; then
- ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
- ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
- ewarn "for more information"
- fi
- done
- fi
- fi
- fi
-
- # Note about configuration change
- einfo
- elog "This version of mariadb reorganizes the configuration from a single my.cnf"
- elog "to several files in /etc/mysql/${PN}.d."
- elog "Please backup any changes you made to /etc/mysql/my.cnf"
- elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
- elog "You may have as many files as needed and they are read alphabetically."
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
- einfo
-}
-
-pkg_config() {
- _getoptval() {
- local section="${1}"
- local option="--${2}"
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
-
- local values=()
- local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
- for parameter in "${parameters[@]}"
- do
- # my_print_defaults guarantees output of options, one per line,
- # in the form that they would be specified on the command line.
- # So checking for --option=* should be safe.
- case ${parameter} in
- ${option}=*)
- values+=( "${parameter#*=}" )
- ;;
- esac
- done
-
- if [[ ${#values[@]} -gt 0 ]] ; then
- # Option could have been set multiple times
- # in which case only the last occurrence
- # contains the current value
- echo "${values[-1]}"
- fi
- }
-
- _mktemp_dry() {
- # emktemp has no --dry-run option
- local template="${1}"
-
- if [[ -z "${template}" ]] ; then
- if [[ -z "${T}" ]] ; then
- template="/tmp/XXXXXXX"
- else
- template="${T}/XXXXXXX"
- fi
- fi
-
- local template_wo_X=${template//X/}
- local n_X
- let n_X=${#template}-${#template_wo_X}
- if [[ ${n_X} -lt 3 ]] ; then
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
- return
- fi
-
- local attempts=0
- local character tmpfile
- while [[ true ]] ; do
- let attempts=attempts+1
-
- new_file=
- while read -n1 character ; do
- if [[ "${character}" == "X" ]] ; then
- tmpfile+="${RANDOM:0:1}"
- else
- tmpfile+="${character}"
- fi
- done < <(echo -n "${template}")
-
- if [[ ! -f "${tmpfile}" ]]
- then
- echo "${tmpfile}"
- return
- fi
-
- if [[ ${attempts} -ge 100 ]] ; then
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
- return
- fi
- done
- }
-
- local mysql_binary="${EROOT}/usr/bin/mysql"
- if [[ ! -x "${mysql_binary}" ]] ; then
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysqld_binary="${EROOT}/usr/sbin/mysqld"
- if [[ ! -x "${mysqld_binary}" ]] ; then
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
- if [[ ! -x "${mysql_install_db_binary}" ]] ; then
- die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
- fi
-
- if [[ -z "${MYSQL_USER}" ]] ; then
- MYSQL_USER=mysql
- if use prefix ; then
- MYSQL_USER=$(id -u -n 2>/dev/null)
- if [[ -z "${MYSQL_USER}" ]] ; then
- die "Failed to determine current username!"
- fi
- fi
- fi
-
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- MYSQL_GROUP=mysql
- if use prefix ; then
- MYSQL_GROUP=$(id -g -n 2>/dev/null)
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- die "Failed to determine current user groupname!"
- fi
- fi
- fi
-
- # my_print_defaults needs to read stuff in $HOME/.my.cnf
- local -x HOME="${EROOT}/root"
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Read currently set data directory
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
-
- # Bug #213475 - MySQL _will_ object strenously if your machine is named
- # localhost. Also causes weird failures.
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
- if [[ -z "${MY_DATADIR}" ]] ; then
- die "Sorry, unable to find MY_DATADIR!"
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
- ewarn "Please rename or delete its content if you wish to initialize a new data directory."
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
- fi
-
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
- # These are dir+prefix
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
-
- # Create missing directories.
- # Always check if mysql user can write to directory even if we just
- # created directory because a parent directory might be not
- # accessible for that user.
- PID_DIR="${EROOT}/run/mysqld"
- if [[ ! -d "${PID_DIR}" ]] ; then
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
- || die "Failed to create PID directory '${PID_DIR}'!"
- fi
-
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_pid_dir_testfile}" ]] \
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_pid_dir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
- else
- rm "${_pid_dir_testfile}" || die
- unset _pid_dir_testfile
- fi
-
- if [[ ! -d "${MY_DATADIR}" ]] ; then
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
- fi
-
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_datadir_testfile}" ]] \
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_datadir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
- else
- rm "${_my_datadir_testfile}" || die
- unset _my_datadir_testfile
- fi
-
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
- fi
-
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
- [[ -z "${MYSQL_TMPDIR}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
-
- mkdir "${MYSQL_TMPDIR}" || die
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
- fi
-
- # Now we need to test MYSQL_TMPDIR...
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_tmpdir_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_tmpdir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
- else
- rm "${_my_tmpdir_testfile}" || die
- unset _my_tmpdir_testfile
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- # Only create directory when MYSQL_LOG_BIN is an absolute path
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Only test when MYSQL_LOG_BIN is an absolute path
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_logbin_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_logbin_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
- else
- rm "${_my_logbin_testfile}" || die
- unset _my_logbin_testfile
- fi
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- # Only create directory when MYSQL_RELAY_LOG is an absolute path
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Only test when MYSQL_RELAY_LOG is an absolute path
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_relaylog_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_relaylog_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
- else
- rm "${_my_relaylog_testfile}" || die
- unset _my_relaylog_testfile
- fi
- fi
-
- local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
- [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
-
- # Limit access
- chmod 0770 "${SETUP_TMPDIR}" || die
- chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
-
- local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
- local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
-
- echo ""
- einfo "Detected settings:"
- einfo "=================="
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Absolute path for binary log files specified
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Absolute path for relay log files specified
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
- fi
-
- einfo "PID DIR:\t\t\t\t${PID_DIR}"
- einfo "Install db log:\t\t\t${mysql_install_log}"
- einfo "Install server log:\t\t\t${mysqld_logfile}"
-
- echo
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local tmp_mysqld_password_source=
-
- for tmp_mysqld_password_source in mysql client ; do
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
- MYSQL_ROOT_PASSWORD=
- continue
- fi
-
- einfo "Found password in '${tmp_mysqld_password_source}' section!"
- break
- fi
- done
-
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
- fi
-
- unset tmp_mysqld_password_source
- fi
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local pwd1="a"
- local pwd2="b"
-
- echo
- einfo "No password for mysql 'root' user was specified via environment"
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
- einfo "file like '${HOME}/.my.cnf'."
- einfo "To continue please provide a password for the mysql 'root' user"
- einfo "now on console:"
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
- read -rsp " >" pwd1 ; echo
-
- einfo "Retype the password"
- read -rsp " >" pwd2 ; echo
-
- if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
- die "Passwords are not the same!"
- fi
-
- MYSQL_ROOT_PASSWORD="${pwd1}"
- unset pwd1 pwd2
-
- echo
- fi
-
- local -a mysqld_options
-
- # Fix bug 446200. Don't reference host my.cnf, needs to come first,
- # see http://bugs.mysql.com/bug.php?id=31312
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
-
- # Figure out which options we need to disable to do the setup
- local helpfile="${TMPDIR}/mysqld-help"
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
-
- local opt optexp optfull
- for opt in host-cache name-resolve networking slave-start \
- federated ssl log-bin relay-log slow-query-log external-locking \
- log-slave-updates \
- ; do
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--skip-test-db"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Initializing ${PN} data directory: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
-
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
- fi
-
- local x=${RANDOM}
- local socket="${PID_DIR}/mysqld.${x}.sock"
- [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
- local pidfile="${PID_DIR}/mysqld.${x}.pid"
- [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
- unset x
-
- cmd=(
- "${mysqld_binary}"
- "${mysqld_options[@]}"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- --max_allowed_packet=8M
- --net_buffer_length=16K
- "--socket='${socket}'"
- "--pid-file='${pidfile}'"
- "--log-error='${mysqld_logfile}'"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
-
- echo -n "Waiting for mysqld to accept connections "
- local maxtry=15
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- if [[ -S "${socket}" ]] ; then
- # Even with a socket we don't know if mysqld will abort
- # start due to an error so just wait a little bit more...
- maxtry=5
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
- fi
-
- echo
-
- if [[ ! -S "${socket}" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
- fi
-
- local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
- touch "${mysql_logfile}" || die
-
- ebegin "Setting root password"
- # Do this from memory, as we don't want clear text passwords in temp files
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
- cmd=(
- "${mysql_binary}"
- --no-defaults
- "--socket='${socket}'"
- -hlocalhost
- "-e \"${sql}\""
- )
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
- local rc=$?
- eend ${rc}
-
- if [[ ${rc} -ne 0 ]] ; then
- # Poor man's solution which tries to avoid having password
- # in log. NOTE: sed can fail if user didn't follow advice
- # and included character which will require escaping...
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
-
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
- fi
-
- # Stop the server
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- echo -n "Stopping the server "
- pkill -F "${pidfile}" &>/dev/null
-
- maxtry=10
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- echo
-
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- # We somehow failed to stop server.
- # However, not a fatal error. Just warn the user.
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
- fi
- fi
-
- rm -r "${SETUP_TMPDIR}" || die
-
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
-}
diff --git a/dev-db/mariadb/mariadb-10.5.15.ebuild b/dev-db/mariadb/mariadb-10.5.15.ebuild
deleted file mode 100644
index 5f5be0b5ce09..000000000000
--- a/dev-db/mariadb/mariadb-10.5.15.ebuild
+++ /dev/null
@@ -1,1309 +0,0 @@
-# Copyright 1999-2022 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://github.com/hydrapolic/gentoo-dist/raw/master/mariadb/mariadb-10.5.15-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
- innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
- numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
- sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
- test xml yassl"
-
-RESTRICT="!bindist? ( bindist ) !test? ( test )"
-
-REQUIRED_USE="jdbc? ( extraengine server !static )
- ?? ( tcmalloc jemalloc )
- static? ( yassl !pam )"
-
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
-
-# Shorten the path because the socket path length must be shorter than 107 chars
-# and we will run a mysql server during test phase
-S="${WORKDIR}/mysql"
-
-# Be warned, *DEPEND are version-dependant
-# These are used for both runtime and compiletime
-COMMON_DEPEND="
- >=dev-libs/libpcre2-10.34:=
- >=sys-apps/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"
-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
- 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_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
- disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
- disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
- disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
- disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
- disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
-
- if ! use latin1 ; then
- disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
- disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
- disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
- disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
- disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
- fi
-
- local test_infos_str test_infos_arr
- for test_infos_str in "${disabled_tests[@]}" ; do
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
-
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then
- die "Invalid test data set, not matching format: ${test_infos_str}"
- fi
-
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
- done
- unset test_infos_str test_infos_arr
-
- # run mysql-test tests
- pushd "${TESTDIR}" &>/dev/null || die
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
- retstatus_tests=$?
-
- popd &>/dev/null || die
-
- # Cleanup is important for these testcases.
- pkill -9 -f "${S}/ndb" 2>/dev/null
- pkill -9 -f "${S}/sql" 2>/dev/null
-
- local failures=""
- [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
-
- [[ -z "${failures}" ]] || die "Test failures: ${failures}"
- einfo "Tests successfully completed"
-}
-
-src_install() {
- cmake_src_install
-
- # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
- if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
- rm "${ED}/usr/include/mysql/server/private/config.h" || die
- fi
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Convenience links
- einfo "Making Convenience links for mysqlcheck multi-call binary"
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
- dosym "mysqlcheck" "/usr/bin/mysqlrepair"
- dosym "mysqlcheck" "/usr/bin/mysqloptimize"
-
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
- if [[ -d "${ED}/usr/data" ]] ; then
- rm -Rf "${ED}/usr/data" || die
- fi
-
- # Unless they explicitly specific USE=test, then do not install the
- # testsuite. It DOES have a use to be installed, esp. when you want to do a
- # validation of your database configuration after tuning it.
- if ! use test ; then
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
- fi
-
- # Configuration stuff
- einfo "Building default configuration ..."
- insinto "${MY_SYSCONFDIR#${EPREFIX}}"
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
- cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
- eprefixify "${TMPDIR}/my.cnf"
- doins "${TMPDIR}/my.cnf"
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
- eprefixify "${TMPDIR}/50-distro-client.cnf"
- doins "${TMPDIR}/50-distro-client.cnf"
-
- if use server ; then
- mycnf_src="my.cnf.distro-server"
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
- "${FILESDIR}/${mycnf_src}" \
- > "${TMPDIR}/my.cnf.ok" || die
- if use prefix ; then
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- if use latin1 ; then
- sed -i \
- -e "/character-set/s|utf8|latin1|g" \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- eprefixify "${TMPDIR}/my.cnf.ok"
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
-
- einfo "Including support files and sample configurations"
- docinto "support-files"
- local script
- for script in \
- "${S}"/support-files/magic
- do
- [[ -f "$script" ]] && dodoc "${script}"
- done
-
- docinto "scripts"
- for script in "${S}"/scripts/mysql* ; do
- [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
- done
- # Manually install supporting files that conflict with other packages
- # but are needed for galera and initial installation
- exeinto /usr/libexec/mariadb
- doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
-
- if use pam ; then
- keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
- fi
- fi
-
- # Conflicting files
- conflicting_files=()
-
- # We prefer my_print_defaults from dev-db/mysql-connector-c
- conflicting_files=( "${ED}/usr/share/man/man1/my_print_defaults.1" )
-
- # Remove bundled mytop in favor of dev-db/mytop
- conflicting_files+=( "${ED}/usr/bin/mytop" )
- conflicting_files+=( "${ED}/usr/share/man/man1/mytop.1" )
-
- local conflicting_file
- for conflicting_file in "${conflicting_files[@]}" ; do
- if [[ -e "${conflicting_file}" ]] ; then
- rm -v "${conflicting_file}" || die
- fi
- done
-
- # Fix a dangling symlink when galera is not built
- if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
- rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
- fi
-
- # Remove broken SST scripts that are incompatible
- local scriptremove
- for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
- if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
- rm "${ED}/usr/bin/${scriptremove}" || die
- fi
- done
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-}
-
-pkg_postinst() {
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Create log directory securely if it does not exist
- [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
-
- if use server ; then
- if use pam; then
- einfo
- elog "This install includes the PAM authentication plugin."
- elog "To activate and configure the PAM plugin, please read:"
- elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
- einfo
- chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
- fi
-
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then
- einfo
- elog "You might want to run:"
- elog "\"emerge --config =${CATEGORY}/${PF}\""
- elog "if this is a new install."
- elog
- elog "If you are switching server implentations, you should run the"
- elog "mysql_upgrade tool."
- einfo
- else
- einfo
- elog "If you are upgrading major versions, you should run the"
- elog "mysql_upgrade tool."
- einfo
- fi
-
- if use galera ; then
- einfo
- elog "Be sure to edit the my.cnf file to activate your cluster settings."
- elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
- elog "The first time the cluster is activated, you should add"
- elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
- elog "This option should then be removed for subsequent starts."
- einfo
- if [[ -n "${REPLACING_VERSIONS}" ]] ; then
- local rver
- for rver in ${REPLACING_VERSIONS} ; do
- if ver_test "${rver}" -lt "10.4.0" ; then
- ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
- ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
- ewarn "for more information"
- fi
- done
- fi
- fi
- fi
-
- # Note about configuration change
- einfo
- elog "This version of mariadb reorganizes the configuration from a single my.cnf"
- elog "to several files in /etc/mysql/${PN}.d."
- elog "Please backup any changes you made to /etc/mysql/my.cnf"
- elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
- elog "You may have as many files as needed and they are read alphabetically."
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
- einfo
-}
-
-pkg_config() {
- _getoptval() {
- local section="${1}"
- local option="--${2}"
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
-
- local values=()
- local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
- for parameter in "${parameters[@]}"
- do
- # my_print_defaults guarantees output of options, one per line,
- # in the form that they would be specified on the command line.
- # So checking for --option=* should be safe.
- case ${parameter} in
- ${option}=*)
- values+=( "${parameter#*=}" )
- ;;
- esac
- done
-
- if [[ ${#values[@]} -gt 0 ]] ; then
- # Option could have been set multiple times
- # in which case only the last occurrence
- # contains the current value
- echo "${values[-1]}"
- fi
- }
-
- _mktemp_dry() {
- # emktemp has no --dry-run option
- local template="${1}"
-
- if [[ -z "${template}" ]] ; then
- if [[ -z "${T}" ]] ; then
- template="/tmp/XXXXXXX"
- else
- template="${T}/XXXXXXX"
- fi
- fi
-
- local template_wo_X=${template//X/}
- local n_X
- let n_X=${#template}-${#template_wo_X}
- if [[ ${n_X} -lt 3 ]] ; then
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
- return
- fi
-
- local attempts=0
- local character tmpfile
- while [[ true ]] ; do
- let attempts=attempts+1
-
- new_file=
- while read -n1 character ; do
- if [[ "${character}" == "X" ]] ; then
- tmpfile+="${RANDOM:0:1}"
- else
- tmpfile+="${character}"
- fi
- done < <(echo -n "${template}")
-
- if [[ ! -f "${tmpfile}" ]]
- then
- echo "${tmpfile}"
- return
- fi
-
- if [[ ${attempts} -ge 100 ]] ; then
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
- return
- fi
- done
- }
-
- local mysql_binary="${EROOT}/usr/bin/mysql"
- if [[ ! -x "${mysql_binary}" ]] ; then
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysqld_binary="${EROOT}/usr/sbin/mysqld"
- if [[ ! -x "${mysqld_binary}" ]] ; then
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
- if [[ ! -x "${mysql_install_db_binary}" ]] ; then
- die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
- fi
-
- if [[ -z "${MYSQL_USER}" ]] ; then
- MYSQL_USER=mysql
- if use prefix ; then
- MYSQL_USER=$(id -u -n 2>/dev/null)
- if [[ -z "${MYSQL_USER}" ]] ; then
- die "Failed to determine current username!"
- fi
- fi
- fi
-
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- MYSQL_GROUP=mysql
- if use prefix ; then
- MYSQL_GROUP=$(id -g -n 2>/dev/null)
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- die "Failed to determine current user groupname!"
- fi
- fi
- fi
-
- # my_print_defaults needs to read stuff in $HOME/.my.cnf
- local -x HOME="${EROOT}/root"
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Read currently set data directory
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
-
- # Bug #213475 - MySQL _will_ object strenously if your machine is named
- # localhost. Also causes weird failures.
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
- if [[ -z "${MY_DATADIR}" ]] ; then
- die "Sorry, unable to find MY_DATADIR!"
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
- ewarn "Please rename or delete its content if you wish to initialize a new data directory."
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
- fi
-
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
- # These are dir+prefix
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
-
- # Create missing directories.
- # Always check if mysql user can write to directory even if we just
- # created directory because a parent directory might be not
- # accessible for that user.
- PID_DIR="${EROOT}/run/mysqld"
- if [[ ! -d "${PID_DIR}" ]] ; then
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
- || die "Failed to create PID directory '${PID_DIR}'!"
- fi
-
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_pid_dir_testfile}" ]] \
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_pid_dir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
- else
- rm "${_pid_dir_testfile}" || die
- unset _pid_dir_testfile
- fi
-
- if [[ ! -d "${MY_DATADIR}" ]] ; then
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
- fi
-
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_datadir_testfile}" ]] \
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_datadir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
- else
- rm "${_my_datadir_testfile}" || die
- unset _my_datadir_testfile
- fi
-
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
- fi
-
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
- [[ -z "${MYSQL_TMPDIR}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
-
- mkdir "${MYSQL_TMPDIR}" || die
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
- fi
-
- # Now we need to test MYSQL_TMPDIR...
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_tmpdir_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_tmpdir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
- else
- rm "${_my_tmpdir_testfile}" || die
- unset _my_tmpdir_testfile
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- # Only create directory when MYSQL_LOG_BIN is an absolute path
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Only test when MYSQL_LOG_BIN is an absolute path
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_logbin_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_logbin_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
- else
- rm "${_my_logbin_testfile}" || die
- unset _my_logbin_testfile
- fi
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- # Only create directory when MYSQL_RELAY_LOG is an absolute path
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Only test when MYSQL_RELAY_LOG is an absolute path
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_relaylog_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_relaylog_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
- else
- rm "${_my_relaylog_testfile}" || die
- unset _my_relaylog_testfile
- fi
- fi
-
- local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
- [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
-
- # Limit access
- chmod 0770 "${SETUP_TMPDIR}" || die
- chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
-
- local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
- local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
-
- echo ""
- einfo "Detected settings:"
- einfo "=================="
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Absolute path for binary log files specified
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Absolute path for relay log files specified
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
- fi
-
- einfo "PID DIR:\t\t\t\t${PID_DIR}"
- einfo "Install db log:\t\t\t${mysql_install_log}"
- einfo "Install server log:\t\t\t${mysqld_logfile}"
-
- echo
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local tmp_mysqld_password_source=
-
- for tmp_mysqld_password_source in mysql client ; do
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
- MYSQL_ROOT_PASSWORD=
- continue
- fi
-
- einfo "Found password in '${tmp_mysqld_password_source}' section!"
- break
- fi
- done
-
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
- fi
-
- unset tmp_mysqld_password_source
- fi
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local pwd1="a"
- local pwd2="b"
-
- echo
- einfo "No password for mysql 'root' user was specified via environment"
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
- einfo "file like '${HOME}/.my.cnf'."
- einfo "To continue please provide a password for the mysql 'root' user"
- einfo "now on console:"
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
- read -rsp " >" pwd1 ; echo
-
- einfo "Retype the password"
- read -rsp " >" pwd2 ; echo
-
- if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
- die "Passwords are not the same!"
- fi
-
- MYSQL_ROOT_PASSWORD="${pwd1}"
- unset pwd1 pwd2
-
- echo
- fi
-
- local -a mysqld_options
-
- # Fix bug 446200. Don't reference host my.cnf, needs to come first,
- # see http://bugs.mysql.com/bug.php?id=31312
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
-
- # Figure out which options we need to disable to do the setup
- local helpfile="${TMPDIR}/mysqld-help"
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
-
- local opt optexp optfull
- for opt in host-cache name-resolve networking slave-start \
- federated ssl log-bin relay-log slow-query-log external-locking \
- log-slave-updates \
- ; do
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--skip-test-db"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Initializing ${PN} data directory: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
-
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
- fi
-
- local x=${RANDOM}
- local socket="${PID_DIR}/mysqld.${x}.sock"
- [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
- local pidfile="${PID_DIR}/mysqld.${x}.pid"
- [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
- unset x
-
- cmd=(
- "${mysqld_binary}"
- "${mysqld_options[@]}"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- --max_allowed_packet=8M
- --net_buffer_length=16K
- "--socket='${socket}'"
- "--pid-file='${pidfile}'"
- "--log-error='${mysqld_logfile}'"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
-
- echo -n "Waiting for mysqld to accept connections "
- local maxtry=15
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- if [[ -S "${socket}" ]] ; then
- # Even with a socket we don't know if mysqld will abort
- # start due to an error so just wait a little bit more...
- maxtry=5
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
- fi
-
- echo
-
- if [[ ! -S "${socket}" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
- fi
-
- local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
- touch "${mysql_logfile}" || die
-
- ebegin "Setting root password"
- # Do this from memory, as we don't want clear text passwords in temp files
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
- cmd=(
- "${mysql_binary}"
- --no-defaults
- "--socket='${socket}'"
- -hlocalhost
- "-e \"${sql}\""
- )
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
- local rc=$?
- eend ${rc}
-
- if [[ ${rc} -ne 0 ]] ; then
- # Poor man's solution which tries to avoid having password
- # in log. NOTE: sed can fail if user didn't follow advice
- # and included character which will require escaping...
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
-
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
- fi
-
- # Stop the server
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- echo -n "Stopping the server "
- pkill -F "${pidfile}" &>/dev/null
-
- maxtry=10
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- echo
-
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- # We somehow failed to stop server.
- # However, not a fatal error. Just warn the user.
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
- fi
- fi
-
- rm -r "${SETUP_TMPDIR}" || die
-
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
-}
diff --git a/dev-db/mariadb/mariadb-10.6.5-r1.ebuild b/dev-db/mariadb/mariadb-10.6.5-r1.ebuild
deleted file mode 100644
index 0d12908c713b..000000000000
--- a/dev-db/mariadb/mariadb-10.6.5-r1.ebuild
+++ /dev/null
@@ -1,1311 +0,0 @@
-# Copyright 1999-2022 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,dlan}/dist/${PN}/${PN}-10.6.5-patches-04.tar.xz )
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET[@]}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
- innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
- numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
- sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
- test xml yassl"
-
-RESTRICT="!bindist? ( bindist ) !test? ( test )"
-
-REQUIRED_USE="jdbc? ( extraengine server !static )
- ?? ( tcmalloc jemalloc )
- static? ( yassl !pam )"
-
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
-
-# Shorten the path because the socket path length must be shorter than 107 chars
-# and we will run a mysql server during test phase
-S="${WORKDIR}/mysql"
-
-# Be warned, *DEPEND are version-dependant
-# These are used for both runtime and compiletime
-COMMON_DEPEND="
- >=dev-libs/libpcre2-10.34:=
- >=sys-apps/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"
-DEPEND="${COMMON_DEPEND}
- server? (
- extraengine? ( jdbc? ( >=virtual/jdk-1.8 ) )
- test? ( acct-group/mysql acct-user/mysql )
- )
- static? ( sys-libs/ncurses[static-libs] )
-"
-RDEPEND="${COMMON_DEPEND}
- !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
- !dev-db/mariadb:0
- !dev-db/mariadb:5.5
- !dev-db/mariadb:10.1
- !dev-db/mariadb:10.2
- !dev-db/mariadb:10.3
- !dev-db/mariadb:10.4
- !dev-db/mariadb:10.5
- !dev-db/mariadb:10.7
- !dev-db/mariadb:10.8
- !<virtual/mysql-5.6-r11
- !<virtual/libmysqlclient-18-r1
- selinux? ( sec-policy/selinux-mysql )
- server? (
- columnstore? ( dev-db/mariadb-connector-c )
- extraengine? ( jdbc? ( >=virtual/jre-1.8 ) )
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-26*
- sst-rsync? ( sys-process/lsof )
- sst-mariabackup? ( net-misc/socat[ssl] )
- )
- !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
- )
-"
-# For other stuff to bring us in
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
-
-mysql_init_vars() {
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
-
- if [[ -z "${MY_DATADIR}" ]] ; then
- MY_DATADIR=""
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
- MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
- | sed -ne '/datadir/s|^--datadir=||p' \
- | tail -n1)
- if [[ -z "${MY_DATADIR}" ]] ; then
- MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
- | sed -e 's/.*=\s*//' \
- | tail -n1)
- fi
- fi
- if [[ -z "${MY_DATADIR}" ]] ; then
- MY_DATADIR="${MY_LOCALSTATEDIR}"
- einfo "Using default MY_DATADIR"
- fi
- elog "MySQL MY_DATADIR is ${MY_DATADIR}"
-
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
- if [[ -e "${MY_DATADIR}" ]] ; then
- # If you get this and you're wondering about it, see bug #207636
- elog "MySQL datadir found in ${MY_DATADIR}"
- elog "A new one will not be created."
- PREVIOUS_DATADIR="yes"
- else
- PREVIOUS_DATADIR="no"
- fi
- export PREVIOUS_DATADIR
- fi
- else
- if [[ ${EBUILD_PHASE} == "config" ]]; then
- local new_MY_DATADIR
- new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
- | sed -ne '/datadir/s|^--datadir=||p' \
- | tail -n1)
-
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
- ewarn "MySQL MY_DATADIR has changed"
- ewarn "from ${MY_DATADIR}"
- ewarn "to ${new_MY_DATADIR}"
- MY_DATADIR="${new_MY_DATADIR}"
- fi
- fi
- fi
-
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR
- export MY_LOCALSTATEDIR MY_LOGDIR
- export MY_DATADIR
-}
-
-pkg_setup() {
- if [[ ${MERGE_TYPE} != binary ]] ; then
- if has test ${FEATURES} ; then
- # Bug #213475 - MySQL _will_ object strenuously if your machine is named
- # localhost. Also causes weird failures.
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
- if ! has userpriv ${FEATURES} ; then
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
- fi
- fi
- fi
-
- java-pkg-opt-2_pkg_setup
-}
-
-src_unpack() {
- unpack ${A}
-
- mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
-}
-
-src_prepare() {
- eapply "${WORKDIR}"/mariadb-patches
-
- eapply_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_SEQUENCE=$(usex extraengine YES NO)
- -DPLUGIN_SPIDER=$(usex extraengine YES NO)
- -DPLUGIN_S3=$(usex s3 YES NO)
- -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO)
- -DCONNECT_WITH_MYSQL=1
- -DCONNECT_WITH_LIBXML2=$(usex xml)
- -DCONNECT_WITH_ODBC=$(usex odbc)
- -DCONNECT_WITH_JDBC=$(usex jdbc)
- # Build failure and autodep wrt bug 639144
- -DCONNECT_WITH_MONGO=OFF
- -DWITH_WSREP=$(usex galera)
- -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
- -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
- -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
- -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
- -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
- -DWITH_MARIABACKUP=$(usex backup ON OFF)
- -DWITH_LIBARCHIVE=$(usex backup ON OFF)
- -DINSTALL_SQLBENCHDIR=""
- -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
- # systemd is only linked to for server notification
- -DWITH_SYSTEMD=$(usex systemd yes no)
- -DWITH_NUMA=$(usex numa ON OFF)
- )
-
- if use test ; then
- # This is needed for the new client lib which tests a real, open server
- mycmakeargs+=( -DSKIP_TESTS=ON )
- fi
-
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
- ewarn "You MUST file bugs without these variables set."
-
- mycmakeargs+=(
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
- )
-
- elif ! use latin1 ; then
- mycmakeargs+=(
- -DDEFAULT_CHARSET=utf8mb4
- -DDEFAULT_COLLATION=utf8mb4_unicode_520_ci
- )
- else
- mycmakeargs+=(
- -DDEFAULT_CHARSET=latin1
- -DDEFAULT_COLLATION=latin1_swedish_ci
- )
- fi
- mycmakeargs+=(
- -DEXTRA_CHARSETS=all
- -DMYSQL_USER=mysql
- -DDISABLE_SHARED=$(usex static YES NO)
- -DWITH_DEBUG=$(usex debug)
- -DWITH_EMBEDDED_SERVER=OFF
- -DWITH_PROFILING=$(usex profiling)
- )
-
- if use static; then
- mycmakeargs+=( -DWITH_PIC=1 )
- fi
-
- if use jemalloc || use tcmalloc ; then
- mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
- fi
-
- # Storage engines
- mycmakeargs+=(
- -DWITH_ARCHIVE_STORAGE_ENGINE=1
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1
- -DWITH_CSV_STORAGE_ENGINE=1
- -DWITH_HEAP_STORAGE_ENGINE=1
- -DWITH_INNOBASE_STORAGE_ENGINE=1
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1
- -DWITH_MYISAM_STORAGE_ENGINE=1
- -DWITH_PARTITION_STORAGE_ENGINE=1
- )
- else
- mycmakeargs+=(
- -DWITHOUT_SERVER=1
- -DWITH_EMBEDDED_SERVER=OFF
- -DEXTRA_CHARSETS=none
- -DINSTALL_SQLBENCHDIR=
- -DWITH_SYSTEMD=no
- )
- fi
-
- cmake_src_configure
-}
-
-src_compile() {
- cmake_src_compile
-}
-
-# Official test instructions:
-# USE='extraengine perl server' \
-# FEATURES='test userpriv' \
-# ebuild mariadb-X.X.XX.ebuild \
-# digest clean package
-src_test() {
- _disable_test() {
- local rawtestname bug reason
- rawtestname="${1}" ; shift
- bug="${1}" ; shift
- reason="${@}"
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
- echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
- }
-
- local TESTDIR="${BUILD_DIR}/mysql-test"
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.mysql_upgrade;27044;Sporadically failing test" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
- disabled_tests+=( "perfschema.privilege_table_io;27045;Sporadically failing test" )
- disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
- disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
- disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
- disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
- disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
-
- if ! use latin1 ; then
- disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
- disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
- disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
- disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
- disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
- fi
-
- local test_infos_str test_infos_arr
- for test_infos_str in "${disabled_tests[@]}" ; do
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
-
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then
- die "Invalid test data set, not matching format: ${test_infos_str}"
- fi
-
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
- done
- unset test_infos_str test_infos_arr
-
- # run mysql-test tests
- pushd "${TESTDIR}" &>/dev/null || die
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
- retstatus_tests=$?
-
- popd &>/dev/null || die
-
- # Cleanup is important for these testcases.
- pkill -9 -f "${S}/ndb" 2>/dev/null
- pkill -9 -f "${S}/sql" 2>/dev/null
-
- local failures=""
- [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
-
- [[ -z "${failures}" ]] || die "Test failures: ${failures}"
- einfo "Tests successfully completed"
-}
-
-src_install() {
- cmake_src_install
-
- # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
- if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
- rm "${ED}/usr/include/mysql/server/private/config.h" || die
- fi
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Convenience links
- einfo "Making Convenience links for mysqlcheck multi-call binary"
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
- dosym "mysqlcheck" "/usr/bin/mysqlrepair"
- dosym "mysqlcheck" "/usr/bin/mysqloptimize"
-
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
- if [[ -d "${ED}/usr/data" ]] ; then
- rm -Rf "${ED}/usr/data" || die
- fi
-
- # Unless they explicitly specific USE=test, then do not install the
- # testsuite. It DOES have a use to be installed, esp. when you want to do a
- # validation of your database configuration after tuning it.
- if ! use test ; then
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
- fi
-
- # Configuration stuff
- einfo "Building default configuration ..."
- insinto "${MY_SYSCONFDIR#${EPREFIX}}"
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
- cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
- eprefixify "${TMPDIR}/my.cnf"
- doins "${TMPDIR}/my.cnf"
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
- eprefixify "${TMPDIR}/50-distro-client.cnf"
- doins "${TMPDIR}/50-distro-client.cnf"
-
- if use server ; then
- mycnf_src="my.cnf.distro-server"
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
- "${FILESDIR}/${mycnf_src}" \
- > "${TMPDIR}/my.cnf.ok" || die
- if use prefix ; then
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- if use latin1 ; then
- sed -i \
- -e "/character-set/s|utf8|latin1|g" \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- eprefixify "${TMPDIR}/my.cnf.ok"
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
-
- einfo "Including support files and sample configurations"
- docinto "support-files"
- local script
- for script in \
- "${S}"/support-files/magic
- do
- [[ -f "$script" ]] && dodoc "${script}"
- done
-
- docinto "scripts"
- for script in "${S}"/scripts/mysql* ; do
- [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
- done
- # Manually install supporting files that conflict with other packages
- # but are needed for galera and initial installation
- exeinto /usr/libexec/mariadb
- doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
-
- if use pam ; then
- keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
- fi
- fi
-
- # Conflicting files
- conflicting_files=()
-
- # We prefer my_print_defaults from dev-db/mysql-connector-c
- conflicting_files=( "${ED}/usr/share/man/man1/my_print_defaults.1" )
-
- # Remove bundled mytop in favor of dev-db/mytop
- conflicting_files+=( "${ED}/usr/bin/mytop" )
- conflicting_files+=( "${ED}/usr/share/man/man1/mytop.1" )
-
- local conflicting_file
- for conflicting_file in "${conflicting_files[@]}" ; do
- if [[ -e "${conflicting_file}" ]] ; then
- rm -v "${conflicting_file}" || die
- fi
- done
-
- # Fix a dangling symlink when galera is not built
- if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
- rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
- fi
-
- # Remove broken SST scripts that are incompatible
- local scriptremove
- for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
- if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
- rm "${ED}/usr/bin/${scriptremove}" || die
- fi
- done
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-}
-
-pkg_postinst() {
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Create log directory securely if it does not exist
- [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
-
- if use server ; then
- if use pam; then
- einfo
- elog "This install includes the PAM authentication plugin."
- elog "To activate and configure the PAM plugin, please read:"
- elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
- einfo
- chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
- fi
-
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then
- einfo
- elog "You might want to run:"
- elog "\"emerge --config =${CATEGORY}/${PF}\""
- elog "if this is a new install."
- elog
- elog "If you are switching server implentations, you should run the"
- elog "mysql_upgrade tool."
- einfo
- else
- einfo
- elog "If you are upgrading major versions, you should run the"
- elog "mysql_upgrade tool."
- einfo
- fi
-
- if use galera ; then
- einfo
- elog "Be sure to edit the my.cnf file to activate your cluster settings."
- elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
- elog "The first time the cluster is activated, you should add"
- elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
- elog "This option should then be removed for subsequent starts."
- einfo
- if [[ -n "${REPLACING_VERSIONS}" ]] ; then
- local rver
- for rver in ${REPLACING_VERSIONS} ; do
- if ver_test "${rver}" -lt "10.4.0" ; then
- ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
- ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
- ewarn "for more information"
- fi
- done
- fi
- fi
- fi
-
- # Note about configuration change
- einfo
- elog "This version of mariadb reorganizes the configuration from a single my.cnf"
- elog "to several files in /etc/mysql/${PN}.d."
- elog "Please backup any changes you made to /etc/mysql/my.cnf"
- elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
- elog "You may have as many files as needed and they are read alphabetically."
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
- einfo
-}
-
-pkg_config() {
- _getoptval() {
- local section="${1}"
- local option="--${2}"
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
-
- local values=()
- local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
- for parameter in "${parameters[@]}"
- do
- # my_print_defaults guarantees output of options, one per line,
- # in the form that they would be specified on the command line.
- # So checking for --option=* should be safe.
- case ${parameter} in
- ${option}=*)
- values+=( "${parameter#*=}" )
- ;;
- esac
- done
-
- if [[ ${#values[@]} -gt 0 ]] ; then
- # Option could have been set multiple times
- # in which case only the last occurrence
- # contains the current value
- echo "${values[-1]}"
- fi
- }
-
- _mktemp_dry() {
- # emktemp has no --dry-run option
- local template="${1}"
-
- if [[ -z "${template}" ]] ; then
- if [[ -z "${T}" ]] ; then
- template="/tmp/XXXXXXX"
- else
- template="${T}/XXXXXXX"
- fi
- fi
-
- local template_wo_X=${template//X/}
- local n_X
- let n_X=${#template}-${#template_wo_X}
- if [[ ${n_X} -lt 3 ]] ; then
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
- return
- fi
-
- local attempts=0
- local character tmpfile
- while [[ true ]] ; do
- let attempts=attempts+1
-
- new_file=
- while read -n1 character ; do
- if [[ "${character}" == "X" ]] ; then
- tmpfile+="${RANDOM:0:1}"
- else
- tmpfile+="${character}"
- fi
- done < <(echo -n "${template}")
-
- if [[ ! -f "${tmpfile}" ]]
- then
- echo "${tmpfile}"
- return
- fi
-
- if [[ ${attempts} -ge 100 ]] ; then
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
- return
- fi
- done
- }
-
- local mysql_binary="${EROOT}/usr/bin/mysql"
- if [[ ! -x "${mysql_binary}" ]] ; then
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysqld_binary="${EROOT}/usr/sbin/mysqld"
- if [[ ! -x "${mysqld_binary}" ]] ; then
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
- if [[ ! -x "${mysql_install_db_binary}" ]] ; then
- die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
- fi
-
- if [[ -z "${MYSQL_USER}" ]] ; then
- MYSQL_USER=mysql
- if use prefix ; then
- MYSQL_USER=$(id -u -n 2>/dev/null)
- if [[ -z "${MYSQL_USER}" ]] ; then
- die "Failed to determine current username!"
- fi
- fi
- fi
-
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- MYSQL_GROUP=mysql
- if use prefix ; then
- MYSQL_GROUP=$(id -g -n 2>/dev/null)
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- die "Failed to determine current user groupname!"
- fi
- fi
- fi
-
- # my_print_defaults needs to read stuff in $HOME/.my.cnf
- local -x HOME="${EROOT}/root"
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Read currently set data directory
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
-
- # Bug #213475 - MySQL _will_ object strenously if your machine is named
- # localhost. Also causes weird failures.
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
- if [[ -z "${MY_DATADIR}" ]] ; then
- die "Sorry, unable to find MY_DATADIR!"
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
- ewarn "Please rename or delete its content if you wish to initialize a new data directory."
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
- fi
-
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
- # These are dir+prefix
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
-
- # Create missing directories.
- # Always check if mysql user can write to directory even if we just
- # created directory because a parent directory might be not
- # accessible for that user.
- PID_DIR="${EROOT}/run/mysqld"
- if [[ ! -d "${PID_DIR}" ]] ; then
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
- || die "Failed to create PID directory '${PID_DIR}'!"
- fi
-
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_pid_dir_testfile}" ]] \
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_pid_dir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
- else
- rm "${_pid_dir_testfile}" || die
- unset _pid_dir_testfile
- fi
-
- if [[ ! -d "${MY_DATADIR}" ]] ; then
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
- fi
-
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_datadir_testfile}" ]] \
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_datadir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
- else
- rm "${_my_datadir_testfile}" || die
- unset _my_datadir_testfile
- fi
-
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
- fi
-
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
- [[ -z "${MYSQL_TMPDIR}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
-
- mkdir "${MYSQL_TMPDIR}" || die
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
- fi
-
- # Now we need to test MYSQL_TMPDIR...
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_tmpdir_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_tmpdir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
- else
- rm "${_my_tmpdir_testfile}" || die
- unset _my_tmpdir_testfile
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- # Only create directory when MYSQL_LOG_BIN is an absolute path
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Only test when MYSQL_LOG_BIN is an absolute path
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_logbin_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_logbin_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
- else
- rm "${_my_logbin_testfile}" || die
- unset _my_logbin_testfile
- fi
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- # Only create directory when MYSQL_RELAY_LOG is an absolute path
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Only test when MYSQL_RELAY_LOG is an absolute path
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_relaylog_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_relaylog_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
- else
- rm "${_my_relaylog_testfile}" || die
- unset _my_relaylog_testfile
- fi
- fi
-
- local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
- [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
-
- # Limit access
- chmod 0770 "${SETUP_TMPDIR}" || die
- chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
-
- local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
- local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
-
- echo ""
- einfo "Detected settings:"
- einfo "=================="
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Absolute path for binary log files specified
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Absolute path for relay log files specified
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
- fi
-
- einfo "PID DIR:\t\t\t\t${PID_DIR}"
- einfo "Install db log:\t\t\t${mysql_install_log}"
- einfo "Install server log:\t\t\t${mysqld_logfile}"
-
- echo
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local tmp_mysqld_password_source=
-
- for tmp_mysqld_password_source in mysql client ; do
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
- MYSQL_ROOT_PASSWORD=
- continue
- fi
-
- einfo "Found password in '${tmp_mysqld_password_source}' section!"
- break
- fi
- done
-
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
- fi
-
- unset tmp_mysqld_password_source
- fi
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local pwd1="a"
- local pwd2="b"
-
- echo
- einfo "No password for mysql 'root' user was specified via environment"
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
- einfo "file like '${HOME}/.my.cnf'."
- einfo "To continue please provide a password for the mysql 'root' user"
- einfo "now on console:"
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
- read -rsp " >" pwd1 ; echo
-
- einfo "Retype the password"
- read -rsp " >" pwd2 ; echo
-
- if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
- die "Passwords are not the same!"
- fi
-
- MYSQL_ROOT_PASSWORD="${pwd1}"
- unset pwd1 pwd2
-
- echo
- fi
-
- local -a mysqld_options
-
- # Fix bug 446200. Don't reference host my.cnf, needs to come first,
- # see http://bugs.mysql.com/bug.php?id=31312
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
-
- # Figure out which options we need to disable to do the setup
- local helpfile="${TMPDIR}/mysqld-help"
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
-
- local opt optexp optfull
- for opt in host-cache name-resolve networking slave-start \
- federated ssl log-bin relay-log slow-query-log external-locking \
- log-slave-updates \
- ; do
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--skip-test-db"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Initializing ${PN} data directory: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
-
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
- fi
-
- local x=${RANDOM}
- local socket="${PID_DIR}/mysqld.${x}.sock"
- [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
- local pidfile="${PID_DIR}/mysqld.${x}.pid"
- [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
- unset x
-
- cmd=(
- "${mysqld_binary}"
- "${mysqld_options[@]}"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- --max_allowed_packet=8M
- --net_buffer_length=16K
- "--socket='${socket}'"
- "--pid-file='${pidfile}'"
- "--log-error='${mysqld_logfile}'"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
-
- echo -n "Waiting for mysqld to accept connections "
- local maxtry=15
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- if [[ -S "${socket}" ]] ; then
- # Even with a socket we don't know if mysqld will abort
- # start due to an error so just wait a little bit more...
- maxtry=5
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
- fi
-
- echo
-
- if [[ ! -S "${socket}" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
- fi
-
- local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
- touch "${mysql_logfile}" || die
-
- ebegin "Setting root password"
- # Do this from memory, as we don't want clear text passwords in temp files
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
- cmd=(
- "${mysql_binary}"
- --no-defaults
- "--socket='${socket}'"
- -hlocalhost
- "-e \"${sql}\""
- )
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
- local rc=$?
- eend ${rc}
-
- if [[ ${rc} -ne 0 ]] ; then
- # Poor man's solution which tries to avoid having password
- # in log. NOTE: sed can fail if user didn't follow advice
- # and included character which will require escaping...
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
-
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
- fi
-
- # Stop the server
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- echo -n "Stopping the server "
- pkill -F "${pidfile}" &>/dev/null
-
- maxtry=10
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- echo
-
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- # We somehow failed to stop server.
- # However, not a fatal error. Just warn the user.
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
- fi
- fi
-
- rm -r "${SETUP_TMPDIR}" || die
-
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
-}
diff --git a/dev-db/mariadb/mariadb-10.6.8.ebuild b/dev-db/mariadb/mariadb-10.6.8.ebuild
deleted file mode 100644
index fc46726c5ef8..000000000000
--- a/dev-db/mariadb/mariadb-10.6.8.ebuild
+++ /dev/null
@@ -1,1316 +0,0 @@
-# Copyright 1999-2022 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://github.com/hydrapolic/gentoo-dist/raw/master/mariadb/mariadb-10.6.8-patches-01.tar.xz"
-
-SRC_URI="mirror://mariadb/${PN}-${PV}/source/${P}.tar.gz
- ${PATCH_SET[@]}"
-
-HOMEPAGE="https://mariadb.org/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2 LGPL-2.1+"
-SLOT="$(ver_cut 1-2)/${SUBSLOT:-0}"
-IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
- innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 mroonga
- numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
- sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
- test xml yassl"
-
-RESTRICT="!bindist? ( bindist ) !test? ( test )"
-
-REQUIRED_USE="jdbc? ( extraengine server !static )
- ?? ( tcmalloc jemalloc )
- static? ( yassl !pam )"
-
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris"
-
-# Shorten the path because the socket path length must be shorter than 107 chars
-# and we will run a mysql server during test phase
-S="${WORKDIR}/mysql"
-
-# Be warned, *DEPEND are version-dependant
-# These are used for both runtime and compiletime
-COMMON_DEPEND="
- >=dev-libs/libpcre2-10.34:=
- >=sys-apps/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"
-DEPEND="${COMMON_DEPEND}
- server? (
- extraengine? ( jdbc? ( >=virtual/jdk-1.8 ) )
- test? ( acct-group/mysql acct-user/mysql )
- )
- static? ( sys-libs/ncurses[static-libs] )
-"
-RDEPEND="${COMMON_DEPEND}
- !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
- !dev-db/mariadb:0
- !dev-db/mariadb:5.5
- !dev-db/mariadb:10.1
- !dev-db/mariadb:10.2
- !dev-db/mariadb:10.3
- !dev-db/mariadb:10.4
- !dev-db/mariadb:10.5
- !dev-db/mariadb:10.7
- !dev-db/mariadb:10.8
- !<virtual/mysql-5.6-r11
- !<virtual/libmysqlclient-18-r1
- selinux? ( sec-policy/selinux-mysql )
- server? (
- columnstore? ( dev-db/mariadb-connector-c )
- extraengine? ( jdbc? ( >=virtual/jre-1.8 ) )
- galera? (
- sys-apps/iproute2
- =sys-cluster/galera-26*
- sst-rsync? ( sys-process/lsof )
- sst-mariabackup? ( net-misc/socat[ssl] )
- )
- !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
- )
-"
-# For other stuff to bring us in
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
-
-mysql_init_vars() {
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
-
- if [[ -z "${MY_DATADIR}" ]] ; then
- MY_DATADIR=""
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
- MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
- | sed -ne '/datadir/s|^--datadir=||p' \
- | tail -n1)
- if [[ -z "${MY_DATADIR}" ]] ; then
- MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
- | sed -e 's/.*=\s*//' \
- | tail -n1)
- fi
- fi
- if [[ -z "${MY_DATADIR}" ]] ; then
- MY_DATADIR="${MY_LOCALSTATEDIR}"
- einfo "Using default MY_DATADIR"
- fi
- elog "MySQL MY_DATADIR is ${MY_DATADIR}"
-
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
- if [[ -e "${MY_DATADIR}" ]] ; then
- # If you get this and you're wondering about it, see bug #207636
- elog "MySQL datadir found in ${MY_DATADIR}"
- elog "A new one will not be created."
- PREVIOUS_DATADIR="yes"
- else
- PREVIOUS_DATADIR="no"
- fi
- export PREVIOUS_DATADIR
- fi
- else
- if [[ ${EBUILD_PHASE} == "config" ]]; then
- local new_MY_DATADIR
- new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
- | sed -ne '/datadir/s|^--datadir=||p' \
- | tail -n1)
-
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
- ewarn "MySQL MY_DATADIR has changed"
- ewarn "from ${MY_DATADIR}"
- ewarn "to ${new_MY_DATADIR}"
- MY_DATADIR="${new_MY_DATADIR}"
- fi
- fi
- fi
-
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR
- export MY_LOCALSTATEDIR MY_LOGDIR
- export MY_DATADIR
-}
-
-pkg_setup() {
- if [[ ${MERGE_TYPE} != binary ]] ; then
- if has test ${FEATURES} ; then
- # Bug #213475 - MySQL _will_ object strenuously if your machine is named
- # localhost. Also causes weird failures.
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
- if ! has userpriv ${FEATURES} ; then
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
- fi
- fi
- fi
-
- java-pkg-opt-2_pkg_setup
-}
-
-src_unpack() {
- unpack ${A}
-
- mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
-}
-
-src_prepare() {
- eapply "${WORKDIR}"/mariadb-patches
-
- eapply_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_SEQUENCE=$(usex extraengine YES NO)
- -DPLUGIN_SPIDER=$(usex extraengine YES NO)
- -DPLUGIN_S3=$(usex s3 YES NO)
- -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO)
- -DCONNECT_WITH_MYSQL=1
- -DCONNECT_WITH_LIBXML2=$(usex xml)
- -DCONNECT_WITH_ODBC=$(usex odbc)
- -DCONNECT_WITH_JDBC=$(usex jdbc)
- # Build failure and autodep wrt bug 639144
- -DCONNECT_WITH_MONGO=OFF
- -DWITH_WSREP=$(usex galera)
- -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
- -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
- -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
- -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
- -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
- -DWITH_MARIABACKUP=$(usex backup ON OFF)
- -DWITH_LIBARCHIVE=$(usex backup ON OFF)
- -DINSTALL_SQLBENCHDIR=""
- -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
- # systemd is only linked to for server notification
- -DWITH_SYSTEMD=$(usex systemd yes no)
- -DWITH_NUMA=$(usex numa ON OFF)
- )
-
- if use test ; then
- # This is needed for the new client lib which tests a real, open server
- mycmakeargs+=( -DSKIP_TESTS=ON )
- fi
-
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
- ewarn "You MUST file bugs without these variables set."
-
- mycmakeargs+=(
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
- )
-
- elif ! use latin1 ; then
- mycmakeargs+=(
- -DDEFAULT_CHARSET=utf8mb4
- -DDEFAULT_COLLATION=utf8mb4_unicode_520_ci
- )
- else
- mycmakeargs+=(
- -DDEFAULT_CHARSET=latin1
- -DDEFAULT_COLLATION=latin1_swedish_ci
- )
- fi
- mycmakeargs+=(
- -DEXTRA_CHARSETS=all
- -DMYSQL_USER=mysql
- -DDISABLE_SHARED=$(usex static YES NO)
- -DWITH_DEBUG=$(usex debug)
- -DWITH_EMBEDDED_SERVER=OFF
- -DWITH_PROFILING=$(usex profiling)
- )
-
- if use static; then
- mycmakeargs+=( -DWITH_PIC=1 )
- fi
-
- if use jemalloc || use tcmalloc ; then
- mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
- fi
-
- # Storage engines
- mycmakeargs+=(
- -DWITH_ARCHIVE_STORAGE_ENGINE=1
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1
- -DWITH_CSV_STORAGE_ENGINE=1
- -DWITH_HEAP_STORAGE_ENGINE=1
- -DWITH_INNOBASE_STORAGE_ENGINE=1
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1
- -DWITH_MYISAM_STORAGE_ENGINE=1
- -DWITH_PARTITION_STORAGE_ENGINE=1
- )
- else
- mycmakeargs+=(
- -DWITHOUT_SERVER=1
- -DWITH_EMBEDDED_SERVER=OFF
- -DEXTRA_CHARSETS=none
- -DINSTALL_SQLBENCHDIR=
- -DWITH_SYSTEMD=no
- )
- fi
-
- cmake_src_configure
-}
-
-src_compile() {
- cmake_src_compile
-}
-
-# Official test instructions:
-# USE='extraengine perl server' \
-# FEATURES='test userpriv' \
-# ebuild mariadb-X.X.XX.ebuild \
-# digest clean package
-src_test() {
- _disable_test() {
- local rawtestname bug reason
- rawtestname="${1}" ; shift
- bug="${1}" ; shift
- reason="${@}"
- ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
- echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
- }
-
- local TESTDIR="${BUILD_DIR}/mysql-test"
- local retstatus_tests
-
- if ! use server ; then
- einfo "Skipping server tests due to minimal build."
- return 0
- fi
-
- # Ensure that parallel runs don't die
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-
- if [[ -z "${MTR_PARALLEL}" ]] ; then
- local -x MTR_PARALLEL=$(makeopts_jobs)
-
- if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
- # Running multiple tests in parallel usually require higher ulimit
- # and fs.aio-max-nr setting. In addition, tests like main.multi_update
- # are known to hit timeout when system is busy.
- # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
- # using "auto".
- local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
- info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
- einfo "${info_msg}"
- unset info_msg
- MTR_PARALLEL=4
- fi
- else
- einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
- fi
-
- # Try to increase file limits to increase test coverage
- if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
- # Upper limit comes from parts.partition_* tests
- ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
-
- if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
- # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
- ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
-
- if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
- ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
- else
- einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
- fi
- else
- einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
- fi
-
- # create directories because mysqladmin might run out of order
- mkdir -p "${T}"/var-tests{,/log} || die
-
- if [[ ! -f "${S}/mysql-test/unstable-tests" ]] ; then
- touch "${S}"/mysql-test/unstable-tests || die
- fi
-
- cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
-
- local -a disabled_tests
- disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
- disabled_tests+=( "innodb_gis.1;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "innodb_gis.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.gis;25095;Known rounding error with latest AMD processors" )
- disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
- disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
- disabled_tests+=( "main.mysql_upgrade;27044;Sporadically failing test" )
- disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
- disabled_tests+=( "main.selectivity_no_engine;26320;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
- disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
- disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" )
- disabled_tests+=( "mariabackup.*;0;Broken test suite" )
- disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
- disabled_tests+=( "perfschema.prepared_statements;0;Broken test suite" )
- disabled_tests+=( "perfschema.privilege_table_io;27045;Sporadically failing test" )
- disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
- disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
- disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
- disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
- disabled_tests+=( "spider.*;0;Fails with network sandbox" )
- disabled_tests+=( "sys_vars.wsrep_on_without_provider;25625;Known to be broken" )
-
- if ! use latin1 ; then
- disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
- disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
- disabled_tests+=( "main.sp2;24177;Requires USE=latin1" )
- disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
- disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" )
- fi
-
- local test_infos_str test_infos_arr
- for test_infos_str in "${disabled_tests[@]}" ; do
- IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
-
- if [[ ${#test_infos_arr[@]} != 3 ]] ; then
- die "Invalid test data set, not matching format: ${test_infos_str}"
- fi
-
- _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
- done
- unset test_infos_str test_infos_arr
-
- # run mysql-test tests
- pushd "${TESTDIR}" &>/dev/null || die
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
- retstatus_tests=$?
-
- popd &>/dev/null || die
-
- # Cleanup is important for these testcases.
- pkill -9 -f "${S}/ndb" 2>/dev/null
- pkill -9 -f "${S}/sql" 2>/dev/null
-
- local failures=""
- [[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
-
- [[ -z "${failures}" ]] || die "Test failures: ${failures}"
- einfo "Tests successfully completed"
-}
-
-src_install() {
- cmake_src_install
-
- # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
- if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
- rm "${ED}/usr/include/mysql/server/private/config.h" || die
- fi
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Convenience links
- einfo "Making Convenience links for mysqlcheck multi-call binary"
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
- dosym "mysqlcheck" "/usr/bin/mysqlrepair"
- dosym "mysqlcheck" "/usr/bin/mysqloptimize"
-
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
- if [[ -d "${ED}/usr/data" ]] ; then
- rm -Rf "${ED}/usr/data" || die
- fi
-
- # Unless they explicitly specific USE=test, then do not install the
- # testsuite. It DOES have a use to be installed, esp. when you want to do a
- # validation of your database configuration after tuning it.
- if ! use test ; then
- rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
- fi
-
- # Configuration stuff
- einfo "Building default configuration ..."
- insinto "${MY_SYSCONFDIR#${EPREFIX}}"
- [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
- cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
- eprefixify "${TMPDIR}/my.cnf"
- doins "${TMPDIR}/my.cnf"
- insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
- cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
- eprefixify "${TMPDIR}/50-distro-client.cnf"
- doins "${TMPDIR}/50-distro-client.cnf"
-
- if use server ; then
- mycnf_src="my.cnf.distro-server"
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
- "${FILESDIR}/${mycnf_src}" \
- > "${TMPDIR}/my.cnf.ok" || die
- if use prefix ; then
- sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- if use latin1 ; then
- sed -i \
- -e "/character-set/s|utf8|latin1|g" \
- "${TMPDIR}/my.cnf.ok" || die
- fi
- eprefixify "${TMPDIR}/my.cnf.ok"
- newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
-
- einfo "Including support files and sample configurations"
- docinto "support-files"
- local script
- for script in \
- "${S}"/support-files/magic
- do
- [[ -f "$script" ]] && dodoc "${script}"
- done
-
- docinto "scripts"
- for script in "${S}"/scripts/mysql* ; do
- [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
- done
- # Manually install supporting files that conflict with other packages
- # but are needed for galera and initial installation
- exeinto /usr/libexec/mariadb
- doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
-
- if use pam ; then
- keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
- fi
- fi
-
- # Conflicting files
- conflicting_files=()
-
- # We prefer my_print_defaults from dev-db/mysql-connector-c
- conflicting_files=( "${ED}/usr/share/man/man1/my_print_defaults.1" )
-
- # Remove bundled mytop in favor of dev-db/mytop
- conflicting_files+=( "${ED}/usr/bin/mytop" )
- conflicting_files+=( "${ED}/usr/share/man/man1/mytop.1" )
-
- local conflicting_file
- for conflicting_file in "${conflicting_files[@]}" ; do
- if [[ -e "${conflicting_file}" ]] ; then
- rm -v "${conflicting_file}" || die
- fi
- done
-
- # Fix a dangling symlink when galera is not built
- if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
- rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
- fi
-
- # Remove dangling symlink
- rm "${ED}/usr/$(get_libdir)/libmariadb.a" || die
-
- # Remove broken SST scripts that are incompatible
- local scriptremove
- for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
- if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
- rm "${ED}/usr/bin/${scriptremove}" || die
- fi
- done
-}
-
-pkg_preinst() {
- java-pkg-opt-2_pkg_preinst
-}
-
-pkg_postinst() {
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Create log directory securely if it does not exist
- [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
-
- if use server ; then
- if use pam; then
- einfo
- elog "This install includes the PAM authentication plugin."
- elog "To activate and configure the PAM plugin, please read:"
- elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
- einfo
- chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
- fi
-
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then
- einfo
- elog "You might want to run:"
- elog "\"emerge --config =${CATEGORY}/${PF}\""
- elog "if this is a new install."
- elog
- elog "If you are switching server implentations, you should run the"
- elog "mysql_upgrade tool."
- einfo
- else
- einfo
- elog "If you are upgrading major versions, you should run the"
- elog "mysql_upgrade tool."
- einfo
- fi
-
- if use galera ; then
- einfo
- elog "Be sure to edit the my.cnf file to activate your cluster settings."
- elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
- elog "The first time the cluster is activated, you should add"
- elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
- elog "This option should then be removed for subsequent starts."
- einfo
- if [[ -n "${REPLACING_VERSIONS}" ]] ; then
- local rver
- for rver in ${REPLACING_VERSIONS} ; do
- if ver_test "${rver}" -lt "10.4.0" ; then
- ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
- ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
- ewarn "for more information"
- fi
- done
- fi
- fi
- fi
-
- # Note about configuration change
- einfo
- elog "This version of mariadb reorganizes the configuration from a single my.cnf"
- elog "to several files in /etc/mysql/${PN}.d."
- elog "Please backup any changes you made to /etc/mysql/my.cnf"
- elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
- elog "You may have as many files as needed and they are read alphabetically."
- elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
- einfo
-}
-
-pkg_config() {
- _getoptval() {
- local section="${1}"
- local option="--${2}"
- local extra_options="${3}"
- local cmd=(
- "${my_print_defaults_binary}"
- "${extra_options}"
- "${section}"
- )
-
- local values=()
- local parameters=( $(eval "${cmd[@]}" 2>/dev/null) )
- for parameter in "${parameters[@]}"
- do
- # my_print_defaults guarantees output of options, one per line,
- # in the form that they would be specified on the command line.
- # So checking for --option=* should be safe.
- case ${parameter} in
- ${option}=*)
- values+=( "${parameter#*=}" )
- ;;
- esac
- done
-
- if [[ ${#values[@]} -gt 0 ]] ; then
- # Option could have been set multiple times
- # in which case only the last occurrence
- # contains the current value
- echo "${values[-1]}"
- fi
- }
-
- _mktemp_dry() {
- # emktemp has no --dry-run option
- local template="${1}"
-
- if [[ -z "${template}" ]] ; then
- if [[ -z "${T}" ]] ; then
- template="/tmp/XXXXXXX"
- else
- template="${T}/XXXXXXX"
- fi
- fi
-
- local template_wo_X=${template//X/}
- local n_X
- let n_X=${#template}-${#template_wo_X}
- if [[ ${n_X} -lt 3 ]] ; then
- echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
- return
- fi
-
- local attempts=0
- local character tmpfile
- while [[ true ]] ; do
- let attempts=attempts+1
-
- new_file=
- while read -n1 character ; do
- if [[ "${character}" == "X" ]] ; then
- tmpfile+="${RANDOM:0:1}"
- else
- tmpfile+="${character}"
- fi
- done < <(echo -n "${template}")
-
- if [[ ! -f "${tmpfile}" ]]
- then
- echo "${tmpfile}"
- return
- fi
-
- if [[ ${attempts} -ge 100 ]] ; then
- echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
- return
- fi
- done
- }
-
- local mysql_binary="${EROOT}/usr/bin/mysql"
- if [[ ! -x "${mysql_binary}" ]] ; then
- die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysqld_binary="${EROOT}/usr/sbin/mysqld"
- if [[ ! -x "${mysqld_binary}" ]] ; then
- die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db"
- if [[ ! -x "${mysql_install_db_binary}" ]] ; then
- die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
- fi
-
- local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
- if [[ ! -x "${my_print_defaults_binary}" ]] ; then
- die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
- fi
-
- if [[ -z "${MYSQL_USER}" ]] ; then
- MYSQL_USER=mysql
- if use prefix ; then
- MYSQL_USER=$(id -u -n 2>/dev/null)
- if [[ -z "${MYSQL_USER}" ]] ; then
- die "Failed to determine current username!"
- fi
- fi
- fi
-
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- MYSQL_GROUP=mysql
- if use prefix ; then
- MYSQL_GROUP=$(id -g -n 2>/dev/null)
- if [[ -z "${MYSQL_GROUP}" ]] ; then
- die "Failed to determine current user groupname!"
- fi
- fi
- fi
-
- # my_print_defaults needs to read stuff in $HOME/.my.cnf
- local -x HOME="${EROOT}/root"
-
- # Make sure the vars are correctly initialized
- mysql_init_vars
-
- # Read currently set data directory
- MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
-
- # Bug #213475 - MySQL _will_ object strenously if your machine is named
- # localhost. Also causes weird failures.
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
- if [[ -z "${MY_DATADIR}" ]] ; then
- die "Sorry, unable to find MY_DATADIR!"
- elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
- ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
- ewarn "Please rename or delete its content if you wish to initialize a new data directory."
- die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
- fi
-
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
- # These are dir+prefix
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
-
- # Create missing directories.
- # Always check if mysql user can write to directory even if we just
- # created directory because a parent directory might be not
- # accessible for that user.
- PID_DIR="${EROOT}/run/mysqld"
- if [[ ! -d "${PID_DIR}" ]] ; then
- einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
- install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
- || die "Failed to create PID directory '${PID_DIR}'!"
- fi
-
- local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_pid_dir_testfile}" ]] \
- && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_pid_dir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
- else
- rm "${_pid_dir_testfile}" || die
- unset _pid_dir_testfile
- fi
-
- if [[ ! -d "${MY_DATADIR}" ]] ; then
- einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
- || die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
- fi
-
- local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_datadir_testfile}" ]] \
- && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_datadir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
- else
- rm "${_my_datadir_testfile}" || die
- unset _my_datadir_testfile
- fi
-
- if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
- einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
- || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
- fi
-
- if [[ -z "${MYSQL_TMPDIR}" ]] ; then
- MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
- [[ -z "${MYSQL_TMPDIR}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
-
- mkdir "${MYSQL_TMPDIR}" || die
- chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
- fi
-
- # Now we need to test MYSQL_TMPDIR...
- local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_tmpdir_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_tmpdir_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
- else
- rm "${_my_tmpdir_testfile}" || die
- unset _my_tmpdir_testfile
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* && ! -d "${MYSQL_LOG_BIN}" ]] ; then
- # Only create directory when MYSQL_LOG_BIN is an absolute path
- einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
- || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
- fi
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Only test when MYSQL_LOG_BIN is an absolute path
- local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_logbin_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_logbin_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
- else
- rm "${_my_logbin_testfile}" || die
- unset _my_logbin_testfile
- fi
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
- # Only create directory when MYSQL_RELAY_LOG is an absolute path
- einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
- install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
- || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Only test when MYSQL_RELAY_LOG is an absolute path
- local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
- [[ -z "${_my_relaylog_testfile}" ]] \
- && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
-
- if use prefix ; then
- touch "${_my_relaylog_testfile}" &>/dev/null
- else
- su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
- fi
-
- if [[ $? -ne 0 ]] ; then
- die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
- else
- rm "${_my_relaylog_testfile}" || die
- unset _my_relaylog_testfile
- fi
- fi
-
- local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null)
- [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir"
-
- # Limit access
- chmod 0770 "${SETUP_TMPDIR}" || die
- chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die
-
- local mysql_install_log="${SETUP_TMPDIR}/install_db.log"
- local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log"
-
- echo ""
- einfo "Detected settings:"
- einfo "=================="
- einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
- einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
- einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
- einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
-
- if [[ "${MYSQL_LOG_BIN}" == /* ]] ; then
- # Absolute path for binary log files specified
- einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
- fi
-
- if [[ "${MYSQL_RELAY_LOG}" == /* ]] ; then
- # Absolute path for relay log files specified
- einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
- fi
-
- einfo "PID DIR:\t\t\t\t${PID_DIR}"
- einfo "Install db log:\t\t\t${mysql_install_log}"
- einfo "Install server log:\t\t\t${mysqld_logfile}"
-
- echo
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local tmp_mysqld_password_source=
-
- for tmp_mysqld_password_source in mysql client ; do
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
- MYSQL_ROOT_PASSWORD=
- continue
- fi
-
- einfo "Found password in '${tmp_mysqld_password_source}' section!"
- break
- fi
- done
-
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
- fi
-
- unset tmp_mysqld_password_source
- fi
-
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
- local pwd1="a"
- local pwd2="b"
-
- echo
- einfo "No password for mysql 'root' user was specified via environment"
- einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
- einfo "file like '${HOME}/.my.cnf'."
- einfo "To continue please provide a password for the mysql 'root' user"
- einfo "now on console:"
- ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
- read -rsp " >" pwd1 ; echo
-
- einfo "Retype the password"
- read -rsp " >" pwd2 ; echo
-
- if [[ "x${pwd1}" != "x${pwd2}" ]] ; then
- die "Passwords are not the same!"
- fi
-
- MYSQL_ROOT_PASSWORD="${pwd1}"
- unset pwd1 pwd2
-
- echo
- fi
-
- local -a mysqld_options
-
- # Fix bug 446200. Don't reference host my.cnf, needs to come first,
- # see http://bugs.mysql.com/bug.php?id=31312
- use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
-
- # Figure out which options we need to disable to do the setup
- local helpfile="${TMPDIR}/mysqld-help"
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
-
- local opt optexp optfull
- for opt in host-cache name-resolve networking slave-start \
- federated ssl log-bin relay-log slow-query-log external-locking \
- log-slave-updates \
- ; do
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
- grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
- done
-
- # Prepare timezones, see
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
- local tz_sql="${SETUP_TMPDIR}/tz.sql"
-
- echo "USE mysql;" >"${tz_sql}"
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
- if [[ $? -ne 0 ]] ; then
- die "mysql_tzinfo_to_sql failed!"
- fi
-
- local cmd=(
- "${mysql_install_db_binary}"
- "${mysqld_options[@]}"
- "--init-file='${tz_sql}'"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- "--log-error='${mysql_install_log}'"
- "--rpm"
- "--cross-bootstrap"
- "--skip-test-db"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Initializing ${PN} data directory: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
-
- if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
- die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
- fi
-
- local x=${RANDOM}
- local socket="${PID_DIR}/mysqld.${x}.sock"
- [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!"
- local pidfile="${PID_DIR}/mysqld.${x}.pid"
- [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!"
- unset x
-
- cmd=(
- "${mysqld_binary}"
- "${mysqld_options[@]}"
- "--basedir='${EROOT}/usr'"
- "--datadir='${MY_DATADIR}'"
- "--tmpdir='${MYSQL_TMPDIR}'"
- --max_allowed_packet=8M
- --net_buffer_length=16K
- "--socket='${socket}'"
- "--pid-file='${pidfile}'"
- "--log-error='${mysqld_logfile}'"
- "--user=${MYSQL_USER}"
- )
-
- einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
- eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
-
- echo -n "Waiting for mysqld to accept connections "
- local maxtry=15
- while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- if [[ -S "${socket}" ]] ; then
- # Even with a socket we don't know if mysqld will abort
- # start due to an error so just wait a little bit more...
- maxtry=5
- while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
- fi
-
- echo
-
- if [[ ! -S "${socket}" ]] ; then
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
- die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
- fi
-
- local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log"
- touch "${mysql_logfile}" || die
-
- ebegin "Setting root password"
- # Do this from memory, as we don't want clear text passwords in temp files
- local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
- cmd=(
- "${mysql_binary}"
- --no-defaults
- "--socket='${socket}'"
- -hlocalhost
- "-e \"${sql}\""
- )
- eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
- local rc=$?
- eend ${rc}
-
- if [[ ${rc} -ne 0 ]] ; then
- # Poor man's solution which tries to avoid having password
- # in log. NOTE: sed can fail if user didn't follow advice
- # and included character which will require escaping...
- sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
-
- grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
- die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
- fi
-
- # Stop the server
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- echo -n "Stopping the server "
- pkill -F "${pidfile}" &>/dev/null
-
- maxtry=10
- while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
- maxtry=$((${maxtry}-1))
- echo -n "."
- sleep 1
- done
-
- echo
-
- if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
- # We somehow failed to stop server.
- # However, not a fatal error. Just warn the user.
- ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
- fi
- fi
-
- rm -r "${SETUP_TMPDIR}" || die
-
- einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
-}