diff --git a/Aliases/percona-server@8.4 b/Aliases/percona-server@8.4 new file mode 120000 index 000000000000..59c3aef615bc --- /dev/null +++ b/Aliases/percona-server@8.4 @@ -0,0 +1 @@ +../Formula/p/percona-server.rb \ No newline at end of file diff --git a/Formula/p/percona-server.rb b/Formula/p/percona-server.rb index 6922570c09a1..f052828670cd 100644 --- a/Formula/p/percona-server.rb +++ b/Formula/p/percona-server.rb @@ -1,13 +1,12 @@ class PerconaServer < Formula desc "Drop-in MySQL replacement" homepage "https://www.percona.com" - url "https://downloads.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.36-28/source/tarball/percona-server-8.0.36-28.tar.gz" - sha256 "8a4b44bd9cf79a38e6275e8f5f9d4e8d2c308854b71fd5bf5d1728fff43a6844" + url "https://downloads.percona.com/downloads/Percona-Server-8.4/Percona-Server-8.4.3-3/source/tarball/percona-server-8.4.3-3.tar.gz" + sha256 "dfb5b46fccd8284ad3a09054f9a62d0a6423a2b703b6fb86d186cec09cee660a" license "BSD-3-Clause" - revision 6 livecheck do - url "https://docs.percona.com/percona-server/latest/" + url "https://docs.percona.com/percona-server/#{version.major_minor}/" regex(/href=.*?v?(\d+(?:[.-]\d+)+)\.html/i) strategy :page_match do |page, regex| page.scan(regex).map do |match| @@ -19,12 +18,12 @@ class PerconaServer < Formula end bottle do - sha256 arm64_sequoia: "7c456f1f1415322cdb5f79dd56733ae4992fff109e7d1f7880b09ca88503d032" - sha256 arm64_sonoma: "3782d7bf2f6b76ed88df11b66a3e91079c3c5871b298437bc3ac8a2ab6d0fc6c" - sha256 arm64_ventura: "1789387d1bff059bac32c7e2d8c912ff4a03b28aeefbf53845e2b8b18a3969f2" - sha256 sonoma: "bbb07a26cb305c9ff6319d8d8ff8270f665e1e166fa63708dc2ef40badc04be0" - sha256 ventura: "40049e14f51428d0f7e92a58d8456e698d8750dd8dd6587cdaaed813048b2944" - sha256 x86_64_linux: "aed371c8cd1999e1af8a3a208bfcb4ddab0d9263ce75f966489dc1c08a927398" + sha256 arm64_sequoia: "178d82b3db05a5a7b18d56b3543ca414f8cd39ef81686d3f0b5a22ac6dfa6a7c" + sha256 arm64_sonoma: "102326c938c21077c25a4ccb0e5a86498383d7df20c6ead4511074db8d1ab3a3" + sha256 arm64_ventura: "23ca1f5ec39d9c376940923114c2507dfd9d21a294d813f8166944662706902d" + sha256 sonoma: "83f27ea31aec5bfa2135b5cbe052aab9980e0d5aa3466e5f5ecec6f9bfc2e6a4" + sha256 ventura: "bbdc26a2ae63bbaa76f643f28b093db94c60317bf6fa94b961c763959253be6d" + sha256 x86_64_linux: "4c36de24fb32225376a5d306a4c5ef76fe5f0cda206b88aea17552d3901fcafa" end depends_on "bison" => :build @@ -32,7 +31,6 @@ class PerconaServer < Formula depends_on "pkgconf" => :build depends_on "abseil" depends_on "icu4c@76" - depends_on "libevent" depends_on "libfido2" depends_on "lz4" depends_on "openldap" # Needs `ldap_set_urllist_proc`, not provided by LDAP.framework @@ -49,44 +47,38 @@ class PerconaServer < Formula on_linux do depends_on "patchelf" => :build depends_on "libtirpc" - depends_on "readline" end conflicts_with "mariadb", "mysql", because: "percona, mariadb, and mysql install the same binaries" - # https://bugs.mysql.com/bug.php?id=86711 - # https://github.com/Homebrew/homebrew-core/pull/20538 + # https://github.com/percona/percona-server/blob/8.4/cmake/os/Darwin.cmake fails_with :clang do - build 800 - cause "Wrong inlining with Clang 8.0, see MySQL Bug #86711" + build 999 + cause "Requires Apple Clang 10.0 or newer" end - # https://github.com/percona/percona-server/blob/Percona-Server-#{version}/cmake/boost.cmake - resource "boost" do - url "https://downloads.sourceforge.net/project/boost/boost/1.77.0/boost_1_77_0.tar.bz2" - sha256 "fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854" - end - - # Backport support for newer Protobuf. Remove with 8.0.39 / 8.4.2 - patch do - url "https://github.com/percona/percona-server/commit/089c011f8e2a865e4bd97715653b4bc0973c43a1.patch?full_index=1" - sha256 "aac166f579e636923abeb86cc89934efaf0185df35355aab2d08192d9bf9efd8" - end - # Backport support for Protobuf 22+ on Linux. Remove with 8.0.40 / 8.4.3 - patch do - url "https://github.com/mysql/mysql-server/commit/269abc0409b22bb87ec88bd4d53dfb7a1403eace.patch?full_index=1" - sha256 "ffcee32804e7e1237907432adb3590fcbf30c625eea836df6760c05a312a84e1" + # https://github.com/percona/percona-server/blob/8.4/cmake/os/Linux.cmake + fails_with :gcc do + version "9" + cause "Requires GCC 10 or newer" end # Patch out check for Homebrew `boost`. # This should not be necessary when building inside `brew`. # https://github.com/Homebrew/homebrew-test-bot/pull/820 - patch do - url "https://raw.githubusercontent.com/Homebrew/formula-patches/030f7433e89376ffcff836bb68b3903ab90f9cdc/mysql/boost-check.patch" - sha256 "af27e4b82c84f958f91404a9661e999ccd1742f57853978d8baec2f993b51153" + patch :DATA + + def datadir + var/"mysql" end def install + # Remove bundled libraries other than explicitly allowed below. + # `boost` and `rapidjson` must use bundled copy due to patches. + # `lz4` is still needed due to xxhash.c used by mysqlgcs + keep = %w[boost coredumper duktape libbacktrace libcno libkmip lz4 opensslpp rapidjson unordered_dense] + (buildpath/"extra").each_child { |dir| rm_r(dir) unless keep.include?(dir.basename.to_s) } + # Find Homebrew OpenLDAP instead of the macOS framework inreplace "cmake/ldap.cmake", "NAMES ldap_r ldap", "NAMES ldap" @@ -98,6 +90,8 @@ def install # Disable ABI checking inreplace "cmake/abi_check.cmake", "RUN_ABI_CHECK 1", "RUN_ABI_CHECK 0" if OS.linux? + icu4c = deps.find { |dep| dep.name.match?(/^icu4c(@\d+)?$/) } + .to_formula # -DINSTALL_* are relative to `CMAKE_INSTALL_PREFIX` (`prefix`) args = %W[ -DCOMPILATION_COMMENT=Homebrew @@ -109,44 +103,32 @@ def install -DINSTALL_MANDIR=share/man -DINSTALL_MYSQLSHAREDIR=share/mysql -DINSTALL_PLUGINDIR=lib/percona-server/plugin - -DMYSQL_DATADIR=#{var}/mysql + -DMYSQL_DATADIR=#{datadir} -DSYSCONFDIR=#{etc} - -DWITH_EMBEDDED_SERVER=ON - -DWITH_INNODB_MEMCACHED=ON - -DWITH_UNIT_TESTS=OFF + -DBISON_EXECUTABLE=#{Formula["bison"].opt_bin}/bison + -DOPENSSL_ROOT_DIR=#{Formula["openssl@3"].opt_prefix} + -DWITH_ICU=#{icu4c.opt_prefix} -DWITH_SYSTEM_LIBS=ON -DWITH_EDITLINE=system -DWITH_FIDO=system - -DWITH_ICU=system - -DWITH_LIBEVENT=system -DWITH_LZ4=system -DWITH_PROTOBUF=system -DWITH_SSL=system - -DOPENSSL_ROOT_DIR=#{Formula["openssl@3"].opt_prefix} -DWITH_ZLIB=system -DWITH_ZSTD=system + -DWITH_UNIT_TESTS=OFF + -DROCKSDB_BUILD_ARCH=#{ENV.effective_arch} ] - - # MySQL >5.7.x mandates Boost as a requirement to build & has a strict - # version check in place to ensure it only builds against expected release. - # This is problematic when Boost releases don't align with MySQL releases. - (buildpath/"boost").install resource("boost") - args << "-DWITH_BOOST=#{buildpath}/boost" - - # Percona MyRocks does not compile on macOS - # https://bugs.launchpad.net/percona-server/+bug/1741639 - args << "-DWITHOUT_ROCKSDB=1" - - # TokuDB does not compile on macOS - # https://bugs.launchpad.net/percona-server/+bug/1531446 - args << "-DWITHOUT_TOKUDB=1" + args << "-DROCKSDB_DISABLE_AVX2=ON" if build.bottle? + args << "-DALLOW_NO_SSE42=ON" if Hardware::CPU.intel? && (!OS.mac? || !MacOS.version.requires_sse42?) + args << "-DWITH_KERBEROS=system" unless OS.mac? system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args system "cmake", "--build", "build" system "cmake", "--install", "build" - (prefix/"mysql-test").cd do - test_args = ["--vardir=#{Dir.mktmpdir}"] + cd prefix/"mysql-test" do + test_args = ["--vardir=#{buildpath}/mysql-test-vardir"] # For Linux, disable failing on warning: "Setting thread 31563 nice to 0 failed" # Docker containers lack CAP_SYS_NICE capability by default. test_args << "--nowarnings" if OS.linux? @@ -157,18 +139,19 @@ def install rm_r(prefix/"mysql-test") # Fix up the control script and link into bin. - inreplace "#{prefix}/support-files/mysql.server", + inreplace prefix/"support-files/mysql.server", /^(PATH=".*)(")/, "\\1:#{HOMEBREW_PREFIX}/bin\\2" bin.install_symlink prefix/"support-files/mysql.server" # Install my.cnf that binds to 127.0.0.1 by default - (buildpath/"my.cnf").write <<~EOS + (buildpath/"my.cnf").write <<~INI # Default Homebrew MySQL server config [mysqld] # Only allow connections from localhost bind-address = 127.0.0.1 - EOS + mysqlx-bind-address = 127.0.0.1 + INI etc.install "my.cnf" end @@ -179,10 +162,10 @@ def post_install # Don't initialize database, it clashes when testing other MySQL-like implementations. return if ENV["HOMEBREW_GITHUB_ACTIONS"] - unless (var/"mysql/mysql/user.frm").exist? + unless (datadir/"mysql/general_log.CSM").exist? ENV["TMPDIR"] = nil system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}", - "--basedir=#{prefix}", "--datadir=#{var}/mysql", "--tmpdir=/tmp" + "--basedir=#{prefix}", "--datadir=#{datadir}", "--tmpdir=/tmp" end end @@ -190,12 +173,15 @@ def caveats s = <<~EOS We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation + MySQL is configured to only allow connections from localhost by default + To connect run: - mysql -uroot + mysql -u root EOS if (my_cnf = ["/etc/my.cnf", "/etc/mysql/my.cnf"].find { |x| File.exist? x }) s += <<~EOS + A "#{my_cnf}" from another install may interfere with a Homebrew-built server starting up correctly. EOS @@ -212,16 +198,73 @@ def caveats test do (testpath/"mysql").mkpath (testpath/"tmp").mkpath - system bin/"mysqld", "--no-defaults", "--initialize-insecure", "--user=#{ENV["USER"]}", - "--basedir=#{prefix}", "--datadir=#{testpath}/mysql", "--tmpdir=#{testpath}/tmp" + port = free_port - fork do - system bin/"mysqld", "--no-defaults", "--user=#{ENV["USER"]}", - "--datadir=#{testpath}/mysql", "--port=#{port}", "--tmpdir=#{testpath}/tmp" + socket = testpath/"mysql.sock" + mysqld_args = %W[ + --no-defaults + --mysqlx=OFF + --user=#{ENV["USER"]} + --port=#{port} + --socket=#{socket} + --basedir=#{prefix} + --datadir=#{testpath}/mysql + --tmpdir=#{testpath}/tmp + ] + client_args = %W[ + --port=#{port} + --socket=#{socket} + --user=root + --password= + ] + + system bin/"mysqld", *mysqld_args, "--initialize-insecure" + pid = spawn(bin/"mysqld", *mysqld_args) + begin + sleep 5 + output = shell_output("#{bin}/mysql #{client_args.join(" ")} --execute='show databases;'") + assert_match "information_schema", output + ensure + system bin/"mysqladmin", *client_args, "shutdown" + Process.kill "TERM", pid end - sleep 5 - assert_match "information_schema", - shell_output("#{bin}/mysql --port=#{port} --user=root --password= --execute='show databases;'") - system bin/"mysqladmin", "--port=#{port}", "--user=root", "--password=", "shutdown" end end + +__END__ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 438dff720c5..47863c17e23 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1948,31 +1948,6 @@ MYSQL_CHECK_RAPIDJSON() + MYSQL_CHECK_FIDO() + MYSQL_CHECK_FIDO_DLLS() + +-IF(APPLE) +- GET_FILENAME_COMPONENT(HOMEBREW_BASE ${HOMEBREW_HOME} DIRECTORY) +- IF(EXISTS ${HOMEBREW_BASE}/include/boost) +- FOREACH(SYSTEM_LIB ICU LZ4 PROTOBUF ZSTD FIDO) +- IF(WITH_${SYSTEM_LIB} STREQUAL "system") +- MESSAGE(FATAL_ERROR +- "WITH_${SYSTEM_LIB}=system is not compatible with Homebrew boost\n" +- "MySQL depends on ${BOOST_PACKAGE_NAME} with a set of patches.\n" +- "Including headers from ${HOMEBREW_BASE}/include " +- "will break the build.\n" +- "Please use WITH_${SYSTEM_LIB}=bundled\n" +- "or do 'brew uninstall boost' or 'brew unlink boost'" +- ) +- ENDIF() +- ENDFOREACH() +- ENDIF() +- # Ensure that we look in /usr/local/include or /opt/homebrew/include +- FOREACH(SYSTEM_LIB ICU LZ4 PROTOBUF ZSTD FIDO) +- IF(WITH_${SYSTEM_LIB} STREQUAL "system") +- INCLUDE_DIRECTORIES(SYSTEM ${HOMEBREW_BASE}/include) +- BREAK() +- ENDIF() +- ENDFOREACH() +-ENDIF() +- + IF(WITH_AUTHENTICATION_WEBAUTHN OR + WITH_AUTHENTICATION_CLIENT_PLUGINS) + IF(WITH_FIDO STREQUAL "system" AND diff --git a/Formula/p/percona-server@8.0.rb b/Formula/p/percona-server@8.0.rb new file mode 100644 index 000000000000..781391b904f0 --- /dev/null +++ b/Formula/p/percona-server@8.0.rb @@ -0,0 +1,256 @@ +class PerconaServerAT80 < Formula + desc "Drop-in MySQL replacement" + homepage "https://www.percona.com" + url "https://downloads.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.36-28/source/tarball/percona-server-8.0.36-28.tar.gz" + sha256 "8a4b44bd9cf79a38e6275e8f5f9d4e8d2c308854b71fd5bf5d1728fff43a6844" + license "BSD-3-Clause" + + livecheck do + url "https://docs.percona.com/percona-server/#{version.major_minor}/" + regex(/href=.*?v?(\d+(?:[.-]\d+)+)\.html/i) + strategy :page_match do |page, regex| + page.scan(regex).map do |match| + # Convert a version like 1.2.3-4.0 to 1.2.3-4 (but leave a version like + # 1.2.3-4.5 as-is). + match[0].sub(/(-\d+)\.0$/, '\1') + end + end + end + + bottle do + sha256 arm64_sequoia: "cb125ddd7595efd0e92ccb4f4e053db69c92d9cd739ad31b8b458db863ef9324" + sha256 arm64_sonoma: "c3c879d0b2bd04e9eaa4811a9ba90f99ad82de67a04cc4b65ed09e0f69452041" + sha256 arm64_ventura: "d0ac375df688d6fbbf824408f3842d653949cb6fe80730d4b231152f28b704b9" + sha256 sonoma: "485efb2b577503cacec0d48d6da734eb71c21da61bf0f51fc59f54c7c7918651" + sha256 ventura: "315761a59cf60d727ac928cdf3aa6c36f51dd5e1fd71b544858e0495d55a6c03" + sha256 x86_64_linux: "b310c666b0a39f19e9dd6fd0d01e4b2b3b543cffc1e7180a91aec19401eb39f8" + end + + keg_only :versioned_formula + + depends_on "bison" => :build + depends_on "cmake" => :build + depends_on "pkgconf" => :build + depends_on "abseil" + depends_on "icu4c@76" + depends_on "libevent" + depends_on "libfido2" + depends_on "lz4" + depends_on "openldap" # Needs `ldap_set_urllist_proc`, not provided by LDAP.framework + depends_on "openssl@3" + depends_on "protobuf" + depends_on "zlib" # Zlib 1.2.13+ + depends_on "zstd" + + uses_from_macos "curl" + uses_from_macos "cyrus-sasl" + uses_from_macos "krb5" + uses_from_macos "libedit" + + on_linux do + depends_on "patchelf" => :build + depends_on "libtirpc" + end + + # https://github.com/percona/percona-server/blob/8.0/cmake/os/Darwin.cmake + fails_with :clang do + build 999 + cause "Requires Apple Clang 10.0 or newer" + end + + # https://github.com/percona/percona-server/blob/Percona-Server-#{version}/cmake/boost.cmake + resource "boost" do + url "https://downloads.sourceforge.net/project/boost/boost/1.77.0/boost_1_77_0.tar.bz2" + sha256 "fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854" + + livecheck do + url "https://raw.githubusercontent.com/percona/percona-server/refs/tags/Percona-Server-#{LATEST_VERSION}/cmake/boost.cmake" + regex(%r{/release/v?(\d+(?:\.\d+)+)/}i) + end + end + + # Backport support for newer Protobuf. Remove with 8.0.39 + patch do + url "https://github.com/percona/percona-server/commit/089c011f8e2a865e4bd97715653b4bc0973c43a1.patch?full_index=1" + sha256 "aac166f579e636923abeb86cc89934efaf0185df35355aab2d08192d9bf9efd8" + end + # Backport support for Protobuf 22+ on Linux. Remove with 8.0.40 + patch do + url "https://github.com/mysql/mysql-server/commit/269abc0409b22bb87ec88bd4d53dfb7a1403eace.patch?full_index=1" + sha256 "ffcee32804e7e1237907432adb3590fcbf30c625eea836df6760c05a312a84e1" + end + + # Patch out check for Homebrew `boost`. + # This should not be necessary when building inside `brew`. + # https://github.com/Homebrew/homebrew-test-bot/pull/820 + patch do + url "https://raw.githubusercontent.com/Homebrew/formula-patches/030f7433e89376ffcff836bb68b3903ab90f9cdc/mysql/boost-check.patch" + sha256 "af27e4b82c84f958f91404a9661e999ccd1742f57853978d8baec2f993b51153" + end + + def datadir + var/"mysql" + end + + def install + # Remove bundled libraries other than explicitly allowed below. + # `boost` and `rapidjson` must use bundled copy due to patches. + # `lz4` is still needed due to xxhash.c used by mysqlgcs + keep = %w[coredumper duktape libkmip lz4 opensslpp rapidjson robin-hood-hashing] + (buildpath/"extra").each_child { |dir| rm_r(dir) unless keep.include?(dir.basename.to_s) } + (buildpath/"boost").install resource("boost") + + # Find Homebrew OpenLDAP instead of the macOS framework + inreplace "cmake/ldap.cmake", "NAMES ldap_r ldap", "NAMES ldap" + + # Fix mysqlrouter_passwd RPATH to link to metadata_cache.so + inreplace "router/src/http/src/CMakeLists.txt", + "ADD_INSTALL_RPATH(mysqlrouter_passwd \"${ROUTER_INSTALL_RPATH}\")", + "\\0\nADD_INSTALL_RPATH(mysqlrouter_passwd \"${RPATH_ORIGIN}/../${ROUTER_INSTALL_PLUGINDIR}\")" + + # Disable ABI checking + inreplace "cmake/abi_check.cmake", "RUN_ABI_CHECK 1", "RUN_ABI_CHECK 0" if OS.linux? + + icu4c = deps.find { |dep| dep.name.match?(/^icu4c(@\d+)?$/) } + .to_formula + # -DINSTALL_* are relative to `CMAKE_INSTALL_PREFIX` (`prefix`) + args = %W[ + -DCOMPILATION_COMMENT=Homebrew + -DDEFAULT_CHARSET=utf8mb4 + -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci + -DINSTALL_DOCDIR=share/doc/#{name} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mysql + -DINSTALL_PLUGINDIR=lib/percona-server/plugin + -DMYSQL_DATADIR=#{datadir} + -DSYSCONFDIR=#{etc} + -DBISON_EXECUTABLE=#{Formula["bison"].opt_bin}/bison + -DOPENSSL_ROOT_DIR=#{Formula["openssl@3"].opt_prefix} + -DWITH_ICU=#{icu4c.opt_prefix} + -DWITH_SYSTEM_LIBS=ON + -DWITH_BOOST=#{buildpath}/boost + -DWITH_EDITLINE=system + -DWITH_FIDO=system + -DWITH_LIBEVENT=system + -DWITH_LZ4=system + -DWITH_PROTOBUF=system + -DWITH_SSL=system + -DWITH_ZLIB=system + -DWITH_ZSTD=system + -DWITH_UNIT_TESTS=OFF + -DWITH_INNODB_MEMCACHED=ON + -DROCKSDB_BUILD_ARCH=#{ENV.effective_arch} + ] + args << "-DROCKSDB_DISABLE_AVX2=ON" if build.bottle? + args << "-DALLOW_NO_SSE42=ON" if Hardware::CPU.intel? && (!OS.mac? || !MacOS.version.requires_sse42?) + args << "-DWITH_KERBEROS=system" unless OS.mac? + + system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" + + cd prefix/"mysql-test" do + test_args = ["--vardir=#{buildpath}/mysql-test-vardir"] + # For Linux, disable failing on warning: "Setting thread 31563 nice to 0 failed" + # Docker containers lack CAP_SYS_NICE capability by default. + test_args << "--nowarnings" if OS.linux? + system "./mysql-test-run.pl", "status", *test_args + end + + # Remove the tests directory + rm_r(prefix/"mysql-test") + + # Fix up the control script and link into bin. + inreplace prefix/"support-files/mysql.server", + /^(PATH=".*)(")/, + "\\1:#{HOMEBREW_PREFIX}/bin\\2" + bin.install_symlink prefix/"support-files/mysql.server" + + # Install my.cnf that binds to 127.0.0.1 by default + (buildpath/"my.cnf").write <<~INI + # Default Homebrew MySQL server config + [mysqld] + # Only allow connections from localhost + bind-address = 127.0.0.1 + mysqlx-bind-address = 127.0.0.1 + INI + etc.install "my.cnf" + end + + def post_install + # Make sure the var/mysql directory exists + (var/"mysql").mkpath + + # Don't initialize database, it clashes when testing other MySQL-like implementations. + return if ENV["HOMEBREW_GITHUB_ACTIONS"] + + unless (datadir/"mysql/general_log.CSM").exist? + ENV["TMPDIR"] = nil + system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}", + "--basedir=#{prefix}", "--datadir=#{datadir}", "--tmpdir=/tmp" + end + end + + def caveats + s = <<~EOS + We've installed your MySQL database without a root password. To secure it run: + mysql_secure_installation + + MySQL is configured to only allow connections from localhost by default + + To connect run: + mysql -u root + EOS + if (my_cnf = ["/etc/my.cnf", "/etc/mysql/my.cnf"].find { |x| File.exist? x }) + s += <<~EOS + + A "#{my_cnf}" from another install may interfere with a Homebrew-built + server starting up correctly. + EOS + end + s + end + + service do + run [opt_bin/"mysqld_safe", "--datadir=#{var}/mysql"] + keep_alive true + working_dir var/"mysql" + end + + test do + (testpath/"mysql").mkpath + (testpath/"tmp").mkpath + + port = free_port + socket = testpath/"mysql.sock" + mysqld_args = %W[ + --no-defaults + --mysqlx=OFF + --user=#{ENV["USER"]} + --port=#{port} + --socket=#{socket} + --basedir=#{prefix} + --datadir=#{testpath}/mysql + --tmpdir=#{testpath}/tmp + ] + client_args = %W[ + --port=#{port} + --socket=#{socket} + --user=root + --password= + ] + + system bin/"mysqld", *mysqld_args, "--initialize-insecure" + pid = spawn(bin/"mysqld", *mysqld_args) + begin + sleep 5 + output = shell_output("#{bin}/mysql #{client_args.join(" ")} --execute='show databases;'") + assert_match "information_schema", output + ensure + system bin/"mysqladmin", *client_args, "shutdown" + Process.kill "TERM", pid + end + end +end diff --git a/Formula/q/qt-percona-server.rb b/Formula/q/qt-percona-server.rb index 2a70a7f29cef..d3dee32d8b25 100644 --- a/Formula/q/qt-percona-server.rb +++ b/Formula/q/qt-percona-server.rb @@ -4,17 +4,18 @@ class QtPerconaServer < Formula url "https://download.qt.io/official_releases/qt/6.7/6.7.3/submodules/qtbase-everywhere-src-6.7.3.tar.xz" sha256 "8ccbb9ab055205ac76632c9eeddd1ed6fc66936fc56afc2ed0fd5d9e23da3097" license any_of: ["GPL-2.0-only", "GPL-3.0-only", "LGPL-3.0-only"] + revision 1 livecheck do formula "qt" end bottle do - sha256 cellar: :any, arm64_sonoma: "60bf3e61d61cf447ab0d3f411d95e03c0adf40e46aed63a3a4f7de827083b88a" - sha256 cellar: :any, arm64_ventura: "ce07eba34a46e36bc779143c694b4814e2089fcc922252c88dba897899046e88" - sha256 cellar: :any, sonoma: "db44a66e8a43cdecf0aad8d6c6dd85310754584ca0876f6911ebc9035f24dd86" - sha256 cellar: :any, ventura: "a72f065f79433dfb2c27044f2249f629894ec4c2140e81930682cf0a210d0a4a" - sha256 cellar: :any_skip_relocation, x86_64_linux: "9be1770432fa9425df2bdb36ffc2545ab753ca990337799489c2f473640c32ab" + sha256 cellar: :any, arm64_sonoma: "1ddef630fd535a78863fe590869c44ae945fa5440eafcb8a47b1147a5d56d3cf" + sha256 cellar: :any, arm64_ventura: "de8893b2e841a762a7b9dae8933b5f28bd1872e7504e09b2432a0ecf24cd71e3" + sha256 cellar: :any, sonoma: "91e25ff4c6ba990382dd7c97e015163bef458660d7e45c0febe7f335eb1b5698" + sha256 cellar: :any, ventura: "1dec6aa1e06b02ae44355af80b74287c5855d8101e74a274006b735a529f0c92" + sha256 cellar: :any_skip_relocation, x86_64_linux: "428c6d820ad63f8121c706c2570c6d227e108ea7eba62a85fbb67eb924d2d5f8" end depends_on "cmake" => [:build, :test]