Skip to content

Commit

Permalink
mysql: modernize syntax
Browse files Browse the repository at this point in the history
Closes Homebrew/legacy-homebrew#40577.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
  • Loading branch information
tamird authored and MikeMcQuaid committed Jun 15, 2015
1 parent beac2d0 commit 6e0eb85
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions Formula/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class Mysql < Formula
sha256 "f5c73b0b85a0e1f0123f488e5fc37babb5fbfe56103596ab54f3ebb570a2459b" => :mountain_lion
end

depends_on "cmake" => :build
depends_on "pidof" unless MacOS.version >= :mountain_lion
depends_on "openssl"

option :universal
option "with-tests", "Build with unit tests"
option "with-embedded", "Build the embedded server"
Expand All @@ -24,10 +28,6 @@ class Mysql < Formula
deprecated_option "enable-memcached" => "with-memcached"
deprecated_option "enable-debug" => "with-debug"

depends_on "cmake" => :build
depends_on "pidof" unless MacOS.version >= :mountain_lion
depends_on "openssl"

conflicts_with "mysql-cluster", "mariadb", "percona-server",
:because => "mysql, mariadb, and percona install the same binaries."
conflicts_with "mysql-connector-c",
Expand All @@ -39,7 +39,7 @@ class Mysql < Formula
end

def datadir
var+"mysql"
var/"mysql"
end

def install
Expand All @@ -53,7 +53,7 @@ def install
# compilation of gems and other software that queries `mysql-config`.
ENV.minimal_optimization

# -DINSTALL_* are relative to prefix
# -DINSTALL_* are relative to `CMAKE_INSTALL_PREFIX` (`prefix`)
args = %W[
.
-DCMAKE_INSTALL_PREFIX=#{prefix}
Expand Down Expand Up @@ -111,7 +111,7 @@ def install

# Don't create databases inside of the prefix!
# See: https://github.com/Homebrew/homebrew/issues/4975
rm_rf prefix+"data"
rm_rf prefix/"data"

# Link the setup script into bin
bin.install_symlink prefix/"scripts/mysql_install_db"
Expand All @@ -125,17 +125,16 @@ def install

bin.install_symlink prefix/"support-files/mysql.server"

# Move mysqlaccess to libexec
libexec.install bin/"mysqlaccess"
libexec.install bin/"mysqlaccess.conf"
end

def post_install
# Make sure the datadir exists
datadir.mkpath
unless File.exist? "#{datadir}/mysql/user.frm"
unless (datadir/"mysql/user.frm").exist?
ENV["TMPDIR"] = nil
system "#{bin}/mysql_install_db", "--verbose", "--user=#{ENV["USER"]}",
system bin/"mysql_install_db", "--verbose", "--user=#{ENV["USER"]}",
"--basedir=#{prefix}", "--datadir=#{datadir}", "--tmpdir=/tmp"
end
end
Expand Down Expand Up @@ -176,7 +175,7 @@ def plist; <<-EOS.undent
end

test do
(prefix+"mysql-test").cd do
(prefix/"mysql-test").cd do
system "./mysql-test-run.pl", "status"
end
end
Expand Down

0 comments on commit 6e0eb85

Please sign in to comment.