Skip to content

Commit a46fee3

Browse files
authored
Merge pull request #206433 from ankane/hypopg
hypopg 1.4.1 (new formula)
2 parents 9537358 + e9054ff commit a46fee3

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

Formula/h/hypopg.rb

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
class Hypopg < Formula
2+
desc "Hypothetical Indexes for PostgreSQL"
3+
homepage "https://github.com/HypoPG/hypopg"
4+
url "https://github.com/HypoPG/hypopg/archive/refs/tags/1.4.1.tar.gz"
5+
sha256 "9afe6357fd389d8d33fad81703038ce520b09275ec00153c6c89282bcdedd6bc"
6+
license "PostgreSQL"
7+
8+
bottle do
9+
sha256 cellar: :any_skip_relocation, arm64_sequoia: "10b284849ebe8618fcd22cf24d8c7f738a6c8eebbfc43985a507678933d7cb99"
10+
sha256 cellar: :any_skip_relocation, arm64_sonoma: "5af96aaf0761e90723a994ecd9513d41771f9b29322d83d9ed59e5333d75a29d"
11+
sha256 cellar: :any_skip_relocation, arm64_ventura: "336b887e0c2c5cd91097071f09d67bd9d9de7524015e1496e70866c63b1e4d8f"
12+
sha256 cellar: :any_skip_relocation, sonoma: "102e97902b5026c63764d4e82c30aebe724f41d73d8bec88c6d3910a49acfb32"
13+
sha256 cellar: :any_skip_relocation, ventura: "7fa60d1d35db14d12c9c77a9ada287f3b89bf9126047a85fde1a77d4567f794e"
14+
sha256 cellar: :any_skip_relocation, x86_64_linux: "c86012c904916b59941015fa5f90726c1b968edd014214b52a7c0e3fe13095d8"
15+
end
16+
17+
depends_on "postgresql@14" => [:build, :test]
18+
depends_on "postgresql@17" => [:build, :test]
19+
20+
def postgresqls
21+
deps.map(&:to_formula).sort_by(&:version).filter { |f| f.name.start_with?("postgresql@") }
22+
end
23+
24+
def install
25+
postgresqls.each do |postgresql|
26+
ENV["PG_CONFIG"] = postgresql.opt_bin/"pg_config"
27+
system "make"
28+
system "make", "install", "pkglibdir=#{lib/postgresql.name}",
29+
"datadir=#{share/postgresql.name}",
30+
"pkgincludedir=#{include/postgresql.name}"
31+
system "make", "clean"
32+
end
33+
end
34+
35+
test do
36+
ENV["LC_ALL"] = "C"
37+
postgresqls.each do |postgresql|
38+
pg_ctl = postgresql.opt_bin/"pg_ctl"
39+
psql = postgresql.opt_bin/"psql"
40+
port = free_port
41+
42+
datadir = testpath/postgresql.name
43+
system pg_ctl, "initdb", "-D", datadir
44+
(datadir/"postgresql.conf").write <<~EOS, mode: "a+"
45+
port = #{port}
46+
EOS
47+
system pg_ctl, "start", "-D", datadir, "-l", testpath/"log-#{postgresql.name}"
48+
begin
49+
system psql, "-p", port.to_s, "-c", "CREATE EXTENSION hypopg;", "postgres"
50+
ensure
51+
system pg_ctl, "stop", "-D", datadir
52+
end
53+
end
54+
end
55+
end

0 commit comments

Comments
 (0)