scouting: Make the deployment work with new rules_pkg

The rules_pkg upgrade from a couple of months ago broke the scouting
deployment. The behaviour of the `include_runfiles` attribute changed.
Instead of flattening the runfiles tree, it now creates a dedicated
".runfiles" tree for a binary. This is great, but unexpected.

This patch fixes the code to work with the new directory layout.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I1757a42a5733579ed16bfd76f3436fb55d9a9e04
diff --git a/scouting/deploy/BUILD b/scouting/deploy/BUILD
index 65b33fb..e453b0b 100644
--- a/scouting/deploy/BUILD
+++ b/scouting/deploy/BUILD
@@ -17,15 +17,6 @@
     include_runfiles = True,
     package_dir = "opt/frc971/scouting_server",
     strip_prefix = ".",
-    # The "include_runfiles" attribute creates a runfiles tree as seen from
-    # within the workspace directory. But what we really want is the runfiles
-    # tree as seen from the root of the runfiles tree (i.e. one directory up).
-    # So we work around it by manually adding some symlinks that let us pretend
-    # that we're at the root of the runfiles tree.
-    symlinks = {
-        "org_frc971": ".",
-        "bazel_tools": "external/bazel_tools",
-    },
 )
 
 pkg_tar(
diff --git a/scouting/deploy/postinst b/scouting/deploy/postinst
index be2b170..20f6052 100644
--- a/scouting/deploy/postinst
+++ b/scouting/deploy/postinst
@@ -21,7 +21,7 @@
 
 # Update the timestamps on the files so that web browsers pull the new version.
 # Otherwise users have to explicitly bypass the cache when visiting the site.
-find /opt/frc971/scouting_server/scouting/www/ -type f -exec touch {} +
+find /opt/frc971/scouting_server/scouting/scouting.runfiles/org_frc971/scouting/www/ -type f -exec touch {} +
 
 systemctl daemon-reload
 systemctl enable scouting.service
diff --git a/scouting/deploy/scouting.service b/scouting/deploy/scouting.service
index 2c55676..f5b0431 100644
--- a/scouting/deploy/scouting.service
+++ b/scouting/deploy/scouting.service
@@ -6,8 +6,8 @@
 User=www-data
 Group=www-data
 Type=simple
-WorkingDirectory=/opt/frc971/scouting_server
-Environment=RUNFILES_DIR=/opt/frc971/scouting_server
+WorkingDirectory=/opt/frc971/scouting_server/scouting/scouting.runfiles/org_frc971
+Environment=RUNFILES_DIR=/opt/frc971/scouting_server/scouting/scouting.runfiles
 # Add "julia" to the PATH.
 Environment=PATH=/opt/frc971/julia_runtime/bin:/usr/local/bin:/usr/bin:/bin
 # Use the Julia cache set up by the frc971-scouting-julia package.