filebeat: generate and install fields.yml into etc/

use native Makefile env var to install pip wheels from source
This commit is contained in:
Tyler Langlois 2018-03-05 11:40:32 -08:00 committed by commitay
parent e4687d913b
commit 926da5c538

View file

@ -14,21 +14,35 @@ class Filebeat < Formula
depends_on "go" => :build
resource "virtualenv" do
url "https://files.pythonhosted.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz"
sha256 "02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a"
end
def install
gopath = buildpath/"gopath"
(gopath/"src/github.com/elastic/beats").install Dir["{*,.git,.gitignore}"]
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/elastic/beats").install Dir["{*,.git,.gitignore}"]
ENV["GOPATH"] = gopath
ENV.prepend_create_path "PYTHONPATH", buildpath/"vendor/lib/python2.7/site-packages"
cd gopath/"src/github.com/elastic/beats/filebeat" do
resource("virtualenv").stage do
system "python", *Language::Python.setup_install_args(buildpath/"vendor")
end
ENV.prepend_path "PATH", buildpath/"vendor/bin"
cd "src/github.com/elastic/beats/filebeat" do
system "make"
# prevent downloading binary wheels during python setup
system "make", "PIP_INSTALL_COMMANDS=--no-binary :all", "python-env"
system "make", "DEV_OS=darwin", "update"
system "make", "modules"
libexec.install "filebeat"
(prefix/"module").install Dir["_meta/module.generated/*"]
(etc/"filebeat").install Dir["filebeat.*"]
(etc/"filebeat").install Dir["filebeat.*", "fields.yml"]
end
prefix.install_metafiles gopath/"src/github.com/elastic/beats"
prefix.install_metafiles buildpath/"src/github.com/elastic/beats"
(bin/"filebeat").write <<~EOS
#!/bin/sh