diff --git a/Formula/kapacitor.rb b/Formula/kapacitor.rb index 056d7bd2e3ef..f4ad96c02939 100644 --- a/Formula/kapacitor.rb +++ b/Formula/kapacitor.rb @@ -22,6 +22,10 @@ class Kapacitor < Formula depends_on "go" => :build depends_on "rust" => :build + on_linux do + depends_on "pkg-config" => :build # for `pkg-config-wrapper` + end + # NOTE: The version here is specified in the go.mod of kapacitor. # If you're upgrading to a newer kapacitor version, check to see if this needs upgraded too. resource "pkg-config-wrapper" do @@ -29,12 +33,31 @@ class Kapacitor < Formula sha256 "9bfe2c06b09fe7f3274f4ff8da1d87c9102640285bb38dad9a8c26dd5b9fe5af" end + # Temporary resource using version specified in the go.mod of kapacitor. + # We currently need this to support building with Rust v1.54+. + # Upstream issue ref: https://github.com/influxdata/kapacitor/issues/2612 + # TODO: Remove when `flux` version in go.mod is updated to v0.124 or later. + resource "flux" do + url "https://github.com/influxdata/flux/archive/4347b978c91a46349790f773239589ba6abdfd98.tar.gz" + sha256 "557cf85a756a633dacb08852ee55889c246df412330119bd844612d2cc55ce23" + version "0.116.1-0.20210519190248-4347b978c91a" + + # Fix build with Rust v1.54+. + # Backport of https://github.com/influxdata/flux/commit/c29d2c02ab42d591bb91e5d6321dacba3609e928 + patch :DATA + end + def install resource("pkg-config-wrapper").stage do system "go", "build", *std_go_args, "-o", buildpath/"bootstrap/pkg-config" end ENV.prepend_path "PATH", buildpath/"bootstrap" + # Fix build with Rust v1.54+. Remove when flux in go.mod is updated to v0.124+. + r = resource("flux") + (buildpath/"flux").install r + system "go", "mod", "edit", "-replace", "github.com/influxdata/flux@v#{r.version}=#{buildpath}/flux" + ldflags = %W[ -s -w @@ -115,3 +138,69 @@ def plist end end end + +__END__ +diff --git a/libflux/flux-core/src/parser/mod.rs b/libflux/flux-core/src/parser/mod.rs +index c35771a6..6430654c 100644 +--- a/libflux/flux-core/src/parser/mod.rs ++++ b/libflux/flux-core/src/parser/mod.rs +@@ -32,7 +32,6 @@ pub fn parse_string(name: &str, s: &str) -> File { + } + + struct TokenError { +- pub message: String, + pub token: Token, + } + +@@ -1398,7 +1397,7 @@ impl Parser { + value, + })); + } +- Err(message) => return Err(TokenError { token: t, message }), ++ Err(_) => return Err(TokenError { token: t }), + } + } + TokenType::StringExpr => { +@@ -1473,10 +1472,7 @@ impl Parser { + base: self.base_node_from_token(&t), + value, + }), +- Err(_) => Err(TokenError { +- token: t, +- message: String::from("failed to parse float literal"), +- }), ++ Err(_) => Err(TokenError { token: t }), + } + } + fn parse_string_literal(&mut self) -> StringLit { +@@ -1520,7 +1516,7 @@ impl Parser { + base: self.base_node_from_token(&t), + value, + }), +- Err(message) => Err(TokenError { token: t, message }), ++ Err(_message) => Err(TokenError { token: t }), + } + } + fn parse_duration_literal(&mut self) -> Result { +@@ -1532,7 +1528,7 @@ impl Parser { + base: self.base_node_from_token(&t), + values, + }), +- Err(message) => Err(TokenError { token: t, message }), ++ Err(_message) => Err(TokenError { token: t }), + } + } + fn parse_pipe_literal(&mut self) -> PipeLit { +diff --git a/libflux/go/libflux/buildinfo.gen.go b/libflux/go/libflux/buildinfo.gen.go +index 104cb0c9..d1223a3a 100644 +--- a/libflux/go/libflux/buildinfo.gen.go ++++ b/libflux/go/libflux/buildinfo.gen.go +@@ -29,7 +29,7 @@ var sourceHashes = map[string]string{ + "libflux/flux-core/src/formatter/mod.rs": "de2216b303b3a57627bae6eb7788e7b7ecc5ef5638242380533e9efdea7e512e", + "libflux/flux-core/src/formatter/tests.rs": "e6bd0be3341673a6c2b5d45ebefcdf6f74c7608eea7f45410aff43c66f1916b8", + "libflux/flux-core/src/lib.rs": "49b07452edaed71ccfdb850c3ae1b7d8903f4e4837ae601d300edab19b34004c", +- "libflux/flux-core/src/parser/mod.rs": "31b69ead574a94a5652b25be1d134bd48a4b342603c6a6f72f46726520ca5b3c", ++ "libflux/flux-core/src/parser/mod.rs": "221cc327e434573ca27b46864ea3b53f151f1491dfca2dcd7af06b27ac0bda10", + "libflux/flux-core/src/parser/strconv.rs": "748c82f6efc2eafaafb872db5b4185ce29aafa8f03ba02c4b84f4a9614e832d2", + "libflux/flux-core/src/parser/tests.rs": "e3a7c9222f90323a7ea9b319bd84f96f66c6f115af6d199a0da332c894713ae4", + "libflux/flux-core/src/scanner/mod.rs": "2e15c9e0a73d0936d2eaeec030b636786db6dbe7aab673045de3a3e815c49f8a",