blob: 2bf4b4edbb60239017501a0ec701ddaa596ef011 [file] [log] [blame]
Philipp Schrader0f5d2502022-03-08 22:44:55 -08001load("@rules_pkg//pkg:pkg.bzl", "pkg_deb", "pkg_tar")
2load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
3
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 = {
26 "opt/frc971/scouting_server/org_frc971": ".",
27 "opt/frc971/scouting_server/bazel_tools": "external/bazel_tools",
28 },
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",
45 description = "The FRC971 scouting web server.",
46 # TODO(phil): What's a good email address for this?
47 maintainer = "frc971@frc971.org",
48 package = "frc971-scouting-server",
49 postinst = "postinst",
50 predepends = [
51 "systemd",
52 ],
53 prerm = "prerm",
54 version = "1",
55)
56
57py_binary(
58 name = "deploy",
59 srcs = [
60 "deploy.py",
61 ],
62 args = [
63 "--deb",
64 "$(location :frc971-scouting-server)",
65 ],
66 data = [
67 ":frc971-scouting-server",
68 ],
69)