forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Homebrew#204543 from Homebrew/percona-xtrabackup-8.4
percona-xtrabackup 8.4.0-2, [email protected] 8.0.35-32 (new formula)
- Loading branch information
Showing
4 changed files
with
234 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2438,6 +2438,7 @@ pedump | |
pegtl | ||
percona-toolkit | ||
percona-xtrabackup | ||
[email protected] | ||
periscope | ||
perl | ||
perl-dbd-mysql | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Formula/p/percona-xtrabackup.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
class PerconaXtrabackupAT80 < Formula | ||
desc "Open source hot backup tool for InnoDB and XtraDB databases" | ||
homepage "https://www.percona.com/software/mysql-database/percona-xtrabackup" | ||
url "https://downloads.percona.com/downloads/Percona-XtraBackup-8.0/Percona-XtraBackup-8.0.35-32/source/tarball/percona-xtrabackup-8.0.35-32.tar.gz" | ||
sha256 "04982a36e36d0e9dfb8487afa77329dd0d2d38da163a205f0179635ceea1aff1" | ||
license "GPL-2.0-only" | ||
|
||
livecheck do | ||
url "https://docs.percona.com/percona-xtrabackup/#{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: "e5afd37f5fd4c4f32d8774cdb17d48ffccdbaed1101f8870b3dd327b8eab1dbc" | ||
sha256 arm64_sonoma: "99483ad138428415892749dfbde689af2cd9fcf66e66a4861068349edfb7c7ea" | ||
sha256 arm64_ventura: "79a0f127c6ac44100e902bb0416d191123a829c9b4288f27db14d62de0418432" | ||
sha256 sonoma: "2122b3ef73c7120d2f2a4f4e8d6c2e21838fd4837de8cdff80f3509b78fd32eb" | ||
sha256 ventura: "4c060f49c28ef29a5c97463574cf2822836970bbbc03cec70c2b1ab437890152" | ||
sha256 x86_64_linux: "1ee6bc1d9aabde4fef12b4c0519c8baefaacc43ca9c9f4dd0e7677caf38e353a" | ||
end | ||
|
||
keg_only :versioned_formula | ||
|
||
depends_on "bison" => :build # needs bison >= 3.0.4 | ||
depends_on "cmake" => :build | ||
depends_on "libevent" => :build | ||
depends_on "pkgconf" => :build | ||
depends_on "sphinx-doc" => :build | ||
depends_on "[email protected]" => :test | ||
depends_on "icu4c@76" | ||
depends_on "libev" | ||
depends_on "libgcrypt" | ||
depends_on "lz4" | ||
depends_on "openssl@3" | ||
depends_on "perl-dbd-mysql" | ||
depends_on "protobuf" | ||
depends_on "zlib" | ||
depends_on "zstd" | ||
|
||
uses_from_macos "cyrus-sasl" => :build | ||
uses_from_macos "libedit" => :build | ||
uses_from_macos "vim" => :build # needed for xxd | ||
uses_from_macos "curl" | ||
uses_from_macos "perl" | ||
|
||
on_linux do | ||
depends_on "patchelf" => :build | ||
depends_on "libaio" | ||
depends_on "procps" | ||
end | ||
|
||
# Check boost version via `brew livecheck percona-xtrabackup --resources --autobump` | ||
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-xtrabackup/refs/tags/percona-xtrabackup-#{LATEST_VERSION}/cmake/boost.cmake" | ||
regex(%r{/release/v?(\d+(?:\.\d+)+)/}i) | ||
end | ||
end | ||
|
||
# Apply fix for newer protobuf from MySQL repo. Remove once Percona syncs with MySQL 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 :DATA | ||
|
||
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 libkmip lz4 rapidjson robin-hood-hashing] | ||
(buildpath/"extra").each_child { |dir| rm_r(dir) unless keep.include?(dir.basename.to_s) } | ||
(buildpath/"boost").install resource("boost") | ||
|
||
perl = "/usr/bin/perl" | ||
if OS.linux? | ||
perl = Formula["perl"].opt_bin/"perl" | ||
# Disable ABI checking | ||
inreplace "cmake/abi_check.cmake", "RUN_ABI_CHECK 1", "RUN_ABI_CHECK 0" | ||
end | ||
|
||
# Make sure Perl from `perl-dbd-mysql` is used at runtime. Otherwise may have incompatible modules | ||
inreplace "storage/innobase/xtrabackup/src/backup_copy.cc", 'popen("perl",', "popen(\"#{perl}\"," | ||
|
||
icu4c = deps.map(&:to_formula).find { |f| f.name.match?(/^icu4c@\d+$/) } | ||
# -DWITH_FIDO=system isn't set as feature isn't enabled and bundled copy was removed. | ||
# Formula paths are set to avoid HOMEBREW_HOME logic in CMake scripts | ||
cmake_args = %W[ | ||
-DBUILD_CONFIG=xtrabackup_release | ||
-DCOMPILATION_COMMENT=Homebrew | ||
-DINSTALL_PLUGINDIR=lib/percona-xtrabackup/plugin | ||
-DINSTALL_MANDIR=#{man} | ||
-DWITH_MAN_PAGES=ON | ||
-DINSTALL_MYSQLTESTDIR= | ||
-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_LIBEVENT=system | ||
-DWITH_LZ4=system | ||
-DWITH_PROTOBUF=system | ||
-DWITH_SSL=system | ||
-DWITH_ZLIB=system | ||
-DWITH_ZSTD=system | ||
] | ||
# Reduce overlinking on macOS | ||
cmake_args += %w[EXE MODULE].map { |type| "-DCMAKE_#{type}_LINKER_FLAGS=-Wl,-dead_strip_dylibs" } if OS.mac? | ||
|
||
# Remove conflicting manpages | ||
rm (Dir["man/*"] - ["man/CMakeLists.txt"]) | ||
|
||
system "cmake", "-S", ".", "-B", "build", *cmake_args, *std_cmake_args | ||
system "cmake", "--build", "build" | ||
system "cmake", "--install", "build" | ||
bin.env_script_all_files(libexec/"bin", PERL5LIB: Formula["perl-dbd-mysql"].opt_libexec/"lib/perl5") | ||
|
||
# remove conflicting library that is already installed by mysql | ||
(lib/"libmysqlservices.a").unlink | ||
# remove conflicting libraries/headers that are installed by percona-server | ||
(lib/"libkmip.a").unlink | ||
(lib/"libkmippp.a").unlink | ||
(include/"kmip.h").unlink | ||
(include/"kmippp.h").unlink | ||
end | ||
|
||
test do | ||
mysql = Formula["[email protected]"] | ||
common_args = %W[--no-defaults --port=#{free_port} --socket=#{testpath}/mysql.sock] | ||
client_args = %w[--user=root --password=] | ||
server_args = %W[--datadir=#{testpath}/mysql --tmpdir=#{testpath}/tmp] | ||
mysqld_args = common_args + server_args + %W[--mysqlx=OFF --user=#{ENV["USER"]}] | ||
mysqladmin_args = common_args + client_args | ||
xtrabackup_args = common_args + client_args + server_args + %W[--target-dir=#{testpath}/backup --backup] | ||
|
||
(testpath/"backup").mkpath | ||
(testpath/"mysql").mkpath | ||
(testpath/"tmp").mkpath | ||
|
||
assert_match version.to_s, shell_output("#{bin}/xtrabackup --version 2>&1") | ||
|
||
output = shell_output("#{bin}/xtrabackup #{xtrabackup_args.join(" ")} 2>&1", 1) | ||
assert_match "Failed to connect to MySQL server", output | ||
|
||
system mysql.bin/"mysqld", *mysqld_args, "--initialize-insecure" | ||
pid = spawn(mysql.bin/"mysqld", *mysqld_args) | ||
begin | ||
sleep 5 | ||
output = shell_output("#{bin}/xtrabackup #{xtrabackup_args.join(" ")} 2>&1") | ||
refute_match "[ERROR]", output | ||
assert_match "[Xtrabackup] completed OK!", output | ||
assert_match "version_check Done.", output # check Perl modules work | ||
assert_path_exists testpath/"backup/xtrabackup_info" | ||
ensure | ||
system mysql.bin/"mysqladmin", *mysqladmin_args, "shutdown" | ||
Process.kill "TERM", pid | ||
end | ||
end | ||
end | ||
|
||
__END__ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 42e63d0..5d21cc3 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -1942,31 +1942,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 LIBEVENT 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 LIBEVENT LZ4 PROTOBUF ZSTD FIDO) | ||
- IF(WITH_${SYSTEM_LIB} STREQUAL "system") | ||
- INCLUDE_DIRECTORIES(SYSTEM ${HOMEBREW_BASE}/include) | ||
- BREAK() | ||
- ENDIF() | ||
- ENDFOREACH() | ||
-ENDIF() | ||
- | ||
IF(WITH_AUTHENTICATION_FIDO OR WITH_AUTHENTICATION_CLIENT_PLUGINS) | ||
IF(WITH_FIDO STREQUAL "system" AND | ||
NOT WITH_SSL STREQUAL "system") |