Remove a bunch of references to "@org_frc971"

Downstream users use this as @aos. Use a combination of the clean_dep macro
and repo mappings to make it so that we will no longer have to maintain
diffs across the repositories.

The remaining differences are largely in some random rust files.

Change-Id: Ie10c88c299bc1ee9a0309a6a5536c49638519557
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/analysis/BUILD b/aos/analysis/BUILD
index 1e3b2fa..85f8783 100644
--- a/aos/analysis/BUILD
+++ b/aos/analysis/BUILD
@@ -1,6 +1,7 @@
 load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
 load("//aos:config.bzl", "aos_config")
 load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
+load("//tools/build_rules:clean_dep.bzl", "aos_repo_name")
 load("//tools/build_rules:js.bzl", "ts_project")
 
 package(default_visibility = ["//visibility:public"])
@@ -79,6 +80,7 @@
         ":plotter",
         "//aos/analysis/cpp_plot:cpp_plot_files",
     ],
+    local_defines = ["AOS_REPO_NAME=\\\"" + aos_repo_name() + "\\\""],
     deps = [
         ":plot_data_fbs",
         "//aos/events:simulated_event_loop",
diff --git a/aos/analysis/in_process_plotter.cc b/aos/analysis/in_process_plotter.cc
index dcb60b7..6c45389 100644
--- a/aos/analysis/in_process_plotter.cc
+++ b/aos/analysis/in_process_plotter.cc
@@ -12,8 +12,8 @@
 namespace aos::analysis {
 
 namespace {
-const char *kDataPath = "aos/analysis/cpp_plot";
-const char *kConfigPath = "aos/analysis/plotter.json";
+const char *kDataPath = "../" AOS_REPO_NAME "/aos/analysis/cpp_plot";
+const char *kConfigPath = "../" AOS_REPO_NAME "/aos/analysis/plotter.json";
 }  // namespace
 
 Plotter::Plotter()
diff --git a/aos/events/logging/BUILD b/aos/events/logging/BUILD
index 5d8c1b0..f056bca 100644
--- a/aos/events/logging/BUILD
+++ b/aos/events/logging/BUILD
@@ -233,6 +233,9 @@
     data = [
         ":logfile_utils_out_of_space_test_runner",
     ],
+    env = {
+        "RUNNER": "$(rootpath :logfile_utils_out_of_space_test_runner)",
+    },
     tags = [
         # This uses unclone to make a new mount namespace.  Turns out, this is
         # quite hard to figure out how to put in a remote cluster.  So just
diff --git a/aos/events/logging/logfile_utils_out_of_space_test.sh b/aos/events/logging/logfile_utils_out_of_space_test.sh
index 6a32347..f56a4f9 100755
--- a/aos/events/logging/logfile_utils_out_of_space_test.sh
+++ b/aos/events/logging/logfile_utils_out_of_space_test.sh
@@ -31,7 +31,7 @@
 
 mount -t tmpfs tmpfs -o size=${SIZE} "${TMPFS}"
 
-exec "$(rlocation org_frc971/aos/events/logging/logfile_utils_out_of_space_test_runner)" -tmpfs "${TMPFS}"
+exec "${RUNNER}" -tmpfs "${TMPFS}"
 END
   echo "Finished test with ${SIZE}" >&2
 }
diff --git a/aos/flatbuffers.bzl b/aos/flatbuffers.bzl
index c26906a..a5158cc 100644
--- a/aos/flatbuffers.bzl
+++ b/aos/flatbuffers.bzl
@@ -1,3 +1,5 @@
+load("//tools/build_rules:clean_dep.bzl", "clean_dep")
+
 def cc_static_flatbuffer(name, target, function, bfbs_name = None, visibility = None):
     """Creates a cc_library which encodes a file as a Span.
 
@@ -9,10 +11,10 @@
     """
     native.genrule(
         name = name + "_gen",
-        tools = ["@org_frc971//aos:flatbuffers_static"],
+        tools = [clean_dep("//aos:flatbuffers_static")],
         srcs = [target],
         outs = [name + ".h"],
-        cmd = "$(location @org_frc971//aos:flatbuffers_static) '$(SRCS)' $(OUTS) '" + function + "' " + (bfbs_name if bfbs_name else "-"),
+        cmd = "$(location " + clean_dep("//aos:flatbuffers_static") + ") '$(SRCS)' $(OUTS) '" + function + "' " + (bfbs_name if bfbs_name else "-"),
     )
 
     native.cc_library(
diff --git a/aos/flatbuffers/generate.bzl b/aos/flatbuffers/generate.bzl
index 52627bc..a060639 100644
--- a/aos/flatbuffers/generate.bzl
+++ b/aos/flatbuffers/generate.bzl
@@ -1,5 +1,6 @@
 load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary")
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
+load("//tools/build_rules:clean_dep.bzl", "aos_repo_name", "clean_dep")
 
 def static_flatbuffer(name, visibility = None, deps = [], srcs = [], **kwargs):
     """Generates the code for the static C++ flatbuffer API for the specified fbs file.
@@ -36,10 +37,11 @@
 
     run_binary(
         name = name + "_gen",
-        tool = "@org_frc971//aos/flatbuffers:generate_wrapper",
+        tool = clean_dep("//aos/flatbuffers:generate_wrapper"),
         srcs = [reflection_out],
         outs = header_names,
         env = {
+            "AOS_REPO_NAME": aos_repo_name(),
             "BFBS_FILES": "$(execpaths %s)" % (reflection_out,),
             "BASE_FILES": " ".join(srcs),
             "OUT_FILES": " ".join(["$(execpath %s)" % (name,) for name in header_names]),
@@ -48,7 +50,7 @@
     native.cc_library(
         name = name,
         hdrs = header_names,
-        deps = ["@org_frc971//aos/flatbuffers:static_table", "@org_frc971//aos/flatbuffers:static_vector", name + fbs_suffix] + deps,
+        deps = [clean_dep("//aos/flatbuffers:static_table"), clean_dep("//aos/flatbuffers:static_vector"), name + fbs_suffix] + deps,
         visibility = visibility,
     )
     native.alias(
diff --git a/aos/flatbuffers/generate.sh b/aos/flatbuffers/generate.sh
index 09bb4dc..f3ba9f1 100755
--- a/aos/flatbuffers/generate.sh
+++ b/aos/flatbuffers/generate.sh
@@ -22,9 +22,9 @@
 LEN=${#INPUTS[@]}
 
 for ((i = 0; i < $LEN; i++)); do
-  $(rlocation org_frc971/aos/flatbuffers/generate) \
+  $(rlocation ${AOS_REPO_NAME}/aos/flatbuffers/generate) \
     --reflection_bfbs "${INPUTS[i]}" \
     --output_file "${OUTPUTS[i]}" \
     --base_file_name "$(basename ${SCHEMA_FILES[i]})"
-  $(rlocation llvm_k8/bin/clang-format) --style=file:"$(rlocation org_frc971/.clang-format)" -i "${OUTPUTS[i]}"
+  $(rlocation llvm_k8/bin/clang-format) --style=file:"$(rlocation ${AOS_REPO_NAME}/.clang-format)" -i "${OUTPUTS[i]}"
 done