2016-04-19 20:37:18 +00:00
|
|
|
class Citus < Formula
|
|
|
|
desc "PostgreSQL-based distributed RDBMS"
|
|
|
|
homepage "https://www.citusdata.com"
|
2016-05-17 22:46:36 +00:00
|
|
|
url "https://github.com/citusdata/citus/archive/v5.1.0.tar.gz"
|
|
|
|
sha256 "bd577091bf4cde10d85eec87b1d90b569306772128002bff4034e1c6b3938578"
|
2016-04-19 20:37:18 +00:00
|
|
|
|
|
|
|
head "https://github.com/citusdata/citus.git"
|
|
|
|
|
2016-04-19 23:35:54 +00:00
|
|
|
bottle do
|
2016-05-18 04:17:32 +00:00
|
|
|
sha256 "d1e25699b68474b71a0c4cdec0a1a214e34e6a960b01e8dec8f7721ccf8d3abc" => :el_capitan
|
|
|
|
sha256 "3ed56156e6534f6b883c20084ba4080c651f2e2cc62db810130fb992d97f7250" => :yosemite
|
|
|
|
sha256 "0518f758045cc426ee1fcc6f8097f6d7ee74b22859fa731f90192c9ee8444f7d" => :mavericks
|
2016-04-19 23:35:54 +00:00
|
|
|
end
|
|
|
|
|
2016-04-19 20:37:18 +00:00
|
|
|
depends_on "postgresql"
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["PG_CONFIG"] = Formula["postgresql"].opt_bin/"pg_config"
|
|
|
|
|
|
|
|
system "./configure"
|
|
|
|
|
|
|
|
# workaround for https://github.com/Homebrew/homebrew/issues/49948
|
|
|
|
system "make", "libpq=-L#{Formula["postgresql"].opt_lib} -lpq"
|
|
|
|
|
|
|
|
# Use stage directory to prevent installing to pg_config-defined dirs,
|
|
|
|
# which would not be within this package's Cellar.
|
|
|
|
mkdir "stage"
|
|
|
|
system "make", "install", "DESTDIR=#{buildpath}/stage"
|
|
|
|
|
|
|
|
bin.install Dir["stage/**/bin/*"]
|
|
|
|
lib.install Dir["stage/**/lib/*"]
|
|
|
|
include.install Dir["stage/**/include/*"]
|
|
|
|
(share/"postgresql/extension").install Dir["stage/**/share/postgresql/extension/*"]
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
pg_bin = Formula["postgresql"].opt_bin
|
|
|
|
pg_port = "55561"
|
|
|
|
system "#{pg_bin}/initdb", testpath/"test"
|
|
|
|
pid = fork do
|
|
|
|
exec("#{pg_bin}/postgres",
|
|
|
|
"-D", testpath/"test",
|
|
|
|
"-c", "shared_preload_libraries=citus",
|
|
|
|
"-p", pg_port)
|
|
|
|
end
|
|
|
|
|
|
|
|
begin
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
count_workers_query = "SELECT COUNT(*) FROM master_get_active_worker_nodes();"
|
|
|
|
|
|
|
|
system "#{pg_bin}/createdb", "-p", pg_port, "test"
|
|
|
|
system "#{pg_bin}/psql", "-p", pg_port, "-d", "test", "--command", "CREATE EXTENSION citus;"
|
|
|
|
|
|
|
|
assert_equal "0", shell_output("#{pg_bin}/psql -p #{pg_port} -d test -Atc" \
|
|
|
|
"'#{count_workers_query}'").strip
|
|
|
|
ensure
|
|
|
|
Process.kill 9, pid
|
|
|
|
Process.wait pid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|