Skip to content
Closed

trino 396 #111295

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
21 changes: 14 additions & 7 deletions Formula/trino.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class Trino < Formula

desc "Distributed SQL query engine for big data"
homepage "https://trino.io"
url "https://search.maven.org/remotecontent?filepath=io/trino/trino-server/375/trino-server-375.tar.gz"
sha256 "293c1456f1cb4292890226cc092884ab85cd206e52704509e2e27a58d3b318b6"
url "https://search.maven.org/remotecontent?filepath=io/trino/trino-server/396/trino-server-396.tar.gz", using: :nounzip
sha256 "99bb7dce00178fa40cdf9f8f731c18b749637bf9fe32118870cad1de0febd2a1"
license "Apache-2.0"

livecheck do
Expand All @@ -26,17 +26,21 @@ class Trino < Formula
depends_on "python@3.10"

resource "trino-src" do
url "https://github.com/trinodb/trino/archive/375.tar.gz", using: :nounzip
sha256 "bab8287f387931faa228b698a30886c084f2981c4313b8ebef4340c685c490c8"
url "https://github.com/trinodb/trino/archive/refs/tags/396.tar.gz", using: :nounzip
sha256 "9557a088f3878097feb8cf9ee3fc26c0565bdcfe898880107170b884054a4dba"
end

resource "trino-cli" do
url "https://search.maven.org/remotecontent?filepath=io/trino/trino-cli/375/trino-cli-375-executable.jar"
sha256 "0b96af66dca43353389be3c348f0472a9e709ace22c9a2a9689acb64b70beac1"
url "https://search.maven.org/remotecontent?filepath=io/trino/trino-cli/396/trino-cli-396-executable.jar"
sha256 "438347986c281a2cf419131ce999d6db1bb37488b141f68de62325e1cbbc927a"
end

def install
libexec.install Dir["*"]
# Manually extract tarball to avoid losing hardlinks which increases bottle
# size from MBs to GBs. Remove once Homebrew is able to preserve hardlinks.
# Ref: https://github.com/Homebrew/brew/pull/13154
libexec.mkpath
system "tar", "-C", libexec.to_s, "--strip-components", "1", "-xzf", "trino-server-#{version}.tar.gz"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

It would be good to handle hard links properly though; I'm pretty sure other formulae will benefit too.

If we don't know how to do that, we could maybe consider just replacing hard links with soft links when bottling.


# Manually untar, since macOS-bundled tar produces the error:
# trino-363/plugin/trino-hive/src/test/resources/<truncated>.snappy.orc.crc: Failed to restore metadata
Expand All @@ -47,6 +51,7 @@ def install
(libexec/"etc").install Dir["trino-#{r.version}/core/docker/default/etc/*"]
inreplace libexec/"etc/node.properties", "docker", tap.user.downcase
inreplace libexec/"etc/node.properties", "/data/trino", var/"trino/data"
inreplace libexec/"etc/jvm.config", %r{^-agentpath:/usr/lib/trino/bin/libjvmkill.so$\n}, ""
end

rewrite_shebang detected_python_shebang, libexec/"bin/launcher.py"
Expand All @@ -59,6 +64,8 @@ def install

# Remove incompatible pre-built binaries
libprocname_dirs = libexec.glob("bin/procname/*")
# Keep the Linux-x86_64 directory to make bottles identical
libprocname_dirs.reject! { |dir| dir.basename.to_s == "Linux-x86_64" } if build.bottle?
libprocname_dirs.reject! { |dir| dir.basename.to_s == "#{OS.kernel_name}-#{Hardware::CPU.arch}" }
libprocname_dirs.map(&:rmtree)
end
Expand Down