kafka 0.10.0.1

Closes #4041.

Signed-off-by: Andrew Janke <janke@eilonwy.local>
This commit is contained in:
Dmitry Melnichenko 2016-08-19 15:12:21 +03:00 committed by Andrew Janke
parent bbca927ed0
commit 4460c0164a

View file

@ -1,11 +1,9 @@
class Kafka < Formula
desc "Publish-subscribe messaging rethought as a distributed commit log"
homepage "https://kafka.apache.org"
url "http://mirrors.ibiblio.org/apache/kafka/0.10.0.1/kafka-0.10.0.1-src.tgz"
mirror "https://archive.apache.org/dist/kafka/0.10.0.1/kafka-0.10.0.1-src.tgz"
sha256 "ae5e58d60240d9c9b6c6090ef60bbdcc7b9d9861c6c9be86c5736a6ef74ca56e"
head "https://git-wip-us.apache.org/repos/asf/kafka.git", :branch => "trunk"
url "http://mirrors.ibiblio.org/apache/kafka/0.10.0.1/kafka_2.11-0.10.0.1.tgz"
mirror "https://archive.apache.org/dist/kafka/0.10.0.1/kafka_2.11-0.10.0.1.tgz"
sha256 "2d73625aeddd827c9e92eefb3c727a78455725fbca4361c221eaa05ae1fab02d"
bottle do
cellar :any_skip_relocation
@ -14,9 +12,8 @@ class Kafka < Formula
sha256 "d1864412af3c518555cefba70b65f4b95d623ec97eeaccfed860cab45faed251" => :mavericks
end
depends_on "gradle"
depends_on "zookeeper"
depends_on :java => "1.7+"
depends_on :java => "1.8+"
# Related to https://issues.apache.org/jira/browse/KAFKA-2034
# Since Kafka does not currently set the source or target compability version inside build.gradle
@ -29,9 +26,6 @@ class Kafka < Formula
def install
ENV.java_cache
system "gradle"
system "gradle", "jar"
data = var/"lib"
inreplace "config/server.properties",
"log.dirs=/tmp/kafka-logs", "log.dirs=#{data}/kafka-logs"
@ -39,16 +33,13 @@ class Kafka < Formula
inreplace "config/zookeeper.properties",
"dataDir=/tmp/zookeeper", "dataDir=#{data}/zookeeper"
# Workaround for conflicting slf4j-log4j12 jars (1.7.10 is preferred)
rm_f "core/build/dependant-libs-2.10.5/slf4j-log4j12-1.7.6.jar"
# remove Windows scripts
rm_rf "bin/windows"
libexec.install %w[clients core examples]
libexec.install "libs"
prefix.install "bin"
bin.env_script_all_files(libexec/"bin", Language::Java.java_home_env("1.7+"))
bin.env_script_all_files(libexec/"bin", Language::Java.java_home_env("1.8+"))
Dir["#{bin}/*.sh"].each { |f| mv f, f.to_s.gsub(/.sh$/, "") }
mv "config", "kafka"
@ -99,26 +90,27 @@ class Kafka < Formula
begin
fork do
exec "#{bin}/zookeeper-server-start #{testpath}/kafka/zookeeper.properties >/dev/null"
exec "#{bin}/zookeeper-server-start #{testpath}/kafka/zookeeper.properties > #{logs}/test.zookeeper-server-start.log 2>&1"
end
sleep 5
sleep 15
fork do
exec "#{bin}/kafka-server-start #{testpath}/kafka/server.properties >/dev/null"
exec "#{bin}/kafka-server-start #{testpath}/kafka/server.properties > #{logs}/test.kafka-server-start.log 2>&1"
end
sleep 5
sleep 30
@demo_pid = fork do
exec "#{libexec}/examples/bin/java-producer-consumer-demo.sh > #{testpath}/kafka/demo.out 2>/dev/null"
end
sleep 5
system "#{bin}/kafka-topics --zookeeper localhost:2181 --create --if-not-exists --replication-factor 1 --partitions 1 --topic test > #{testpath}/kafka/demo.out 2>/dev/null"
system "echo \"test message\" | #{bin}/kafka-console-producer --broker-list localhost:9092 --topic test 2>/dev/null"
system "#{bin}/kafka-console-consumer --zookeeper localhost:2181 --topic test --from-beginning --max-messages 1 >> #{testpath}/kafka/demo.out 2>/dev/null"
system "#{bin}/kafka-topics --zookeeper localhost:2181 --delete --topic test >> #{testpath}/kafka/demo.out 2>/dev/null"
ensure
quiet_system "pkill", "-9", "-f", "#{testpath}/kafka/"
system "#{bin}/kafka-server-stop"
system "#{bin}/zookeeper-server-stop"
sleep 10
end
assert_match "Received message: ", IO.read("#{testpath}/kafka/demo.out")
assert_match /test message/, IO.read("#{testpath}/kafka/demo.out")
end
end