/
apache-spark.rb
42 lines (36 loc) 路 1.55 KB
/
apache-spark.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class ApacheSpark < Formula
desc "Engine for large-scale data processing"
homepage "https://spark.apache.org/"
url "https://dlcdn.apache.org/spark/spark-3.5.1/spark-3.5.1-bin-hadoop3.tgz"
mirror "https://archive.apache.org/dist/spark/spark-3.5.1/spark-3.5.1-bin-hadoop3.tgz"
version "3.5.1"
sha256 "5df15f8027067c060fe47ebd351a1431a61dbecc9c28b8dd29e2c6e1935c23eb"
license "Apache-2.0"
head "https://github.com/apache/spark.git", branch: "master"
# The download page creates file links using JavaScript, so we identify
# versions within the related JS file.
livecheck do
url "https://spark.apache.org/js/downloads.js"
regex(/addRelease\(.*?["']v?(\d+(?:\.\d+)+)["']/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "79ec442b9aaf93f302007436b8c5194b67e2cdfbcf57f89a7cffb3bf90a3cf54"
end
depends_on "openjdk@17"
def install
# Rename beeline to distinguish it from hive's beeline
mv "bin/beeline", "bin/spark-beeline"
rm_f Dir["bin/*.cmd"]
libexec.install Dir["*"]
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec/"bin", JAVA_HOME: Language::Java.overridable_java_home_env("17")[:JAVA_HOME])
end
test do
assert_match "Long = 1000",
pipe_output(bin/"spark-shell --conf spark.driver.bindAddress=127.0.0.1",
"sc.parallelize(1 to 1000).count()")
assert_match "String = abi/trivial",
pipe_output(bin/"spark-shell --conf spark.driver.bindAddress=127.0.0.1",
"jdk.incubator.foreign.FunctionDescriptor.TRIVIAL_ATTRIBUTE_NAME")
end
end