logstash: fix version

- Fix https://github.com/Homebrew/homebrew-core/issues/66907
- use platform independent URL
- remove URL check for `/-oss-/` from test
- build from source
- remove `bottle :unneeded`
- use openjdk@8
- remove from style exception allowlist

Closes #66908.

Co-authored-by: Alexander Bayandin <a.bayandin@gmail.com>
Co-authored-by: Seeker <meaningseeking@protonmail.com>
Signed-off-by: Alexander Bayandin <864213+bayandin@users.noreply.github.com>
Signed-off-by: Francois-Xavier Coudert <fxcoudert@gmail.com>
master
carlocab 2020-12-14 16:19:40 +00:00 committed by Francois-Xavier Coudert
parent 3ddce15d89
commit 0c35496f59
2 changed files with 16 additions and 17 deletions

View File

@ -1,9 +1,10 @@
class Logstash < Formula class Logstash < Formula
desc "Tool for managing events and logs" desc "Tool for managing events and logs"
homepage "https://www.elastic.co/products/logstash" homepage "https://www.elastic.co/products/logstash"
url "https://artifacts.elastic.co/downloads/logstash/logstash-oss-7.10.1-darwin-x86_64.tar.gz" url "https://github.com/elastic/logstash/archive/v7.10.1.tar.gz"
sha256 "8e5b8d2557029de9278361a8bb5ef86144a0d2176bb9c586a4170434e7ba15db" sha256 "9f4732d3c324d27ed348060eccf38840ec74f6baf155ef5f7347346b714a1c58"
license "Apache-2.0" license "Apache-2.0"
version_scheme 1
head "https://github.com/elastic/logstash.git" head "https://github.com/elastic/logstash.git"
livecheck do livecheck do
@ -11,19 +12,19 @@ class Logstash < Formula
regex(/^v?(\d+(?:\.\d+)+)$/i) regex(/^v?(\d+(?:\.\d+)+)$/i)
end end
bottle :unneeded depends_on "openjdk@8"
depends_on "openjdk@11"
def install def install
if build.head? # remove non open source files
# Build the package from source rm_rf "x-pack"
system "rake", "artifact:tar" ENV["OSS"] = "true"
# Extract the package to the current directory
mkdir "tar" # Build the package from source
system "tar", "--strip-components=1", "-xf", Dir["build/logstash-*.tar.gz"].first, "-C", "tar" system "rake", "artifact:no_bundle_jdk_tar"
cd "tar" # Extract the package to the current directory
end mkdir "tar"
system "tar", "--strip-components=1", "-xf", Dir["build/logstash-*.tar.gz"].first, "-C", "tar"
cd "tar"
inreplace "bin/logstash", inreplace "bin/logstash",
%r{^\. "\$\(cd `dirname \$\{SOURCEPATH\}`/\.\.; pwd\)/bin/logstash\.lib\.sh"}, %r{^\. "\$\(cd `dirname \$\{SOURCEPATH\}`/\.\.; pwd\)/bin/logstash\.lib\.sh"},
@ -42,7 +43,7 @@ class Logstash < Formula
(libexec/"config").rmtree (libexec/"config").rmtree
bin.install libexec/"bin/logstash", libexec/"bin/logstash-plugin" bin.install libexec/"bin/logstash", libexec/"bin/logstash-plugin"
bin.env_script_all_files(libexec/"bin", Language::Java.java_home_env("11")) bin.env_script_all_files(libexec/"bin", Language::Java.overridable_java_home_env("1.8"))
end end
def post_install def post_install
@ -88,7 +89,6 @@ class Logstash < Formula
end end
test do test do
assert_includes(stable.url, "-oss-")
# workaround https://github.com/elastic/logstash/issues/6378 # workaround https://github.com/elastic/logstash/issues/6378
(testpath/"config").mkpath (testpath/"config").mkpath
["jvm.options", "log4j2.properties", "startup.options"].each do |f| ["jvm.options", "log4j2.properties", "startup.options"].each do |f|

View File

@ -9,6 +9,5 @@
"gcore", "gcore",
"cspice", "cspice",
"x264", "x264",
"vifm", "vifm"
"logstash"
] ]