Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql: remove unused inreplace and args #204546

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions Formula/m/mysql.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Mysql < Formula

Check notice on line 1 in Formula/m/mysql.rb

View workflow job for this annotation

GitHub Actions / macOS 15-arm64

Bottle cache hit

Bottle for mysql built at b3f0eb075a2 (Merge 6c1f55274aaabb94b1e99bd8cb2fd6087966d36a into 78da9dd7899eafa6c61184a2838e17388d0db7af, 2025-01-17)

Check notice on line 1 in Formula/m/mysql.rb

View workflow job for this annotation

GitHub Actions / macOS 14-arm64

Bottle cache hit

Bottle for mysql built at b3f0eb075a2 (Merge 6c1f55274aaabb94b1e99bd8cb2fd6087966d36a into 78da9dd7899eafa6c61184a2838e17388d0db7af, 2025-01-17)

Check notice on line 1 in Formula/m/mysql.rb

View workflow job for this annotation

GitHub Actions / Linux

Bottle cache hit

Bottle for mysql built at b3f0eb075a2 (Merge 6c1f55274aaabb94b1e99bd8cb2fd6087966d36a into 78da9dd7899eafa6c61184a2838e17388d0db7af, 2025-01-17)

Check notice on line 1 in Formula/m/mysql.rb

View workflow job for this annotation

GitHub Actions / macOS 13-arm64

Bottle cache hit

Bottle for mysql built at b3f0eb075a2 (Merge 6c1f55274aaabb94b1e99bd8cb2fd6087966d36a into 78da9dd7899eafa6c61184a2838e17388d0db7af, 2025-01-17)
desc "Open source relational database management system"
homepage "https://dev.mysql.com/doc/refman/9.1/en/"
url "https://cdn.mysql.com/Downloads/MySQL-9.1/mysql-9.1.0.tar.gz"
Expand Down Expand Up @@ -73,14 +73,6 @@
if OS.linux?
# Disable ABI checking
inreplace "cmake/abi_check.cmake", "RUN_ABI_CHECK 1", "RUN_ABI_CHECK 0"

# Work around build issue with Protobuf 22+ on Linux
# Ref: https://bugs.mysql.com/bug.php?id=113045
# Ref: https://bugs.mysql.com/bug.php?id=115163
inreplace "cmake/protobuf.cmake" do |s|
s.gsub! 'IF(APPLE AND WITH_PROTOBUF STREQUAL "system"', 'IF(WITH_PROTOBUF STREQUAL "system"'
s.gsub! ' INCLUDE REGEX "${HOMEBREW_HOME}.*")', ' INCLUDE REGEX "libabsl.*")'
end
elsif MacOS.version <= :ventura
ENV["CC"] = Formula["llvm@18"].opt_bin/"clang"
ENV["CXX"] = Formula["llvm@18"].opt_bin/"clang++"
Expand Down Expand Up @@ -115,31 +107,26 @@
-DOPENSSL_ROOT_DIR=#{Formula["openssl@3"].opt_prefix}
-DWITH_ICU=#{icu4c.opt_prefix}
-DWITH_SYSTEM_LIBS=ON
-DWITH_BOOST=boost
-DWITH_EDITLINE=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
]

# Add the dependencies to the CMake args
if OS.mac? && MacOS.version <=(:ventura)
%W[
args += %W[
-DABSL_INCLUDE_DIR=#{Formula["abseil"].opt_include}
-DICU_ROOT=#{Formula["icu4c@76"].opt_prefix}
-DLZ4_INCLUDE_DIR=#{Formula["lz4"].opt_include}
-DOPENSSL_INCLUDE_DIR=#{Formula["openssl@3"].opt_include}
-DPROTOBUF_INCLUDE_DIR=#{Formula["protobuf"].opt_include}
-DZLIB_INCLUDE_DIR=#{Formula["zlib"].opt_include}
-DZSTD_INCLUDE_DIR=#{Formula["zstd"].opt_include}
].each do |arg|
args << arg
end
]
end

system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
Expand Down Expand Up @@ -221,17 +208,33 @@
(testpath/"mysql").mkpath
(testpath/"tmp").mkpath

args = %W[--no-defaults --user=#{ENV["USER"]} --datadir=#{testpath}/mysql --tmpdir=#{testpath}/tmp]
system bin/"mysqld", *args, "--initialize-insecure", "--basedir=#{prefix}"
port = free_port
pid = spawn(bin/"mysqld", *args, "--port=#{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 --port=#{port} --user=root --password= --execute='show databases;'")
output = shell_output("#{bin}/mysql #{client_args.join(" ")} --execute='show databases;'")
assert_match "information_schema", output
system bin/"mysqladmin", "--port=#{port}", "--user=root", "--password=", "shutdown"
ensure
system bin/"mysqladmin", *client_args, "shutdown"
Process.kill "TERM", pid
end
end
Expand Down
46 changes: 36 additions & 10 deletions Formula/m/[email protected]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class MysqlAT80 < Formula

Check notice on line 1 in Formula/m/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 15-arm64

Bottle cache hit

Bottle for [email protected] built at b3f0eb075a2 (Merge 6c1f55274aaabb94b1e99bd8cb2fd6087966d36a into 78da9dd7899eafa6c61184a2838e17388d0db7af, 2025-01-17)

Check notice on line 1 in Formula/m/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 14-arm64

Bottle cache hit

Bottle for [email protected] built at b3f0eb075a2 (Merge 6c1f55274aaabb94b1e99bd8cb2fd6087966d36a into 78da9dd7899eafa6c61184a2838e17388d0db7af, 2025-01-17)

Check notice on line 1 in Formula/m/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 13-arm64

Bottle cache hit

Bottle for [email protected] built at b3f0eb075a2 (Merge 6c1f55274aaabb94b1e99bd8cb2fd6087966d36a into 78da9dd7899eafa6c61184a2838e17388d0db7af, 2025-01-17)
desc "Open source relational database management system"
homepage "https://dev.mysql.com/doc/refman/8.0/en/"
url "https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-8.0.40.tar.gz"
Expand Down Expand Up @@ -54,6 +54,12 @@
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[duktape lz4 rapidjson unordered_dense]
(buildpath/"extra").each_child { |dir| rm_r(dir) unless keep.include?(dir.basename.to_s) }

# Disable ABI checking
inreplace "cmake/abi_check.cmake", "RUN_ABI_CHECK 1", "RUN_ABI_CHECK 0" if OS.linux?

Expand Down Expand Up @@ -91,7 +97,7 @@
system "cmake", "--build", "build"
system "cmake", "--install", "build"

(prefix/"mysql-test").cd do
cd prefix/"mysql-test" do
system "./mysql-test-run.pl", "status", "--vardir=#{buildpath}/mysql-test-vardir"
end

Expand All @@ -105,13 +111,13 @@
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
mysqlx-bind-address = 127.0.0.1
EOS
INI
etc.install "my.cnf"
end

Expand Down Expand Up @@ -159,15 +165,35 @@
(testpath/"mysql").mkpath
(testpath/"tmp").mkpath

args = %W[--no-defaults --user=#{ENV["USER"]} --datadir=#{testpath}/mysql --tmpdir=#{testpath}/tmp]
system bin/"mysqld", *args, "--initialize-insecure", "--basedir=#{prefix}"
port = free_port
fork { exec bin/"mysqld", *args, "--port=#{port}" }
sleep 5
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=
]

output = shell_output("#{bin}/mysql --port=#{port} --user=root --password= --execute='show databases;'")
assert_match "information_schema", output
system bin/"mysqladmin", "--port=#{port}", "--user=root", "--password=", "shutdown"
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

Expand Down
35 changes: 24 additions & 11 deletions Formula/m/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,13 @@ def install
-DOPENSSL_ROOT_DIR=#{Formula["openssl@3"].opt_prefix}
-DWITH_ICU=#{icu4c.opt_prefix}
-DWITH_SYSTEM_LIBS=ON
-DWITH_BOOST=boost
-DWITH_EDITLINE=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
]

system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
Expand All @@ -133,13 +130,13 @@ def install
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
mysqlx-bind-address = 127.0.0.1
EOS
INI
etc.install "my.cnf"
end

Expand Down Expand Up @@ -187,17 +184,33 @@ def caveats
(testpath/"mysql").mkpath
(testpath/"tmp").mkpath

args = %W[--no-defaults --user=#{ENV["USER"]} --datadir=#{testpath}/mysql --tmpdir=#{testpath}/tmp]
system bin/"mysqld", *args, "--initialize-insecure", "--basedir=#{prefix}"
port = free_port
pid = spawn(bin/"mysqld", *args, "--port=#{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 --port=#{port} --user=root --password= --execute='show databases;'")
output = shell_output("#{bin}/mysql #{client_args.join(" ")} --execute='show databases;'")
assert_match "information_schema", output
system bin/"mysqladmin", "--port=#{port}", "--user=root", "--password=", "shutdown"
ensure
system bin/"mysqladmin", *client_args, "shutdown"
Process.kill "TERM", pid
end
end
Expand Down
Loading