-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathBUILD
128 lines (115 loc) · 2.45 KB
/
BUILD
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("@pip_deps//:requirements.bzl", "requirement")
load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar")
py_library(
name = "config",
srcs = ["config.py"],
visibility = ["//:__subpackages__"],
)
py_test(
name = "config_test",
srcs = ["config_test.py"],
deps = [
":config",
],
)
py_library(
name = "connect",
srcs = ["connect.py"],
visibility = ["//:__subpackages__"],
deps = [
":config",
requirement("libdyson"),
],
)
py_library(
name = "metrics",
srcs = ["metrics.py"],
deps = [
requirement("libdyson"),
requirement("prometheus_client"),
],
)
py_test(
name = "metrics_test",
srcs = ["metrics_test.py"],
deps = [
":metrics",
requirement("libdyson"),
requirement("prometheus_client"),
],
)
py_binary(
name = "main",
srcs = ["main.py"],
deps = [
":config",
":connect",
":metrics",
requirement("prometheus_client"),
],
)
py_binary(
name = "config_builder",
srcs = ["config_builder.py"],
deps = [
":config",
requirement("libdyson"),
],
)
pkg_tar(
name = "deb-bin",
# This depends on --build_python_zip.
srcs = [
":config_builder",
":main",
"//misc:switch_heat_mode",
],
mode = "0755",
package_dir = "/opt/prometheus-dyson/bin",
)
pkg_tar(
name = "deb-config-sample",
srcs = ["config-sample.ini"],
mode = "0644",
package_dir = "/etc/prometheus-dyson",
)
pkg_tar(
name = "deb-default",
srcs = ["debian/prometheus-dyson"],
mode = "0644",
package_dir = "/etc/default",
strip_prefix = "/debian",
)
pkg_tar(
name = "deb-service",
srcs = ["debian/prometheus-dyson.service"],
mode = "0644",
package_dir = "/lib/systemd/system",
strip_prefix = "/debian",
)
pkg_tar(
name = "debian-data",
deps = [
":deb-bin",
":deb-config-sample",
":deb-default",
":deb-service",
],
)
pkg_deb(
name = "main-deb",
# libdyson includes native deps.
architecture = "amd64",
built_using = "bazel",
data = ":debian-data",
depends = [
"python3",
],
description_file = "debian/description",
maintainer = "Sean Rees <sean at erifax.org>",
package = "prometheus-dyson",
postrm = "debian/postrm",
prerm = "debian/prerm",
version = "0.4.1",
)