Skip to content

Commit 20606e3

Browse files
committed
pgloader: workaround to avoid corrupted Linux bottles
1 parent 4c3717d commit 20606e3

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

Formula/p/pgloader.rb

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,37 @@ class Pgloader < Formula
3636
depends_on "sbcl"
3737
depends_on "zstd"
3838

39+
on_linux do
40+
# Patchelf will corrupt the SBCL core which is appended to binary.
41+
on_arm do
42+
pour_bottle? only_if: :default_prefix
43+
end
44+
on_intel do
45+
pour_bottle? only_if: :default_prefix
46+
end
47+
end
48+
3949
def install
4050
system "make"
4151
bin.install "bin/pgloader"
52+
53+
# Work around patchelf corrupting the SBCL core which is appended to binary
54+
# TODO: Find a better way to handle this in brew, either automatically or via DSL
55+
if OS.linux? && build.bottle?
56+
cp bin/"pgloader", prefix
57+
Utils::Gzip.compress(prefix/"pgloader")
58+
end
4259
end
4360

44-
test do
45-
# Fails in Linux CI with "Can't find sbcl.core"
46-
return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]
61+
def post_install
62+
if (prefix/"pgloader.gz").exist?
63+
system "gunzip", prefix/"pgloader.gz"
64+
bin.install prefix/"pgloader"
65+
(bin/"pgloader").chmod 0755
66+
end
67+
end
4768

69+
test do
4870
output = shell_output("#{bin}/pgloader --summary 2>&1", 2)
4971
assert_match "pgloader [ option ... ] SOURCE TARGET", output
5072

0 commit comments

Comments
 (0)