Unverified Commit 72ac7fea authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

kapacitor: 1.7.0 -> 1.7.5 (#344895)

parents 986014c4 d1b84151
Loading
Loading
Loading
Loading
+190 −0
Original line number Diff line number Diff line
From 3a5c573079f427dcda47176137747806200551cb Mon Sep 17 00:00:00 2001
From: wxt <3264117476@qq.com>
Date: Fri, 27 Sep 2024 21:25:14 +0800
Subject: [PATCH] fix build

---
 flux-core/src/semantic/flatbuffers/types.rs |  6 +++---
 flux-core/src/semantic/nodes.rs             |  5 ++---
 flux-core/src/semantic/sub.rs               | 24 ++++++++++-----------
 flux-core/src/semantic/types.rs             |  5 +++--
 go/libflux/buildinfo.gen.go                 |  9 ++++----
 5 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/flux-core/src/semantic/flatbuffers/types.rs b/flux-core/src/semantic/flatbuffers/types.rs
index c3eecf0..e7e1c95 100644
--- a/flux-core/src/semantic/flatbuffers/types.rs
+++ b/flux-core/src/semantic/flatbuffers/types.rs
@@ -108,7 +108,7 @@ impl From<fb::PolyType<'_>> for Option<PolyType> {
         for value in c.iter() {
             let constraint: Option<(Tvar, Kind)> = value.into();
             let (tv, kind) = constraint?;
-            cons.entry(tv).or_insert_with(Vec::new).push(kind);
+            cons.entry(tv).or_default().push(kind);
         }
         Some(PolyType {
             vars,
@@ -345,9 +345,9 @@ where
     builder.finished_data()
 }
 
-pub fn deserialize<'a, T: 'a, S>(buf: &'a [u8]) -> S
+pub fn deserialize<'a, T, S>(buf: &'a [u8]) -> S
 where
-    T: flatbuffers::Follow<'a> + flatbuffers::Verifiable,
+    T: flatbuffers::Follow<'a> + flatbuffers::Verifiable + 'a,
     S: std::convert::From<T::Inner>,
 {
     flatbuffers::root::<T>(buf).unwrap().into()
diff --git a/flux-core/src/semantic/nodes.rs b/flux-core/src/semantic/nodes.rs
index 3213991..f64dbd4 100644
--- a/flux-core/src/semantic/nodes.rs
+++ b/flux-core/src/semantic/nodes.rs
@@ -822,9 +822,8 @@ impl VariableAssgn {
         //
         // Note these variables are fixed after generalization
         // and so it is safe to update these nodes in place.
-        self.vars = p.vars.clone();
-        self.cons = p.cons.clone();
-
+	self.vars.clone_from(&p.vars);
+        self.cons.clone_from(&p.cons);
         // Update the type environment
         infer.env.add(self.id.name.clone(), p);
         Ok(())
diff --git a/flux-core/src/semantic/sub.rs b/flux-core/src/semantic/sub.rs
index 2ca73e0..1431565 100644
--- a/flux-core/src/semantic/sub.rs
+++ b/flux-core/src/semantic/sub.rs
@@ -481,7 +481,7 @@ where
 }
 
 #[allow(clippy::too_many_arguments, clippy::type_complexity)]
-pub(crate) fn merge4<A: ?Sized, B: ?Sized, C: ?Sized, D: ?Sized>(
+pub(crate) fn merge4<A, B, C, D>(
     a_original: &A,
     a: Option<A::Owned>,
     b_original: &B,
@@ -492,10 +492,10 @@ pub(crate) fn merge4<A: ?Sized, B: ?Sized, C: ?Sized, D: ?Sized>(
     d: Option<D::Owned>,
 ) -> Option<(A::Owned, B::Owned, C::Owned, D::Owned)>
 where
-    A: ToOwned,
-    B: ToOwned,
-    C: ToOwned,
-    D: ToOwned,
+    A: ToOwned + ?Sized,
+    B: ToOwned + ?Sized,
+    C: ToOwned + ?Sized,
+    D: ToOwned + ?Sized,
 {
     let a_b_c = merge3(a_original, a, b_original, b, c_original, c);
     merge_fn(
@@ -515,7 +515,7 @@ where
     .map(|((a, b, c), d)| (a, b, c, d))
 }
 
-pub(crate) fn merge3<A: ?Sized, B: ?Sized, C: ?Sized>(
+pub(crate) fn merge3<A, B, C>(
     a_original: &A,
     a: Option<A::Owned>,
     b_original: &B,
@@ -524,9 +524,9 @@ pub(crate) fn merge3<A: ?Sized, B: ?Sized, C: ?Sized>(
     c: Option<C::Owned>,
 ) -> Option<(A::Owned, B::Owned, C::Owned)>
 where
-    A: ToOwned,
-    B: ToOwned,
-    C: ToOwned,
+    A: ToOwned + ?Sized,
+    B: ToOwned + ?Sized,
+    C: ToOwned + ?Sized,
 {
     let a_b = merge(a_original, a, b_original, b);
     merge_fn(
@@ -542,15 +542,15 @@ where
 
 /// Merges two values using `f` if either or both them is `Some(..)`.
 /// If both are `None`, `None` is returned.
-pub(crate) fn merge<A: ?Sized, B: ?Sized>(
+pub(crate) fn merge<A, B>(
     a_original: &A,
     a: Option<A::Owned>,
     b_original: &B,
     b: Option<B::Owned>,
 ) -> Option<(A::Owned, B::Owned)>
 where
-    A: ToOwned,
-    B: ToOwned,
+    A: ToOwned + ?Sized,
+    B: ToOwned + ?Sized,
 {
     merge_fn(a_original, A::to_owned, a, b_original, B::to_owned, b)
 }
diff --git a/flux-core/src/semantic/types.rs b/flux-core/src/semantic/types.rs
index 6a0e292..685475a 100644
--- a/flux-core/src/semantic/types.rs
+++ b/flux-core/src/semantic/types.rs
@@ -1327,7 +1327,7 @@ fn collect_record(record: &Record) -> (RefMonoTypeVecMap<'_, RecordLabel>, Optio
 
     let mut fields = record.fields();
     for field in &mut fields {
-        a.entry(&field.k).or_insert_with(Vec::new).push(&field.v);
+        a.entry(&field.k).or_default().push(&field.v);
     }
     (a, fields.tail())
 }
@@ -1812,7 +1812,7 @@ impl PartialEq<&str> for Label {
 
 impl PartialOrd for Label {
     fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
-        self.0.name().partial_cmp(other.0.name())
+        Some(self.cmp(other))
     }
 }
 
@@ -2198,6 +2198,7 @@ impl Function {
 pub(crate) trait TypeLike {
     type Error;
     fn typ(&self) -> &MonoType;
+    #[allow(dead_code)]
     fn into_type(self) -> MonoType;
     fn error(&self, error: Error) -> Self::Error;
 }
diff --git a/go/libflux/buildinfo.gen.go b/go/libflux/buildinfo.gen.go
index 2d13f4a..266f493 100644
--- a/go/libflux/buildinfo.gen.go
+++ b/go/libflux/buildinfo.gen.go
@@ -10,6 +10,7 @@ package libflux
 // and forces the cgo library to rebuild and relink
 // the sources. This is because non-C/C++ sources
 // are not tracked by Go's build system.'
+//
 //lint:ignore U1000 generated code
 var sourceHashes = map[string]string{
 	"libflux/Cargo.lock":                                                                          "ec8537d38afbe08ecf451990b8c0a84ee4b30ee66d440d6525832c769764e44e",
@@ -41,17 +42,17 @@ var sourceHashes = map[string]string{
 	"libflux/flux-core/src/semantic/env.rs":                                                       "8da036aa5f0e09f94fd2461687e97131068e56c762bef8cd98cfd91f36ef3e98",
 	"libflux/flux-core/src/semantic/flatbuffers/mod.rs":                                           "270671ffdcb1eb5308f9bbab0431c9464df264070a2deb05c526d182a6ec5585",
 	"libflux/flux-core/src/semantic/flatbuffers/semantic_generated.rs":                            "beaaa6b08d8b56dba81153a58e440bbdc430b4eca0201a3431e90b793f1adbce",
-	"libflux/flux-core/src/semantic/flatbuffers/types.rs":                                         "029d51104eb4a0bbfc8d82a470e0f2915a27d7cb00c08a3f35e638b5a3105fc2",
+	"libflux/flux-core/src/semantic/flatbuffers/types.rs":                                         "c378f78c87464d9ecd4dc86b4808c0268e3968adf3def0170c77ce78bb0200c9",
 	"libflux/flux-core/src/semantic/formatter/mod.rs":                                             "8dd34520750a39ad242adfbb68c38a170d56bad82d5ccf80b165f0977ea68289",
 	"libflux/flux-core/src/semantic/fresh.rs":                                                     "97238fbc317e7c51836a6ba3441d641d9f4f8c7f637bde4bccbd0e09146129d0",
 	"libflux/flux-core/src/semantic/fs.rs":                                                        "f7f609bc8149769d99b737150e184a2d54029c0b768365dbcf08ff193b0e1f6f",
 	"libflux/flux-core/src/semantic/import.rs":                                                    "184e955211db1ceb1be782b4daf75584b86907b1428e50015497909cfc2dd89a",
 	"libflux/flux-core/src/semantic/infer.rs":                                                     "9d4293f2471a90cc89c1e45cdc72082e0da1a484981b803aea05856e6b4d722f",
 	"libflux/flux-core/src/semantic/mod.rs":                                                       "a70c32d73f0053e4a3eda7ad23626252cf6420b5db8b440a7351c2f62aa7a948",
-	"libflux/flux-core/src/semantic/nodes.rs":                                                     "23ee2dec99b71f0fe81987528b3dfbd95e89d77a274ccc8a0baa146dea89ad51",
-	"libflux/flux-core/src/semantic/sub.rs":                                                       "a989e50c113ca899fe02f8d49a4744a420580a3f803f656db25beb2d0c2a247b",
+	"libflux/flux-core/src/semantic/nodes.rs":                                                     "d5bff77bcb3de0e730b2a3f6d1245a12c718dfe3b8ecf937532330d2579ab53f",
+	"libflux/flux-core/src/semantic/sub.rs":                                                       "618713f4d14e9e2674204a9d293600692213327e77842cbe973c7b1715e23f24",
 	"libflux/flux-core/src/semantic/symbols.rs":                                                   "ddbceca632ca384c6bb461a660e02781c43295025f2dd10f1ea997131dd5eb30",
-	"libflux/flux-core/src/semantic/types.rs":                                                     "ed414b695e925f18f74984ec88bba652ef8dd8c9e905cb9e8fa19b101a4601b4",
+	"libflux/flux-core/src/semantic/types.rs":                                                     "ae9cdcff357d217c0f744769a95b9f3bf55083f923df0c235f52de2b40be8f74",
 	"libflux/flux-core/src/semantic/vectorize.rs":                                                 "6ce2dc4e6ff572abc0146a220291322ea88557ce674ae16220a2d67420e9fa0d",
 	"libflux/flux-core/src/semantic/walk/_walk.rs":                                                "c3d04e72cfbe595d4919b84f4df4bc6c55297516cf8e12e6cb691f48be648291",
 	"libflux/flux-core/src/semantic/walk/mod.rs":                                                  "f71aac086dd1d7b730e24bac690a3e47a9bfe575cd6cba499af67db9b920c726",
-- 
2.46.0
+45 −26
Original line number Diff line number Diff line
{ stdenv
, lib
, rustPlatform
, fetchFromGitHub
, fetchpatch
, libiconv
, buildGoModule
, pkg-config
{
  stdenv,
  lib,
  rustPlatform,
  fetchFromGitHub,
  fetchpatch,
  libiconv,
  buildGoModule,
  pkg-config,
}:

let
  libflux_version = "0.171.0";
  flux = rustPlatform.buildRustPackage rec {
    pname = "libflux";
    version = "v${libflux_version}";
    version = "${libflux_version}";
    src = fetchFromGitHub {
      owner = "influxdata";
      repo = "flux";
      rev = "v${libflux_version}";
      rev = "refs/tags/v${libflux_version}";
      hash = "sha256-v9MUR+PcxAus91FiHYrMN9MbNOTWewh7MT6/t/QWQcM=";
    };
    patches = [
@@ -29,6 +30,8 @@ let
      # Can be removed as soon as kapacitor depends on a newer version of `libflux`, cf:
      # https://github.com/influxdata/kapacitor/blob/v1.7.0/go.mod#L26
      ./fix-linting-error-on-unneeded-clone.patch
      # https://github.com/influxdata/flux/commit/68c831c40b396f0274f6a9f97d77707c39970b02
      ./0001-fix-build.patch

      # https://github.com/influxdata/flux/pull/5273
      # fix compile error with Rust 1.64
@@ -40,7 +43,7 @@ let
      })
    ];
    sourceRoot = "${src.name}/libflux";
    cargoHash = "sha256-oAMoGGdR0QEjSzZ0/J5J9s/ekSlryCcRBSo5N2r70Ko=";
    cargoHash = "sha256-yIYeJvLe+L72ZyuQ2AK6l4HGSF/tgCyGQsXEOWUXDn0=";
    nativeBuildInputs = [ rustPlatform.bindgenHook ];
    buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
    pkgcfg = ''
@@ -51,28 +54,30 @@ let
      Libs: -L/out/lib -lflux -lpthread
    '';
    passAsFile = [ "pkgcfg" ];
    postInstall = ''
    postInstall =
      ''
        mkdir -p $out/include $out/pkgconfig
        cp -r $NIX_BUILD_TOP/source/libflux/include/influxdata $out/include
        substitute $pkgcfgPath $out/pkgconfig/flux.pc \
        --replace /out $out
    '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
          --replace-fail /out $out
      ''
      + lib.optionalString stdenv.hostPlatform.isDarwin ''
        install_name_tool -id $out/lib/libflux.dylib $out/lib/libflux.dylib
      '';
  };
in
buildGoModule rec {
  pname = "kapacitor";
  version = "1.7.0";
  version = "1.7.5";

  src = fetchFromGitHub {
    owner = "influxdata";
    repo = "kapacitor";
    rev = "v${version}";
    hash = "sha256-vDluZZrct1x+OMVU8MNO56YBZq7JNlpW68alOrAGYSM=";
    rev = "refs/tags/v${version}";
    hash = "sha256-vxaLfJq0NFAJst0/AEhNJUl9dAaZY3blZAFthseMSX0=";
  };

  vendorHash = "sha256-OX4QAthg15lwMyhOPyLTS++CMvGI5Um+FSd025PhW3E=";
  vendorHash = "sha256-myToEgta8R5R4v2/nZqtQQvNdy1kWgwklbQeFxzIdgs=";

  nativeBuildInputs = [ pkg-config ];

@@ -90,20 +95,34 @@ buildGoModule rec {
  # Remove failing server tests
  preCheck = ''
    rm server/server_test.go
    rm pipeline/tick/*test.go
  '';

  checkFlags =
    let
      skippedTests = [
        "TestBatch_KapacitorLoopback"
      ];
    in
    [
      "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$"
    ];

  # Tests start http servers which need to bind to local addresses,
  # but that fails in the Darwin sandbox by default unless this option is turned on
  # Error is: panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted
  # See also https://github.com/NixOS/nix/pull/1646
  __darwinAllowLocalNetworking = true;

  meta = with lib; {
  meta = {
    description = "Open source framework for processing, monitoring, and alerting on time series data";
    homepage = "https://influxdata.com/time-series-platform/kapacitor/";
    downloadPage = "https://github.com/influxdata/kapacitor/releases";
    license = licenses.mit;
    license = lib.licenses.mit;
    changelog = "https://github.com/influxdata/kapacitor/blob/master/CHANGELOG.md";
    maintainers = with maintainers; [ offline totoroot ];
    maintainers = with lib.maintainers; [
      offline
      totoroot
    ];
  };
}
+0 −2
Original line number Diff line number Diff line
@@ -5261,8 +5261,6 @@ with pkgs;
  jwx = callPackage ../tools/security/jwx { } ;
  kapacitor = callPackage ../servers/monitoring/kapacitor { };
  karma = callPackage ../servers/monitoring/karma { };
  kaldi = callPackage ../tools/audio/kaldi {