2013-11-09 01:13:19 +00:00
|
|
|
class Mesos < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Apache cluster manager"
|
2015-03-05 02:59:16 +00:00
|
|
|
homepage "https://mesos.apache.org"
|
2015-07-24 19:16:17 +00:00
|
|
|
url "https://www.apache.org/dyn/closer.cgi?path=mesos/0.23.0/mesos-0.23.0.tar.gz"
|
|
|
|
mirror "https://archive.apache.org/dist/mesos/0.23.0/mesos-0.23.0.tar.gz"
|
|
|
|
sha256 "b967355ec1f7cf9ffcef76b58939ed48dd4975ea90d1c976669b50c589bdbdec"
|
2013-11-09 01:13:19 +00:00
|
|
|
|
2014-08-25 20:52:59 +00:00
|
|
|
bottle do
|
2015-07-27 18:42:32 +00:00
|
|
|
sha256 "717f73125b020b89e545384a3e5c1fbf2c36647b365fb181423954b9ceaa7b5d" => :yosemite
|
|
|
|
sha256 "090168dc4599d005491053e3fee6b0e932b7cf388066adec20e1e6eeb128e2b4" => :mavericks
|
|
|
|
sha256 "5c0916e2622083f4903449576a8b751e9dcc64da88ef0434efce6d76f14ab2cf" => :mountain_lion
|
2014-08-25 20:52:59 +00:00
|
|
|
end
|
|
|
|
|
2015-01-30 10:10:15 +00:00
|
|
|
depends_on :java => "1.7+"
|
2014-08-25 20:29:18 +00:00
|
|
|
depends_on :macos => :mountain_lion
|
2013-11-09 01:13:19 +00:00
|
|
|
depends_on "maven" => :build
|
2015-02-22 22:24:45 +00:00
|
|
|
depends_on :apr => :build
|
|
|
|
depends_on "subversion"
|
|
|
|
|
2015-03-05 02:59:16 +00:00
|
|
|
resource "boto" do
|
|
|
|
url "https://pypi.python.org/packages/source/b/boto/boto-2.36.0.tar.gz"
|
2015-07-24 19:16:17 +00:00
|
|
|
sha256 "8033c6f7a7252976df0137b62536cfe38f1dbd1ef443a7a6d8bc06c063bc36bd"
|
2015-03-05 02:59:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "protobuf" do
|
|
|
|
url "https://pypi.python.org/packages/source/p/protobuf/protobuf-2.6.1.tar.gz"
|
2015-07-24 19:16:17 +00:00
|
|
|
sha256 "8faca1fb462ee1be58d00f5efb4ca4f64bde92187fe61fde32615bbee7b3e745"
|
2015-03-05 02:59:16 +00:00
|
|
|
end
|
|
|
|
|
2015-08-03 12:55:31 +00:00
|
|
|
# build dependencies for protobuf
|
2015-03-05 02:59:16 +00:00
|
|
|
resource "six" do
|
|
|
|
url "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz"
|
2015-07-24 19:16:17 +00:00
|
|
|
sha256 "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5"
|
2015-03-05 02:59:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "python-dateutil" do
|
|
|
|
url "https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.0.tar.gz"
|
2015-07-24 19:16:17 +00:00
|
|
|
sha256 "439df33ce47ef1478a4f4765f3390eab0ed3ec4ae10be32f2930000c8d19f417"
|
2015-03-05 02:59:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "pytz" do
|
|
|
|
url "https://pypi.python.org/packages/source/p/pytz/pytz-2014.10.tar.bz2"
|
2015-07-24 19:16:17 +00:00
|
|
|
sha256 "387f968fde793b142865802916561839f5591d8b4b14c941125eb0fca7e4e58d"
|
2015-03-05 02:59:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "python-gflags" do
|
|
|
|
url "https://pypi.python.org/packages/source/p/python-gflags/python-gflags-2.0.tar.gz"
|
2015-07-24 19:16:17 +00:00
|
|
|
sha256 "0dff6360423f3ec08cbe3bfaf37b339461a54a21d13be0dd5d9c9999ce531078"
|
2015-03-05 02:59:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "google-apputils" do
|
|
|
|
url "https://pypi.python.org/packages/source/g/google-apputils/google-apputils-0.4.2.tar.gz"
|
2015-07-24 19:16:17 +00:00
|
|
|
sha256 "47959d0651c32102c10ad919b8a0ffe0ae85f44b8457ddcf2bdc0358fb03dc29"
|
2015-03-05 02:59:16 +00:00
|
|
|
end
|
2015-02-22 22:24:45 +00:00
|
|
|
|
|
|
|
needs :cxx11
|
2014-10-07 04:08:27 +00:00
|
|
|
|
2013-11-09 01:13:19 +00:00
|
|
|
def install
|
2015-03-05 02:59:16 +00:00
|
|
|
boto_path = libexec/"boto/lib/python2.7/site-packages"
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", boto_path
|
|
|
|
resource("boto").stage do
|
|
|
|
system "python", *Language::Python.setup_install_args(libexec/"boto")
|
|
|
|
end
|
|
|
|
(lib/"python2.7/site-packages").mkpath
|
|
|
|
(lib/"python2.7/site-packages/homebrew-mesos-boto.pth").write "#{boto_path}\n"
|
|
|
|
|
2015-02-22 22:24:45 +00:00
|
|
|
# work around distutils abusing CC instead of using CXX
|
|
|
|
# https://issues.apache.org/jira/browse/MESOS-799
|
|
|
|
# https://github.com/Homebrew/homebrew/pull/37087
|
2015-03-05 02:59:16 +00:00
|
|
|
native_patch = <<-EOS.undent
|
|
|
|
import os
|
2015-05-05 18:37:17 +00:00
|
|
|
os.environ["CC"] = os.environ["CXX"]
|
2015-03-05 02:59:16 +00:00
|
|
|
os.environ["LDFLAGS"] = "@LIBS@"
|
|
|
|
\\0
|
|
|
|
EOS
|
2015-02-22 22:24:45 +00:00
|
|
|
inreplace "src/python/native/setup.py.in",
|
|
|
|
"import ext_modules",
|
2015-03-05 02:59:16 +00:00
|
|
|
native_patch
|
2015-02-22 22:24:45 +00:00
|
|
|
|
2014-10-07 04:08:27 +00:00
|
|
|
args = ["--prefix=#{prefix}",
|
|
|
|
"--disable-debug",
|
|
|
|
"--disable-dependency-tracking",
|
2015-01-30 10:10:15 +00:00
|
|
|
"--disable-silent-rules",
|
2015-02-22 22:24:45 +00:00
|
|
|
"--with-svn=#{Formula["subversion"].opt_prefix}"
|
2014-10-07 04:08:27 +00:00
|
|
|
]
|
|
|
|
|
2015-02-22 22:24:45 +00:00
|
|
|
unless MacOS::CLT.installed?
|
|
|
|
args << "--with-apr=#{Formula["apr"].opt_prefix}/libexec"
|
|
|
|
end
|
|
|
|
|
|
|
|
ENV.cxx11
|
2013-11-09 01:13:19 +00:00
|
|
|
|
2015-03-05 02:59:16 +00:00
|
|
|
system "./configure", "--disable-python", *args
|
2013-11-09 01:13:19 +00:00
|
|
|
system "make"
|
|
|
|
system "make", "install"
|
2015-03-05 02:59:16 +00:00
|
|
|
|
|
|
|
system "./configure", "--enable-python", *args
|
|
|
|
["native", "interface", ""].each do |p|
|
|
|
|
cd "src/python/#{p}" do
|
|
|
|
system "python", *Language::Python.setup_install_args(prefix)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# stage protobuf build dependencies
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", buildpath/"protobuf/lib/python2.7/site-packages"
|
|
|
|
%w[six python-dateutil pytz python-gflags google-apputils].each do |r|
|
|
|
|
resource(r).stage do
|
|
|
|
system "python", *Language::Python.setup_install_args(buildpath/"protobuf")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
protobuf_path = libexec/"protobuf/lib/python2.7/site-packages"
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", protobuf_path
|
|
|
|
resource("protobuf").stage do
|
|
|
|
ln_s buildpath/"protobuf/lib/python2.7/site-packages/google/apputils", "google/apputils"
|
|
|
|
system "python", *Language::Python.setup_install_args(libexec/"protobuf")
|
|
|
|
end
|
|
|
|
pth_contents = "import site; site.addsitedir('#{protobuf_path}')\n"
|
|
|
|
(lib/"python2.7/site-packages/homebrew-mesos-protobuf.pth").write pth_contents
|
|
|
|
|
|
|
|
(share/"mesos").install "ec2"
|
2013-11-09 01:13:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2014-07-01 22:29:32 +00:00
|
|
|
require "timeout"
|
|
|
|
|
|
|
|
master = fork do
|
|
|
|
exec "#{sbin}/mesos-master", "--ip=127.0.0.1",
|
|
|
|
"--registry=in_memory"
|
|
|
|
end
|
|
|
|
slave = fork do
|
|
|
|
exec "#{sbin}/mesos-slave", "--master=127.0.0.1:5050",
|
|
|
|
"--work_dir=#{testpath}"
|
|
|
|
end
|
2015-01-30 10:10:15 +00:00
|
|
|
Timeout.timeout(15) do
|
2014-07-01 22:29:32 +00:00
|
|
|
system "#{bin}/mesos", "execute",
|
|
|
|
"--master=127.0.0.1:5050",
|
|
|
|
"--name=execute-touch",
|
|
|
|
"--command=touch\s#{testpath}/executed"
|
|
|
|
end
|
|
|
|
Process.kill("TERM", master)
|
|
|
|
Process.kill("TERM", slave)
|
2015-01-30 10:10:15 +00:00
|
|
|
assert File.exist?("#{testpath}/executed")
|
2015-03-05 02:59:16 +00:00
|
|
|
system "python", "-c", "import mesos.native"
|
2013-11-09 01:13:19 +00:00
|
|
|
end
|
|
|
|
end
|