Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 30 additions & 19 deletions Formula/p/pgloader.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
class Pgloader < Formula
desc "Data loading tool for PostgreSQL"
homepage "https://github.com/dimitri/pgloader"
license "PostgreSQL"
head "https://github.com/dimitri/pgloader.git", branch: "master"

stable do
# Using git checkout as Makefile runs `git archive` to create bundle
url "https://github.com/dimitri/pgloader.git",
tag: "v3.6.10",
revision: "af8c3c147297654967a0744052ab2eb8682b1466"

depends_on "sbcl" => :build
depends_on "freetds" => :no_linkage

Check warning on line 13 in Formula/p/pgloader.rb

View workflow job for this annotation

GitHub Actions / macOS 14-arm64

pgloader: new dependency impact

Adding `freetds` adds 4 new recursive dependencies on arm64_sonoma (32.9MB).
depends_on "openssl@3" => :no_linkage
depends_on "zstd"

Check warning on line 15 in Formula/p/pgloader.rb

View workflow job for this annotation

GitHub Actions / macOS 14-arm64

pgloader: new dependency impact

Adding `zstd` adds 3 new recursive dependencies on arm64_sonoma (5MB, plus 1 unknown size).

# Resources to avoid `git clone`-ing them in Makefile
resource "qmynd" do
url "https://github.com/qitab/qmynd/archive/42664f5fd15a2f308c958c1062edebec30125308.tar.gz"
Expand Down Expand Up @@ -46,44 +50,51 @@
sha256 cellar: :any_skip_relocation, x86_64_linux: "9f23ab10e44dba2d37a2581cf3ded0f0cfceb731e49af0f4565c98d60278a8a7"
end

depends_on "buildapp" => :build
depends_on "sbcl" => :build
head do
url "https://github.com/dimitri/pgloader.git", branch: "main"

depends_on "freetds" => :no_linkage
depends_on "openssl@3" => :no_linkage
depends_on "zstd"
depends_on "clojure" => :build
depends_on "openjdk"
end

on_linux do
# Patchelf will corrupt the SBCL core which is appended to binary.
# TODO: Remove in 4.0
pour_bottle? only_if: :default_prefix
end

def install
bundlename = "pgloader-bundle"
if build.stable?
bundlename = "pgloader-bundle"
# Improve reproducibility by avoiding master branch and git clones usage
inreplace "Makefile", /(git archive .*) master /, "\\1 v#{version} "
resources.each do |r|
r.stage("build/bundle/#{bundlename}/local-projects/#{r.name}")
end
end

# Creating bundle to use fixed date for reproducibly fetching dependencies. Increasing date to get
# https://github.com/melisgl/named-readtables/commit/6eea56674442b884a4fee6ede4c8aad63541aa5b
system "make", "build/#{bundlename}.tgz", "BUNDLENAME=#{bundlename}", "BUNDLEDIST=2026-01-01"
# Creating bundle to use fixed date for reproducibly fetching dependencies. Increasing date to get
# https://github.com/melisgl/named-readtables/commit/6eea56674442b884a4fee6ede4c8aad63541aa5b
system "make", "build/#{bundlename}.tgz", "BUNDLENAME=#{bundlename}", "BUNDLEDIST=2026-01-01"

bin.mkpath
system "tar", "-xf", "build/#{bundlename}.tgz"
system "make", "-C", bundlename, "BUILDAPP=#{Formula["buildapp"].bin}/buildapp", "PGLOADER=#{bin}/pgloader"
bin.mkpath
system "tar", "-xf", "build/#{bundlename}.tgz"
system "make", "-C", bundlename, "PGLOADER=#{bin}/pgloader"

# Work around patchelf corrupting the SBCL core which is appended to binary
# TODO: Find a better way to handle this in brew, either automatically or via DSL
if OS.linux? && build.bottle?
cp bin/"pgloader", prefix
Utils::Gzip.compress(prefix/"pgloader")
# Work around patchelf corrupting the SBCL core which is appended to binary
if OS.linux? && build.bottle?
cp bin/"pgloader", prefix
Utils::Gzip.compress(prefix/"pgloader")
end
else
cd "clojure" do
system "clojure", "-T:build", "uber"
libexec.install Dir["target/pgloader*.jar"]
bin.write_jar_script libexec/"pgloader.jar", "pgloader"
end
end
end

# TODO: Remove in 4.0
post_install_steps do
install_gzipped_executable "pgloader.gz", "bin/pgloader"
end
Expand Down
Loading