-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathnetdata.rb
98 lines (87 loc) · 3.37 KB
/
netdata.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class Netdata < Formula
desc "Diagnose infrastructure problems with metrics, visualizations & alarms"
homepage "https://www.netdata.cloud/"
url "https://github.com/netdata/netdata/releases/download/v2.4.0/netdata-v2.4.0.tar.gz"
sha256 "3349c893cad070273ed78334b29fbd4d320044f352e55c0881eb59033143711a"
license "GPL-3.0-or-later"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
strategy :github_latest
end
bottle do
sha256 arm64_sequoia: "3497283000e98a869afe95224803ff753352cb1f751497f23362f40b86d0064b"
sha256 arm64_sonoma: "923bab76fc7adec9a25a8c6006d299855d2f0795dc50a85b586bfc39fd8f21ef"
sha256 arm64_ventura: "c1e4d3f60cb6ed39ae8cff1c5a1464dbf1d7fdc25ef88c05c56ecb231a4985ba"
sha256 sonoma: "696874cdf8ae089f19793f760c4abcad630b4a3cddd16ff11f8771813134759b"
sha256 ventura: "d2d6034230b34671c093e9989b8cf0eb59f87f9be04ea24278440f2b81ab75e8"
sha256 x86_64_linux: "7e3f67b063e676577276996c197bad4419184c76efdc5c3782bd23eb560f4dd5"
end
depends_on "cmake" => :build
depends_on "go" => :build
depends_on "pkgconf" => :build
depends_on "abseil"
depends_on "dlib"
depends_on "json-c"
depends_on "libuv"
depends_on "libyaml"
depends_on "lz4"
depends_on "openssl@3"
depends_on "pcre2"
depends_on "protobuf"
depends_on "snappy"
depends_on "zstd"
uses_from_macos "curl"
uses_from_macos "zlib"
on_linux do
depends_on "bison" => :build
depends_on "flex" => :build
depends_on "brotli"
depends_on "elfutils"
depends_on "freeipmi"
depends_on "libcap"
depends_on "libmnl"
depends_on "systemd"
depends_on "util-linux"
depends_on "zstd"
end
def install
# Install files using Homebrew's directory layout rather than relative to root.
inreplace "packaging/cmake/Modules/NetdataEBPFLegacy.cmake", "DESTINATION usr/", "DESTINATION "
inreplace "CMakeLists.txt" do |s|
s.gsub! %r{(\s"?(?:\$\{NETDATA_RUNTIME_PREFIX\}/)?)usr/}, "\\1"
s.gsub! %r{(\s"?)(?:\$\{NETDATA_RUNTIME_PREFIX\}/)?etc/}, "\\1#{etc}/"
s.gsub! %r{(\s"?)(?:\$\{NETDATA_RUNTIME_PREFIX\}/)?var/}, "\\1#{var}/"
# Fix not to use `fetchContent` for `dlib` library
# Issue ref: https://github.com/netdata/netdata/issues/20147
s.gsub! "netdata_bundle_dlib()", "find_package(dlib REQUIRED)"
s.gsub! "netdata_add_dlib_to_target(netdata)", ""
end
system "cmake", "-S", ".", "-B", "build",
"-DBUILD_FOR_PACKAGING=ON",
"-DENABLE_PLUGIN_NFACCT=OFF",
"-DENABLE_PLUGIN_XENSTAT=OFF",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
def post_install
(var/"cache/netdata/unittest-dbengine/dbengine").mkpath
(var/"lib/netdata/registry").mkpath
(var/"lib/netdata/lock").mkpath
(var/"log/netdata").mkpath
(var/"netdata").mkpath
end
service do
run [opt_sbin/"netdata", "-D"]
working_dir var
end
test do
directories = prefix.children(false).map(&:to_s)
%w[usr var etc].each { |dir| refute_includes directories, dir }
system sbin/"netdata", "-W", "set", "registry", "netdata unique id file",
"#{testpath}/netdata.unittest.unique.id",
"-W", "set", "registry", "netdata management api key file",
"#{testpath}/netdata.api.key"
end
end