Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apache-pulsar 2.8.0 (new formula) #83238

Closed
wants to merge 27 commits into from
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e1e6129
New Formula: Apache Pulsar
zbentley Aug 13, 2021
cc5e606
Address linter errors
zbentley Aug 13, 2021
3e22f9e
Address reviewer comments
zbentley Aug 14, 2021
a57ec65
Attempt to resolve CI failures: make /etc path
zbentley Aug 16, 2021
832b3dd
try moving directory creation to before tar command
zbentley Aug 16, 2021
d744550
Remove asterisk for config symlink
zbentley Aug 16, 2021
59a250e
Remove non-optional cross compiled PPC file
zbentley Aug 20, 2021
f949f6b
Add protobuf as build dependency
zbentley Aug 20, 2021
6d74191
Attempt to force x86_64 architecture to get m1 build working
zbentley Aug 20, 2021
a764ca7
Fix linter issues
zbentley Aug 20, 2021
918a4ce
Try overriding protoc command
zbentley Aug 20, 2021
b976db0
Fix trailing new line
zbentley Aug 20, 2021
e7fbbf0
Try a newer version of protoc
zbentley Aug 20, 2021
517a8d1
Try overriding grpc version as well
zbentley Aug 20, 2021
83ea2af
Give up on versioning grpc and proto forward
zbentley Aug 20, 2021
0e6e813
Constrain arch
zbentley Aug 26, 2021
ebda469
Constrain arch
zbentley Aug 26, 2021
79956f2
Support building from HEAD properly
zbentley Aug 27, 2021
774e4f8
Address reviewer comments
zbentley Aug 29, 2021
1e325fb
Link to upstream packaging issue and force JVM version
zbentley Aug 29, 2021
0d2389d
Restore JVM version pin for build
zbentley Aug 29, 2021
e5133c4
Reviewer suggestion: use utility fucntion for java home
zbentley Aug 30, 2021
ade8e84
Fix mistaken non-string use of java_home_env
zbentley Aug 30, 2021
33679a0
Address reviewer comments
zbentley Sep 10, 2021
0dfe3db
Apply suggestions from code review
zbentley Sep 14, 2021
e1a7780
Move log creation to postinstall
zbentley Sep 14, 2021
b8f8360
Update Formula/apache-pulsar.rb
zbentley Sep 16, 2021
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
74 changes: 74 additions & 0 deletions Formula/apache-pulsar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
class ApachePulsar < Formula
desc "Cloud-native distributed messaging and streaming platform"
homepage "https://pulsar.apache.org/"
url "https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=pulsar/pulsar-2.8.0/apache-pulsar-2.8.0-src.tar.gz"
mirror "https://archive.apache.org/dist/pulsar/pulsar-2.8.0/apache-pulsar-2.8.0-src.tar.gz"
sha256 "0e161a81c62c7234c1e0c243bb6fe30046ec1cd01472618573ecdc2a73b1163b"
license "Apache-2.0"
head "https://github.com/apache/pulsar.git", branch: "master"

depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "cppunit" => :build
depends_on "libtool" => :build
depends_on "maven" => :build
depends_on "pkg-config" => :build
depends_on "protobuf" => :build
depends_on arch: :x86_64
depends_on "openjdk@11"

def install
# Missing executable permission reported upstream: https://github.com/apache/pulsar/issues/11833
chmod "+x", "src/rename-netty-native-libs.sh"
Copy link
Member

Choose a reason for hiding this comment

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

This should be fixed upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is executable in master: https://github.com/apache/pulsar/blob/master/src/rename-netty-native-libs.sh

The only place it seems to be not executable is in the tarballs on the apache mirrors.

Copy link
Member

Choose a reason for hiding this comment

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

Then upstream needs to check why.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I filed an issue upstream and linked to it in the formula.


with_env("TMPDIR" => buildpath, **Language::Java.java_home_env("11")) do
system "mvn", "-X", "clean", "package", "-DskipTests", "-Pcore-modules"
end

built_version = if build.head?
# This script does not need any particular version of py3 nor any libs, so both
# brew-installed python and system python will work.
Utils.safe_popen_read("python3", "src/get-project-version.py").strip
else
version
end
zbentley marked this conversation as resolved.
Show resolved Hide resolved

binpfx = "apache-pulsar-#{built_version}"
system "tar", "-xf", "distribution/server/target/#{binpfx}-bin.tar.gz"
libexec.install "#{binpfx}/bin", "#{binpfx}/lib", "#{binpfx}/instances", "#{binpfx}/conf"
(libexec/"lib/presto/bin/procname/Linux-ppc64le").rmtree
pkgshare.install "#{binpfx}/examples", "#{binpfx}/licenses"
(etc/"pulsar").install_symlink libexec/"conf"

libexec.glob("bin/*") do |path|
if !path.fnmatch?("*common.sh") && !path.directory?
bin_name = path.basename
(bin/bin_name).write_env_script libexec/"bin"/bin_name, Language::Java.java_home_env("11")
end
end
end

def post_install
(var/"log/pulsar").mkpath
end

service do
run [bin/"pulsar", "standalone"]
log_path var/"log/pulsar/output.log"
error_log_path var/"log/pulsar/error.log"
end

test do
fork do
exec bin/"pulsar", "standalone", "--zookeeper-dir", "#{testpath}/zk", " --bookkeeper-dir", "#{testpath}/bk"
end
# The daemon takes some time to start; pulsar-client will retry until it gets a connection, but emit confusing
# errors until that happens, so sleep to reduce log spam.
sleep 15

output = shell_output("#{bin}/pulsar-client produce my-topic --messages 'hello-pulsar'")
assert_match "1 messages successfully produced", output
output = shell_output("#{bin}/pulsar initialize-cluster-metadata -c a -cs localhost -uw localhost -zk localhost")
assert_match "Cluster metadata for 'a' setup correctly", output
end
end