From 26d02eafed858fcc28beca1516747070cdc5d259 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Sat, 25 Apr 2026 05:02:39 +0300 Subject: [PATCH 01/19] dev-python/clickdc: new package, add 0.1.1 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/731 Signed-off-by: Sam James --- dev-python/clickdc/Manifest | 1 + dev-python/clickdc/clickdc-0.1.1.ebuild | 49 +++++++++++++++++++ .../files/clickdc-0.1.1-click-8.2.patch | 15 ++++++ dev-python/clickdc/metadata.xml | 12 +++++ 4 files changed, 77 insertions(+) create mode 100644 dev-python/clickdc/Manifest create mode 100644 dev-python/clickdc/clickdc-0.1.1.ebuild create mode 100644 dev-python/clickdc/files/clickdc-0.1.1-click-8.2.patch create mode 100644 dev-python/clickdc/metadata.xml diff --git a/dev-python/clickdc/Manifest b/dev-python/clickdc/Manifest new file mode 100644 index 0000000000000..349ec2b1eb948 --- /dev/null +++ b/dev-python/clickdc/Manifest @@ -0,0 +1 @@ +DIST clickdc-0.1.1.tar.gz 10128 BLAKE2B 98d9cf5f223be841c07698ec3a42f8cf49b8808d8090a7a5aaa2809c44d613f87e81fa2cee99e1cb611f8b0b691faaa9fd9de9fa71fb85e17e4845409bd44621 SHA512 9b369d86240da16cc38edae7b7ca705610c8afce3240fafeb287053b860c40cd30bd3af48a73fb5d4444cb62ecb1266c505f817f231671b95d0413fb416e7a6c diff --git a/dev-python/clickdc/clickdc-0.1.1.ebuild b/dev-python/clickdc/clickdc-0.1.1.ebuild new file mode 100644 index 0000000000000..9894ae3e95364 --- /dev/null +++ b/dev-python/clickdc/clickdc-0.1.1.ebuild @@ -0,0 +1,49 @@ +# Copyright 2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{12..14} ) + +inherit distutils-r1 pypi + +DESCRIPTION="Define click command line options from a python dataclass" +HOMEPAGE=" + https://github.com/Kamilcuk/clickdc + https://pypi.org/project/clickdc/ +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + dev-python/click[${PYTHON_USEDEP}] + dev-python/typing-extensions[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-python/pydantic[${PYTHON_USEDEP}] + ) +" + +EPYTEST_DESELECT=( + # Irrevelant downstream, unpackaged pyright + "tests/test_typing.py" +) +EPYTEST_PLUGINS=() +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/clickdc-0.1.1-click-8.2.patch +) + +python_prepare_all() { + # workaround setuptools-git-versioning + sed -e "/^\[project\]/aversion = \"${PV}\"" \ + -e '/^dynamic =/ s/"version", //' \ + -i pyproject.toml || die + + distutils-r1_python_prepare_all +} diff --git a/dev-python/clickdc/files/clickdc-0.1.1-click-8.2.patch b/dev-python/clickdc/files/clickdc-0.1.1-click-8.2.patch new file mode 100644 index 0000000000000..13cdbad77d5eb --- /dev/null +++ b/dev-python/clickdc/files/clickdc-0.1.1-click-8.2.patch @@ -0,0 +1,15 @@ +More complicated patch +https://github.com/Kamilcuk/clickdc/pull/3 + +--- a/tests/test.py ++++ b/tests/test.py +@@ -11,7 +11,7 @@ import clickdc + + + def invoke(*args, **kwargs): +- return CliRunner(mix_stderr=True).invoke(*args, **kwargs) ++ return CliRunner().invoke(*args, **kwargs) + + + def run(arg_class, input: str, output: Any = None, fail: int = 0, toargs: bool = False): + diff --git a/dev-python/clickdc/metadata.xml b/dev-python/clickdc/metadata.xml new file mode 100644 index 0000000000000..076d44c24befd --- /dev/null +++ b/dev-python/clickdc/metadata.xml @@ -0,0 +1,12 @@ + + + + + python@gentoo.org + + + + Kamilcuk/clickdc + clickdc + + From de200fc1d52e7530c88c54c6d2a2f4b9674ed2df Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Sat, 25 Apr 2026 05:19:53 +0300 Subject: [PATCH 02/19] dev-db/mycli: add 1.70.0 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/731 Signed-off-by: Sam James --- dev-db/mycli/Manifest | 2 + dev-db/mycli/mycli-1.70.0.ebuild | 190 +++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 dev-db/mycli/mycli-1.70.0.ebuild diff --git a/dev-db/mycli/Manifest b/dev-db/mycli/Manifest index b272fe57947c3..3ac564f0cdd36 100644 --- a/dev-db/mycli/Manifest +++ b/dev-db/mycli/Manifest @@ -2,3 +2,5 @@ DIST mycli-1.64.0.tar.gz 356929 BLAKE2B 2cc581f8f79c75aafb2eae6523ac3b2842e958ef DIST mycli-1.64.0.tar.gz.provenance 9605 BLAKE2B 320f5f1ef0b356948a2e87b8acb0b99ad840ede59fe8b5bf102b472ed25ef4b6d8c03ec41b95e1edc4346068364bae4f6bdbe956d3efded926756936bf08da1b SHA512 aa1e1f5e31addc744c8cf378e400aa034da7eb89e93d9458eccdecfd52bfa261ff990ce21267f7961f1ffedffc3b8499eb0899fcec06d87e078d3de994cf38f0 DIST mycli-1.65.0.tar.gz 358883 BLAKE2B f155547301dc01fd3e2546dc662998f7f9c2bb301a0b8081b7eac1078782a879d0f96854ca50be298a144ca292b9a119032890091115c76726811621faa8bab6 SHA512 fcd58c72cc0d98c58467e90e566f79d1ce4693ce79b0be49203a547f3a92f0818ba04ebfc8c0822a5807e37701ec1345d785bd01e1d5fad1258f28d188b375f8 DIST mycli-1.65.0.tar.gz.provenance 9484 BLAKE2B f9af01db05dac0a069e3a5da5ccb9c3741079f21c6f3d0dcc07eb475d672aa6ecd83eb992f3f8c8fa42ca5b4d1d6707d961012a4677f9f9244a5fcf2fda71fbb SHA512 0d1418fd257a7efab78f1266eb166b37669c9fa308b93c1f84ffe967e74d83da33cf7265930329296fed5ae5161107edb207780922961251b81df0220035422d +DIST mycli-1.70.0.tar.gz 461619 BLAKE2B 88202706c1a0869da08dda0dc09ac2bb2597c84258d8e8d68a0a227d829a3bb88e9bb66065457e15dac1f3993c952aca14ec6b7234ddf9e3f5b820a38438e6cf SHA512 94546ceb40ce91476381c4c242e344c8bb8bb9728122f3a2dd8136ce5dfe6b7ed7e7bd059a7398e2907dad53d319ab2abafe175cd708fa1e5d743d1c009f0cd6 +DIST mycli-1.70.0.tar.gz.provenance 9373 BLAKE2B b45211cc1f9ea6f0e10c24b40f05bfc8c2a40097689c58f5b898614a60ba9c9508b6624d026d4228379da9d4b961f27288928a9a490f4e14ac1c6fd7ae618eb2 SHA512 3fdd28bd6738ed130b5b7eda5553b5f954e357da6ab89d63c39c6efa4d861b08966ebcabfeb3b57213d9e89c279ffa1268c3db9a2b6cf7ea42093c541ef0529c diff --git a/dev-db/mycli/mycli-1.70.0.ebuild b/dev-db/mycli/mycli-1.70.0.ebuild new file mode 100644 index 0000000000000..d87bd93bf51fe --- /dev/null +++ b/dev-db/mycli/mycli-1.70.0.ebuild @@ -0,0 +1,190 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_SINGLE_IMPL=yes +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{12..14} ) +PYPI_VERIFY_REPO=https://github.com/dbcli/mycli +inherit distutils-r1 edo eapi9-ver multiprocessing pypi + +DESCRIPTION="CLI for MySQL Database with auto-completion and syntax highlighting" +HOMEPAGE=" + https://www.mycli.net/ + https://github.com/dbcli/mycli/ + https://pypi.org/project/mycli/ +" + +LICENSE="BSD MIT" +SLOT="0" +KEYWORDS="~amd64" + +# optional llm unpackaged +IUSE="ssh" + +# ~paramiko-3.5.1: Pinned due to breakage. Feature soft deprecated for future removal +# https://github.com/dbcli/mycli/commit/82c7d92a16ad15906c46df14cc6e6ee0249609e6 +# https://github.com/dbcli/mycli/issues/1464 +RDEPEND=" + $(python_gen_cond_dep ' + >=dev-python/cli-helpers-2.12.0[${PYTHON_USEDEP}] + >=dev-python/click-8.3.1[${PYTHON_USEDEP}] + >=dev-python/clickdc-0.1.1[${PYTHON_USEDEP}] + >=dev-python/configobj-5.0.9[${PYTHON_USEDEP}] + >=dev-python/cryptography-46.0.5[${PYTHON_USEDEP}] + >=dev-python/keyring-25.7.0[${PYTHON_USEDEP}] + >=dev-python/prompt-toolkit-3.0.6[${PYTHON_USEDEP}] + =dev-python/pycryptodome-3.23.0[${PYTHON_USEDEP}] + >=dev-python/pyfzf-0.3.1[${PYTHON_USEDEP}] + >=dev-python/pygments-2.19.2[${PYTHON_USEDEP}] + >=dev-python/pymysql-1.1.2[${PYTHON_USEDEP}] + >=dev-python/pyperclip-1.11.0[${PYTHON_USEDEP}] + >=dev-python/rapidfuzz-3.14.3[${PYTHON_USEDEP}] + >=dev-python/sqlglot-30.4.3[${PYTHON_USEDEP}] + =dev-python/sqlparse-0.3.0[${PYTHON_USEDEP}] + >=dev-python/wcwidth-0.6.0[${PYTHON_USEDEP}] + ssh? ( + ~dev-python/paramiko-3.5.1[${PYTHON_USEDEP}] + dev-python/sshtunnel[${PYTHON_USEDEP}] + ) + ') +" +BDEPEND=" + $(python_gen_cond_dep ' + dev-python/setuptools-scm[${PYTHON_USEDEP}] + test? ( + dev-db/mysql[server] + >=dev-python/behave-1.3.3[${PYTHON_USEDEP}] + ~dev-python/paramiko-3.5.1[${PYTHON_USEDEP}] + >=dev-python/pexpect-4.9.0[${PYTHON_USEDEP}] + dev-python/sshtunnel[${PYTHON_USEDEP}] + ) + ') +" + +EPYTEST_PLUGINS=() +distutils_enable_tests pytest + +export SETUPTOOLS_SCM_PRETEND_VERSION=${PV} + +python_prepare_all() { + # no coverage please + sed -e 's/import coverage ; coverage.process_startup(); //' \ + -i test/features/environment.py test/features/steps/wrappers.py || die + + # dont pin dependencies + sed -e '/^dependencies = \[/,/^\]$/ s/"\(.*\) ~=/"\1 >=/' \ + -i pyproject.toml || die + + # convert from pycryptodomex to pycryptodome + sed -e 's/pycryptodomex/pycryptodome/' -i pyproject.toml || die + sed -e 's/from Cryptodome/from Crypto/' -i mycli/config.py || die + + # network-sandbox messes with these + sed -e '/run mycli on localhost without port/i @gentoo_skip' \ + -e '/run mycli on TCP host without port/i @gentoo_skip' \ + -e '/run mycli without host and port/i @gentoo_skip' \ + -i test/features/connection.feature || die + + # Requires an old school vi and the symlink for vi itself messes with this + sed -e '/edit sql in file with external editor/i @gentoo_skip' \ + -i test/features/iocommands.feature || die + + # avoid unpackaged pytest-random-order + sed -e "/^addopts =/ s/, '--random-order'//" -i pyproject.toml || die + + distutils-r1_python_prepare_all +} + +src_test() { + # test/utils.py + local -x PYTEST_PASSWORD="notsecure" + local -x PYTEST_HOST="127.0.0.1" + local -x PYTEST_PORT="43307" + local -x PYTEST_CHARSET="utf8" + + einfo "Creating mysql test instance ..." + mysqld \ + --no-defaults \ + --initialize-insecure \ + --basedir="${EPREFIX}/usr" \ + --datadir="${T}/mysql" 1>"${T}"/mysql_install.log || die + + einfo "Starting mysql test instance ..." + mysqld \ + --no-defaults \ + --character-set-server="${PYTEST_CHARSET}" \ + --bind-address="${PYTEST_HOST}" \ + --port="${PYTEST_PORT}" \ + --pid-file="${T}/mysqld.pid" \ + --socket="${T}/mysqld.sock" \ + --datadir="${T}/mysql" 1>"${T}/mysqld.log" 2>&1 & + + # wait for it to start + local i + for (( i = 0; i < 10; i++ )); do + [[ -S ${T}/mysqld.sock ]] && break + sleep 1 + done + [[ ! -S ${T}/mysqld.sock ]] && die "mysqld failed to start" + + einfo "Configuring test mysql instance ..." + mysql \ + -u root \ + --socket="${T}/mysqld.sock" \ + -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${PYTEST_PASSWORD}'" \ + || die "Failed to change mysql user password" + + EPYTEST_IGNORE=( + # Requires unpackaged llm + test/pytests/test_special_llm.py + ) + + local failures=() + if ! nonfatal distutils-r1_src_test ; then + failures+=( pytest ) + fi + + if ! nonfatal edo behave \ + --jobs=$(get_makeopts_jobs) \ + --summary --verbose \ + --tags="not @gentoo_skip" \ + test/features ; then + failures+=( behave ) + fi + + einfo "Stopping mysql test instance ..." + pkill -F "${T}"/mysqld.pid || die + # wait for it to stop + local i + for (( i = 0; i < 10; i++ )); do + [[ -S ${T}/mysqld.sock ]] || break + sleep 1 + done + + rm -rf "${T}"/mysql || die + + if [[ ${#failures[@]} -gt 0 ]]; then + die "Tests failed: ${failures}" + fi +} + +pkg_postinst() { + if use ssh && ver_replacing -lt 1.49; then + elog "The built-in SSH functionality has been soft deprecated in mycli." + elog "It may be removed upstream in a future release and even sooner" + elog "downstream in the ebuild due to the pinned paramiko dependency." + elog "See also https://github.com/dbcli/mycli/issues/1464" + elog "" + fi + if ver_replacing -lt 1.50; then + elog "Reading configuration from '.my.cnf' has been deprecated." + elog "Configuration should be done in '.myclirc' from now on," + elog "and in the future '.my.cnf' will be ignored." + elog "See also https://github.com/dbcli/mycli/issues/1490" + elog "" + fi +} From cff26dbe4158497b719b95cac7fb3035816b8799 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Sat, 25 Apr 2026 05:20:50 +0300 Subject: [PATCH 03/19] dev-db/mycli: drop 1.64.0 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/731 Merges: https://codeberg.org/gentoo/gentoo/pulls/731 Signed-off-by: Sam James --- dev-db/mycli/Manifest | 2 - dev-db/mycli/mycli-1.64.0.ebuild | 190 ------------------------------- 2 files changed, 192 deletions(-) delete mode 100644 dev-db/mycli/mycli-1.64.0.ebuild diff --git a/dev-db/mycli/Manifest b/dev-db/mycli/Manifest index 3ac564f0cdd36..7d284a4a832cc 100644 --- a/dev-db/mycli/Manifest +++ b/dev-db/mycli/Manifest @@ -1,5 +1,3 @@ -DIST mycli-1.64.0.tar.gz 356929 BLAKE2B 2cc581f8f79c75aafb2eae6523ac3b2842e958ef45b4031cafea78a17dd6c5df01e778b51c9e4002c82ce31b297636ad1f26141d20e98b483a54280c27ea06e8 SHA512 b4af6b15990975e40a4ff15e605e2692d71b3a54bd83b84dc97b8a5b638eadf6e95d3a311abbb8f07e55c10b119bcf738bdf663366cf04ed2432039cbedc8efe -DIST mycli-1.64.0.tar.gz.provenance 9605 BLAKE2B 320f5f1ef0b356948a2e87b8acb0b99ad840ede59fe8b5bf102b472ed25ef4b6d8c03ec41b95e1edc4346068364bae4f6bdbe956d3efded926756936bf08da1b SHA512 aa1e1f5e31addc744c8cf378e400aa034da7eb89e93d9458eccdecfd52bfa261ff990ce21267f7961f1ffedffc3b8499eb0899fcec06d87e078d3de994cf38f0 DIST mycli-1.65.0.tar.gz 358883 BLAKE2B f155547301dc01fd3e2546dc662998f7f9c2bb301a0b8081b7eac1078782a879d0f96854ca50be298a144ca292b9a119032890091115c76726811621faa8bab6 SHA512 fcd58c72cc0d98c58467e90e566f79d1ce4693ce79b0be49203a547f3a92f0818ba04ebfc8c0822a5807e37701ec1345d785bd01e1d5fad1258f28d188b375f8 DIST mycli-1.65.0.tar.gz.provenance 9484 BLAKE2B f9af01db05dac0a069e3a5da5ccb9c3741079f21c6f3d0dcc07eb475d672aa6ecd83eb992f3f8c8fa42ca5b4d1d6707d961012a4677f9f9244a5fcf2fda71fbb SHA512 0d1418fd257a7efab78f1266eb166b37669c9fa308b93c1f84ffe967e74d83da33cf7265930329296fed5ae5161107edb207780922961251b81df0220035422d DIST mycli-1.70.0.tar.gz 461619 BLAKE2B 88202706c1a0869da08dda0dc09ac2bb2597c84258d8e8d68a0a227d829a3bb88e9bb66065457e15dac1f3993c952aca14ec6b7234ddf9e3f5b820a38438e6cf SHA512 94546ceb40ce91476381c4c242e344c8bb8bb9728122f3a2dd8136ce5dfe6b7ed7e7bd059a7398e2907dad53d319ab2abafe175cd708fa1e5d743d1c009f0cd6 diff --git a/dev-db/mycli/mycli-1.64.0.ebuild b/dev-db/mycli/mycli-1.64.0.ebuild deleted file mode 100644 index a6ec734f4e13c..0000000000000 --- a/dev-db/mycli/mycli-1.64.0.ebuild +++ /dev/null @@ -1,190 +0,0 @@ -# Copyright 1999-2026 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_SINGLE_IMPL=yes -DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{12..14} ) -PYPI_VERIFY_REPO=https://github.com/dbcli/mycli -inherit distutils-r1 edo eapi9-ver multiprocessing pypi - -DESCRIPTION="CLI for MySQL Database with auto-completion and syntax highlighting" -HOMEPAGE=" - https://www.mycli.net/ - https://github.com/dbcli/mycli/ - https://pypi.org/project/mycli/ -" - -LICENSE="BSD MIT" -SLOT="0" -KEYWORDS="~amd64 ~arm64" - -# optional llm unpackaged -IUSE="ssh" - -# ~paramiko-3.5.1: Pinned due to breakage. Feature soft deprecated for future removal -# https://github.com/dbcli/mycli/commit/82c7d92a16ad15906c46df14cc6e6ee0249609e6 -# https://github.com/dbcli/mycli/issues/1464 -RDEPEND=" - $(python_gen_cond_dep ' - >=dev-python/cli-helpers-2.11.0[${PYTHON_USEDEP}] - >=dev-python/click-8.3.1[${PYTHON_USEDEP}] - >=dev-python/configobj-5.0.9[${PYTHON_USEDEP}] - >=dev-python/cryptography-46.0.5[${PYTHON_USEDEP}] - >=dev-python/keyring-25.7.0[${PYTHON_USEDEP}] - >=dev-python/prompt-toolkit-3.0.6[${PYTHON_USEDEP}] - =dev-python/pycryptodome-3.23.0[${PYTHON_USEDEP}] - >=dev-python/pyfzf-0.3.1[${PYTHON_USEDEP}] - >=dev-python/pygments-2.19.2[${PYTHON_USEDEP}] - >=dev-python/pymysql-1.1.2[${PYTHON_USEDEP}] - >=dev-python/pyperclip-1.11.0[${PYTHON_USEDEP}] - >=dev-python/rapidfuzz-3.14.3[${PYTHON_USEDEP}] - >=dev-python/sqlglot-29.0.1[${PYTHON_USEDEP}] - =dev-python/sqlparse-0.3.0[${PYTHON_USEDEP}] - >=dev-python/wcwidth-0.6.0[${PYTHON_USEDEP}] - ssh? ( - ~dev-python/paramiko-3.5.1[${PYTHON_USEDEP}] - dev-python/sshtunnel[${PYTHON_USEDEP}] - ) - ') -" -BDEPEND=" - $(python_gen_cond_dep ' - dev-python/setuptools-scm[${PYTHON_USEDEP}] - test? ( - dev-db/mysql[server] - >=dev-python/behave-1.3.3[${PYTHON_USEDEP}] - ~dev-python/paramiko-3.5.1[${PYTHON_USEDEP}] - >=dev-python/pexpect-4.9.0[${PYTHON_USEDEP}] - dev-python/sshtunnel[${PYTHON_USEDEP}] - ) - ') -" - -EPYTEST_PLUGINS=() -distutils_enable_tests pytest - -export SETUPTOOLS_SCM_PRETEND_VERSION=${PV} - -python_prepare_all() { - # no coverage please - sed -e 's/import coverage ; coverage.process_startup(); //' \ - -i test/features/environment.py test/features/steps/wrappers.py || die - - # dont pin dependencies - sed -e '/^dependencies = \[/,/^\]$/ s/"\(.*\) ~=/"\1 >=/' \ - -i pyproject.toml || die - - # convert from pycryptodomex to pycryptodome - sed -e 's/pycryptodomex/pycryptodome/' -i pyproject.toml || die - sed -e 's/from Cryptodome/from Crypto/' -i mycli/config.py || die - - # network-sandbox messes with these - sed -e '/run mycli on localhost without port/i @gentoo_skip' \ - -e '/run mycli on TCP host without port/i @gentoo_skip' \ - -e '/run mycli without host and port/i @gentoo_skip' \ - -i test/features/connection.feature || die - - # Requires an old school vi and the symlink for vi itself messes with this - sed -e '/edit sql in file with external editor/i @gentoo_skip' \ - -i test/features/iocommands.feature || die - - distutils-r1_python_prepare_all -} - -src_test() { - # test/utils.py - local -x PYTEST_PASSWORD="notsecure" - local -x PYTEST_HOST="127.0.0.1" - local -x PYTEST_PORT="43307" - local -x PYTEST_CHARSET="utf8" - - einfo "Creating mysql test instance ..." - mysqld \ - --no-defaults \ - --initialize-insecure \ - --basedir="${EPREFIX}/usr" \ - --datadir="${T}/mysql" 1>"${T}"/mysql_install.log || die - - einfo "Starting mysql test instance ..." - mysqld \ - --no-defaults \ - --character-set-server="${PYTEST_CHARSET}" \ - --bind-address="${PYTEST_HOST}" \ - --port="${PYTEST_PORT}" \ - --pid-file="${T}/mysqld.pid" \ - --socket="${T}/mysqld.sock" \ - --datadir="${T}/mysql" 1>"${T}/mysqld.log" 2>&1 & - - # wait for it to start - local i - for (( i = 0; i < 10; i++ )); do - [[ -S ${T}/mysqld.sock ]] && break - sleep 1 - done - [[ ! -S ${T}/mysqld.sock ]] && die "mysqld failed to start" - - einfo "Configuring test mysql instance ..." - mysql \ - -u root \ - --socket="${T}/mysqld.sock" \ - -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${PYTEST_PASSWORD}'" \ - || die "Failed to change mysql user password" - - EPYTEST_IGNORE=( - # Requires unpackaged llm - test/test_llm_special.py - # AssertionError: assert 8 in [4, 5, 6, 7] - # Per upstream: "...it is a flaky test at best." - # https://github.com/dbcli/mycli/commit/3d08910a366d4505a40e8a0fb36c210330723f18 - test/test_special_iocommands.py::test_watch_query_full - ) - - local failures=() - if ! nonfatal distutils-r1_src_test ; then - failures+=( pytest ) - fi - - if ! nonfatal edo behave \ - --jobs=$(get_makeopts_jobs) \ - --summary --verbose \ - --tags="not @gentoo_skip" \ - test/features ; then - failures+=( behave ) - fi - - einfo "Stopping mysql test instance ..." - pkill -F "${T}"/mysqld.pid || die - # wait for it to stop - local i - for (( i = 0; i < 10; i++ )); do - [[ -S ${T}/mysqld.sock ]] || break - sleep 1 - done - - rm -rf "${T}"/mysql || die - - if [[ ${#failures[@]} -gt 0 ]]; then - die "Tests failed: ${failures}" - fi -} - -pkg_postinst() { - if use ssh && ver_replacing -lt 1.49; then - elog "The built-in SSH functionality has been soft deprecated in mycli." - elog "It may be removed upstream in a future release and even sooner" - elog "downstream in the ebuild due to the pinned paramiko dependency." - elog "See also https://github.com/dbcli/mycli/issues/1464" - elog "" - fi - if ver_replacing -lt 1.50; then - elog "Reading configuration from '.my.cnf' has been deprecated." - elog "Configuration should be done in '.myclirc' from now on," - elog "and in the future '.my.cnf' will be ignored." - elog "See also https://github.com/dbcli/mycli/issues/1490" - elog "" - fi -} From 04ff78af9aca810abc05d568cb4419ee645226fa Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Sat, 25 Apr 2026 03:39:38 +0300 Subject: [PATCH 04/19] dev-python/pypax: enable py3.14 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/732 Signed-off-by: Sam James --- dev-python/pypax/pypax-0.9.5-r2.ebuild | 4 ++-- dev-python/pypax/pypax-9999.ebuild | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev-python/pypax/pypax-0.9.5-r2.ebuild b/dev-python/pypax/pypax-0.9.5-r2.ebuild index 71d1782aaaebd..91ac7335b3a16 100644 --- a/dev-python/pypax/pypax-0.9.5-r2.ebuild +++ b/dev-python/pypax/pypax-0.9.5-r2.ebuild @@ -1,11 +1,11 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{9..13} ) +PYTHON_COMPAT=( python3_{11..14} ) inherit distutils-r1 diff --git a/dev-python/pypax/pypax-9999.ebuild b/dev-python/pypax/pypax-9999.ebuild index ad89926ea24cf..214c19bce065a 100644 --- a/dev-python/pypax/pypax-9999.ebuild +++ b/dev-python/pypax/pypax-9999.ebuild @@ -1,11 +1,11 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..14} ) inherit distutils-r1 From 14bbcec816af235398f0ba35a57959e1c4ed1f83 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Sat, 25 Apr 2026 03:45:09 +0300 Subject: [PATCH 05/19] sys-apps/elfix: use python-single-r1 Bug: https://bugs.gentoo.org/708676 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/732 Merges: https://codeberg.org/gentoo/gentoo/pulls/732 Signed-off-by: Sam James --- sys-apps/elfix/elfix-0.9.5-r2.ebuild | 56 ++++++++++++++++++++++++++++ sys-apps/elfix/elfix-9999.ebuild | 19 ++++++++-- 2 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 sys-apps/elfix/elfix-0.9.5-r2.ebuild diff --git a/sys-apps/elfix/elfix-0.9.5-r2.ebuild b/sys-apps/elfix/elfix-0.9.5-r2.ebuild new file mode 100644 index 0000000000000..0f9edecc76586 --- /dev/null +++ b/sys-apps/elfix/elfix-0.9.5-r2.ebuild @@ -0,0 +1,56 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +inherit python-single-r1 + +if [[ ${PV} == *9999* ]] ; then + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/elfix.git" + inherit autotools git-r3 +else + SRC_URI="https://dev.gentoo.org/~blueness/elfix/${P}.tar.gz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +DESCRIPTION="Suite of tools to work with ELF objects on Hardened Gentoo" +HOMEPAGE="https://www.gentoo.org/proj/en/hardened/pax-quickstart.xml + https://dev.gentoo.org/~blueness/elfix/" + +LICENSE="GPL-3+" +SLOT="0" +IUSE="+ptpax test +xtpax" +REQUIRED_USE="${PYTHON_REQUIRED_USE} + || ( ptpax xtpax ) +" +# These only work with a properly configured PaX kernel +RESTRICT="!test? ( test ) test" + +DEPEND="$(python_gen_cond_dep "~dev-python/pypax-${PV}[ptpax=,xtpax=,\${PYTHON_USEDEP}]") + ptpax? ( dev-libs/elfutils ) + xtpax? ( sys-apps/attr )" + +RDEPEND="${DEPEND} + ${PYTHON_DEPS}" + +src_prepare() { + default + if [[ ${PV} == *9999* ]]; then + eautoreconf + cd doc && ./make.sh || die + fi +} + +src_configure() { + rm -f "${S}/scripts/setup.py" || die + econf \ + $(use_enable test tests) \ + $(use_enable ptpax) \ + $(use_enable xtpax) +} + +src_install() { + default + python_fix_shebang "${ED}" +} diff --git a/sys-apps/elfix/elfix-9999.ebuild b/sys-apps/elfix/elfix-9999.ebuild index d7ed625acc47c..0f9edecc76586 100644 --- a/sys-apps/elfix/elfix-9999.ebuild +++ b/sys-apps/elfix/elfix-9999.ebuild @@ -1,8 +1,11 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 +PYTHON_COMPAT=( python3_{11..14} ) +inherit python-single-r1 + if [[ ${PV} == *9999* ]] ; then EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/elfix.git" inherit autotools git-r3 @@ -18,15 +21,18 @@ HOMEPAGE="https://www.gentoo.org/proj/en/hardened/pax-quickstart.xml LICENSE="GPL-3+" SLOT="0" IUSE="+ptpax test +xtpax" -REQUIRED_USE="|| ( ptpax xtpax )" +REQUIRED_USE="${PYTHON_REQUIRED_USE} + || ( ptpax xtpax ) +" # These only work with a properly configured PaX kernel RESTRICT="!test? ( test ) test" -DEPEND="~dev-python/pypax-${PV}[ptpax=,xtpax=] +DEPEND="$(python_gen_cond_dep "~dev-python/pypax-${PV}[ptpax=,xtpax=,\${PYTHON_USEDEP}]") ptpax? ( dev-libs/elfutils ) xtpax? ( sys-apps/attr )" -RDEPEND="${DEPEND}" +RDEPEND="${DEPEND} + ${PYTHON_DEPS}" src_prepare() { default @@ -43,3 +49,8 @@ src_configure() { $(use_enable ptpax) \ $(use_enable xtpax) } + +src_install() { + default + python_fix_shebang "${ED}" +} From c6cb465c1293c6e0443122dacbd435327da4f9b6 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 24 Apr 2026 18:31:57 +0300 Subject: [PATCH 06/19] net-im/gajim: add 2.4.6 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/730 Signed-off-by: Sam James --- net-im/gajim/Manifest | 1 + net-im/gajim/gajim-2.4.6.ebuild | 115 ++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 net-im/gajim/gajim-2.4.6.ebuild diff --git a/net-im/gajim/Manifest b/net-im/gajim/Manifest index 99497680f17fe..398bd431cf20d 100644 --- a/net-im/gajim/Manifest +++ b/net-im/gajim/Manifest @@ -1,3 +1,4 @@ DIST gajim-2.2.0.tar.gz 4798143 BLAKE2B 3799bacfd6a94d8313bf02c6f48d0e348aeb89147c730c8c5ef04d9cf1d8ff289cabd576cea55be755410080416706776c1af224fe1cd2a1fa63f4bbd887026c SHA512 b61682a8dde3beaf03d5be16091e54b2aada681493d4f4ad4a83bade37d3762d12663a0b918abbc07136c32925ba168780caaf9dfe9080872779026755286b45 DIST gajim-2.4.4.tar.gz 5050978 BLAKE2B e8dd3f09d5f8bac0ec14813134d6182dcb9b7bf36062b894649116cba2fcad9aa3e4f0494570bc24f883041cc99a28a9d0d9c1d0d1eed735e427b01f677accc1 SHA512 442a4a8d8dfe1d22fb2cd10ebe30c38e6d7ce0f7bb6d1a7e3022c89e9c24b699bd0cf9c64ea19a8f3872d8d2ea052ebf241ab256310a1763550251739e89dd0e DIST gajim-2.4.5.tar.gz 5091348 BLAKE2B a162857a81c3a689a2a6cf692b95d3499eba7f1d1858bd9212f905333172c533f731f960a62ff2436933d5425ee1fbb9e09177ad426829ae828883896c9c5647 SHA512 37e7665e5b7d4b45af096fa002efdade412bb844f3403297a2fda21ae802272a687b47e1ab18bc0376403622ec80cd45fbda6804d3870356391901d1011b8168 +DIST gajim-2.4.6.tar.gz 5105111 BLAKE2B e105867689b615ac771a39600e279d8e11932ef948e32914bb314147987cf99ba612226d69cd546ff92c131046122ac09c14160f05aa4f67771b0be538720190 SHA512 36967064f90bbddd1e84e93129d13eef6f5ca47a1e8417ca19feb5a411b860949c8acb8e8c9db558ee662a379a97eb1026a3d74ec1e5f5c8d4114a5fa9409ae3 diff --git a/net-im/gajim/gajim-2.4.6.ebuild b/net-im/gajim/gajim-2.4.6.ebuild new file mode 100644 index 0000000000000..2e62916548b6f --- /dev/null +++ b/net-im/gajim/gajim-2.4.6.ebuild @@ -0,0 +1,115 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +PYTHON_REQ_USE="sqlite,xml(+)" +DISTUTILS_USE_PEP517=setuptools + +inherit distutils-r1 optfeature xdg + +DESCRIPTION="GTK XMPP Client" +HOMEPAGE="https://gajim.org/" +SRC_URI="https://gajim.org/downloads/$(ver_cut 1-2)/${P/_p/-}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" + +KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86" +IUSE="voice" + +# Same order as in upstream pyproject.toml please for the python dependencies + +# For introspection dependencies consult upstream documentation and any gi.require_version in the code + +# USE="voice" handles all video and audio. +# https://dev.gajim.org/gajim/gajim#rich-previews-images-and-voice-messages + +# xdg-desktop-portal: apparent runtime requirement +# https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a2963fc1a23747bbb60a3785bf06dd566e6d8be9 + +# httpx[http2,socks]: h2, socksio +# gst-plugins-rs (uses gtk4paintablesink): media-plugins/gst-plugin-gtk4 +RDEPEND=" + >=dev-python/cryptography-43.0.0[${PYTHON_USEDEP}] + dev-python/css-parser[${PYTHON_USEDEP}] + >=dev-python/emoji-2.6.0[${PYTHON_USEDEP}] + dev-python/h2[${PYTHON_USEDEP}] + dev-python/httpx[${PYTHON_USEDEP}] + dev-python/keyring[${PYTHON_USEDEP}] + =dev-python/nbxmpp-7.2.0[${PYTHON_USEDEP}] + =dev-python/omemo-dr-1.2.0[${PYTHON_USEDEP}] + dev-python/packaging[${PYTHON_USEDEP}] + >=dev-python/pillow-9.1.0[${PYTHON_USEDEP}] + >=dev-python/precis-i18n-1.0.0[${PYTHON_USEDEP}] + >=dev-python/pycairo-1.16.0[${PYTHON_USEDEP}] + >=dev-python/pygobject-3.53.0:3[cairo,${PYTHON_USEDEP}] + >=dev-python/qrcode-7.3.1[${PYTHON_USEDEP}] + >=dev-python/sqlalchemy-2.0.0[${PYTHON_USEDEP}] + dev-python/socksio[${PYTHON_USEDEP}] + dev-python/truststore[${PYTHON_USEDEP}] + + >=dev-libs/glib-2.80[introspection(+)] + >=gui-libs/gtk-4.17.5:4[introspection] + gui-libs/gtksourceview:5[introspection] + >=gui-libs/libadwaita-1.7.0[introspection] + media-libs/graphene[introspection] + net-libs/libsoup:3.0[introspection] + x11-libs/gdk-pixbuf:2[introspection] + >=x11-libs/pango-1.50.0[introspection] + + voice? ( + media-libs/gstreamer:1.0[introspection] + media-libs/gst-plugins-bad + media-libs/gst-plugins-base + media-libs/gst-plugins-good + media-libs/gst-plugins-ugly + media-plugins/gst-plugins-gtk + media-plugins/gst-plugins-libav + media-plugins/gst-plugin-gtk4 + net-libs/farstream:0.2[introspection] + ) + + sys-apps/xdg-desktop-portal +" +BDEPEND=" + >=sys-devel/gettext-0.17-r1 +" + +EPYTEST_PLUGINS=() +distutils_enable_tests pytest + +python_compile_all() { + # Generates manpages, app icons, translation and metadata + ./make.py build --dist unix || die +} + +python_install_all() { + # Installs manpages, app icons, translation and metadata + ./make.py install --dist unix --prefix="${ED}/usr" || die + + # Undo compression in ./make.py install + gzip -d "${ED}"/usr/share/man/man1/*.gz || die + + distutils-r1_python_install_all +} + +pkg_postinst() { + ewarn "The chat database format changes when upgrading from 1.8.x to 1.9.x." + ewarn "The first time the user starts Gajim, an automatic migration is performed." + + # https://dev.gajim.org/gajim/gajim/-/tree/master?ref_type=heads#optional-runtime-requirements + #optfeature "Sentry error reporting to dev.gajim.org" dev-python/sentry-sdk + optfeature "keyring support" app-crypt/libsecret[introspection] + optfeature "spellchecking support" "app-text/hunspell app-text/libspelling:1" + # https://dev.gajim.org/gajim/gajim/-/issues/11578 + #optfeature "better NAT traversing" net-libs/gupnp:1.6[introspection] + optfeature "network lose detection" net-misc/networkmanager[introspection] + optfeature "sharing your location" app-misc/geoclue:2.0[introspection] + optfeature "accurate version info about the used operating system" dev-python/distro + + xdg_pkg_postinst +} From f9aea4a9e12d3874f1ab34a124201f79c0d1bba2 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 24 Apr 2026 18:32:11 +0300 Subject: [PATCH 07/19] net-im/gajim: drop 2.4.4 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/730 Signed-off-by: Sam James --- net-im/gajim/Manifest | 1 - net-im/gajim/gajim-2.4.4.ebuild | 115 -------------------------------- 2 files changed, 116 deletions(-) delete mode 100644 net-im/gajim/gajim-2.4.4.ebuild diff --git a/net-im/gajim/Manifest b/net-im/gajim/Manifest index 398bd431cf20d..dca4b0573e761 100644 --- a/net-im/gajim/Manifest +++ b/net-im/gajim/Manifest @@ -1,4 +1,3 @@ DIST gajim-2.2.0.tar.gz 4798143 BLAKE2B 3799bacfd6a94d8313bf02c6f48d0e348aeb89147c730c8c5ef04d9cf1d8ff289cabd576cea55be755410080416706776c1af224fe1cd2a1fa63f4bbd887026c SHA512 b61682a8dde3beaf03d5be16091e54b2aada681493d4f4ad4a83bade37d3762d12663a0b918abbc07136c32925ba168780caaf9dfe9080872779026755286b45 -DIST gajim-2.4.4.tar.gz 5050978 BLAKE2B e8dd3f09d5f8bac0ec14813134d6182dcb9b7bf36062b894649116cba2fcad9aa3e4f0494570bc24f883041cc99a28a9d0d9c1d0d1eed735e427b01f677accc1 SHA512 442a4a8d8dfe1d22fb2cd10ebe30c38e6d7ce0f7bb6d1a7e3022c89e9c24b699bd0cf9c64ea19a8f3872d8d2ea052ebf241ab256310a1763550251739e89dd0e DIST gajim-2.4.5.tar.gz 5091348 BLAKE2B a162857a81c3a689a2a6cf692b95d3499eba7f1d1858bd9212f905333172c533f731f960a62ff2436933d5425ee1fbb9e09177ad426829ae828883896c9c5647 SHA512 37e7665e5b7d4b45af096fa002efdade412bb844f3403297a2fda21ae802272a687b47e1ab18bc0376403622ec80cd45fbda6804d3870356391901d1011b8168 DIST gajim-2.4.6.tar.gz 5105111 BLAKE2B e105867689b615ac771a39600e279d8e11932ef948e32914bb314147987cf99ba612226d69cd546ff92c131046122ac09c14160f05aa4f67771b0be538720190 SHA512 36967064f90bbddd1e84e93129d13eef6f5ca47a1e8417ca19feb5a411b860949c8acb8e8c9db558ee662a379a97eb1026a3d74ec1e5f5c8d4114a5fa9409ae3 diff --git a/net-im/gajim/gajim-2.4.4.ebuild b/net-im/gajim/gajim-2.4.4.ebuild deleted file mode 100644 index f25c4fa0f9ffe..0000000000000 --- a/net-im/gajim/gajim-2.4.4.ebuild +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright 1999-2026 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -PYTHON_COMPAT=( python3_{11..14} ) -PYTHON_REQ_USE="sqlite,xml(+)" -DISTUTILS_USE_PEP517=setuptools - -inherit distutils-r1 optfeature xdg - -DESCRIPTION="GTK XMPP Client" -HOMEPAGE="https://gajim.org/" -SRC_URI="https://gajim.org/downloads/$(ver_cut 1-2)/${P/_p/-}.tar.gz" - -LICENSE="GPL-3" -SLOT="0" - -KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86" -IUSE="voice" - -# Same order as in upstream pyproject.toml please for the python dependencies - -# For introspection dependencies consult upstream documentation and any gi.require_version in the code - -# USE="voice" handles all video and audio. -# https://dev.gajim.org/gajim/gajim#rich-previews-images-and-voice-messages - -# xdg-desktop-portal: apparent runtime requirement -# https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a2963fc1a23747bbb60a3785bf06dd566e6d8be9 - -# httpx[http2,socks]: h2, socksio -# gst-plugins-rs (uses gtk4paintablesink): media-plugins/gst-plugin-gtk4 -RDEPEND=" - >=dev-python/cryptography-3.4.8[${PYTHON_USEDEP}] - dev-python/css-parser[${PYTHON_USEDEP}] - >=dev-python/emoji-2.6.0[${PYTHON_USEDEP}] - dev-python/h2[${PYTHON_USEDEP}] - dev-python/httpx[${PYTHON_USEDEP}] - dev-python/keyring[${PYTHON_USEDEP}] - =dev-python/nbxmpp-7.1.0[${PYTHON_USEDEP}] - =dev-python/omemo-dr-1.2.0[${PYTHON_USEDEP}] - dev-python/packaging[${PYTHON_USEDEP}] - >=dev-python/pillow-9.1.0[${PYTHON_USEDEP}] - >=dev-python/precis-i18n-1.0.0[${PYTHON_USEDEP}] - >=dev-python/pycairo-1.16.0[${PYTHON_USEDEP}] - >=dev-python/pygobject-3.53.0:3[cairo,${PYTHON_USEDEP}] - >=dev-python/qrcode-7.3.1[${PYTHON_USEDEP}] - >=dev-python/sqlalchemy-2.0.0[${PYTHON_USEDEP}] - dev-python/socksio[${PYTHON_USEDEP}] - dev-python/truststore[${PYTHON_USEDEP}] - - >=dev-libs/glib-2.80[introspection(+)] - >=gui-libs/gtk-4.17.5:4[introspection] - gui-libs/gtksourceview:5[introspection] - >=gui-libs/libadwaita-1.7.0[introspection] - media-libs/graphene[introspection] - net-libs/libsoup:3.0[introspection] - x11-libs/gdk-pixbuf:2[introspection] - >=x11-libs/pango-1.50.0[introspection] - - voice? ( - media-libs/gstreamer:1.0[introspection] - media-libs/gst-plugins-bad - media-libs/gst-plugins-base - media-libs/gst-plugins-good - media-libs/gst-plugins-ugly - media-plugins/gst-plugins-gtk - media-plugins/gst-plugins-libav - media-plugins/gst-plugin-gtk4 - net-libs/farstream:0.2[introspection] - ) - - sys-apps/xdg-desktop-portal -" -BDEPEND=" - >=sys-devel/gettext-0.17-r1 -" - -EPYTEST_PLUGINS=() -distutils_enable_tests pytest - -python_compile_all() { - # Generates manpages, app icons, translation and metadata - ./make.py build --dist unix || die -} - -python_install_all() { - # Installs manpages, app icons, translation and metadata - ./make.py install --dist unix --prefix="${ED}/usr" || die - - # Undo compression in ./make.py install - gzip -d "${ED}"/usr/share/man/man1/*.gz || die - - distutils-r1_python_install_all -} - -pkg_postinst() { - ewarn "The chat database format changes when upgrading from 1.8.x to 1.9.x." - ewarn "The first time the user starts Gajim, an automatic migration is performed." - - # https://dev.gajim.org/gajim/gajim/-/tree/master?ref_type=heads#optional-runtime-requirements - #optfeature "Sentry error reporting to dev.gajim.org" dev-python/sentry-sdk - optfeature "keyring support" app-crypt/libsecret[introspection] - optfeature "spellchecking support" "app-text/hunspell app-text/libspelling:1" - # https://dev.gajim.org/gajim/gajim/-/issues/11578 - #optfeature "better NAT traversing" net-libs/gupnp:1.6[introspection] - optfeature "network lose detection" net-misc/networkmanager[introspection] - optfeature "sharing your location" app-misc/geoclue:2.0[introspection] - optfeature "notifcation sound support" media-libs/gsound[introspection] - - xdg_pkg_postinst -} From 08edc340339113af1afd51d3954230d965626a1c Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 24 Apr 2026 22:57:11 +0300 Subject: [PATCH 08/19] net-im/gajim: backport py3.14 support Pygobject >=3.52 situation looks grim tree wise. So the new versions seem unattainable for the time being. Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/730 Merges: https://codeberg.org/gentoo/gentoo/pulls/730 Signed-off-by: Sam James --- net-im/gajim/files/gajim-2.2.0-py3.14.patch | 34 ++++++ net-im/gajim/gajim-2.2.0-r1.ebuild | 110 ++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 net-im/gajim/files/gajim-2.2.0-py3.14.patch create mode 100644 net-im/gajim/gajim-2.2.0-r1.ebuild diff --git a/net-im/gajim/files/gajim-2.2.0-py3.14.patch b/net-im/gajim/files/gajim-2.2.0-py3.14.patch new file mode 100644 index 0000000000000..d93e555e015e5 --- /dev/null +++ b/net-im/gajim/files/gajim-2.2.0-py3.14.patch @@ -0,0 +1,34 @@ +https://dev.gajim.org/gajim/gajim/-/commit/89272f260c318389be10855c42ad0b82de385c77 + +From 89272f260c318389be10855c42ad0b82de385c77 Mon Sep 17 00:00:00 2001 +From: Philipp Hörist +Date: Sat, 29 Nov 2025 14:45:13 +0100 +Subject: [PATCH] fix: Commands: Don’t fail to create commands with python 3.14 + +--- a/gajim/common/commands.py ++++ b/gajim/common/commands.py +@@ -9,6 +9,7 @@ + import io + import operator + import shlex ++import sys + from collections.abc import Callable + + from nbxmpp.protocol import JID +@@ -77,7 +78,12 @@ def __init__(self) -> None: + Observable.__init__(self) + + def init(self) -> None: +- self._parser = ArgumentParser(prog='ChatCommands') ++ if sys.version_info >= (3, 14): ++ # Disable colors because we depend on a stable format for the ++ # usage string ++ self._parser = ArgumentParser(prog='ChatCommands', color=False) ++ else: ++ self._parser = ArgumentParser(prog='ChatCommands') + self._sub_parser = self._parser.add_subparsers(title='Commands') + self._commands: dict[str, tuple[list[str], str]] = {} + +-- +GitLab + diff --git a/net-im/gajim/gajim-2.2.0-r1.ebuild b/net-im/gajim/gajim-2.2.0-r1.ebuild new file mode 100644 index 0000000000000..44e6e51ab94ad --- /dev/null +++ b/net-im/gajim/gajim-2.2.0-r1.ebuild @@ -0,0 +1,110 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +PYTHON_REQ_USE="sqlite,xml(+)" +DISTUTILS_USE_PEP517=setuptools + +inherit distutils-r1 optfeature xdg + +DESCRIPTION="GTK XMPP Client" +HOMEPAGE="https://gajim.org/" +SRC_URI="https://gajim.org/downloads/$(ver_cut 1-2)/${P/_p/-}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" + +KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86" +IUSE="voice" + +# Same order as in upstream pyproject.toml please for the python dependencies + +# For introspection dependencies consult upstream documentation and any gi.require_version in the code + +# USE="voice" handles all video and audio. +# https://dev.gajim.org/gajim/gajim#for-video-and-audio-calls +# https://dev.gajim.org/gajim/gajim#for-voice-messages + +# xdg-desktop-portal: apparent runtime requirement +# https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a2963fc1a23747bbb60a3785bf06dd566e6d8be9 + +RDEPEND="${COMMON_DEPEND} + >=dev-python/cryptography-3.4.8[${PYTHON_USEDEP}] + dev-python/css-parser[${PYTHON_USEDEP}] + >=dev-python/emoji-2.6.0[${PYTHON_USEDEP}] + dev-python/keyring[${PYTHON_USEDEP}] + =dev-python/nbxmpp-6.2.0[${PYTHON_USEDEP}] + =dev-python/omemo-dr-1.0.0[${PYTHON_USEDEP}] + dev-python/packaging[${PYTHON_USEDEP}] + >=dev-python/pillow-9.1.0[${PYTHON_USEDEP}] + >=dev-python/precis-i18n-1.0.0[${PYTHON_USEDEP}] + >=dev-python/pycairo-1.16.0[${PYTHON_USEDEP}] + >=dev-python/pygobject-3.42.0:3[cairo,${PYTHON_USEDEP}] + >=dev-python/qrcode-7.3.1[${PYTHON_USEDEP}] + >=dev-python/sqlalchemy-2.0.0[${PYTHON_USEDEP}] + + dev-libs/glib[introspection(+)] + >=gui-libs/gtk-4.14.0:4[introspection] + gui-libs/gtksourceview:5[introspection] + media-libs/graphene[introspection] + net-libs/libsoup:3.0[introspection] + x11-libs/gdk-pixbuf:2[introspection] + >=x11-libs/pango-1.50.0[introspection] + + voice? ( + media-libs/gstreamer:1.0[introspection] + media-libs/gst-plugins-base + media-libs/gst-plugins-ugly + media-plugins/gst-plugins-gtk + media-plugins/gst-plugins-libav + net-libs/farstream:0.2[introspection] + ) + + sys-apps/xdg-desktop-portal +" +BDEPEND=" + >=sys-devel/gettext-0.17-r1 +" + +EPYTEST_PLUGINS=() +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/gajim-2.2.0-py3.14.patch +) + +python_compile_all() { + # Generates manpages, app icons, translation and metadata + ./make.py build --dist unix || die +} + +python_install_all() { + # Installs manpages, app icons, translation and metadata + ./make.py install --dist unix --prefix="${ED}/usr" || die + + # Undo compression in ./make.py install + gzip -d "${ED}"/usr/share/man/man1/*.gz || die + + distutils-r1_python_install_all +} + +pkg_postinst() { + ewarn "The chat database format changes when upgrading from 1.8.x to 1.9.x." + ewarn "The first time the user starts Gajim, an automatic migration is performed." + + # https://dev.gajim.org/gajim/gajim/-/tree/master?ref_type=heads#optional-runtime-requirements + #optfeature "Sentry error reporting to dev.gajim.org" dev-python/sentry-sdk + optfeature "keyring support" app-crypt/libsecret[introspection] + optfeature "spellchecking support" "app-text/hunspell app-text/libspelling:1" + # https://dev.gajim.org/gajim/gajim/-/issues/11578 + #optfeature "better NAT traversing" net-libs/gupnp:1.6[introspection] + optfeature "network lose detection" net-misc/networkmanager[introspection] + optfeature "sharing your location" app-misc/geoclue:2.0[introspection] + optfeature "notifcation sound support" media-libs/gsound[introspection] + + xdg_pkg_postinst +} From 6d0562ece65fe7159d0fca20b82eba07871b44d7 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 24 Apr 2026 18:24:51 +0300 Subject: [PATCH 09/19] dev-util/android-udev-rules: add 20260423 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/728 Signed-off-by: Sam James --- dev-util/android-udev-rules/Manifest | 1 + .../android-udev-rules-20260423.ebuild | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 dev-util/android-udev-rules/android-udev-rules-20260423.ebuild diff --git a/dev-util/android-udev-rules/Manifest b/dev-util/android-udev-rules/Manifest index 831bdf46d443f..9b5a99f5df3a7 100644 --- a/dev-util/android-udev-rules/Manifest +++ b/dev-util/android-udev-rules/Manifest @@ -1,2 +1,3 @@ DIST android-udev-rules-20250314.tar.gz 25109 BLAKE2B 8e0738d69a244a5df42b696d32f4d7ca629f660598fb470eb4dcfab93c937aea3bc2a9d9ed5a9ebbd65714551b81cd95cab5cf51e1cb5cc07128c2f741c60afd SHA512 792851a7579cc183f15900d74c476ed3a96e8cfe5a510a0c9f0ee5ee16642f497c237a32d68d725efcbeeade613cc0fb6135e5ed5797a84d776e367e1b5b5974 DIST android-udev-rules-20250525.tar.gz 23794 BLAKE2B 2a086c3451d7f5309108960eff25afc77e7902e3bbf68018b1a4b89115123e7a45c293dbecece217a5565f71e5688e3996426f0e6a1167bf35deb14da4bddb70 SHA512 c4370ba89ee240d540b6a18e6fd37bace27315b9637577eb08c48cfec8c77dcb8ebfebdf2b7853b9f3c7db35fe50458af52d070946bb0ab0db67539470bbf0ad +DIST android-udev-rules-20260423.tar.gz 23917 BLAKE2B 0149de234ac44e72b05cfb5467d636ee71b29e04bf80036524912823f9fe6c831c3493c7f6b44c6969e369432df25379f97c48df3992593a776016b2971c623a SHA512 97966f1c02a9f85825a217384c94cfa8b9f721173e543c324b866ee7823b09ca67ec7ba1b012ce10de9d56ae7e4157d4cec8364c8e325001664cf6383778a5fe diff --git a/dev-util/android-udev-rules/android-udev-rules-20260423.ebuild b/dev-util/android-udev-rules/android-udev-rules-20260423.ebuild new file mode 100644 index 0000000000000..0dc57aebae4a5 --- /dev/null +++ b/dev-util/android-udev-rules/android-udev-rules-20260423.ebuild @@ -0,0 +1,42 @@ +# Copyright 2022-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit udev + +DESCRIPTION="Android udev rules list aimed to be the most comprehensive on the net" +HOMEPAGE="https://github.com/M0Rf30/android-udev-rules" +SRC_URI="https://github.com/M0Rf30/android-udev-rules/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~x86" + +# No tests +RESTRICT="test" + +RDEPEND=" + acct-group/android + virtual/udev +" + +src_prepare() { + default + + # Use the pre-existing android group + sed -i 's/GROUP="adbusers"/GROUP="android"/' 51-android.rules || die +} + +src_install() { + udev_dorules 51-android.rules + einstalldocs +} + +pkg_postinst() { + udev_reload +} + +pkg_postrm() { + udev_reload +} From 5610e6ffa31ed942639f3fc7405bf93c694226ba Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 24 Apr 2026 18:28:20 +0300 Subject: [PATCH 10/19] dev-util/android-udev-rules: drop 20250314 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/728 Merges: https://codeberg.org/gentoo/gentoo/pulls/728 Signed-off-by: Sam James --- dev-util/android-udev-rules/Manifest | 1 - .../android-udev-rules-20250314.ebuild | 42 ------------------- 2 files changed, 43 deletions(-) delete mode 100644 dev-util/android-udev-rules/android-udev-rules-20250314.ebuild diff --git a/dev-util/android-udev-rules/Manifest b/dev-util/android-udev-rules/Manifest index 9b5a99f5df3a7..3e2a20ee6e5fa 100644 --- a/dev-util/android-udev-rules/Manifest +++ b/dev-util/android-udev-rules/Manifest @@ -1,3 +1,2 @@ -DIST android-udev-rules-20250314.tar.gz 25109 BLAKE2B 8e0738d69a244a5df42b696d32f4d7ca629f660598fb470eb4dcfab93c937aea3bc2a9d9ed5a9ebbd65714551b81cd95cab5cf51e1cb5cc07128c2f741c60afd SHA512 792851a7579cc183f15900d74c476ed3a96e8cfe5a510a0c9f0ee5ee16642f497c237a32d68d725efcbeeade613cc0fb6135e5ed5797a84d776e367e1b5b5974 DIST android-udev-rules-20250525.tar.gz 23794 BLAKE2B 2a086c3451d7f5309108960eff25afc77e7902e3bbf68018b1a4b89115123e7a45c293dbecece217a5565f71e5688e3996426f0e6a1167bf35deb14da4bddb70 SHA512 c4370ba89ee240d540b6a18e6fd37bace27315b9637577eb08c48cfec8c77dcb8ebfebdf2b7853b9f3c7db35fe50458af52d070946bb0ab0db67539470bbf0ad DIST android-udev-rules-20260423.tar.gz 23917 BLAKE2B 0149de234ac44e72b05cfb5467d636ee71b29e04bf80036524912823f9fe6c831c3493c7f6b44c6969e369432df25379f97c48df3992593a776016b2971c623a SHA512 97966f1c02a9f85825a217384c94cfa8b9f721173e543c324b866ee7823b09ca67ec7ba1b012ce10de9d56ae7e4157d4cec8364c8e325001664cf6383778a5fe diff --git a/dev-util/android-udev-rules/android-udev-rules-20250314.ebuild b/dev-util/android-udev-rules/android-udev-rules-20250314.ebuild deleted file mode 100644 index 7fe4e9222260f..0000000000000 --- a/dev-util/android-udev-rules/android-udev-rules-20250314.ebuild +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2022-2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit udev - -DESCRIPTION="Android udev rules list aimed to be the most comprehensive on the net" -HOMEPAGE="https://github.com/M0Rf30/android-udev-rules" -SRC_URI="https://github.com/M0Rf30/android-udev-rules/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="GPL-3" -SLOT="0" -KEYWORDS="amd64 ~arm arm64 x86" - -# No tests -RESTRICT="test" - -RDEPEND=" - acct-group/android - virtual/udev -" - -src_prepare() { - default - - # Use the pre-existing android group - sed -i 's/GROUP="adbusers"/GROUP="android"/' 51-android.rules || die -} - -src_install() { - udev_dorules 51-android.rules - einstalldocs -} - -pkg_postinst() { - udev_reload -} - -pkg_postrm() { - udev_reload -} From 134cdca85b531daec83ef41f6070588a08dfa57c Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 24 Apr 2026 17:15:42 +0300 Subject: [PATCH 11/19] dev-db/mysql-connector-c++: add 9.7.0 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/727 Merges: https://codeberg.org/gentoo/gentoo/pulls/727 Signed-off-by: Sam James --- dev-db/mysql-connector-c++/Manifest | 1 + .../mysql-connector-c++-9.7.0.ebuild | 185 ++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 dev-db/mysql-connector-c++/mysql-connector-c++-9.7.0.ebuild diff --git a/dev-db/mysql-connector-c++/Manifest b/dev-db/mysql-connector-c++/Manifest index c66826944e49a..4ac971f843865 100644 --- a/dev-db/mysql-connector-c++/Manifest +++ b/dev-db/mysql-connector-c++/Manifest @@ -1,2 +1,3 @@ DIST mysql-connector-c++-9.4.0-src.tar.gz 4788987 BLAKE2B 41a6cfbcfcca91b9a244fa30c6f1857ea4574e084bc9d2283bd0f34777acabb5dc30084c401ca7c12213f7d9a6e14d019182df48da86a59f48e32e2444626ea3 SHA512 80fc167c2ac0f6f1a368cb4778c67c3d95d713f8d350169d4a9e733a81bc60b4ed9847d1d6a29d1ca0e01002b0266c1391ef4b59604f5060ff81d62030c233c5 DIST mysql-connector-c++-9.6.0-src.tar.gz 4789835 BLAKE2B d4991161d524e887b7dff1eacf719f9114657dd4a34df9c2b20882f8eb125ec0d86527464b7f1444fbe4e9f346dd92b49a5a6a48675ed3e426b599628be3c5d3 SHA512 227854759a19d5738ca4a33b128242b166699b0e664652e8f621c084898c84ac0c99daeeb4ee9c68bef2c2bd539f268bfb0f38d8ead590ea0b27919865655442 +DIST mysql-connector-c++-9.7.0-src.tar.gz 4790031 BLAKE2B f826020d96779f92118acd266de1e397f55cbeff49a8091ebad79ae7d868e1e8dad4d3dd17cfc0acce76d06472c85d667fbc8e51f07ed1b62f0c8f78135759fa SHA512 9c29c0baab89f37d0eeec0c78fce9707d8ad8605cbb1ed660a9845d046ba67a4abada88ef585d69a7f7c0077a2bc65f1058696fee1c53724dd52cf976e8cacb6 diff --git a/dev-db/mysql-connector-c++/mysql-connector-c++-9.7.0.ebuild b/dev-db/mysql-connector-c++/mysql-connector-c++-9.7.0.ebuild new file mode 100644 index 0000000000000..e6e5dfba2a5b3 --- /dev/null +++ b/dev-db/mysql-connector-c++/mysql-connector-c++-9.7.0.ebuild @@ -0,0 +1,185 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +URI_DIR="Connector-C++" +DESCRIPTION="MySQL database connector for C++ (mimics JDBC 4.0 API)" +HOMEPAGE="https://dev.mysql.com/downloads/connector/cpp/" +SRC_URI=" + https://dev.mysql.com/get/Downloads/${URI_DIR}/${P}-src.tar.gz +" +S="${WORKDIR}/${P}-src" + +LICENSE="Artistic GPL-2" +# See ABI_VERSION(s) is version.cmake +SLOT="0/2.10" # ABI_VERSION_MAJOR/JDBC_ABI_VERSION_MAJOR +# -ppc, -sparc for bug #711940 +KEYWORDS="~amd64 ~arm ~arm64 -ppc ~ppc64 -sparc ~x86" +IUSE="+legacy test" + +RESTRICT="!test? ( test )" + +RDEPEND=" + app-arch/lz4:= + app-arch/zstd:= + dev-libs/openssl:= + virtual/zlib:= + legacy? ( + >=dev-db/mysql-connector-c-8.0.27:= + ) +" +DEPEND=" + ${RDEPEND} + test? ( + dev-cpp/gtest + ) +" +BDEPEND=" + test? ( + >=dev-db/mysql-8[server] + ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-8.0.27-mysqlclient_r.patch + "${FILESDIR}"/${PN}-8.0.33-jdbc.patch + "${FILESDIR}"/${PN}-9.2.0-gcc-15-cstdint.patch + "${FILESDIR}"/${PN}-9.2.0-test-iomanip.patch + "${FILESDIR}"/${PN}-9.4.0-hookup-tests.patch + "${FILESDIR}"/${PN}-9.4.0-cmake4.patch +) + +src_prepare() { + cmake_src_prepare + + # ignores MAKEOPTS and runs recursive make -j$(nproc). Clobbers jobs badly + # enough that your system immediately freezes. + # + # https://bugs.gentoo.org/921309 + # https://bugs.mysql.com/bug.php?id=115734 + sed -i 's/prc_cnt AND NOT/FALSE AND NOT/' cdk/cmake/dependency.cmake || die +} + +src_configure() { + # sanity check subslot to kick would be drive by bumpers + local detected_abi + detected_abi="$(awk '$1 ~ "set.*ABI_VERSION_MAJOR" {printf("%s.",$2)}' version.cmake)" + detected_abi="${detected_abi%.}" + if [[ "${SLOT#0/}" != "${detected_abi}" ]]; then + die "Sub slot ${SLOT#0/} doesn't match upstream specified ABI ${detected_abi}." + fi + + local mycmakeargs=( + -DBUNDLE_DEPENDENCIES=OFF + # Cannot handle protobuf >23, bug #912797 + #-DWITH_PROTOBUF=system + -DWITH_LZ4=system + -DWITH_SSL=system + -DWITH_ZLIB=system + -DWITH_ZSTD=system + -DWITH_JDBC=$(usex legacy) + -DWITH_TESTS=$(usex test) + ) + + if use legacy ; then + mycmakeargs+=( + -DMYSQLCLIENT_STATIC_BINDING=0 + -DMYSQLCLIENT_STATIC_LINKING=0 + ) + fi + + cmake_src_configure +} + +# NOTE: Test failures in jdbc may be a sign of issues in mysql-connector-c. +src_test() { + local CMAKE_SKIP_TESTS=( + # Test that configures, builds and install a test project again. It gets caught on the install phase. + Link_test + # Only ipv4 will work as only the ipv4 local address is specified. A future task for someone... + # https://dev.mysql.com/doc/refman/8.4/en/x-plugin-options-system-variables.html#sysvar_mysqlx_bind_address + Sess.ipv6 + # FIXME: + # not ok 15 - preparedstatement::queryAttributes # assertEquals(int) failed in + # /var/tmp/portage/dev-db/mysql-connector-c++-9.2.0/work/mysql-connector-c++-9.2.0-src/jdbc/test/unit/classes/preparedstatement.cpp, + # line #1582 expecting '200' got '0' + jdbc_test_preparedstatement + ) + + local -x MYSQL_HOST="127.0.0.1" + local -x MYSQL_PORT="5555" + local -x MYSQL_USER="$(whoami)" + local -x MYSQL_PASSWORD="insecure" + local -x XPLUGIN_PORT="5556" + + einfo "Creating mysql test instance" + mkdir -p "${T}"/mysql || die + mysqld \ + --no-defaults \ + --initialize-insecure \ + --user root \ + --basedir="${EPREFIX}/usr" \ + --datadir="${T}"/mysql 1>"${T}"/mysqld_install.log || die + + einfo "Starting mysql test instance ..." + mysqld \ + --no-defaults \ + --character-set-server=utf8 \ + --bind-address=${MYSQL_HOST} \ + --port=${MYSQL_PORT} \ + --socket="${T}"/mysqld.sock \ + --mysqlx-bind-address=${MYSQL_HOST} \ + --mysqlx-port=${XPLUGIN_PORT} \ + --mysqlx-socket="${T}"/mysqlx.sock \ + --pid-file="${T}"/mysqld.pid \ + --datadir="${T}"/mysql 1>"${T}"/mysqld.log 2>&1 & + + # wait for it to start + local i + for (( i = 0; i < 10; i++ )); do + [[ -S ${T}/mysqld.sock ]] && break + sleep 1 + done + [[ ! -S ${T}/mysqld.sock ]] && die "mysqld failed to start" + + einfo "Configure mysql test instance ..." + # https://github.com/mysql/mysql-connector-cpp/blob/trunk/jdbc/test/CJUnitTestsPort/README + mysql -u root \ + -e "CREATE USER ${MYSQL_USER} IDENTIFIED BY '${MYSQL_PASSWORD}'; GRANT ALL PRIVILEGES ON *.* TO ${MYSQL_USER} WITH GRANT OPTION;" \ + -S "${T}/mysqld.sock" \ + -h ${MYSQL_HOST} \ + -P ${MYSQL_PORT} || die + mysql -u root \ + -S "${T}/mysqld.sock" \ + -h ${MYSQL_HOST} \ + -P ${MYSQL_PORT} < "${S}"/jdbc/test/CJUnitTestsPort/cts.sql || die + + # Do tests with one job for proper clean up in database tests. + nonfatal cmake_src_test -j1 + local ret=${?} + + einfo "Stopping mysql test instance ..." + pkill -F "${T}"/mysqld.pid || die + # wait for it to stop + local i + for (( i = 0; i < 10; i++ )); do + [[ -S ${T}/mysqld.sock ]] || break + sleep 1 + done + + rm -rf "${T}"/mysql || die + + [[ ${ret} -ne 0 ]] && die +} + +src_install() { + cmake_src_install + einstalldocs + + # cmake package config file appears to be broken in multiple ways + rm "${ED}/usr/mysql-concpp-config.cmake" || die + rm "${ED}/usr/mysql-concpp-config-version.cmake" || die +} From 832e7a60a76cb43c2de5a034c6772ffd90722ccc Mon Sep 17 00:00:00 2001 From: Nicolas PARLANT Date: Fri, 24 Apr 2026 01:16:42 +0200 Subject: [PATCH 12/19] media-gfx/qiv: Bump to 3.0.4 it should fix a memory leak patch merged Bug: https://bugs.gentoo.org/963527 Signed-off-by: Nicolas PARLANT Part-of: https://codeberg.org/gentoo/gentoo/pulls/719 Merges: https://codeberg.org/gentoo/gentoo/pulls/719 Signed-off-by: Sam James --- media-gfx/qiv/Manifest | 1 + media-gfx/qiv/qiv-3.0.4.ebuild | 74 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 media-gfx/qiv/qiv-3.0.4.ebuild diff --git a/media-gfx/qiv/Manifest b/media-gfx/qiv/Manifest index 536a718d2be5c..b83cc90591e21 100644 --- a/media-gfx/qiv/Manifest +++ b/media-gfx/qiv/Manifest @@ -1 +1,2 @@ DIST qiv-3.0.2.tar.gz 143688 BLAKE2B 5f5fa04383ef7a7f0891279a1644cc6ecdc59c43dd8d0fcbbb9b03aa8e7633e9afb2e039a47e745f1bb2f2ea8d5b38cd62a3c0d3e1a9708cf0630d27821f4626 SHA512 51c27eff7e4f65dd21c022d7f60c59e78f41adb2e6feadbc85842865c7d0a1c5d1fd752ad0bd96af77f33acfaed4d6fdb27acd824b92733a198064cb9122a1dd +DIST qiv-3.0.4.tar.gz 146841 BLAKE2B bc38dea92610a7251d76fd421b48d86898282365b66cfee2f63bc2431253b5ef2ce4ddd062dbbdb09d1dee53b687919261d142966d8eea9e717581b259f6f2ec SHA512 494630090ae8f86f71019db2fd3027715d8c7549edee1dcc15d0ea0569d5fc98c7b9f3518f688c9ab345b67a8f6bc59734b506af17fec3607ad52b301704cf6a diff --git a/media-gfx/qiv/qiv-3.0.4.ebuild b/media-gfx/qiv/qiv-3.0.4.ebuild new file mode 100644 index 0000000000000..3ed2f9c8d9c3b --- /dev/null +++ b/media-gfx/qiv/qiv-3.0.4.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit optfeature toolchain-funcs xdg + +DESCRIPTION="Quick Image Viewer" +HOMEPAGE="https://spiegl.de/qiv/ https://codeberg.org/ciberandy/qiv" +SRC_URI="https://codeberg.org/ciberandy/qiv/releases/download/v${PV}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~mips ~x86" +IUSE="exif lcms" +# just a launch-test +RESTRICT="test" + +RDEPEND=" + dev-libs/glib:2 + sys-apps/file + x11-libs/cairo + x11-libs/gdk-pixbuf:2 + x11-libs/gtk+:3[X] + x11-libs/libX11 + x11-libs/libXext + x11-libs/pango + exif? ( media-libs/libexif ) + lcms? ( + media-libs/lcms:2 + media-libs/libjpeg-turbo:= + media-libs/tiff:= + ) +" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" + +src_prepare() { + default + + if ! use exif ; then + sed -i 's/^EXIF =/#\0/' Makefile || die + fi + + if ! use lcms ; then + sed -i 's/^LCMS =/#\0/' Makefile || die + fi +} + +src_compile() { + tc-export CC PKG_CONFIG + default +} + +src_install() { + local myemakeargs=( + PREFIX="${ED}/usr" + # do not compress the manpage + COMPRESS_PROG=true + # do not strip + STRIP_FLAG= + ) + emake "${myemakeargs[@]}" install + + dodoc Changelog contrib/qiv-command.example README README.TODO +} + +pkg_postinst() { + xdg_pkg_postinst + optfeature "GIF support" gui-libs/gdk-pixbuf[gif] + optfeature "JPEG support" gui-libs/gdk-pixbuf[jpeg] + optfeature "TIFF support" gui-libs/gdk-pixbuf[tiff] + optfeature "WebP support" gui-libs/gdk-pixbuf-loader-webp +} From 763b7764799f6dfdefb6cfd2383a0bd7dab4520b Mon Sep 17 00:00:00 2001 From: Henning Schild Date: Fri, 24 Apr 2026 13:09:57 +0200 Subject: [PATCH 13/19] sci-geosciences/qmapshack: bump to 1.20.2 Signed-off-by: Henning Schild Part-of: https://codeberg.org/gentoo/gentoo/pulls/722 Merges: https://codeberg.org/gentoo/gentoo/pulls/722 Signed-off-by: Sam James --- sci-geosciences/qmapshack/Manifest | 1 + .../qmapshack/qmapshack-1.20.2.ebuild | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 sci-geosciences/qmapshack/qmapshack-1.20.2.ebuild diff --git a/sci-geosciences/qmapshack/Manifest b/sci-geosciences/qmapshack/Manifest index 92ad651fd4d68..c93040b25386f 100644 --- a/sci-geosciences/qmapshack/Manifest +++ b/sci-geosciences/qmapshack/Manifest @@ -1,2 +1,3 @@ DIST qmapshack-1.19.0.tar.gz 58382506 BLAKE2B 5280480d09ce70bd96fc9e96e36b2a2da412f3938230cb21921270d88cb5885b53517251afbe29c597a709d84c2db5e5c34d6fbaf43f3f3e8ac7a3592996ed07 SHA512 a3da5396d9f1c7773a06f1edfdfce627249ab892e0386d804cd974cd88f9ea657e0ea330ab1855171b4b7777c77084f63308a23f2343437e544b20e1162364e5 DIST qmapshack-1.20.1.tar.gz 57842834 BLAKE2B 88c4b2f0c293a8c1e067411f6ad9db64a32d549f189bfdc5fb9e0cb54a8c653b8da1b2e28e77431edb0f082fad2c9da5da312cb5e95c2b87051e0fca464dfea2 SHA512 f236431b6944757d12cfa8c4b5af7b43a4b989ce4ede763a5d616f45035dda89a21adb263f82e6e811f0d4f11158be63ed3caac087711fc618afdb770612c41a +DIST qmapshack-1.20.2.tar.gz 57864693 BLAKE2B b827982b27f1e34891abe5d64348295add98995e10a9d42b5ffe09b2d6ccf0104bba44b45e8d073d55081888c27bd1403bdea054afbba300dc59343d678e4fde SHA512 73c4bd9f2063e520d717f5414926fdd19b961b59b4701911de957f1003287a4e0819e64e8ce37cbd4aa10c4389decc6304127e02af74b64a258a86b20eff2d4b diff --git a/sci-geosciences/qmapshack/qmapshack-1.20.2.ebuild b/sci-geosciences/qmapshack/qmapshack-1.20.2.ebuild new file mode 100644 index 0000000000000..ac840a230862b --- /dev/null +++ b/sci-geosciences/qmapshack/qmapshack-1.20.2.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake xdg + +DESCRIPTION="GPS mapping utility" +HOMEPAGE="https://github.com/Maproom/qmapshack/wiki" +SRC_URI="https://github.com/Maproom/${PN}/archive/tags/V_${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}"/${PN}-tags-V_${PV} + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~amd64" +IUSE="dbus" + +RDEPEND=" + dev-db/sqlite + >=dev-libs/quazip-1.3-r2:=[qt6(+)] + dev-qt/qt5compat:6 + dev-qt/qtbase:6[dbus?,gui,network,sql,widgets,xml] + dev-qt/qtdeclarative:6 + dev-qt/qttools:6[assistant,widgets] + dev-qt/qtwebengine:6[widgets] + sci-geosciences/routino + sci-libs/alglib + sci-libs/gdal:= + sci-libs/proj:= +" +DEPEND="${RDEPEND}" +BDEPEND="dev-qt/qttools:6[linguist]" + +src_configure() { + local mycmakeargs=( + -DUSE_QT6DBus=$(usex dbus) + -DHTML_INSTALL_DIR="${EPREFIX}/usr/share/doc/${PF}/qch" + ) + cmake_src_configure +} + +src_install() { + cmake_src_install + + docompress -x "/usr/share/doc/${PF}/qch" +} From 2443483809bbc60ec08d5d861171ee6029fc3d4c Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Tue, 21 Apr 2026 21:08:18 +0300 Subject: [PATCH 14/19] dev-db/mysql: drop 8.0.43 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/733 Signed-off-by: Sam James --- dev-db/mysql/Manifest | 1 - dev-db/mysql/mysql-8.0.43.ebuild | 1322 ------------------------------ 2 files changed, 1323 deletions(-) delete mode 100644 dev-db/mysql/mysql-8.0.43.ebuild diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest index 96a2131260c2d..2439a482126a0 100644 --- a/dev-db/mysql/Manifest +++ b/dev-db/mysql/Manifest @@ -4,6 +4,5 @@ DIST mysql-8.4.7.tar.gz 478948308 BLAKE2B e2ca33c1149e5c48fdee4c46444ebce8585c95 DIST mysql-8.4.7.tar.gz.asc 833 BLAKE2B 8b8e430b72e0b928a9cdfae965f4e08b7bb2add5e2e9ac2254bc648e4230610d59cefd7f46f83b917ab0752c6434fe0a745944c45174ae3a75ec6429dac3e650 SHA512 51c22eef6e3611da0ce524784844339063ffabb378f0069e7abccee95a16cd8b9cc248b9eff1622adce6cb625322837b93f44fbd5668d18c79b0fd6875032798 DIST mysql-8.4.8.tar.gz 479002191 BLAKE2B 98ebaee3eab210c00743699149314351607c805a040d965ecb406789c8272a1f9985e72c2d6c7263d632da39abe36978c4a220588cd0e2821cf91de0f145a546 SHA512 4e95db1a1c2bf99240d846e690784616b15fb3137b4512072ad71a40911c5bb72c0b0354cc588aab7cd5d396e1d1c709a63d9cd09ae664d8fe6ed0f7683e4cf6 DIST mysql-8.4.8.tar.gz.asc 833 BLAKE2B 0991cedf1bc5048ffe278b83411bcffbe7003011bee403341b62671117cba4369729b395287f35ac972a478a6ab0e41e8733bc660d3b04d28c612914a6c2bc7a SHA512 62fcf0be950f5f9bcec0670bba921d556218a33776f524395ab0d0710c54060192e40e52e1307ed10516cb0553f994ba00dc10342cc9620f5ff20e5705eaf28b -DIST mysql-boost-8.0.43.tar.gz 492715363 BLAKE2B cce0d525a218cc15293611b96402832398152575fa94ad24373f31252e491bc69ed99603e2822bfbe32e0be155d12963ed40857672a8d2ac3a65fbd3acffbe17 SHA512 433666f03448833a24e3811afb0fb98cdaeac573f1dc3b682afa10f534f3d3750c515ea93ef2b07557ea5d7151051e181a845e0885d2ac63f01558938c4485ba DIST mysql-boost-8.0.44.tar.gz 492448984 BLAKE2B e018119cb65d6835693cbc4401fc83e54d71e887578da9ea7b5d1ba8053bd7e4de2912553db6da7c8b3569d03b82391dd1858125bc7756d519e73652948f5e9d SHA512 f6881d6f88a4060796e1eac47c1ffe3ea005c27f1b0509fd97774ba5b1e7bf86d0f8c4e13126750f0cc3dd86af92c26459ae8fecf9e8f0f058dab43e93bb3b42 DIST mysql-boost-8.0.45.tar.gz 492472802 BLAKE2B cb253e2c69534c54ea6e79095619ebd4ed0b2187bd5e3b5746c5e6f92a08289df17cbb05305a9c23f3f11f2c78042a7e3edf98f33c9e5f35cc85102bfc97d328 SHA512 9ab52da87e9c1570328080b802f8c9ca1bcbb08e489e1d6cc3282b994cfd07099a0cf5eee420faa684e8372aee66495b34b633224dca98cd5caa8f4a93e500a4 diff --git a/dev-db/mysql/mysql-8.0.43.ebuild b/dev-db/mysql/mysql-8.0.43.ebuild deleted file mode 100644 index e711bbaf59d0f..0000000000000 --- a/dev-db/mysql/mysql-8.0.43.ebuild +++ /dev/null @@ -1,1322 +0,0 @@ -# Copyright 1999-2026 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit check-reqs cmake dot-a edo flag-o-matic linux-info multiprocessing prefix toolchain-funcs - -MY_PV="${PV//_pre*}" -MY_P="${PN}-${MY_PV}" - -# Patch version -PATCH_SET=( https://github.com/parona-source/mysql-server/releases/download/mysql-8.0.43-patches-01/mysql-8.0.43-patches-01.tar.xz ) - -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" -HOMEPAGE="https://www.mysql.com/" -# https://dev.mysql.com/downloads/mysql/ -SRC_URI="https://dev.mysql.com/get/Downloads/MySQL-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz" -# https://downloads.mysql.com/archives/community/ -SRC_URI+=" https://cdn.mysql.com/archives/mysql-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz" -SRC_URI+=" ${PATCH_SET[@]}" -# 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" - -LICENSE="GPL-2" -SLOT="8.0" -# -ppc for bug #761715 -KEYWORDS="amd64 arm arm64 ~hppa ~mips -ppc ppc64 ~riscv ~s390 ~sparc x86 ~x64-macos ~x64-solaris" -IUSE="cjk cracklib debug jemalloc latin1 numa +perl profiling router selinux +server tcmalloc test test-install" -RESTRICT="!test? ( test )" - -REQUIRED_USE=" - ?? ( tcmalloc jemalloc ) - cjk? ( server ) - jemalloc? ( server ) - numa? ( server ) - profiling? ( server ) - router? ( server ) - tcmalloc? ( server ) - test? ( server ) - test-install? ( server ) -" - -# Be warned, *DEPEND are version-dependent -# These are used for both runtime and compiletime -COMMON_DEPEND=" - >=app-arch/lz4-1.9.4:= - >=app-arch/zstd-1.2.0:= - >=dev-libs/openssl-1.0.0:= - sys-libs/ncurses:= - >=virtual/zlib-1.2.13:= - server? ( - dev-libs/icu:= - dev-libs/libevent:=[ssl,threads(+)] - net-libs/libtirpc:= - cjk? ( app-text/mecab ) - jemalloc? ( dev-libs/jemalloc:= ) - kernel_linux? ( - dev-libs/libaio - sys-process/procps - ) - numa? ( sys-process/numactl ) - tcmalloc? ( dev-util/google-perftools:= ) - ) -" - -DEPEND=" - ${COMMON_DEPEND} - server? ( net-libs/rpcsvc-proto ) -" -RDEPEND=" - ${COMMON_DEPEND} - !dev-db/mariadb - !dev-db/mariadb-galera - !dev-db/percona-server - !dev-db/mysql-cluster - !dev-db/mysql:0 - !dev-db/mysql:5.7 - selinux? ( sec-policy/selinux-mysql ) - !prefix? ( - acct-group/mysql - acct-user/mysql - dev-db/mysql-init-scripts - ) - test-install? ( - app-arch/zip - dev-lang/perl - dev-perl/Expect - dev-perl/JSON - sys-libs/timezone-data - ) -" -# 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 )" - -# https://bugs.gentoo.org/623962 -# tests set TZ for tests leading to failures on musl if sys-libs/timezone-data isnt installed -BDEPEND=" - app-alternatives/yacc - virtual/pkgconfig - test? ( - acct-group/mysql - acct-user/mysql - app-arch/zip - dev-lang/perl - dev-perl/Expect - dev-perl/JSON - sys-libs/timezone-data - ) - -" - -PATCHES=( - "${WORKDIR}"/mysql-patches - # Needed due to bundled boost-1.77, this fix is included in boost-1.81 - "${FILESDIR}"/mysql-8.0.36-boost-clang-fix.patch - # Needed due to bundled boost-1.77, this fix is included in boost-1.79 - "${FILESDIR}"/mysql-8.0.37-fix-bundled-boost.patch - # Needed due to bundled abseil-cpp-20230802, this fix is included in abseil-cpp-20240722 - "${FILESDIR}"/mysql-8.0.37-fix-bundled-abseil.patch - # for 8.0.43 only - "${FILESDIR}"/mysql-8.0.43-fix-clang-20-allocator.patch -) - -mysql_init_vars() { - : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} - : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - MY_DATADIR="${MY_LOCALSTATEDIR}" - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_pretend() { - if [[ ${MERGE_TYPE} != binary ]] ; then - if use server ; then - CHECKREQS_DISK_BUILD="3G" - - if has test ${FEATURES} ; then - CHECKREQS_DISK_BUILD="10G" - - if use elibc_musl; then - # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" - CHECKREQS_DISK_BUILD="18G" - fi - fi - - check-reqs_pkg_pretend - fi - fi -} - -pkg_setup() { - if [[ ${MERGE_TYPE} != binary ]] ; then - CHECKREQS_DISK_BUILD="3G" - - if has test ${FEATURES} ; then - CHECKREQS_DISK_BUILD="10G" - - if use elibc_musl; then - # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" - CHECKREQS_DISK_BUILD="18G" - fi - - # 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 - - local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) - if [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] ; then - die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!" - fi - - if use latin1 ; then - # Upstream only supports tests with default charset - die "Testing with USE=latin1 is not supported." - fi - fi - - if use kernel_linux && use numa ; then - linux-info_get_any_version - - local CONFIG_CHECK="~NUMA" - - local WARNING_NUMA="\ -This package expects NUMA support in kernel which this system does not have at the moment; \ -Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" - - check_extra_config - fi - - use server && check-reqs_pkg_setup - fi -} - -src_unpack() { - unpack ${A} - - mv -f "${WORKDIR}/${MY_P}" "${S}" || die -} - -src_prepare() { - # Avoid rpm call which would trigger sandbox, #692368 - sed -i \ - -e 's/MY_RPM rpm/MY_RPM rpmNONEXISTENT/' \ - CMakeLists.txt || die - - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux - if [[ -d "${S}/support-files/SELinux" ]] ; then - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die - fi - - # Remove man pages for client-lib tools we don't install - rm \ - man/my_print_defaults.1 \ - man/perror.1 \ - man/zlib_decompress.1 \ - || die - - cmake_src_prepare -} - -src_configure() { - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - # Code requires C++17 due to https://github.com/mysql/mysql-server/commit/236ab55bedd8c9eacd80766d85edde2a8afacd08 - append-cxxflags -std=c++17 - - # Debug build type used extensively to add preprocessor definitions - use debug && CMAKE_BUILD_TYPE="Debug" - - lto-guarantee-fat - - local mycmakeargs=( - -Wno-dev # less noise - - # Building everything as shared breaks upstream assumptions. - # For example bundled abseil is excpected to be static and is therefore not installed. - # Breaking the assumption leading the mysql to being built against bundled abseil, - # but then dynamically linked against system abseil once installed. - -DBUILD_SHARED_LIBS=OFF - - -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_PRIV_LIBDIR=$(get_libdir)/mysql/private - -DINSTALL_MYSQLSHAREDIR=share/mysql - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_SBINDIR=sbin - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" - - -DROUTER_INSTALL_PLUGINDIR="$(get_libdir)/mysqlrouter" - -DROUTER_INSTALL_LIBDIR="$(get_libdir)/mysqlrouter/private" - -DROUTER_INSTALL_LOGROTATEDIR="${EPREFIX}/etc/logrotate.d" - -DROUTER_INSTALL_DOCDIR="share/doc/${PF}" - - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" - -DWITH_UNIT_TESTS=$(usex test ON OFF) - - # Enables -Werror - -DMYSQL_MAINTAINER_MODE=OFF - - # debug hack wrt #497532 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" - - # Automagically uses LLD when not using LTO (bug #710272, #775845) - -DUSE_LD_LLD=OFF - - # Causes issues on musl bug #922808 - -DWITH_BUILD_ID=OFF - - # These are installed via dev-db/mysql-connector-c - -DWITHOUT_CLIENTLIBS=YES - - # Using bundled editline to get CTRL+C working - -DWITH_EDITLINE=bundled - -DWITH_ZLIB=system - -DWITH_SSL=system - -DWITH_LIBWRAP=0 - -DENABLED_LOCAL_INFILE=1 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DWITH_DEFAULT_COMPILER_OPTIONS=0 - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - - -DWITH_CURL=system - -DWITH_BOOST="${S}/boost" - -DWITH_ROUTER=$(usex router ON OFF) - - -DWITH_ICU=system - -DWITH_LZ4=system - # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex - -DWITH_RAPIDJSON=bundled - -DWITH_ZSTD=system - - # This is the expected location for upstream RPM's and the script will search for location relative to it. - # Other locations will not work. - -DINSTALL_MYSQLTESTDIR=$(usex test-install 'share/mysql-test' 0) - ) - - if tc-is-lto ; then - mycmakeargs+=( -DWITH_LTO=ON ) - else - mycmakeargs+=( -DWITH_LTO=OFF ) - 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." - ewarn "Tests will probably fail!" - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - elif use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8mb4 - -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci - ) - fi - - if use server ; then - mycmakeargs+=( - -DWITH_EXTRA_CHARSETS=all - -DWITH_DEBUG=$(usex debug) - -DWITH_MECAB=$(usex cjk system OFF) - -DWITH_LIBEVENT=system - # Cannot handle protobuf >23 bug #912797 - # 05/06/2024: protobuf has been updated, - # but it cannot handle abseil when building against system - # Currently bundles protobuf-25.1 - -DWITH_PROTOBUF=bundled - -DWITH_NUMA=$(usex numa ON OFF) - ) - - if use jemalloc ; then - mycmakeargs+=( -DWITH_JEMALLOC=ON ) - elif use tcmalloc ; then - mycmakeargs+=( -DWITH_TCMALLOC=ON ) - fi - - if use profiling ; then - # Setting to OFF doesn't work: Once set, profiling options will be added - # to `mysqld --help` output via sql/sys_vars.cc causing - # "main.mysqld--help-notwin" test to fail - mycmakeargs+=( -DENABLED_PROFILING=ON ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_EXAMPLE_STORAGE_ENGINE=0 - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_FEDERATED_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_INNODB_MEMCACHED=0 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - ) - else - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITH_SYSTEMD=no - ) - fi - - cmake_src_configure -} - -# Official test instructions: -# ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' \ -# ebuild mysql-X.X.XX.ebuild digest clean test install -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 - - einfo "Official test instructions:" - einfo "ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' ebuild ..." - - # Ensure that parallel runs don't die - local -x MTR_BUILD_THREAD="$((${RANDOM} % 100))" - - # Use a tmpfs opportunistically, otherwise set MTR_PARALLEL to 1. - # MySQL tests are I/O heavy. They benefit greatly from a tmpfs, parallel tests without a tmpfs are flaky due to timeouts. - if mountpoint -q /dev/shm ; then - local VARDIR="/dev/shm/mysql-var-${MTR_BUILD_THREAD}" - local -x MTR_PARALLEL=${MTR_PARALLEL:-$(makeopts_jobs)} - else - ewarn "/dev/shm not mounted, setting default MTR_PARALLEL to 1. Tests will take a long time" - local VARDIR="${T}/vardir" - # Set it to one while allowing users to override it. - local -x MTR_PARALLEL=${MTR_PARALLEL:-1} - fi - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" - - # Disable unit tests, run them separately with eclass defaults - local -x MTR_UNIT_TESTS=0 - - # Increase test timeouts - # bug #923649 - # https://github.com/gentoo/gentoo/pull/35002#issuecomment-1926101030 - local -x MTR_SUITE_TIMEOUT=$(( 60 * 40 )) # minutes - local -x MTR_TESTCASE_TIMEOUT=60 # minutes - - # Include config for tests, this is for scenarios where mysql wasn't installed previously or if the - # configuration was from an older version. - sed \ - -e "s/@GENTOO_PORTAGE_EPREFIX@/${EPREFIX}/" \ - -e "s/@DATADIR@/${MY_DATADIR}/" \ - "${FILESDIR}"/my.cnf-8.0.distro-client \ - "${FILESDIR}"/my.cnf-8.0.distro-server \ - > "${T}"/my.cnf || die - local -x PATH_CONFIG_FILE="${T}/my.cnf" - - # Create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - # Run mysql tests - pushd "${TESTDIR}" &>/dev/null || die - - touch "${T}/disabled.def" || die - - local -a disabled_tests=( - "auth_sec.atomic_rename_user;103512;Depends on user running test" - "auth_sec.keyring_file_data_qa;0;Won't work with user privileges" - "auth_sec.openssl_without_fips;94718;Known test failure" - - "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" - "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" - "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" - "gis.st_symdifference;5452;Known rounding error with latest AMD processors (PS)" - - "main.derived_limit;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.explain_tree;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.gis-precise;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.mysql_load_data_local_dir;0;Known test failure -- no upstream bug yet" - "main.select_icp_mrr;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_bugs;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_dupsweed;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_dupsweed_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_dupsweed_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_firstmatch;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_firstmatch_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_firstmatch_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_mat_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_all_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "perfschema.statement_digest_query_sample;0;Test will fail on slow hardware" - - "rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch;0;Unstable test" - "rpl_gtid.rpl_multi_source_mtr_includes;97844;Unstable test" - "main.partition_datatype;0;Unstable test" - - "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware" - - "sys_vars.build_id_basic;0;Requires -DWITH_BUILD_ID=ON" - - "main.keyring_migration_password;0;Known test failure -- no upstream bug yet" - "innodb.upgrade_orphan;0;Known test failure -- no upstream bug yet" - - # Updated in newer versions - # https://github.com/mysql/mysql-server/commit/269f4ef1e091c7a4404450f97c5ae1845443eb25 - "auth_sec.admin_channel_tls;0;Certificate expired" - "auth_sec.admin_channel_tls_startup;0;Certificate expired" - "auth_sec.cert_verify;0;Certificate expired" - "auth_sec.cert_verify_openssl;0;Certificate expired" - "x.mysqlxtest_mode_ssl;0;Certificate expired" - "x.mysqlxtest_mode_ssl_unixsocket;0;Certificate expired" - ) - - if ! hash zip 1>/dev/null 2>&1 ; then - # No need to force dep app-arch/zip for one test - disabled_tests+=( - "innodb.discarded_partition_create;0;Requires app-arch/zip" - "innodb.partition_upgrade_create;0;Requires app-arch/zip" - ) - fi - - if has_version ">=dev-libs/openssl-3.2" ; then - # https://bugs.mysql.com/bug.php?id=113258 - # Fails still with 8.0.41 - disabled_tests+=( - "rpl.rpl_tlsv13;0;CCM8 ciphers have a lower security level with OpenSSL 3.2" - "auth_sec.wl15800_ciphers_tlsv13;0;CCM8 ciphers have a lower security level with OpenSSL 3.2" - ) - fi - - if use debug; then - disabled_tests+=( - "innodb.dblwr_unencrypt;0;Unstable test" - ) - 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 - - local -a CMAKE_SKIP_TESTS=( - # timing test, can be unreliable - "routertest_harness_net_ts_timer" - - # Could not get local host address: Name or service not known(errno: -2) - "routertest_component_bootstrap" - "routertest_component_bootstrap_account" - "routertest_component_bootstrap_clusterset" - "routertest_component_config_overwrites" - "routertest_component_rest_api_enable" - "routertest_component_routing" - "routertest_component_sd_notify" - "routertest_component_state_file" - "routertest_integration_routing_direct" - "routertest_integration_routing_reuse" - "routertest_integration_routing_sharing" - "routertest_integration_routing_sharing_constrained_pools" - "routertest_integration_routing_sharing_restart" - - # TODO: ??? - "pfs_host-oom" - "pfs_user-oom" - "pfs" - ) - - # 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 - - # run mysql-test tests - # Enable force restart to ensure success when tests don't cleanup sufficiently. - # Anything touching gtid_executed is negatively affected if you have unlucky ordering - nonfatal edo perl mysql-test-run.pl \ - --force --force-restart \ - --vardir="${VARDIR}" --tmpdir="${T}/tmp-tests" \ - --skip-test=tokudb --skip-test-list="${T}/disabled.def" \ - --max-test-fail=0 \ - --retry=3 --retry-failure=2 \ - --report-unstable-tests \ - --report-features - retstatus_tests=$? - - if [[ "${VARDIR}" != "${T}/var-tests" ]]; then - # Move vardir to tempdir. - mv "${VARDIR}" "${T}/var-tests" - # Clean up mysql temporary directory - rm -rf "${VARDIR}" 2>/dev/null - fi - - if [[ "${retstatus_tests}" -ne 0 ]]; then - eerror "Tests failed. When you file a bug, please attach the following items:" - eerror "The file that is created with this command:" - eerror "\t'find ${T}/var-tests -name '*.log' | tar -caf mysql-test-logs.tar.xz --files-from -'" - fi - - 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 - - # bug #823656 - cmake_src_test --test-command "--gtest_death_test_style=threadsafe" - - [[ "${retstatus_tests}" -ne 0 ]] && die "Test failures: mysql-test-run.pl" - einfo "Tests successfully completed" -} - -src_install() { - strip-lto-bytecode - cmake_src_install - - # 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 - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#"${EPREFIX}"}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#"${EPREFIX}"}/mysql.d" - cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - mycnf_src="my.cnf-8.0.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|utf8mb4|latin1|g" \ - "${TMPDIR}/my.cnf.ok" || die - fi - - eprefixify "${TMPDIR}/my.cnf.ok" - - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - #Remove mytop if perl is not selected - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" - - if use router ; then - rm -rf \ - "${ED}/usr/LICENSE.router" \ - "${ED}/usr/README.router" \ - "${ED}/usr/run" \ - "${ED}/usr/var" \ - || die - fi - - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - # NOTE: $MY_LOGDIR contains $EPREFIX by default - [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" - - # Note about configuration change - einfo - elog "This version of ${PN} reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/mysql.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/mysql.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 - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog " \"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - einfo - else - einfo - elog "Upgrade process for ${PN}-8.x has changed. Please read" - elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html" - einfo - fi -} - -pkg_config() { - _getoptval() { - local section="$1" - local flag="--${2}=" - local extra_options="${3}" - local cmd=( - "${my_print_defaults_binary}" - "${extra_options}" - "${section}" - ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" - fi - } - - _mktemp_dry() { - # emktemp has no --dry-run option - local template="${1}" - - if [[ -z "${template}" ]] ; then - if [[ -z "${T}" ]] ; then - template="/tmp/XXXXXXX" - else - template="${T}/XXXXXXX" - fi - fi - - local template_wo_X=${template//X/} - local n_X - let n_X=${#template}-${#template_wo_X} - if [[ ${n_X} -lt 3 ]] ; then - echo "${FUNCNAME[0]}: too few X's in template '${template}'" >&2 - return - fi - - local attempts=0 - local character tmpfile - while [[ true ]] ; do - let attempts=attempts+1 - - new_file= - while read -n1 character ; do - if [[ "${character}" == "X" ]] ; then - tmpfile+="${RANDOM:0:1}" - else - tmpfile+="${character}" - fi - done < <(echo -n "${template}") - - if [[ ! -f "${tmpfile}" ]] - then - echo "${tmpfile}" - return - fi - - if [[ ${attempts} -ge 100 ]] ; then - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 - return - fi - done - } - - local mysqld_binary="${EROOT}/usr/sbin/mysqld" - if [[ ! -x "${mysqld_binary}" ]] ; then - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysql_binary="${EROOT}/usr/bin/mysql" - if [[ ! -x "${mysql_binary}" ]] ; then - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" - if [[ ! -x "${my_print_defaults_binary}" ]] ; then - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" - fi - - if [[ -z "${MYSQL_USER}" ]] ; then - MYSQL_USER=mysql - if use prefix ; then - MYSQL_USER=$(id -u -n 2>/dev/null) - if [[ -z "${MYSQL_USER}" ]] ; then - die "Failed to determine current username!" - fi - fi - fi - - if [[ -z "${MYSQL_GROUP}" ]] ; then - MYSQL_GROUP=mysql - if use prefix ; then - MYSQL_GROUP=$(id -g -n 2>/dev/null) - if [[ -z "${MYSQL_GROUP}" ]] ; then - die "Failed to determine current user groupname!" - fi - fi - fi - - # my_print_defaults needs to read stuff in $HOME/.my.cnf - local -x HOME="${EROOT}/root" - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Read currently set data directory - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ -z "${MY_DATADIR}" ]] ; then - die "Sorry, unable to find MY_DATADIR!" - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" - ewarn "Please rename or delete its content if you wish to initialize a new data directory." - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" - fi - - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_TMPDIR=${MYSQL_TMPDIR%/} - # These are dir+prefix - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - - # Create missing directories. - # Always check if mysql user can write to directory even if we just - # created directory because a parent directory might be not - # accessible for that user. - PID_DIR="${EROOT}/run/mysqld" - if [[ ! -d "${PID_DIR}" ]] ; then - einfo "Creating ${PN} PID directory '${PID_DIR}' ..." - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ - || die "Failed to create PID directory '${PID_DIR}'!" - fi - - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_pid_dir_testfile}" ]] \ - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_pid_dir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" - else - rm "${_pid_dir_testfile}" || die - unset _pid_dir_testfile - fi - - if [[ ! -d "${MY_DATADIR}" ]] ; then - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" - fi - - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_datadir_testfile}" ]] \ - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_datadir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" - else - rm "${_my_datadir_testfile}" || die - unset _my_datadir_testfile - fi - - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" - fi - - if [[ -z "${MYSQL_TMPDIR}" ]] ; then - MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" - [[ -z "${MYSQL_TMPDIR}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" - - mkdir "${MYSQL_TMPDIR}" || die - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die - fi - - # Now we need to test MYSQL_TMPDIR... - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_tmpdir_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_tmpdir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" - else - rm "${_my_tmpdir_testfile}" || die - unset _my_tmpdir_testfile - fi - - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" - fi - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_logbin_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_logbin_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" - else - rm "${_my_logbin_testfile}" || die - unset _my_logbin_testfile - fi - fi - - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_relaylog_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_relaylog_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" - else - rm "${_my_relaylog_testfile}" || die - unset _my_relaylog_testfile - fi - fi - - local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" - if [[ -z "${mysql_install_log}" ]] ; then - die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" - else - # make sure file is writable for MYSQL_USER... - touch "${mysql_install_log}" || die - chown ${MYSQL_USER} "${mysql_install_log}" || die - fi - - local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" - if [[ -z "${mysqld_logfile}" ]] ; then - die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" - else - # make sure file is writable for MYSQL_USER... - touch "${mysqld_logfile}" || die - chown ${MYSQL_USER} "${mysqld_logfile}" || die - fi - - echo "" - einfo "Detected settings:" - einfo "==================" - einfo "MySQL User:\t\t\t\t${MYSQL_USER}" - einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" - einfo "MySQL DATA directory:\t\t${MY_DATADIR}" - einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" - fi - - einfo "PID DIR:\t\t\t\t${PID_DIR}" - einfo "Install db log:\t\t\t${mysql_install_log}" - einfo "Install server log:\t\t\t${mysqld_logfile}" - - local -a config_files - - local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" - if [[ -f "${config_file}" ]] ; then - config_files+=( "${config_file}" ) - else - ewarn "Client configuration '${config_file}' not found." - ewarn "Skipping configuration of default authentication plugin for client ..." - fi - - config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" - if [[ -f "${config_file}" ]] ; then - config_files+=( "${config_file}" ) - else - ewarn "Server configuration '${config_file}' not found" - ewarn "Skipping configuration of default authentication plugin for mysqld ..." - fi - - if [[ ${#config_files[@]} -gt 0 ]] ; then - if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then - local user_answer - - echo - einfo "Please select default authentication plugin (enter number or plugin name):" - einfo "1) caching_sha2_password [MySQL 8.0 default]" - einfo "2) mysql_native_password [MySQL 5.7 default]" - einfo - einfo "For details see:" - einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" - read -p " >" user_answer - echo - - case "${user_answer}" in - 1|caching_sha2_password) - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password - ;; - 2|mysql_native_password) - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password - ;; - '') - die "No authentication plugin selected!" - ;; - *) - die "Authentication plugin '${user_answer}' is unknown/unsupported!" - ;; - esac - - echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" - - unset user_answer - fi - - local cfg_option cfg_option_tabs cfg_section - for config_file in "${config_files[@]}" ; do - cfg_option="default-authentication-plugin" - cfg_section="mysqld" - cfg_option_tabs="\t\t" - if [[ "${config_file}" == *client.cnf ]] ; then - cfg_option="default-auth" - cfg_section="client" - cfg_option_tabs="\t\t\t\t" - fi - - if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then - einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." - sed -i \ - -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ - "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" - else - einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." - sed -i \ - -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ - "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" - fi - done - unset cfg_option cfg_option_tabs cfg_section - fi - unset config_files config_file - - 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!" - ewarn "(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="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" - [[ -z "${tz_sql}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" - - 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 - - # --initialize-insecure will not set root password - # --initialize would set a random one in the log which we don't need as we set it ourselves - local cmd=( - "${mysqld_binary}" - "${mysqld_options[@]}" - "--initialize-insecure" - "--init-file='${tz_sql}'" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - "--log-error='${mysql_install_log}'" - "--user=${MYSQL_USER}" - ) - - einfo "Initializing ${PN} data directory: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 - - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; 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 - - rm "${tz_sql}" || die - - local x=${RANDOM} - local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" - local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" - 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="${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 - - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" -} From 37fe07860f71cc18eba0f2434983f1be3fbcdaf0 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Tue, 21 Apr 2026 21:09:06 +0300 Subject: [PATCH 15/19] dev-db/mysql: drop 8.4.7 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/733 Signed-off-by: Sam James --- dev-db/mysql/Manifest | 2 - dev-db/mysql/mysql-8.4.7.ebuild | 1315 ------------------------------- 2 files changed, 1317 deletions(-) delete mode 100644 dev-db/mysql/mysql-8.4.7.ebuild diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest index 2439a482126a0..1d1f39783f23d 100644 --- a/dev-db/mysql/Manifest +++ b/dev-db/mysql/Manifest @@ -1,7 +1,5 @@ DIST mysql-8.0.43-patches-01.tar.xz 8396 BLAKE2B 83c1992ae6f3b58f5c0e07926abb36fd1581f6db5a4e440b62e16f87d99133797c74e889f1a0e99d407ab7882f825b516885599cdb41e4429b405c968c995dbf SHA512 8e1480817f924c6a3db1ac412fe551337cfa134bf2729344fdb811d44ced96c78300ffca0eabc4ddd5e24827ebc1ddeea6c5973fd00ecd4c7fe67fe96d4c0081 DIST mysql-8.4.7-patches-01.tar.xz 8268 BLAKE2B 5a580c4295c246ffaad0d2819ab2860d0f762b633611b5c4a9c1cfb4f0a959d20595148108ea04fc9f0a699f46c39939e3c093fa0845d717133807ce8f1c74a6 SHA512 d451c6766b41cc95356e7c7cd45238d18236d9d71225e00b129d30c59463bc5c05f077a9c9d77b605fecb07189dd8502e8a6568cc5b75264e2255ffcd61715e9 -DIST mysql-8.4.7.tar.gz 478948308 BLAKE2B e2ca33c1149e5c48fdee4c46444ebce8585c95ec32c2a73970cfc194728f159ad599807eb93c0b95f6bb34498cf7a8599d5fe2f802e6116d0e93b175e5d7cf46 SHA512 d9596395b176490d5e58be307c2f82f55c9acd3206c1ba29bdb8c96c67438bbe5594621f601161ccb77f56c8262d00255ab6fd8aa62db61c80a1721e3d4e45a2 -DIST mysql-8.4.7.tar.gz.asc 833 BLAKE2B 8b8e430b72e0b928a9cdfae965f4e08b7bb2add5e2e9ac2254bc648e4230610d59cefd7f46f83b917ab0752c6434fe0a745944c45174ae3a75ec6429dac3e650 SHA512 51c22eef6e3611da0ce524784844339063ffabb378f0069e7abccee95a16cd8b9cc248b9eff1622adce6cb625322837b93f44fbd5668d18c79b0fd6875032798 DIST mysql-8.4.8.tar.gz 479002191 BLAKE2B 98ebaee3eab210c00743699149314351607c805a040d965ecb406789c8272a1f9985e72c2d6c7263d632da39abe36978c4a220588cd0e2821cf91de0f145a546 SHA512 4e95db1a1c2bf99240d846e690784616b15fb3137b4512072ad71a40911c5bb72c0b0354cc588aab7cd5d396e1d1c709a63d9cd09ae664d8fe6ed0f7683e4cf6 DIST mysql-8.4.8.tar.gz.asc 833 BLAKE2B 0991cedf1bc5048ffe278b83411bcffbe7003011bee403341b62671117cba4369729b395287f35ac972a478a6ab0e41e8733bc660d3b04d28c612914a6c2bc7a SHA512 62fcf0be950f5f9bcec0670bba921d556218a33776f524395ab0d0710c54060192e40e52e1307ed10516cb0553f994ba00dc10342cc9620f5ff20e5705eaf28b DIST mysql-boost-8.0.44.tar.gz 492448984 BLAKE2B e018119cb65d6835693cbc4401fc83e54d71e887578da9ea7b5d1ba8053bd7e4de2912553db6da7c8b3569d03b82391dd1858125bc7756d519e73652948f5e9d SHA512 f6881d6f88a4060796e1eac47c1ffe3ea005c27f1b0509fd97774ba5b1e7bf86d0f8c4e13126750f0cc3dd86af92c26459ae8fecf9e8f0f058dab43e93bb3b42 diff --git a/dev-db/mysql/mysql-8.4.7.ebuild b/dev-db/mysql/mysql-8.4.7.ebuild deleted file mode 100644 index 892d43038fa37..0000000000000 --- a/dev-db/mysql/mysql-8.4.7.ebuild +++ /dev/null @@ -1,1315 +0,0 @@ -# Copyright 1999-2026 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit check-reqs cmake dot-a edo eapi9-ver flag-o-matic linux-info multiprocessing toolchain-funcs prefix verify-sig - -MY_PV="${PV//_pre*}" -MY_P="${PN}-${MY_PV}" - -# $ git format-patch mysql-${PV}...mysql-${PV}-patches -o mysql-patches -# $ tar caf mysql-${PV}-patches-01.tar.xz mysql-patches -PATCH_SET=( - # https://github.com/parona-source/mysql-server/releases/tag/mysql-8.4.7-patches-01 - https://github.com/parona-source/mysql-server/releases/download/mysql-8.4.7-patches-01/mysql-8.4.7-patches-01.tar.xz -) - -DESCRIPTION="Fast, multi-threaded, multi-user SQL database server" -HOMEPAGE="https://www.mysql.com/" -# Latest source distributions are available at https://dev.mysql.com/downloads/mysql/ -# before they are moved to https://downloads.mysql.com/archives/community/ -SRC_URI=" - https://dev.mysql.com/get/Downloads/MySQL-$(ver_cut 1-2)/${MY_P}.tar.gz - https://cdn.mysql.com/archives/mysql-$(ver_cut 1-2)/${MY_P}.tar.gz - verify-sig? ( - https://dev.mysql.com/downloads/gpg/?file=${MY_P}.tar.gz&p=23 - -> ${MY_P}.tar.gz.asc - https://downloads.mysql.com/archives/gpg/?file=${MY_P}.tar.gz&p=23 - -> ${MY_P}.tar.gz.asc - ) - ${PATCH_SET[@]} -" -# 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" - -VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/mysql.asc" - -LICENSE="GPL-2" -# https://dev.mysql.com/blog-archive/introducing-mysql-innovation-and-long-term-support-lts-versions/ -SLOT="$(ver_cut 1-2)" -# 64-bit only since 8.2.0 -# https://github.com/mysql/mysql-server/commit/07bf1bdb620daf62c02ead0d5439d65c7c34aa00 -# -arm -hppa -mips -ppc -x86 -# -ppc for bug #761715 -KEYWORDS="~amd64 -arm ~arm64 -hppa -mips -ppc ~ppc64 ~riscv ~s390 ~sparc -x86 ~x64-macos ~x64-solaris" -IUSE="cjk cracklib debug jemalloc numa +perl profiling router selinux +server tcmalloc test test-install" -RESTRICT="!test? ( test )" - -REQUIRED_USE=" - ?? ( tcmalloc jemalloc ) - cjk? ( server ) - jemalloc? ( server ) - numa? ( server ) - profiling? ( server ) - router? ( server ) - tcmalloc? ( server ) - test? ( server ) - test-install? ( server ) -" - -# Be warned, *DEPEND are version-dependent -# These are used for both runtime and compiletime -COMMON_DEPEND=" - >=app-arch/lz4-1.9.4:= - >=app-arch/zstd-1.2.0:= - >=dev-libs/openssl-1.0.0:= - sys-libs/ncurses:= - >=virtual/zlib-1.2.13:= - server? ( - dev-libs/icu:= - net-libs/libtirpc:= - cjk? ( app-text/mecab ) - jemalloc? ( dev-libs/jemalloc:= ) - kernel_linux? ( - dev-libs/libaio - sys-process/procps - ) - numa? ( sys-process/numactl ) - tcmalloc? ( dev-util/google-perftools:= ) - ) -" -DEPEND=" - ${COMMON_DEPEND} - virtual/libudev - server? ( net-libs/rpcsvc-proto ) -" -RDEPEND=" - ${COMMON_DEPEND} - !dev-db/mariadb - !dev-db/mariadb-galera - !dev-db/percona-server - !dev-db/mysql-cluster - !dev-db/mysql:0 - !dev-db/mysql:5.7 - !dev-db/mysql:8.0 - selinux? ( sec-policy/selinux-mysql ) - !prefix? ( - acct-group/mysql - acct-user/mysql - dev-db/mysql-init-scripts - ) - test-install? ( - app-arch/zip - dev-lang/perl - dev-perl/Expect - dev-perl/JSON - sys-libs/timezone-data - ) -" -# 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 )" - -# https://bugs.gentoo.org/623962 -# tests set TZ for tests leading to failures on musl if sys-libs/timezone-data isnt installed -BDEPEND=" - app-alternatives/yacc - virtual/pkgconfig - test? ( - acct-group/mysql - acct-user/mysql - app-arch/zip - dev-lang/perl - dev-perl/Expect - dev-perl/JSON - sys-libs/timezone-data - ) - verify-sig? ( >=sec-keys/openpgp-keys-mysql-20231023 ) -" - -PATCHES=( - "${WORKDIR}"/mysql-patches - # Needed due to bundled abseil-cpp-20230802, this fix is included in abseil-cpp-20240722 - "${FILESDIR}"/mysql-8.0.37-fix-bundled-abseil.patch -) - -mysql_init_vars() { - : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} - : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - MY_DATADIR="${MY_LOCALSTATEDIR}" - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_pretend() { - CHECKREQS_DISK_BUILD="3G" - - if has test ${FEATURES} ; then - # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" - CHECKREQS_DISK_BUILD="18G" - - # 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 - - if use kernel_linux && use numa ; then - linux-info_get_any_version - - local CONFIG_CHECK="~NUMA" - - local WARNING_NUMA="\ -This package expects NUMA support in kernel which this system does not have at the moment; \ -Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" - - check_extra_config - fi - check-reqs_pkg_pretend -} - -pkg_setup() { - CHECKREQS_DISK_BUILD="3G" - if has test ${FEATURES} ; then - # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" - CHECKREQS_DISK_BUILD="18G" - - local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) - if [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] ; then - die "FEATURES=test requires fs.aio-max-nr=250000 at minimum!" - fi - fi - check-reqs_pkg_setup -} - -src_unpack() { - if use verify-sig; then - verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz" "${DISTDIR}/${MY_P}.tar.gz.asc" - fi - - unpack ${A} - - mv -f "${WORKDIR}/${MY_P}" "${S}" || die -} - -src_prepare() { - # Avoid rpm call which would trigger sandbox, #692368 - sed -i \ - -e 's/MY_RPM rpm/MY_RPM rpmNONEXISTENT/' \ - CMakeLists.txt || die - - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux - if [[ -d "${S}/support-files/SELinux" ]] ; then - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die - fi - - cmake_src_prepare -} - -src_configure() { - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - # Debug build type used extensively to add preprocessor definitions - use debug && CMAKE_BUILD_TYPE="Debug" - - lto-guarantee-fat - - local mycmakeargs=( - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" - - -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_PRIV_LIBDIR="$(get_libdir)/mysql/private" - -DINSTALL_MANDIR="share/man" - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_MYSQLSHAREDIR="share/mysql" - -DINSTALL_PLUGINDIR="$(get_libdir)/mysql/plugin" - -DINSTALL_SBINDIR="sbin" - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DSYSCONFDIR="${EPREFIX}/etc/mysql" - - -DENABLED_PROFILING=$(usex profiling) - -DWITHOUT_SERVER=$(usex !server) - - -DWITH_ROUTER=$(usex router) - -DROUTER_INSTALL_PLUGINDIR="$(get_libdir)/mysqlrouter" - -DROUTER_INSTALL_LIBDIR="$(get_libdir)/mysqlrouter/private" - -DROUTER_INSTALL_DOCDIR="share/doc/${PF}" - -DROUTER_INSTALL_LOGROTATEDIR="${EPREFIX}/etc/logrotate.d" - - # Webauthn plugins not available in community build - # https://dev.mysql.com/doc/refman/8.4/en/webauthn-pluggable-authentication.html - # Which is why FIDO, KERBEROS and LDAP are disabled. - - # Valid options differ. - # With some none is disabled, while with others empty is disabled. - -DWITH_CURL=system - -DWITH_EDITLINE=bundled # Using bundled editline to get CTRL+C working - -DWITH_FIDO=none - -DWITH_ICU=$(usex server system none) - -DWITH_JEMALLOC=$(usex jemalloc) - -WITH_KERBEROS=none - -WITH_LDAP=none - -DWITH_LZ4=system - -DWITH_NUMA=$(usex numa) - -DWITH_PROTOBUF=$(usex server bundled none) # Cannot handle protobuf >23 bug #912797 - # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex - # see extra/RAPIDJSON-README - -DWITH_RAPIDJSON=bundled - -DWITH_SASL=system - -DWITH_SSL=system - -DWITH_ZLIB=system - -DWITH_ZSTD=system - - # Installs support files that would conflict with dev-db/mysql-init-scripts - -DWITH_SYSTEMD=0 - - # These are installed via dev-db/mysql-connector-c - -DWITHOUT_CLIENTLIBS=ON - - # Building everything as shared breaks upstream assumptions. - # For example bundled abseil is excpected to be static and is therefore not installed. - # Breaking the assumption leading the mysql to being built against bundled abseil, - # but then dynamically linked against system abseil once installed. - -DBUILD_SHARED_LIBS=OFF - - -DENABLED_LOCAL_INFILE=ON # Should LOAD DATA LOCAL be enabled by default? - - -Wno-dev # less noise - - -DMYSQL_MAINTAINER_MODE=OFF # Enables -Werror - # These are fine as they don't override user flags - # (also means you don't specify expected things like c++ standard) - -DWITH_DEFAULT_COMPILER_OPTIONS=ON - - # Causes issues on musl bug #922808 - -DWITH_BUILD_ID=OFF - - -DWITH_DEBUG=$(usex debug) - # debug hack wrt #497532 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" - - -DWITH_UNIT_TESTS=$(usex test) - # This is the expected location for upstream RPM's and the script will search for location relative to it. - # Other locations will not work. - -DINSTALL_MYSQLTESTDIR=$(usex test-install 'share/mysql-test' 0) - ) - - if use server ; then - mycmakeargs+=( - -DWITH_EXTRA_CHARSETS=all - - -DWITH_MECAB=$(usex cjk system) - - # Storage engines - -DWITH_ARCHIVE_STORAGE_ENGINE=ON - -DWITH_BLACKHOLE_STORAGE_ENGINE=ON - -DWITH_CSV_STORAGE_ENGINE=ON - -DWITH_EXAMPLE_STORAGE_ENGINE=OFF - -DWITH_FEDERATED_STORAGE_ENGINE=ON - -DWITH_HEAP_STORAGE_ENGINE=ON - -DWITH_INNOBASE_STORAGE_ENGINE=ON - -DWITH_MYISAMMRG_STORAGE_ENGINE=ON - -DWITH_MYISAM_STORAGE_ENGINE=ON - ) - fi - - if tc-is-lto ; then - mycmakeargs+=( -DWITH_LTO=ON ) - else - mycmakeargs+=( -DWITH_LTO=OFF ) - 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." - ewarn "Tests will probably fail!" - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8mb4 - -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci - ) - fi - - cmake_src_configure -} - -# Official test instructions: -# ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' \ -# ebuild mysql-X.X.XX.ebuild digest clean test install -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 - - einfo "Official test instructions:" - einfo "ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' ebuild ..." - - # Try to increase file limits to increase test coverage - local ulimit_n - for ulimit_n in {16500,4162,3000}; do - ulimit -n ${ulimit_n} 1>/dev/null 2>&1 && break - done - - case ${ulimit_n} in - 16500) - # Upper limit comes from parts.partition_* tests - einfo "Will run test suite with open file limit set to 16500 (best test coverage)." - ;; - 4162) - # Medium limit comes from - # '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." - ;; - 3000) - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." - ;; - *) - ewarn "For minimum test coverage, please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." - ;; - esac - - # Documentation for mysql-test-run (MTR_* variables and so on) - # https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_MYSQL_TEST_RUN_PL.html - - # Ensure that parallel runs don't die - local -x MTR_BUILD_THREAD="$((${RANDOM} % 100))" - - # Use a tmpfs opportunistically, otherwise set MTR_PARALLEL to 1. - # MySQL tests are I/O heavy. They benefit greatly from a tmpfs, - # parallel tests without a tmpfs are flaky due to timeouts. - if mountpoint -q /dev/shm ; then - local VARDIR="/dev/shm/mysql-var-${MTR_BUILD_THREAD}" - local -x MTR_PARALLEL=${MTR_PARALLEL:-$(makeopts_jobs)} - else - ewarn "/dev/shm not mounted, setting default MTR_PARALLEL to 1. Tests will take a long time" - local VARDIR="${T}/vardir" - # Set it to one while allowing users to override it. - local -x MTR_PARALLEL=${MTR_PARALLEL:-1} - fi - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" - - # Disable unit tests, run them separately with eclass defaults - local -x MTR_UNIT_TESTS=0 - - # Increase test timeouts - # bug #923649 - # https://github.com/gentoo/gentoo/pull/35002#issuecomment-1926101030 - local -x MTR_SUITE_TIMEOUT=$(( 60 * 40 )) # minutes - local -x MTR_TESTCASE_TIMEOUT=60 # minutes - - # Include config for tests, this is for scenarios where mysql wasn't installed previously or if the - # configuration was from an older version. - sed \ - -e "s/@GENTOO_PORTAGE_EPREFIX@/${EPREFIX}/" \ - -e "s/@DATADIR@/${MY_DATADIR}/" \ - "${FILESDIR}"/my.cnf-8.4.distro-server > "${T}"/my.cnf || die - local -x PATH_CONFIG_FILE="${T}/my.cnf" - - # Create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - # Run mysql tests - pushd "${TESTDIR}" &>/dev/null || die - - touch "${T}/disabled.def" || die - - local -a disabled_tests=( - "auth_sec.atomic_rename_user;103512;Depends on user running test" - - "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" - "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" - "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" - "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" - "gis.st_symdifference;5452;Known rounding error with latest AMD processors (PS)" - - "main.derived_limit;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.explain_tree;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.gis-precise;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.mysql_load_data_local_dir;0;Known test failure -- no upstream bug yet" - "main.select_icp_mrr;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_bugs;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_dupsweed;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_dupsweed_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_dupsweed_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_firstmatch;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_firstmatch_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_firstmatch_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_mat_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.subquery_sj_all_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" - "main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet" - - "rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch;0;Unstable test" - "rpl_gtid.rpl_multi_source_mtr_includes;97844;Unstable test" - "main.partition_datatype;0;Unstable test" - "rpl.rpl_replication_observers_example_plugin_ongoing_transaction;0;Unstable test" - "main.ps;0;Unstable test" - "innodb.dblwr_encrypt_rowcomp;0;Unstable test" - "main.slow_log;0;Unstable test" - - "perfschema.statement_digest_query_sample;0;Test will fail on slow hardware" - "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware" - - # mysql-test/suite/innodb/t/sdi.test - "innodb.sdi;0;Skip this test when MySQL has been built with other storage engines than InnoDB" - - "sys_vars.build_id_basic;0;build_id disabled in build" - - "innodb.alter_kill;0;Known test failure -- no upstream bug yet" - "main.all_persisted_variables;0;Known failure - no upstream bug yet" - "perfschema.idx_compare_mutex_instances;0;Known failure - no upstream bug yet" - ) - - local -a CMAKE_SKIP_TESTS=( - # timing test, can be unreliable - "routertest_harness_net_ts_timer" - - # Could not get local host address: Name or service not known(errno: -2) - # Socket file path can be at most 107 characters (was 110) - "routertest_component_bootstrap" - "routertest_component_bootstrap_account" - "routertest_component_bootstrap_clusterset" - "routertest_component_config_overwrites" - "routertest_component_rest_api_enable" - "routertest_component_router_stacktrace" - "routertest_component_routing" - "routertest_component_sd_notify" - "routertest_component_state_file" - "routertest_integration_routing_direct" - "routertest_integration_routing_reuse" - "routertest_integration_routing_router_require" - "routertest_integration_routing_sharing" - "routertest_integration_routing_sharing_constrained_pools" - "routertest_integration_routing_sharing_restart" - - # /tmp/foo:/var/lib/mysql:/test//foo - # t2: 5 days - # ${S}/storage/ndb/src/common/util/NodeCertificate.cpp:1485: require((csr->verify())) failed - "NodeCertificate-t" - - # TODO: ??? - # Signal 11 thrown, attempting backtrace. - # stack_bottom = 0 thread_stack 0x0 - # #0 0x5610e9d53916 _ZN19PFS_all_memory_stat5resetEv at storage/perfschema/pfs_stat.h:1026 - # #1 0x5610e9d53916 _ZN27PFS_session_all_memory_stat5resetEv at storage/perfschema/pfs_stat.cc:399 - # #2 0x5610e9d53916 _Z13create_threadP16PFS_thread_classjPKvy at storage/perfschema/pfs_instr.cc:723 - # #3 0x5610e9d5960f test_oom at storage/perfschema/unittest/pfs_instr-oom-t.cc:305 - # #4 0x5610e9d4abed do_all_tests at storage/perfschema/unittest/pfs_instr-oom-t.cc:464 - # #5 0x5610e9d4abed main at storage/perfschema/unittest/pfs_instr-oom-t.cc:469 - # #6 0x7f214d22b68a - # #7 0x7f214d22b739 - # #8 0x5610e9d4e014 - # #9 0xffffffffffffffff - "pfs_host-oom" - "pfs_user-oom" - "pfs_instr-oom" - - # flaky - "logger-t" - ) - - if ! use profiling; then - disabled_tests+=( - "main.mysql_client_test;0;Requires profiling support" - "main.mysqld--help-notwin;0;Result output expects profiling support" - ) - fi - - if use debug; then - disabled_tests+=( - "innodb.dblwr_unencrypt;0;Unstable test" - ) - CMAKE_SKIP_TESTS+=( - "testSecureSocket-t" - ) - 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 - - local test_failures=() - - # bug #823656 - nonfatal cmake_src_test --test-command "--gtest_death_test_style=threadsafe" - if [[ $? -ne 0 ]]; then - test_failures+=( cmake_src_test ) - fi - - # run mysql-test tests - # Enable force restart to ensure success when tests don't cleanup sufficiently. - # Anything touching gtid_executed is negatively affected if you have unlucky ordering - nonfatal edo perl mysql-test-run.pl \ - --force --force-restart \ - --vardir="${VARDIR}" --tmpdir="${T}/tmp-tests" \ - --skip-test=tokudb --skip-test-list="${T}/disabled.def" \ - --max-test-fail=0 \ - --retry=3 --retry-failure=2 \ - --report-unstable-tests \ - --report-features - if [[ $? -ne 0 ]]; then - test_failures+=( mysql-test-run.pl ) - - eerror "Tests failed. When you file a bug, please attach the following items:" - eerror "The file that is created with this command:" - eerror "\t'find ${T}/var-tests -name '*.log' | tar -caf mysql-test-logs.tar.xz --files-from -'" - fi - - if [[ "${VARDIR}" != "${T}/var-tests" ]]; then - # Move vardir to tempdir. - mv "${VARDIR}" "${T}/var-tests" - # Clean up mysql temporary directory - rm -rf "${VARDIR}" 2>/dev/null - fi - - 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 - - if [[ ${#test_failures} -eq 0 ]]; then - einfo "Tests successfully completed" - else - die "Test failures: ${test_failures[@]}" - fi -} - -src_install() { - strip-lto-bytecode - cmake_src_install - - # 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 - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#"${EPREFIX}"}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#"${EPREFIX}"}/mysql.d" - cp "${FILESDIR}/my.cnf-8.4.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - mycnf_src="my.cnf-8.4.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 - - eprefixify "${TMPDIR}/my.cnf.ok" - - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - # Remove mytop if perl is not selected - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then - rm -f "${ED}/usr/bin/mytop" || die - fi - - if use router ; then - rm -rf \ - "${ED}/usr/LICENSE.router" \ - "${ED}/usr/README.router" \ - "${ED}/usr/run" \ - "${ED}/usr/var" \ - || die - fi -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - # NOTE: $MY_LOGDIR contains $EPREFIX by default - [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" - - # Note about configuration change - einfo - elog "This version of ${PN} reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/mysql.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/mysql.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 - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog " \"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - einfo - else - einfo - elog "Upgrade process for ${PN}-8.x has changed. Please read" - elog "https://dev.mysql.com/doc/refman/8.4/en/upgrade-binary-package.html" - einfo - fi - - if ver_replacing -lt 8.4.6; then - elog "The default password authentication plugin has changed in MySQL 8.4 and mysql_native_password" - elog "has been disabled by default. mysql_native_password plugin will removed in MySQL 9.0 and later." - elog "If your database is configured to use mysql_native_password then you should look into" - elog "updating to caching_sha2_password, but you can re-enable mysql_native_password with:" - elog " - Using the commandline option --mysql-native-password=ON for your MySQL Server" - elog " - adding mysql_native_password=ON in the [mysqld] section of your MySQL configuration" - elog "See also:" - elog " https://dev.mysql.com/doc/refman/8.4/en/native-pluggable-authentication.html" - elog " https://dev.mysql.com/doc/refman/8.4/en/caching-sha2-pluggable-authentication.html" - fi -} - -pkg_config() { - _getoptval() { - local section="$1" - local flag="--${2}=" - local extra_options="${3}" - local cmd=( - "${my_print_defaults_binary}" - "${extra_options}" - "${section}" - ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" - fi - } - - _mktemp_dry() { - # emktemp has no --dry-run option - local template="${1}" - - if [[ -z "${template}" ]] ; then - if [[ -z "${T}" ]] ; then - template="/tmp/XXXXXXX" - else - template="${T}/XXXXXXX" - fi - fi - - local template_wo_X=${template//X/} - local n_X - let n_X=${#template}-${#template_wo_X} - if [[ ${n_X} -lt 3 ]] ; then - echo "${FUNCNAME[0]}: too few X's in template '${template}'" >&2 - return - fi - - local attempts=0 - local character tmpfile - while [[ true ]] ; do - let attempts=attempts+1 - - new_file= - while read -n1 character ; do - if [[ "${character}" == "X" ]] ; then - tmpfile+="${RANDOM:0:1}" - else - tmpfile+="${character}" - fi - done < <(echo -n "${template}") - - if [[ ! -f "${tmpfile}" ]] ; then - echo "${tmpfile}" - return - fi - - if [[ ${attempts} -ge 100 ]] ; then - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 - return - fi - done - } - - local mysqld_binary="${EROOT}/usr/sbin/mysqld" - if [[ ! -x "${mysqld_binary}" ]] ; then - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysql_binary="${EROOT}/usr/bin/mysql" - if [[ ! -x "${mysql_binary}" ]] ; then - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" - if [[ ! -x "${my_print_defaults_binary}" ]] ; then - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" - fi - - if [[ -z "${MYSQL_USER}" ]] ; then - MYSQL_USER=mysql - if use prefix ; then - MYSQL_USER=$(id -u -n 2>/dev/null) - if [[ -z "${MYSQL_USER}" ]] ; then - die "Failed to determine current username!" - fi - fi - fi - - if [[ -z "${MYSQL_GROUP}" ]] ; then - MYSQL_GROUP=mysql - if use prefix ; then - MYSQL_GROUP=$(id -g -n 2>/dev/null) - if [[ -z "${MYSQL_GROUP}" ]] ; then - die "Failed to determine current user groupname!" - fi - fi - fi - - # my_print_defaults needs to read stuff in $HOME/.my.cnf - local -x HOME="${EROOT}/root" - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Read currently set data directory - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ -z "${MY_DATADIR}" ]] ; then - die "Sorry, unable to find MY_DATADIR!" - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" - ewarn "Please rename or delete its content if you wish to initialize a new data directory." - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" - fi - - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_TMPDIR=${MYSQL_TMPDIR%/} - # These are dir+prefix - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - - # Create missing directories. - # Always check if mysql user can write to directory even if we just - # created directory because a parent directory might be not - # accessible for that user. - PID_DIR="${EROOT}/run/mysqld" - if [[ ! -d "${PID_DIR}" ]] ; then - einfo "Creating ${PN} PID directory '${PID_DIR}' ..." - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ - || die "Failed to create PID directory '${PID_DIR}'!" - fi - - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_pid_dir_testfile}" ]] \ - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_pid_dir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" - else - rm "${_pid_dir_testfile}" || die - unset _pid_dir_testfile - fi - - if [[ ! -d "${MY_DATADIR}" ]] ; then - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" - fi - - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_datadir_testfile}" ]] \ - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_datadir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" - else - rm "${_my_datadir_testfile}" || die - unset _my_datadir_testfile - fi - - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" - fi - - if [[ -z "${MYSQL_TMPDIR}" ]] ; then - MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" - [[ -z "${MYSQL_TMPDIR}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" - - mkdir "${MYSQL_TMPDIR}" || die - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die - fi - - # Now we need to test MYSQL_TMPDIR... - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_tmpdir_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_tmpdir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" - else - rm "${_my_tmpdir_testfile}" || die - unset _my_tmpdir_testfile - fi - - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" - fi - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_logbin_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_logbin_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" - else - rm "${_my_logbin_testfile}" || die - unset _my_logbin_testfile - fi - fi - - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_relaylog_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_relaylog_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" - else - rm "${_my_relaylog_testfile}" || die - unset _my_relaylog_testfile - fi - fi - - local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" - if [[ -z "${mysql_install_log}" ]] ; then - die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" - else - # make sure file is writable for MYSQL_USER... - touch "${mysql_install_log}" || die - chown ${MYSQL_USER} "${mysql_install_log}" || die - fi - - local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" - if [[ -z "${mysqld_logfile}" ]] ; then - die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" - else - # make sure file is writable for MYSQL_USER... - touch "${mysqld_logfile}" || die - chown ${MYSQL_USER} "${mysqld_logfile}" || die - fi - - echo "" - einfo "Detected settings:" - einfo "==================" - einfo "MySQL User:\t\t\t\t${MYSQL_USER}" - einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" - einfo "MySQL DATA directory:\t\t${MY_DATADIR}" - einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" - fi - - einfo "PID DIR:\t\t\t\t${PID_DIR}" - einfo "Install db log:\t\t\t${mysql_install_log}" - einfo "Install server log:\t\t\t${mysqld_logfile}" - - local -a config_files - - local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" - if [[ -f "${config_file}" ]] ; then - config_files+=( "${config_file}" ) - else - ewarn "Client configuration '${config_file}' not found." - ewarn "Skipping configuration of default authentication plugin for client ..." - fi - - config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" - if [[ -f "${config_file}" ]] ; then - config_files+=( "${config_file}" ) - else - ewarn "Server configuration '${config_file}' not found." - ewarn "Skipping configuration of default authentication plugin for mysqld ..." - fi - - if [[ ${#config_files[@]} -gt 0 ]] ; then - if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then - local user_answer - - echo - einfo "Please select default authentication plugin (enter number or plugin name):" - einfo "1) caching_sha2_password [MySQL 8.0 default]" - einfo "2) mysql_native_password [MySQL 5.7 default]" - einfo - einfo "For details see:" - einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" - read -p " >" user_answer - echo - - case "${user_answer}" in - 1|caching_sha2_password) - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password - ;; - 2|mysql_native_password) - MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password - ;; - '') - die "No authentication plugin selected!" - ;; - *) - die "Authentication plugin '${user_answer}' is unknown/unsupported!" - ;; - esac - - echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" - - unset user_answer - fi - - local cfg_option cfg_option_tabs cfg_section - for config_file in "${config_files[@]}" ; do - cfg_option="default-authentication-plugin" - cfg_section="mysqld" - cfg_option_tabs="\t\t" - if [[ "${config_file}" == *client.cnf ]] ; then - cfg_option="default-auth" - cfg_section="client" - cfg_option_tabs="\t\t\t\t" - fi - - if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then - einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." - sed -i \ - -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ - "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" - else - einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." - sed -i \ - -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ - "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" - fi - done - unset cfg_option cfg_option_tabs cfg_section - fi - unset config_files config_file - - 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!" - ewarn "(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="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" - [[ -z "${tz_sql}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" - - 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 - - # --initialize-insecure will not set root password - # --initialize would set a random one in the log which we don't need as we set it ourselves - local cmd=( - "${mysqld_binary}" - "${mysqld_options[@]}" - "--initialize-insecure" - "--init-file='${tz_sql}'" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - "--log-error='${mysql_install_log}'" - "--user=${MYSQL_USER}" - ) - - einfo "Initializing ${PN} data directory: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 - - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; 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 - - rm "${tz_sql}" || die - - local x=${RANDOM} - local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" - local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" - 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="${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 - - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" -} From 0466e41ea71f8cd7c96a6c512c4008f50970490b Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Tue, 21 Apr 2026 21:27:05 +0300 Subject: [PATCH 16/19] dev-db/mysql: add 8.4.9 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/733 Signed-off-by: Sam James --- dev-db/mysql/Manifest | 2 + dev-db/mysql/mysql-8.4.9.ebuild | 1315 +++++++++++++++++++++++++++++++ 2 files changed, 1317 insertions(+) create mode 100644 dev-db/mysql/mysql-8.4.9.ebuild diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest index 1d1f39783f23d..5137200b3487b 100644 --- a/dev-db/mysql/Manifest +++ b/dev-db/mysql/Manifest @@ -2,5 +2,7 @@ DIST mysql-8.0.43-patches-01.tar.xz 8396 BLAKE2B 83c1992ae6f3b58f5c0e07926abb36f DIST mysql-8.4.7-patches-01.tar.xz 8268 BLAKE2B 5a580c4295c246ffaad0d2819ab2860d0f762b633611b5c4a9c1cfb4f0a959d20595148108ea04fc9f0a699f46c39939e3c093fa0845d717133807ce8f1c74a6 SHA512 d451c6766b41cc95356e7c7cd45238d18236d9d71225e00b129d30c59463bc5c05f077a9c9d77b605fecb07189dd8502e8a6568cc5b75264e2255ffcd61715e9 DIST mysql-8.4.8.tar.gz 479002191 BLAKE2B 98ebaee3eab210c00743699149314351607c805a040d965ecb406789c8272a1f9985e72c2d6c7263d632da39abe36978c4a220588cd0e2821cf91de0f145a546 SHA512 4e95db1a1c2bf99240d846e690784616b15fb3137b4512072ad71a40911c5bb72c0b0354cc588aab7cd5d396e1d1c709a63d9cd09ae664d8fe6ed0f7683e4cf6 DIST mysql-8.4.8.tar.gz.asc 833 BLAKE2B 0991cedf1bc5048ffe278b83411bcffbe7003011bee403341b62671117cba4369729b395287f35ac972a478a6ab0e41e8733bc660d3b04d28c612914a6c2bc7a SHA512 62fcf0be950f5f9bcec0670bba921d556218a33776f524395ab0d0710c54060192e40e52e1307ed10516cb0553f994ba00dc10342cc9620f5ff20e5705eaf28b +DIST mysql-8.4.9.tar.gz 479076177 BLAKE2B bbb9a65d3ba52b734ed4a7654dcda24584d9da87ba817bd025ec63c76f6728a67d26cb9a3effe362ab94eb2651192c7b698c0f6ca2826c15d1faeabd9e37714b SHA512 bae8aba6ba921f96799063f6c10f9f02030276f802e74a8b80f2df34e56b0d4501a1c9a9f818529cb70ec700a8f11aedf7fa645fa5db8550f51291759e6a25ad +DIST mysql-8.4.9.tar.gz.asc 833 BLAKE2B 11d9693dc95b7897492022a64a0205c72cd8978b1e62c28019a9f7223d1070442c869028b2075ed5c37a90a87e07cf77b66c7a41b6c37c8b5c6ebb956c60bde9 SHA512 71944c031d4e7b73ec8c1eace4bd51220b42e1528291c3cdf0ceab25fc0b56f198c756af60f340596ef7d9ebb86e7de341eaef49b1124bb520a54221f028943f DIST mysql-boost-8.0.44.tar.gz 492448984 BLAKE2B e018119cb65d6835693cbc4401fc83e54d71e887578da9ea7b5d1ba8053bd7e4de2912553db6da7c8b3569d03b82391dd1858125bc7756d519e73652948f5e9d SHA512 f6881d6f88a4060796e1eac47c1ffe3ea005c27f1b0509fd97774ba5b1e7bf86d0f8c4e13126750f0cc3dd86af92c26459ae8fecf9e8f0f058dab43e93bb3b42 DIST mysql-boost-8.0.45.tar.gz 492472802 BLAKE2B cb253e2c69534c54ea6e79095619ebd4ed0b2187bd5e3b5746c5e6f92a08289df17cbb05305a9c23f3f11f2c78042a7e3edf98f33c9e5f35cc85102bfc97d328 SHA512 9ab52da87e9c1570328080b802f8c9ca1bcbb08e489e1d6cc3282b994cfd07099a0cf5eee420faa684e8372aee66495b34b633224dca98cd5caa8f4a93e500a4 diff --git a/dev-db/mysql/mysql-8.4.9.ebuild b/dev-db/mysql/mysql-8.4.9.ebuild new file mode 100644 index 0000000000000..b4dede13e7396 --- /dev/null +++ b/dev-db/mysql/mysql-8.4.9.ebuild @@ -0,0 +1,1315 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit check-reqs cmake dot-a edo eapi9-ver flag-o-matic linux-info multiprocessing toolchain-funcs prefix verify-sig + +MY_PV="${PV//_pre*}" +MY_P="${PN}-${MY_PV}" + +# $ git format-patch mysql-${PV}...mysql-${PV}-patches -o mysql-patches +# $ tar caf mysql-${PV}-patches-01.tar.xz mysql-patches +PATCH_SET=( + # https://github.com/parona-source/mysql-server/releases/tag/mysql-8.4.7-patches-01 + https://github.com/parona-source/mysql-server/releases/download/mysql-8.4.7-patches-01/mysql-8.4.7-patches-01.tar.xz +) + +DESCRIPTION="Fast, multi-threaded, multi-user SQL database server" +HOMEPAGE="https://www.mysql.com/" +# Latest source distributions are available at https://dev.mysql.com/downloads/mysql/ +# before they are moved to https://downloads.mysql.com/archives/community/ +SRC_URI=" + https://dev.mysql.com/get/Downloads/MySQL-$(ver_cut 1-2)/${MY_P}.tar.gz + https://cdn.mysql.com/archives/mysql-$(ver_cut 1-2)/${MY_P}.tar.gz + verify-sig? ( + https://dev.mysql.com/downloads/gpg/?file=${MY_P}.tar.gz&p=23 + -> ${MY_P}.tar.gz.asc + https://downloads.mysql.com/archives/gpg/?file=${MY_P}.tar.gz&p=23 + -> ${MY_P}.tar.gz.asc + ) + ${PATCH_SET[@]} +" +# 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" + +VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/mysql.asc" + +LICENSE="GPL-2" +# https://dev.mysql.com/blog-archive/introducing-mysql-innovation-and-long-term-support-lts-versions/ +SLOT="$(ver_cut 1-2)" +# 64-bit only since 8.2.0 +# https://github.com/mysql/mysql-server/commit/07bf1bdb620daf62c02ead0d5439d65c7c34aa00 +# -arm -hppa -mips -ppc -x86 +# -ppc for bug #761715 +KEYWORDS="~amd64 -arm ~arm64 -hppa -mips -ppc ~ppc64 ~riscv ~s390 ~sparc -x86 ~x64-macos ~x64-solaris" +IUSE="cjk cracklib debug jemalloc numa +perl profiling router selinux +server tcmalloc test test-install" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + ?? ( tcmalloc jemalloc ) + cjk? ( server ) + jemalloc? ( server ) + numa? ( server ) + profiling? ( server ) + router? ( server ) + tcmalloc? ( server ) + test? ( server ) + test-install? ( server ) +" + +# Be warned, *DEPEND are version-dependent +# These are used for both runtime and compiletime +COMMON_DEPEND=" + >=app-arch/lz4-1.9.4:= + >=app-arch/zstd-1.2.0:= + >=dev-libs/openssl-1.0.0:= + net-libs/libtirpc:= + sys-libs/ncurses:= + >=virtual/zlib-1.2.13:= + server? ( + dev-libs/icu:= + cjk? ( app-text/mecab ) + jemalloc? ( dev-libs/jemalloc:= ) + kernel_linux? ( + dev-libs/libaio + sys-process/procps + ) + numa? ( sys-process/numactl ) + tcmalloc? ( dev-util/google-perftools:= ) + ) +" +DEPEND=" + ${COMMON_DEPEND} + virtual/libudev + server? ( net-libs/rpcsvc-proto ) +" +RDEPEND=" + ${COMMON_DEPEND} + !dev-db/mariadb + !dev-db/mariadb-galera + !dev-db/percona-server + !dev-db/mysql-cluster + !dev-db/mysql:0 + !dev-db/mysql:5.7 + !dev-db/mysql:8.0 + selinux? ( sec-policy/selinux-mysql ) + !prefix? ( + acct-group/mysql + acct-user/mysql + dev-db/mysql-init-scripts + ) + test-install? ( + app-arch/zip + dev-lang/perl + dev-perl/Expect + dev-perl/JSON + sys-libs/timezone-data + ) +" +# 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 )" + +# https://bugs.gentoo.org/623962 +# tests set TZ for tests leading to failures on musl if sys-libs/timezone-data isnt installed +BDEPEND=" + app-alternatives/yacc + virtual/pkgconfig + test? ( + acct-group/mysql + acct-user/mysql + app-arch/zip + dev-lang/perl + dev-perl/Expect + dev-perl/JSON + sys-libs/timezone-data + ) + verify-sig? ( >=sec-keys/openpgp-keys-mysql-20250120 ) +" + +PATCHES=( + "${WORKDIR}"/mysql-patches + # Needed due to bundled abseil-cpp-20230802, this fix is included in abseil-cpp-20240722 + "${FILESDIR}"/mysql-8.0.37-fix-bundled-abseil.patch +) + +mysql_init_vars() { + : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} + : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + MY_DATADIR="${MY_LOCALSTATEDIR}" + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_pretend() { + CHECKREQS_DISK_BUILD="3G" + + if has test ${FEATURES} ; then + # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" + CHECKREQS_DISK_BUILD="18G" + + # 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 + + if use kernel_linux && use numa ; then + linux-info_get_any_version + + local CONFIG_CHECK="~NUMA" + + local WARNING_NUMA="\ +This package expects NUMA support in kernel which this system does not have at the moment; \ +Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" + + check_extra_config + fi + check-reqs_pkg_pretend +} + +pkg_setup() { + CHECKREQS_DISK_BUILD="3G" + if has test ${FEATURES} ; then + # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" + CHECKREQS_DISK_BUILD="18G" + + local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) + if [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] ; then + die "FEATURES=test requires fs.aio-max-nr=250000 at minimum!" + fi + fi + check-reqs_pkg_setup +} + +src_unpack() { + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}/${MY_P}.tar.gz" "${DISTDIR}/${MY_P}.tar.gz.asc" + fi + + unpack ${A} + + mv -f "${WORKDIR}/${MY_P}" "${S}" || die +} + +src_prepare() { + # Avoid rpm call which would trigger sandbox, #692368 + sed -i \ + -e 's/MY_RPM rpm/MY_RPM rpmNONEXISTENT/' \ + CMakeLists.txt || die + + # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux + if [[ -d "${S}/support-files/SELinux" ]] ; then + echo > "${S}/support-files/SELinux/CMakeLists.txt" || die + fi + + cmake_src_prepare +} + +src_configure() { + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + # Debug build type used extensively to add preprocessor definitions + use debug && CMAKE_BUILD_TYPE="Debug" + + lto-guarantee-fat + + local mycmakeargs=( + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" + + -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_PRIV_LIBDIR="$(get_libdir)/mysql/private" + -DINSTALL_MANDIR="share/man" + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" + -DINSTALL_MYSQLSHAREDIR="share/mysql" + -DINSTALL_PLUGINDIR="$(get_libdir)/mysql/plugin" + -DINSTALL_SBINDIR="sbin" + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" + -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DSYSCONFDIR="${EPREFIX}/etc/mysql" + + -DENABLED_PROFILING=$(usex profiling) + -DWITHOUT_SERVER=$(usex !server) + + -DWITH_ROUTER=$(usex router) + -DROUTER_INSTALL_PLUGINDIR="$(get_libdir)/mysqlrouter" + -DROUTER_INSTALL_LIBDIR="$(get_libdir)/mysqlrouter/private" + -DROUTER_INSTALL_DOCDIR="share/doc/${PF}" + -DROUTER_INSTALL_LOGROTATEDIR="${EPREFIX}/etc/logrotate.d" + + # Webauthn plugins not available in community build + # https://dev.mysql.com/doc/refman/8.4/en/webauthn-pluggable-authentication.html + # Which is why FIDO, KERBEROS and LDAP are disabled. + + # Valid options differ. + # With some none is disabled, while with others empty is disabled. + -DWITH_CURL=system + -DWITH_EDITLINE=bundled # Using bundled editline to get CTRL+C working + -DWITH_FIDO=none + -DWITH_ICU=$(usex server system none) + -DWITH_JEMALLOC=$(usex jemalloc) + -WITH_KERBEROS=none + -WITH_LDAP=none + -DWITH_LZ4=system + -DWITH_NUMA=$(usex numa) + -DWITH_PROTOBUF=$(usex server bundled none) # Cannot handle protobuf >23 bug #912797 + # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex + # see extra/RAPIDJSON-README + -DWITH_RAPIDJSON=bundled + -DWITH_SASL=system + -DWITH_SSL=system + -DWITH_ZLIB=system + -DWITH_ZSTD=system + + # Installs support files that would conflict with dev-db/mysql-init-scripts + -DWITH_SYSTEMD=0 + + # These are installed via dev-db/mysql-connector-c + -DWITHOUT_CLIENTLIBS=ON + + # Building everything as shared breaks upstream assumptions. + # For example bundled abseil is excpected to be static and is therefore not installed. + # Breaking the assumption leading the mysql to being built against bundled abseil, + # but then dynamically linked against system abseil once installed. + -DBUILD_SHARED_LIBS=OFF + + -DENABLED_LOCAL_INFILE=ON # Should LOAD DATA LOCAL be enabled by default? + + -Wno-dev # less noise + + -DMYSQL_MAINTAINER_MODE=OFF # Enables -Werror + # These are fine as they don't override user flags + # (also means you don't specify expected things like c++ standard) + -DWITH_DEFAULT_COMPILER_OPTIONS=ON + + # Causes issues on musl bug #922808 + -DWITH_BUILD_ID=OFF + + -DWITH_DEBUG=$(usex debug) + # debug hack wrt #497532 + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" + + -DWITH_UNIT_TESTS=$(usex test) + # This is the expected location for upstream RPM's and the script will search for location relative to it. + # Other locations will not work. + -DINSTALL_MYSQLTESTDIR=$(usex test-install 'share/mysql-test' 0) + ) + + if use server ; then + mycmakeargs+=( + -DWITH_EXTRA_CHARSETS=all + + -DWITH_MECAB=$(usex cjk system) + + # Storage engines + -DWITH_ARCHIVE_STORAGE_ENGINE=ON + -DWITH_BLACKHOLE_STORAGE_ENGINE=ON + -DWITH_CSV_STORAGE_ENGINE=ON + -DWITH_EXAMPLE_STORAGE_ENGINE=OFF + -DWITH_FEDERATED_STORAGE_ENGINE=ON + -DWITH_HEAP_STORAGE_ENGINE=ON + -DWITH_INNOBASE_STORAGE_ENGINE=ON + -DWITH_MYISAMMRG_STORAGE_ENGINE=ON + -DWITH_MYISAM_STORAGE_ENGINE=ON + ) + fi + + if tc-is-lto ; then + mycmakeargs+=( -DWITH_LTO=ON ) + else + mycmakeargs+=( -DWITH_LTO=OFF ) + 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." + ewarn "Tests will probably fail!" + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8mb4 + -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci + ) + fi + + cmake_src_configure +} + +# Official test instructions: +# ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' \ +# ebuild mysql-X.X.XX.ebuild digest clean test install +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 + + einfo "Official test instructions:" + einfo "ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' ebuild ..." + + # Try to increase file limits to increase test coverage + local ulimit_n + for ulimit_n in {16500,4162,3000}; do + ulimit -n ${ulimit_n} 1>/dev/null 2>&1 && break + done + + case ${ulimit_n} in + 16500) + # Upper limit comes from parts.partition_* tests + einfo "Will run test suite with open file limit set to 16500 (best test coverage)." + ;; + 4162) + # Medium limit comes from + # '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' + einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." + ;; + 3000) + einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." + ;; + *) + ewarn "For minimum test coverage, please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." + ;; + esac + + # Documentation for mysql-test-run (MTR_* variables and so on) + # https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_MYSQL_TEST_RUN_PL.html + + # Ensure that parallel runs don't die + local -x MTR_BUILD_THREAD="$((${RANDOM} % 100))" + + # Use a tmpfs opportunistically, otherwise set MTR_PARALLEL to 1. + # MySQL tests are I/O heavy. They benefit greatly from a tmpfs, + # parallel tests without a tmpfs are flaky due to timeouts. + if mountpoint -q /dev/shm ; then + local VARDIR="/dev/shm/mysql-var-${MTR_BUILD_THREAD}" + local -x MTR_PARALLEL=${MTR_PARALLEL:-$(makeopts_jobs)} + else + ewarn "/dev/shm not mounted, setting default MTR_PARALLEL to 1. Tests will take a long time" + local VARDIR="${T}/vardir" + # Set it to one while allowing users to override it. + local -x MTR_PARALLEL=${MTR_PARALLEL:-1} + fi + einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" + + # Disable unit tests, run them separately with eclass defaults + local -x MTR_UNIT_TESTS=0 + + # Increase test timeouts + # bug #923649 + # https://github.com/gentoo/gentoo/pull/35002#issuecomment-1926101030 + local -x MTR_SUITE_TIMEOUT=$(( 60 * 40 )) # minutes + local -x MTR_TESTCASE_TIMEOUT=60 # minutes + + # Include config for tests, this is for scenarios where mysql wasn't installed previously or if the + # configuration was from an older version. + sed \ + -e "s/@GENTOO_PORTAGE_EPREFIX@/${EPREFIX}/" \ + -e "s/@DATADIR@/${MY_DATADIR}/" \ + "${FILESDIR}"/my.cnf-8.4.distro-server > "${T}"/my.cnf || die + local -x PATH_CONFIG_FILE="${T}/my.cnf" + + # Create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + # Run mysql tests + pushd "${TESTDIR}" &>/dev/null || die + + touch "${T}/disabled.def" || die + + local -a disabled_tests=( + "auth_sec.atomic_rename_user;103512;Depends on user running test" + + "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" + "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" + "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" + "gis.st_symdifference;5452;Known rounding error with latest AMD processors (PS)" + + "main.derived_limit;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.explain_tree;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.gis-precise;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.mysql_load_data_local_dir;0;Known test failure -- no upstream bug yet" + "main.select_icp_mrr;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_bugs;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_dupsweed;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_dupsweed_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_dupsweed_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_firstmatch;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_firstmatch_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_firstmatch_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_mat_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_all_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet" + + "rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch;0;Unstable test" + "rpl_gtid.rpl_multi_source_mtr_includes;97844;Unstable test" + "main.partition_datatype;0;Unstable test" + "rpl.rpl_replication_observers_example_plugin_ongoing_transaction;0;Unstable test" + "main.ps;0;Unstable test" + "innodb.dblwr_encrypt_rowcomp;0;Unstable test" + "main.slow_log;0;Unstable test" + + "perfschema.statement_digest_query_sample;0;Test will fail on slow hardware" + "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware" + + # mysql-test/suite/innodb/t/sdi.test + "innodb.sdi;0;Skip this test when MySQL has been built with other storage engines than InnoDB" + + "sys_vars.build_id_basic;0;build_id disabled in build" + + "innodb.alter_kill;0;Known test failure -- no upstream bug yet" + "main.all_persisted_variables;0;Known failure - no upstream bug yet" + "perfschema.idx_compare_mutex_instances;0;Known failure - no upstream bug yet" + ) + + local -a CMAKE_SKIP_TESTS=( + # timing test, can be unreliable + "routertest_harness_net_ts_timer" + + # Could not get local host address: Name or service not known(errno: -2) + # Socket file path can be at most 107 characters (was 110) + "routertest_component_bootstrap" + "routertest_component_bootstrap_account" + "routertest_component_bootstrap_clusterset" + "routertest_component_config_overwrites" + "routertest_component_rest_api_enable" + "routertest_component_router_stacktrace" + "routertest_component_routing" + "routertest_component_sd_notify" + "routertest_component_state_file" + "routertest_integration_routing_direct" + "routertest_integration_routing_reuse" + "routertest_integration_routing_router_require" + "routertest_integration_routing_sharing" + "routertest_integration_routing_sharing_constrained_pools" + "routertest_integration_routing_sharing_restart" + + # /tmp/foo:/var/lib/mysql:/test//foo + # t2: 5 days + # ${S}/storage/ndb/src/common/util/NodeCertificate.cpp:1485: require((csr->verify())) failed + "NodeCertificate-t" + + # TODO: ??? + # Signal 11 thrown, attempting backtrace. + # stack_bottom = 0 thread_stack 0x0 + # #0 0x5610e9d53916 _ZN19PFS_all_memory_stat5resetEv at storage/perfschema/pfs_stat.h:1026 + # #1 0x5610e9d53916 _ZN27PFS_session_all_memory_stat5resetEv at storage/perfschema/pfs_stat.cc:399 + # #2 0x5610e9d53916 _Z13create_threadP16PFS_thread_classjPKvy at storage/perfschema/pfs_instr.cc:723 + # #3 0x5610e9d5960f test_oom at storage/perfschema/unittest/pfs_instr-oom-t.cc:305 + # #4 0x5610e9d4abed do_all_tests at storage/perfschema/unittest/pfs_instr-oom-t.cc:464 + # #5 0x5610e9d4abed main at storage/perfschema/unittest/pfs_instr-oom-t.cc:469 + # #6 0x7f214d22b68a + # #7 0x7f214d22b739 + # #8 0x5610e9d4e014 + # #9 0xffffffffffffffff + "pfs_host-oom" + "pfs_user-oom" + "pfs_instr-oom" + + # flaky + "logger-t" + ) + + if ! use profiling; then + disabled_tests+=( + "main.mysql_client_test;0;Requires profiling support" + "main.mysqld--help-notwin;0;Result output expects profiling support" + ) + fi + + if use debug; then + disabled_tests+=( + "innodb.dblwr_unencrypt;0;Unstable test" + ) + CMAKE_SKIP_TESTS+=( + "testSecureSocket-t" + ) + 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 + + local test_failures=() + + # bug #823656 + nonfatal cmake_src_test --test-command "--gtest_death_test_style=threadsafe" + if [[ $? -ne 0 ]]; then + test_failures+=( cmake_src_test ) + fi + + # run mysql-test tests + # Enable force restart to ensure success when tests don't cleanup sufficiently. + # Anything touching gtid_executed is negatively affected if you have unlucky ordering + nonfatal edo perl mysql-test-run.pl \ + --force --force-restart \ + --vardir="${VARDIR}" --tmpdir="${T}/tmp-tests" \ + --skip-test=tokudb --skip-test-list="${T}/disabled.def" \ + --max-test-fail=0 \ + --retry=3 --retry-failure=2 \ + --report-unstable-tests \ + --report-features + if [[ $? -ne 0 ]]; then + test_failures+=( mysql-test-run.pl ) + + eerror "Tests failed. When you file a bug, please attach the following items:" + eerror "The file that is created with this command:" + eerror "\t'find ${T}/var-tests -name '*.log' | tar -caf mysql-test-logs.tar.xz --files-from -'" + fi + + if [[ "${VARDIR}" != "${T}/var-tests" ]]; then + # Move vardir to tempdir. + mv "${VARDIR}" "${T}/var-tests" + # Clean up mysql temporary directory + rm -rf "${VARDIR}" 2>/dev/null + fi + + 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 + + if [[ ${#test_failures} -eq 0 ]]; then + einfo "Tests successfully completed" + else + die "Test failures: ${test_failures[@]}" + fi +} + +src_install() { + strip-lto-bytecode + cmake_src_install + + # 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 + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#"${EPREFIX}"}" + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die + eprefixify "${TMPDIR}/my.cnf" + doins "${TMPDIR}/my.cnf" + insinto "${MY_SYSCONFDIR#"${EPREFIX}"}/mysql.d" + cp "${FILESDIR}/my.cnf-8.4.distro-client" "${TMPDIR}/50-distro-client.cnf" || die + eprefixify "${TMPDIR}/50-distro-client.cnf" + doins "${TMPDIR}/50-distro-client.cnf" + + mycnf_src="my.cnf-8.4.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 + + eprefixify "${TMPDIR}/my.cnf.ok" + + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf + + # Remove mytop if perl is not selected + if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then + rm -f "${ED}/usr/bin/mytop" || die + fi + + if use router ; then + rm -rf \ + "${ED}/usr/LICENSE.router" \ + "${ED}/usr/README.router" \ + "${ED}/usr/run" \ + "${ED}/usr/var" \ + || die + fi +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + # NOTE: $MY_LOGDIR contains $EPREFIX by default + [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" + + # Note about configuration change + einfo + elog "This version of ${PN} reorganizes the configuration from a single my.cnf" + elog "to several files in /etc/mysql/mysql.d." + elog "Please backup any changes you made to /etc/mysql/my.cnf" + elog "and add them as a new file under /etc/mysql/mysql.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 + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog " \"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + einfo + else + einfo + elog "Upgrade process for ${PN}-8.x has changed. Please read" + elog "https://dev.mysql.com/doc/refman/8.4/en/upgrade-binary-package.html" + einfo + fi + + if ver_replacing -lt 8.4.6; then + elog "The default password authentication plugin has changed in MySQL 8.4 and mysql_native_password" + elog "has been disabled by default. mysql_native_password plugin will removed in MySQL 9.0 and later." + elog "If your database is configured to use mysql_native_password then you should look into" + elog "updating to caching_sha2_password, but you can re-enable mysql_native_password with:" + elog " - Using the commandline option --mysql-native-password=ON for your MySQL Server" + elog " - adding mysql_native_password=ON in the [mysqld] section of your MySQL configuration" + elog "See also:" + elog " https://dev.mysql.com/doc/refman/8.4/en/native-pluggable-authentication.html" + elog " https://dev.mysql.com/doc/refman/8.4/en/caching-sha2-pluggable-authentication.html" + fi +} + +pkg_config() { + _getoptval() { + local section="$1" + local flag="--${2}=" + local extra_options="${3}" + local cmd=( + "${my_print_defaults_binary}" + "${extra_options}" + "${section}" + ) + local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) + + if [[ ${#results[@]} -gt 0 ]] ; then + # When option is set multiple times only return last value + echo "${results[-1]}" + fi + } + + _mktemp_dry() { + # emktemp has no --dry-run option + local template="${1}" + + if [[ -z "${template}" ]] ; then + if [[ -z "${T}" ]] ; then + template="/tmp/XXXXXXX" + else + template="${T}/XXXXXXX" + fi + fi + + local template_wo_X=${template//X/} + local n_X + let n_X=${#template}-${#template_wo_X} + if [[ ${n_X} -lt 3 ]] ; then + echo "${FUNCNAME[0]}: too few X's in template '${template}'" >&2 + return + fi + + local attempts=0 + local character tmpfile + while [[ true ]] ; do + let attempts=attempts+1 + + new_file= + while read -n1 character ; do + if [[ "${character}" == "X" ]] ; then + tmpfile+="${RANDOM:0:1}" + else + tmpfile+="${character}" + fi + done < <(echo -n "${template}") + + if [[ ! -f "${tmpfile}" ]] ; then + echo "${tmpfile}" + return + fi + + if [[ ${attempts} -ge 100 ]] ; then + echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 + return + fi + done + } + + local mysqld_binary="${EROOT}/usr/sbin/mysqld" + if [[ ! -x "${mysqld_binary}" ]] ; then + die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysql_binary="${EROOT}/usr/bin/mysql" + if [[ ! -x "${mysql_binary}" ]] ; then + die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" + if [[ ! -x "${my_print_defaults_binary}" ]] ; then + die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" + fi + + if [[ -z "${MYSQL_USER}" ]] ; then + MYSQL_USER=mysql + if use prefix ; then + MYSQL_USER=$(id -u -n 2>/dev/null) + if [[ -z "${MYSQL_USER}" ]] ; then + die "Failed to determine current username!" + fi + fi + fi + + if [[ -z "${MYSQL_GROUP}" ]] ; then + MYSQL_GROUP=mysql + if use prefix ; then + MYSQL_GROUP=$(id -g -n 2>/dev/null) + if [[ -z "${MYSQL_GROUP}" ]] ; then + die "Failed to determine current user groupname!" + fi + fi + fi + + # my_print_defaults needs to read stuff in $HOME/.my.cnf + local -x HOME="${EROOT}/root" + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Read currently set data directory + MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ -z "${MY_DATADIR}" ]] ; then + die "Sorry, unable to find MY_DATADIR!" + elif [[ -d "${MY_DATADIR}/mysql" ]] ; then + ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" + ewarn "Please rename or delete its content if you wish to initialize a new data directory." + die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" + fi + + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_TMPDIR=${MYSQL_TMPDIR%/} + # These are dir+prefix + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + + # Create missing directories. + # Always check if mysql user can write to directory even if we just + # created directory because a parent directory might be not + # accessible for that user. + PID_DIR="${EROOT}/run/mysqld" + if [[ ! -d "${PID_DIR}" ]] ; then + einfo "Creating ${PN} PID directory '${PID_DIR}' ..." + install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ + || die "Failed to create PID directory '${PID_DIR}'!" + fi + + local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_pid_dir_testfile}" ]] \ + && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_pid_dir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" + else + rm "${_pid_dir_testfile}" || die + unset _pid_dir_testfile + fi + + if [[ ! -d "${MY_DATADIR}" ]] ; then + einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ + || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" + fi + + local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_datadir_testfile}" ]] \ + && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_datadir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" + else + rm "${_my_datadir_testfile}" || die + unset _my_datadir_testfile + fi + + if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then + einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ + || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" + fi + + if [[ -z "${MYSQL_TMPDIR}" ]] ; then + MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" + [[ -z "${MYSQL_TMPDIR}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" + + mkdir "${MYSQL_TMPDIR}" || die + chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die + fi + + # Now we need to test MYSQL_TMPDIR... + local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_tmpdir_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_tmpdir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" + else + rm "${_my_tmpdir_testfile}" || die + unset _my_tmpdir_testfile + fi + + if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then + einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ + || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" + fi + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_logbin_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_logbin_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" + else + rm "${_my_logbin_testfile}" || die + unset _my_logbin_testfile + fi + fi + + if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then + einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ + || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_relaylog_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_relaylog_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" + else + rm "${_my_relaylog_testfile}" || die + unset _my_relaylog_testfile + fi + fi + + local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" + if [[ -z "${mysql_install_log}" ]] ; then + die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" + else + # make sure file is writable for MYSQL_USER... + touch "${mysql_install_log}" || die + chown ${MYSQL_USER} "${mysql_install_log}" || die + fi + + local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" + if [[ -z "${mysqld_logfile}" ]] ; then + die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" + else + # make sure file is writable for MYSQL_USER... + touch "${mysqld_logfile}" || die + chown ${MYSQL_USER} "${mysqld_logfile}" || die + fi + + echo "" + einfo "Detected settings:" + einfo "==================" + einfo "MySQL User:\t\t\t\t${MYSQL_USER}" + einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" + einfo "MySQL DATA directory:\t\t${MY_DATADIR}" + einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" + fi + + einfo "PID DIR:\t\t\t\t${PID_DIR}" + einfo "Install db log:\t\t\t${mysql_install_log}" + einfo "Install server log:\t\t\t${mysqld_logfile}" + + local -a config_files + + local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" + if [[ -f "${config_file}" ]] ; then + config_files+=( "${config_file}" ) + else + ewarn "Client configuration '${config_file}' not found." + ewarn "Skipping configuration of default authentication plugin for client ..." + fi + + config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" + if [[ -f "${config_file}" ]] ; then + config_files+=( "${config_file}" ) + else + ewarn "Server configuration '${config_file}' not found." + ewarn "Skipping configuration of default authentication plugin for mysqld ..." + fi + + if [[ ${#config_files[@]} -gt 0 ]] ; then + if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then + local user_answer + + echo + einfo "Please select default authentication plugin (enter number or plugin name):" + einfo "1) caching_sha2_password [MySQL 8.0 default]" + einfo "2) mysql_native_password [MySQL 5.7 default]" + einfo + einfo "For details see:" + einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" + read -p " >" user_answer + echo + + case "${user_answer}" in + 1|caching_sha2_password) + MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password + ;; + 2|mysql_native_password) + MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password + ;; + '') + die "No authentication plugin selected!" + ;; + *) + die "Authentication plugin '${user_answer}' is unknown/unsupported!" + ;; + esac + + echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" + + unset user_answer + fi + + local cfg_option cfg_option_tabs cfg_section + for config_file in "${config_files[@]}" ; do + cfg_option="default-authentication-plugin" + cfg_section="mysqld" + cfg_option_tabs="\t\t" + if [[ "${config_file}" == *client.cnf ]] ; then + cfg_option="default-auth" + cfg_section="client" + cfg_option_tabs="\t\t\t\t" + fi + + if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then + einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." + sed -i \ + -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ + "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" + else + einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." + sed -i \ + -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ + "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" + fi + done + unset cfg_option cfg_option_tabs cfg_section + fi + unset config_files config_file + + 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!" + ewarn "(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="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" + [[ -z "${tz_sql}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" + + 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 + + # --initialize-insecure will not set root password + # --initialize would set a random one in the log which we don't need as we set it ourselves + local cmd=( + "${mysqld_binary}" + "${mysqld_options[@]}" + "--initialize-insecure" + "--init-file='${tz_sql}'" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + "--log-error='${mysql_install_log}'" + "--user=${MYSQL_USER}" + ) + + einfo "Initializing ${PN} data directory: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 + + if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; 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 + + rm "${tz_sql}" || die + + local x=${RANDOM} + local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" + local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" + 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="${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 + + einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" +} From f0b8997925ce86595f5b26c843d65c57c970364a Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 24 Apr 2026 18:14:56 +0300 Subject: [PATCH 17/19] dev-db/mysql: add 8.0.46 Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/733 Merges: https://codeberg.org/gentoo/gentoo/pulls/733 Signed-off-by: Sam James --- dev-db/mysql/Manifest | 1 + dev-db/mysql/mysql-8.0.46.ebuild | 1319 ++++++++++++++++++++++++++++++ 2 files changed, 1320 insertions(+) create mode 100644 dev-db/mysql/mysql-8.0.46.ebuild diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest index 5137200b3487b..96911a79e0267 100644 --- a/dev-db/mysql/Manifest +++ b/dev-db/mysql/Manifest @@ -6,3 +6,4 @@ DIST mysql-8.4.9.tar.gz 479076177 BLAKE2B bbb9a65d3ba52b734ed4a7654dcda24584d9da DIST mysql-8.4.9.tar.gz.asc 833 BLAKE2B 11d9693dc95b7897492022a64a0205c72cd8978b1e62c28019a9f7223d1070442c869028b2075ed5c37a90a87e07cf77b66c7a41b6c37c8b5c6ebb956c60bde9 SHA512 71944c031d4e7b73ec8c1eace4bd51220b42e1528291c3cdf0ceab25fc0b56f198c756af60f340596ef7d9ebb86e7de341eaef49b1124bb520a54221f028943f DIST mysql-boost-8.0.44.tar.gz 492448984 BLAKE2B e018119cb65d6835693cbc4401fc83e54d71e887578da9ea7b5d1ba8053bd7e4de2912553db6da7c8b3569d03b82391dd1858125bc7756d519e73652948f5e9d SHA512 f6881d6f88a4060796e1eac47c1ffe3ea005c27f1b0509fd97774ba5b1e7bf86d0f8c4e13126750f0cc3dd86af92c26459ae8fecf9e8f0f058dab43e93bb3b42 DIST mysql-boost-8.0.45.tar.gz 492472802 BLAKE2B cb253e2c69534c54ea6e79095619ebd4ed0b2187bd5e3b5746c5e6f92a08289df17cbb05305a9c23f3f11f2c78042a7e3edf98f33c9e5f35cc85102bfc97d328 SHA512 9ab52da87e9c1570328080b802f8c9ca1bcbb08e489e1d6cc3282b994cfd07099a0cf5eee420faa684e8372aee66495b34b633224dca98cd5caa8f4a93e500a4 +DIST mysql-boost-8.0.46.tar.gz 492495969 BLAKE2B d2f1132b3069e3ac42e884a3c02dfbcf7a23083c9559950b117ca83b6ada7159ff92c83a84c4cf09dfc10df7aa56cbe7ae85751aadcf35e9e694a485edb4c2b2 SHA512 b90ee9ad03ddc4732d2942ae4918010a7c398b2080f0e11750df0e61ec07a17bf26ce6aea8806729250b015607e398a8608363ed0830f4f613fafd09dbab7412 diff --git a/dev-db/mysql/mysql-8.0.46.ebuild b/dev-db/mysql/mysql-8.0.46.ebuild new file mode 100644 index 0000000000000..b63a4e1e3f5bd --- /dev/null +++ b/dev-db/mysql/mysql-8.0.46.ebuild @@ -0,0 +1,1319 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit check-reqs cmake dot-a edo flag-o-matic linux-info multiprocessing prefix toolchain-funcs + +MY_PV="${PV//_pre*}" +MY_P="${PN}-${MY_PV}" + +# Patch version +PATCH_SET=( https://github.com/parona-source/mysql-server/releases/download/mysql-8.0.43-patches-01/mysql-8.0.43-patches-01.tar.xz ) + +DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" +HOMEPAGE="https://www.mysql.com/" +# https://dev.mysql.com/downloads/mysql/ +SRC_URI="https://dev.mysql.com/get/Downloads/MySQL-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz" +# https://downloads.mysql.com/archives/community/ +SRC_URI+=" https://cdn.mysql.com/archives/mysql-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz" +SRC_URI+=" ${PATCH_SET[@]}" +# 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" + +LICENSE="GPL-2" +SLOT="8.0" +# -ppc for bug #761715 +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips -ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos ~x64-solaris" +IUSE="cjk cracklib debug jemalloc latin1 numa +perl profiling router selinux +server tcmalloc test test-install" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + ?? ( tcmalloc jemalloc ) + cjk? ( server ) + jemalloc? ( server ) + numa? ( server ) + profiling? ( server ) + router? ( server ) + tcmalloc? ( server ) + test? ( server ) + test-install? ( server ) +" + +# Be warned, *DEPEND are version-dependent +# These are used for both runtime and compiletime +COMMON_DEPEND=" + >=app-arch/lz4-1.9.4:= + >=app-arch/zstd-1.2.0:= + >=dev-libs/openssl-1.0.0:= + net-libs/libtirpc:= + sys-libs/ncurses:= + >=virtual/zlib-1.2.13:= + server? ( + dev-libs/icu:= + dev-libs/libevent:=[ssl,threads(+)] + cjk? ( app-text/mecab ) + jemalloc? ( dev-libs/jemalloc:= ) + kernel_linux? ( + dev-libs/libaio + sys-process/procps + ) + numa? ( sys-process/numactl ) + tcmalloc? ( dev-util/google-perftools:= ) + ) +" + +DEPEND=" + ${COMMON_DEPEND} + server? ( net-libs/rpcsvc-proto ) +" +RDEPEND=" + ${COMMON_DEPEND} + !dev-db/mariadb + !dev-db/mariadb-galera + !dev-db/percona-server + !dev-db/mysql-cluster + !dev-db/mysql:0 + !dev-db/mysql:5.7 + selinux? ( sec-policy/selinux-mysql ) + !prefix? ( + acct-group/mysql + acct-user/mysql + dev-db/mysql-init-scripts + ) + test-install? ( + app-arch/zip + dev-lang/perl + dev-perl/Expect + dev-perl/JSON + sys-libs/timezone-data + ) +" +# 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 )" + +# https://bugs.gentoo.org/623962 +# tests set TZ for tests leading to failures on musl if sys-libs/timezone-data isnt installed +BDEPEND=" + app-alternatives/yacc + virtual/pkgconfig + test? ( + acct-group/mysql + acct-user/mysql + app-arch/zip + dev-lang/perl + dev-perl/Expect + dev-perl/JSON + sys-libs/timezone-data + ) + +" + +PATCHES=( + "${WORKDIR}"/mysql-patches + # Needed due to bundled boost-1.77, this fix is included in boost-1.81 + "${FILESDIR}"/mysql-8.0.36-boost-clang-fix.patch + # Needed due to bundled boost-1.77, this fix is included in boost-1.79 + "${FILESDIR}"/mysql-8.0.37-fix-bundled-boost.patch + # Needed due to bundled abseil-cpp-20230802, this fix is included in abseil-cpp-20240722 + "${FILESDIR}"/mysql-8.0.37-fix-bundled-abseil.patch +) + +mysql_init_vars() { + : ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} + : ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + : ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + : ${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + MY_DATADIR="${MY_LOCALSTATEDIR}" + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_pretend() { + if [[ ${MERGE_TYPE} != binary ]] ; then + if use server ; then + CHECKREQS_DISK_BUILD="3G" + + if has test ${FEATURES} ; then + CHECKREQS_DISK_BUILD="10G" + + if use elibc_musl; then + # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" + CHECKREQS_DISK_BUILD="18G" + fi + fi + + check-reqs_pkg_pretend + fi + fi +} + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + CHECKREQS_DISK_BUILD="3G" + + if has test ${FEATURES} ; then + CHECKREQS_DISK_BUILD="10G" + + if use elibc_musl; then + # i've seen it take 17GB on musl with FEATURES="test" USE="perl server" + CHECKREQS_DISK_BUILD="18G" + fi + + # 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 + + local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null) + if [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] ; then + die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!" + fi + + if use latin1 ; then + # Upstream only supports tests with default charset + die "Testing with USE=latin1 is not supported." + fi + fi + + if use kernel_linux && use numa ; then + linux-info_get_any_version + + local CONFIG_CHECK="~NUMA" + + local WARNING_NUMA="\ +This package expects NUMA support in kernel which this system does not have at the moment; \ +Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support" + + check_extra_config + fi + + use server && check-reqs_pkg_setup + fi +} + +src_unpack() { + unpack ${A} + + mv -f "${WORKDIR}/${MY_P}" "${S}" || die +} + +src_prepare() { + # Avoid rpm call which would trigger sandbox, #692368 + sed -i \ + -e 's/MY_RPM rpm/MY_RPM rpmNONEXISTENT/' \ + CMakeLists.txt || die + + # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux + if [[ -d "${S}/support-files/SELinux" ]] ; then + echo > "${S}/support-files/SELinux/CMakeLists.txt" || die + fi + + # Remove man pages for client-lib tools we don't install + rm \ + man/my_print_defaults.1 \ + man/perror.1 \ + man/zlib_decompress.1 \ + || die + + cmake_src_prepare +} + +src_configure() { + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + # Code requires C++17 due to https://github.com/mysql/mysql-server/commit/236ab55bedd8c9eacd80766d85edde2a8afacd08 + append-cxxflags -std=c++17 + + # Debug build type used extensively to add preprocessor definitions + use debug && CMAKE_BUILD_TYPE="Debug" + + lto-guarantee-fat + + local mycmakeargs=( + -Wno-dev # less noise + + # Building everything as shared breaks upstream assumptions. + # For example bundled abseil is excpected to be static and is therefore not installed. + # Breaking the assumption leading the mysql to being built against bundled abseil, + # but then dynamically linked against system abseil once installed. + -DBUILD_SHARED_LIBS=OFF + + -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_PRIV_LIBDIR=$(get_libdir)/mysql/private + -DINSTALL_MYSQLSHAREDIR=share/mysql + -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql" + + -DROUTER_INSTALL_PLUGINDIR="$(get_libdir)/mysqlrouter" + -DROUTER_INSTALL_LIBDIR="$(get_libdir)/mysqlrouter/private" + -DROUTER_INSTALL_LOGROTATEDIR="${EPREFIX}/etc/logrotate.d" + -DROUTER_INSTALL_DOCDIR="share/doc/${PF}" + + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + + # Enables -Werror + -DMYSQL_MAINTAINER_MODE=OFF + + # debug hack wrt #497532 + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )" + + # Automagically uses LLD when not using LTO (bug #710272, #775845) + -DUSE_LD_LLD=OFF + + # Causes issues on musl bug #922808 + -DWITH_BUILD_ID=OFF + + # These are installed via dev-db/mysql-connector-c + -DWITHOUT_CLIENTLIBS=YES + + # Using bundled editline to get CTRL+C working + -DWITH_EDITLINE=bundled + -DWITH_ZLIB=system + -DWITH_SSL=system + -DWITH_LIBWRAP=0 + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DWITH_DEFAULT_COMPILER_OPTIONS=0 + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + + -DWITH_CURL=system + -DWITH_BOOST="${S}/boost" + -DWITH_ROUTER=$(usex router ON OFF) + + -DWITH_ICU=system + -DWITH_LZ4=system + # Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex + -DWITH_RAPIDJSON=bundled + -DWITH_ZSTD=system + + # This is the expected location for upstream RPM's and the script will search for location relative to it. + # Other locations will not work. + -DINSTALL_MYSQLTESTDIR=$(usex test-install 'share/mysql-test' 0) + ) + + if tc-is-lto ; then + mycmakeargs+=( -DWITH_LTO=ON ) + else + mycmakeargs+=( -DWITH_LTO=OFF ) + 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." + ewarn "Tests will probably fail!" + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + elif use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8mb4 + -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci + ) + fi + + if use server ; then + mycmakeargs+=( + -DWITH_EXTRA_CHARSETS=all + -DWITH_DEBUG=$(usex debug) + -DWITH_MECAB=$(usex cjk system OFF) + -DWITH_LIBEVENT=system + # Cannot handle protobuf >23 bug #912797 + # 05/06/2024: protobuf has been updated, + # but it cannot handle abseil when building against system + # Currently bundles protobuf-25.1 + -DWITH_PROTOBUF=bundled + -DWITH_NUMA=$(usex numa ON OFF) + ) + + if use jemalloc ; then + mycmakeargs+=( -DWITH_JEMALLOC=ON ) + elif use tcmalloc ; then + mycmakeargs+=( -DWITH_TCMALLOC=ON ) + fi + + if use profiling ; then + # Setting to OFF doesn't work: Once set, profiling options will be added + # to `mysqld --help` output via sql/sys_vars.cc causing + # "main.mysqld--help-notwin" test to fail + mycmakeargs+=( -DENABLED_PROFILING=ON ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_EXAMPLE_STORAGE_ENGINE=0 + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_FEDERATED_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_INNODB_MEMCACHED=0 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + ) + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DWITH_SYSTEMD=no + ) + fi + + cmake_src_configure +} + +# Official test instructions: +# ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' \ +# ebuild mysql-X.X.XX.ebuild digest clean test install +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 + + einfo "Official test instructions:" + einfo "ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' ebuild ..." + + # Ensure that parallel runs don't die + local -x MTR_BUILD_THREAD="$((${RANDOM} % 100))" + + # Use a tmpfs opportunistically, otherwise set MTR_PARALLEL to 1. + # MySQL tests are I/O heavy. They benefit greatly from a tmpfs, parallel tests without a tmpfs are flaky due to timeouts. + if mountpoint -q /dev/shm ; then + local VARDIR="/dev/shm/mysql-var-${MTR_BUILD_THREAD}" + local -x MTR_PARALLEL=${MTR_PARALLEL:-$(makeopts_jobs)} + else + ewarn "/dev/shm not mounted, setting default MTR_PARALLEL to 1. Tests will take a long time" + local VARDIR="${T}/vardir" + # Set it to one while allowing users to override it. + local -x MTR_PARALLEL=${MTR_PARALLEL:-1} + fi + einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" + + # Disable unit tests, run them separately with eclass defaults + local -x MTR_UNIT_TESTS=0 + + # Increase test timeouts + # bug #923649 + # https://github.com/gentoo/gentoo/pull/35002#issuecomment-1926101030 + local -x MTR_SUITE_TIMEOUT=$(( 60 * 40 )) # minutes + local -x MTR_TESTCASE_TIMEOUT=60 # minutes + + # Include config for tests, this is for scenarios where mysql wasn't installed previously or if the + # configuration was from an older version. + sed \ + -e "s/@GENTOO_PORTAGE_EPREFIX@/${EPREFIX}/" \ + -e "s/@DATADIR@/${MY_DATADIR}/" \ + "${FILESDIR}"/my.cnf-8.0.distro-client \ + "${FILESDIR}"/my.cnf-8.0.distro-server \ + > "${T}"/my.cnf || die + local -x PATH_CONFIG_FILE="${T}/my.cnf" + + # Create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + # Run mysql tests + pushd "${TESTDIR}" &>/dev/null || die + + touch "${T}/disabled.def" || die + + local -a disabled_tests=( + "auth_sec.atomic_rename_user;103512;Depends on user running test" + "auth_sec.keyring_file_data_qa;0;Won't work with user privileges" + "auth_sec.openssl_without_fips;94718;Known test failure" + + "gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)" + "gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)" + "gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)" + "gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)" + "gis.st_symdifference;5452;Known rounding error with latest AMD processors (PS)" + + "main.derived_limit;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.explain_tree;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.gis-precise;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.mysql_load_data_local_dir;0;Known test failure -- no upstream bug yet" + "main.select_icp_mrr;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_bugs;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_dupsweed;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_dupsweed_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_dupsweed_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_firstmatch;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_firstmatch_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_firstmatch_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_mat_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.subquery_sj_all_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet" + "perfschema.statement_digest_query_sample;0;Test will fail on slow hardware" + + "rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch;0;Unstable test" + "rpl_gtid.rpl_multi_source_mtr_includes;97844;Unstable test" + "main.partition_datatype;0;Unstable test" + + "sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware" + + "sys_vars.build_id_basic;0;Requires -DWITH_BUILD_ID=ON" + + "main.keyring_migration_password;0;Known test failure -- no upstream bug yet" + "innodb.upgrade_orphan;0;Known test failure -- no upstream bug yet" + ) + + if ! hash zip 1>/dev/null 2>&1 ; then + # No need to force dep app-arch/zip for one test + disabled_tests+=( + "innodb.discarded_partition_create;0;Requires app-arch/zip" + "innodb.partition_upgrade_create;0;Requires app-arch/zip" + ) + fi + + if has_version ">=dev-libs/openssl-3.2" ; then + # https://bugs.mysql.com/bug.php?id=113258 + # Fails still with 8.0.41 + disabled_tests+=( + "rpl.rpl_tlsv13;0;CCM8 ciphers have a lower security level with OpenSSL 3.2" + "auth_sec.wl15800_ciphers_tlsv13;0;CCM8 ciphers have a lower security level with OpenSSL 3.2" + ) + fi + + if use debug; then + disabled_tests+=( + "innodb.dblwr_unencrypt;0;Unstable test" + ) + 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 + + local -a CMAKE_SKIP_TESTS=( + # timing test, can be unreliable + "routertest_harness_net_ts_timer" + + # Could not get local host address: Name or service not known(errno: -2) + "routertest_component_bootstrap" + "routertest_component_bootstrap_account" + "routertest_component_bootstrap_clusterset" + "routertest_component_config_overwrites" + "routertest_component_rest_api_enable" + "routertest_component_routing" + "routertest_component_sd_notify" + "routertest_component_state_file" + "routertest_integration_routing_direct" + "routertest_integration_routing_reuse" + "routertest_integration_routing_sharing" + "routertest_integration_routing_sharing_constrained_pools" + "routertest_integration_routing_sharing_restart" + + # TODO: ??? + "pfs_host-oom" + "pfs_user-oom" + "pfs" + ) + + # 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 + + local test_failures=() + + # bug #823656 + nonfatal cmake_src_test --test-command "--gtest_death_test_style=threadsafe" + if [[ $? -ne 0 ]]; then + test_failures+=( cmake_src_test ) + fi + + # run mysql-test tests + # Enable force restart to ensure success when tests don't cleanup sufficiently. + # Anything touching gtid_executed is negatively affected if you have unlucky ordering + nonfatal edo perl mysql-test-run.pl \ + --force --force-restart \ + --vardir="${VARDIR}" --tmpdir="${T}/tmp-tests" \ + --skip-test=tokudb --skip-test-list="${T}/disabled.def" \ + --max-test-fail=0 \ + --retry=3 --retry-failure=2 \ + --report-unstable-tests \ + --report-features + if [[ $? -ne 0 ]]; then + test_failures+=( mysql-test-run.pl ) + + eerror "Tests failed. When you file a bug, please attach the following items:" + eerror "The file that is created with this command:" + eerror "\t'find ${T}/var-tests -name '*.log' | tar -caf mysql-test-logs.tar.xz --files-from -'" + fi + + if [[ "${VARDIR}" != "${T}/var-tests" ]]; then + # Move vardir to tempdir. + mv "${VARDIR}" "${T}/var-tests" + # Clean up mysql temporary directory + rm -rf "${VARDIR}" 2>/dev/null + fi + + 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 + + if [[ ${#test_failures} -eq 0 ]]; then + einfo "Tests successfully completed" + else + die "Test failures: ${test_failures[@]}" + fi +} + +src_install() { + strip-lto-bytecode + cmake_src_install + + # 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 + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#"${EPREFIX}"}" + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die + eprefixify "${TMPDIR}/my.cnf" + doins "${TMPDIR}/my.cnf" + insinto "${MY_SYSCONFDIR#"${EPREFIX}"}/mysql.d" + cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die + eprefixify "${TMPDIR}/50-distro-client.cnf" + doins "${TMPDIR}/50-distro-client.cnf" + + mycnf_src="my.cnf-8.0.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|utf8mb4|latin1|g" \ + "${TMPDIR}/my.cnf.ok" || die + fi + + eprefixify "${TMPDIR}/my.cnf.ok" + + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf + + #Remove mytop if perl is not selected + [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" + + if use router ; then + rm -rf \ + "${ED}/usr/LICENSE.router" \ + "${ED}/usr/README.router" \ + "${ED}/usr/run" \ + "${ED}/usr/var" \ + || die + fi + + # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them. + find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + # NOTE: $MY_LOGDIR contains $EPREFIX by default + [[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}" + + # Note about configuration change + einfo + elog "This version of ${PN} reorganizes the configuration from a single my.cnf" + elog "to several files in /etc/mysql/mysql.d." + elog "Please backup any changes you made to /etc/mysql/my.cnf" + elog "and add them as a new file under /etc/mysql/mysql.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 + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog " \"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + einfo + else + einfo + elog "Upgrade process for ${PN}-8.x has changed. Please read" + elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html" + einfo + fi +} + +pkg_config() { + _getoptval() { + local section="$1" + local flag="--${2}=" + local extra_options="${3}" + local cmd=( + "${my_print_defaults_binary}" + "${extra_options}" + "${section}" + ) + local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) + + if [[ ${#results[@]} -gt 0 ]] ; then + # When option is set multiple times only return last value + echo "${results[-1]}" + fi + } + + _mktemp_dry() { + # emktemp has no --dry-run option + local template="${1}" + + if [[ -z "${template}" ]] ; then + if [[ -z "${T}" ]] ; then + template="/tmp/XXXXXXX" + else + template="${T}/XXXXXXX" + fi + fi + + local template_wo_X=${template//X/} + local n_X + let n_X=${#template}-${#template_wo_X} + if [[ ${n_X} -lt 3 ]] ; then + echo "${FUNCNAME[0]}: too few X's in template '${template}'" >&2 + return + fi + + local attempts=0 + local character tmpfile + while [[ true ]] ; do + let attempts=attempts+1 + + new_file= + while read -n1 character ; do + if [[ "${character}" == "X" ]] ; then + tmpfile+="${RANDOM:0:1}" + else + tmpfile+="${character}" + fi + done < <(echo -n "${template}") + + if [[ ! -f "${tmpfile}" ]] + then + echo "${tmpfile}" + return + fi + + if [[ ${attempts} -ge 100 ]] ; then + echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 + return + fi + done + } + + local mysqld_binary="${EROOT}/usr/sbin/mysqld" + if [[ ! -x "${mysqld_binary}" ]] ; then + die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysql_binary="${EROOT}/usr/bin/mysql" + if [[ ! -x "${mysql_binary}" ]] ; then + die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" + if [[ ! -x "${my_print_defaults_binary}" ]] ; then + die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" + fi + + if [[ -z "${MYSQL_USER}" ]] ; then + MYSQL_USER=mysql + if use prefix ; then + MYSQL_USER=$(id -u -n 2>/dev/null) + if [[ -z "${MYSQL_USER}" ]] ; then + die "Failed to determine current username!" + fi + fi + fi + + if [[ -z "${MYSQL_GROUP}" ]] ; then + MYSQL_GROUP=mysql + if use prefix ; then + MYSQL_GROUP=$(id -g -n 2>/dev/null) + if [[ -z "${MYSQL_GROUP}" ]] ; then + die "Failed to determine current user groupname!" + fi + fi + fi + + # my_print_defaults needs to read stuff in $HOME/.my.cnf + local -x HOME="${EROOT}/root" + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Read currently set data directory + MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ -z "${MY_DATADIR}" ]] ; then + die "Sorry, unable to find MY_DATADIR!" + elif [[ -d "${MY_DATADIR}/mysql" ]] ; then + ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" + ewarn "Please rename or delete its content if you wish to initialize a new data directory." + die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" + fi + + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_TMPDIR=${MYSQL_TMPDIR%/} + # These are dir+prefix + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + + # Create missing directories. + # Always check if mysql user can write to directory even if we just + # created directory because a parent directory might be not + # accessible for that user. + PID_DIR="${EROOT}/run/mysqld" + if [[ ! -d "${PID_DIR}" ]] ; then + einfo "Creating ${PN} PID directory '${PID_DIR}' ..." + install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ + || die "Failed to create PID directory '${PID_DIR}'!" + fi + + local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_pid_dir_testfile}" ]] \ + && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_pid_dir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" + else + rm "${_pid_dir_testfile}" || die + unset _pid_dir_testfile + fi + + if [[ ! -d "${MY_DATADIR}" ]] ; then + einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ + || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" + fi + + local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_datadir_testfile}" ]] \ + && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_datadir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" + else + rm "${_my_datadir_testfile}" || die + unset _my_datadir_testfile + fi + + if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then + einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ + || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" + fi + + if [[ -z "${MYSQL_TMPDIR}" ]] ; then + MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" + [[ -z "${MYSQL_TMPDIR}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" + + mkdir "${MYSQL_TMPDIR}" || die + chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die + fi + + # Now we need to test MYSQL_TMPDIR... + local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_tmpdir_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_tmpdir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" + else + rm "${_my_tmpdir_testfile}" || die + unset _my_tmpdir_testfile + fi + + if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then + einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ + || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" + fi + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_logbin_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_logbin_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" + else + rm "${_my_logbin_testfile}" || die + unset _my_logbin_testfile + fi + fi + + if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then + einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ + || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_relaylog_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_relaylog_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" + else + rm "${_my_relaylog_testfile}" || die + unset _my_relaylog_testfile + fi + fi + + local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" + if [[ -z "${mysql_install_log}" ]] ; then + die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" + else + # make sure file is writable for MYSQL_USER... + touch "${mysql_install_log}" || die + chown ${MYSQL_USER} "${mysql_install_log}" || die + fi + + local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" + if [[ -z "${mysqld_logfile}" ]] ; then + die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" + else + # make sure file is writable for MYSQL_USER... + touch "${mysqld_logfile}" || die + chown ${MYSQL_USER} "${mysqld_logfile}" || die + fi + + echo "" + einfo "Detected settings:" + einfo "==================" + einfo "MySQL User:\t\t\t\t${MYSQL_USER}" + einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" + einfo "MySQL DATA directory:\t\t${MY_DATADIR}" + einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" + fi + + einfo "PID DIR:\t\t\t\t${PID_DIR}" + einfo "Install db log:\t\t\t${mysql_install_log}" + einfo "Install server log:\t\t\t${mysqld_logfile}" + + local -a config_files + + local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" + if [[ -f "${config_file}" ]] ; then + config_files+=( "${config_file}" ) + else + ewarn "Client configuration '${config_file}' not found." + ewarn "Skipping configuration of default authentication plugin for client ..." + fi + + config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf" + if [[ -f "${config_file}" ]] ; then + config_files+=( "${config_file}" ) + else + ewarn "Server configuration '${config_file}' not found" + ewarn "Skipping configuration of default authentication plugin for mysqld ..." + fi + + if [[ ${#config_files[@]} -gt 0 ]] ; then + if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then + local user_answer + + echo + einfo "Please select default authentication plugin (enter number or plugin name):" + einfo "1) caching_sha2_password [MySQL 8.0 default]" + einfo "2) mysql_native_password [MySQL 5.7 default]" + einfo + einfo "For details see:" + einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" + read -p " >" user_answer + echo + + case "${user_answer}" in + 1|caching_sha2_password) + MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password + ;; + 2|mysql_native_password) + MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password + ;; + '') + die "No authentication plugin selected!" + ;; + *) + die "Authentication plugin '${user_answer}' is unknown/unsupported!" + ;; + esac + + echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" + + unset user_answer + fi + + local cfg_option cfg_option_tabs cfg_section + for config_file in "${config_files[@]}" ; do + cfg_option="default-authentication-plugin" + cfg_section="mysqld" + cfg_option_tabs="\t\t" + if [[ "${config_file}" == *client.cnf ]] ; then + cfg_option="default-auth" + cfg_section="client" + cfg_option_tabs="\t\t\t\t" + fi + + if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then + einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." + sed -i \ + -e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \ + "${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!" + else + einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..." + sed -i \ + -e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \ + "${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!" + fi + done + unset cfg_option cfg_option_tabs cfg_section + fi + unset config_files config_file + + 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!" + ewarn "(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="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" + [[ -z "${tz_sql}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" + + 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 + + # --initialize-insecure will not set root password + # --initialize would set a random one in the log which we don't need as we set it ourselves + local cmd=( + "${mysqld_binary}" + "${mysqld_options[@]}" + "--initialize-insecure" + "--init-file='${tz_sql}'" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + "--log-error='${mysql_install_log}'" + "--user=${MYSQL_USER}" + ) + + einfo "Initializing ${PN} data directory: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 + + if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; 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 + + rm "${tz_sql}" || die + + local x=${RANDOM} + local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" + local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" + 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="${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 + + einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" +} From 510d5750603c7c2fcac056c04778353cf1a181f5 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sat, 25 Apr 2026 05:27:02 +0100 Subject: [PATCH 18/19] dev-util/gtest-parallel: Stabilize 20250716 arm64, #961986 Signed-off-by: Sam James --- dev-util/gtest-parallel/gtest-parallel-20250716.ebuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-util/gtest-parallel/gtest-parallel-20250716.ebuild b/dev-util/gtest-parallel/gtest-parallel-20250716.ebuild index 670054a5c704d..b615f7b3a263e 100644 --- a/dev-util/gtest-parallel/gtest-parallel-20250716.ebuild +++ b/dev-util/gtest-parallel/gtest-parallel-20250716.ebuild @@ -1,4 +1,4 @@ -# Copyright 2025 Gentoo Authors +# Copyright 2025-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -17,7 +17,7 @@ S="${WORKDIR}/${PN}-${MY_COMMIT}" LICENSE="Apache-2.0" SLOT="0" -KEYWORDS="amd64 ~arm64" +KEYWORDS="amd64 arm64" REQUIRED_USE="${PYTHON_REQUIRED_USE}" From f72a645e042ce63fed539e92a3edb62c414240c8 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sat, 25 Apr 2026 05:27:03 +0100 Subject: [PATCH 19/19] media-libs/svt-av1: Stabilize 3.1.2 arm64, #961986 Signed-off-by: Sam James --- media-libs/svt-av1/svt-av1-3.1.2.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media-libs/svt-av1/svt-av1-3.1.2.ebuild b/media-libs/svt-av1/svt-av1-3.1.2.ebuild index a8b050908237b..d907fdaabbc8d 100644 --- a/media-libs/svt-av1/svt-av1-3.1.2.ebuild +++ b/media-libs/svt-av1/svt-av1-3.1.2.ebuild @@ -13,7 +13,7 @@ if [[ ${PV} = 9999 ]]; then EGIT_REPO_URI="https://gitlab.com/AOMediaCodec/SVT-AV1.git" else SRC_URI="https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${PV}/SVT-AV1-v${PV}.tar.bz2" - KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc x86" + KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc x86" S="${WORKDIR}/SVT-AV1-v${PV}" fi