|
| 1 | +class Lakekeeper < Formula |
| 2 | + desc "Apache Iceberg REST Catalog" |
| 3 | + homepage "https://github.com/lakekeeper/lakekeeper" |
| 4 | + url "https://github.com/lakekeeper/lakekeeper/archive/refs/tags/v0.9.2.tar.gz" |
| 5 | + sha256 "c66d2ca9bf9077e985dcf73c42b1e047ca040f02af116ac6ad416c644e212064" |
| 6 | + license "Apache-2.0" |
| 7 | + head "https://github.com/lakekeeper/lakekeeper.git", branch: "main" |
| 8 | + |
| 9 | + bottle do |
| 10 | + sha256 cellar: :any, arm64_sequoia: "c0fa5a90d67cb682bb86aeda90bcc9eeb401ea5b23c29e4deb1a96f711054a2c" |
| 11 | + sha256 cellar: :any, arm64_sonoma: "415eeac806a17163df776577ccccf9d1b563e6fea14b3c1e8ba2fdce080fe723" |
| 12 | + sha256 cellar: :any, arm64_ventura: "74be363ec979cb61a8fff6df7748b7fbf1a65bc8b2cdade9a5d590358c0dd941" |
| 13 | + sha256 cellar: :any, sonoma: "ca749b0b25ed835cd689ccf863088d94de4ff137237b47d28dc635f94c517cae" |
| 14 | + sha256 cellar: :any, ventura: "ab8621f0fcd75d386e0b127472c35b2043819c4de818abcc9309ba42ad635fdf" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "8db376229cfb85fb924828e9e582369ea53cf7439b510d7befd53daab15c1403" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "cmake" => :build |
| 19 | + depends_on "rust" => :build |
| 20 | + depends_on "postgresql@17" => :test |
| 21 | + depends_on "openssl@3" |
| 22 | + |
| 23 | + def install |
| 24 | + # Ensure that the `openssl` crate picks up the intended library. |
| 25 | + ENV["OPENSSL_DIR"] = Formula["openssl@3"].opt_prefix |
| 26 | + ENV["OPENSSL_NO_VENDOR"] = "1" |
| 27 | + |
| 28 | + system "cargo", "install", *std_cargo_args(path: "crates/lakekeeper-bin") |
| 29 | + end |
| 30 | + |
| 31 | + test do |
| 32 | + ENV["LC_ALL"] = "C" |
| 33 | + |
| 34 | + postgresql = Formula["postgresql@17"] |
| 35 | + pg_ctl = postgresql.opt_bin/"pg_ctl" |
| 36 | + port = free_port |
| 37 | + |
| 38 | + system pg_ctl, "initdb", "-D", testpath/"test", "-o", "-E UTF-8" |
| 39 | + (testpath/"test/postgresql.conf").write <<~EOS, mode: "a+" |
| 40 | + port = #{port} |
| 41 | + EOS |
| 42 | + system pg_ctl, "start", "-D", testpath/"test", "-l", testpath/"log" |
| 43 | + |
| 44 | + begin |
| 45 | + ENV["LAKEKEEPER__PG_DATABASE_URL_WRITE"] = "postgres://localhost:#{port}/postgres" |
| 46 | + output = shell_output("#{bin}/lakekeeper migrate") |
| 47 | + assert_match "Database migration complete", output |
| 48 | + ensure |
| 49 | + system pg_ctl, "stop", "-D", testpath/"test" |
| 50 | + end |
| 51 | + end |
| 52 | +end |
0 commit comments