From 926da5c53834387931155294f68ca2205437d52f Mon Sep 17 00:00:00 2001 From: Tyler Langlois Date: Mon, 5 Mar 2018 11:40:32 -0800 Subject: [PATCH] filebeat: generate and install fields.yml into etc/ use native Makefile env var to install pip wheels from source --- Formula/filebeat.rb | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Formula/filebeat.rb b/Formula/filebeat.rb index ceda9fa47a..2cc653686b 100644 --- a/Formula/filebeat.rb +++ b/Formula/filebeat.rb @@ -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