blob: 65b33fb68402ea1c16350045df22e8f86725b6e5 [file] [log] [blame]
Philipp Schrader0f5d2502022-03-08 22:44:55 -08001load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
Austin Schuh8f99c822024-05-05 22:43:40 -07002load("@rules_pkg//pkg:pkg.bzl", "pkg_deb", "pkg_tar")
Philipp Schrader0f5d2502022-03-08 22:44:55 -08003
4pkg_files(
5 name = "systemd_files",
6 srcs = [
7 "scouting.service",
8 ],
9 prefix = "etc/systemd/system",
10)
11
12pkg_tar(
13 name = "server_files",
14 srcs = [
15 "//scouting",
16 ],
17 include_runfiles = True,
18 package_dir = "opt/frc971/scouting_server",
19 strip_prefix = ".",
Philipp Schrader818dddf2023-02-28 21:49:28 -080020 # The "include_runfiles" attribute creates a runfiles tree as seen from
21 # within the workspace directory. But what we really want is the runfiles
22 # tree as seen from the root of the runfiles tree (i.e. one directory up).
23 # So we work around it by manually adding some symlinks that let us pretend
24 # that we're at the root of the runfiles tree.
25 symlinks = {
Philipp Schraderfae3b482023-03-09 20:57:05 -080026 "org_frc971": ".",
27 "bazel_tools": "external/bazel_tools",
Philipp Schrader818dddf2023-02-28 21:49:28 -080028 },
Philipp Schrader0f5d2502022-03-08 22:44:55 -080029)
30
31pkg_tar(
32 name = "deploy_tar",
33 srcs = [
34 ":systemd_files",
35 ],
36 deps = [
37 ":server_files",
38 ],
39)
40
41pkg_deb(
42 name = "frc971-scouting-server",
43 architecture = "amd64",
44 data = ":deploy_tar",
Philipp Schrader119c3822023-03-07 19:49:58 -080045 depends = [
46 "frc971-scouting-julia",
47 ],
Philipp Schrader0f5d2502022-03-08 22:44:55 -080048 description = "The FRC971 scouting web server.",
49 # TODO(phil): What's a good email address for this?
50 maintainer = "frc971@frc971.org",
51 package = "frc971-scouting-server",
52 postinst = "postinst",
53 predepends = [
54 "systemd",
55 ],
56 prerm = "prerm",
57 version = "1",
58)
59
60py_binary(
61 name = "deploy",
62 srcs = [
63 "deploy.py",
64 ],
65 args = [
66 "--deb",
67 "$(location :frc971-scouting-server)",
68 ],
69 data = [
70 ":frc971-scouting-server",
71 ],
Philipp Schrader119c3822023-03-07 19:49:58 -080072 visibility = ["//scouting/DriverRank:__pkg__"],
Philipp Schrader0f5d2502022-03-08 22:44:55 -080073)