mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[bazel] Fix sandbox leaks and add support for remote execution (#9031)
These were caught by building on engflow. This fixes a couple of places where paths were escaping the sandbox and resolving back to the git repo. --------- Signed-off-by: Austin Schuh <austin.linux@gmail.com>
This commit is contained in:
@@ -51,24 +51,7 @@ class HeaderToDatConfig:
|
||||
self.yml_file = args[1].path
|
||||
self.defines = defines
|
||||
|
||||
def find_root_dir(include_root):
|
||||
"""
|
||||
Somewhat naive attempt to find the "root" directory of the repository,
|
||||
as specified from the runfiles path
|
||||
"""
|
||||
if "__main__/" in include_root:
|
||||
return pathlib.Path(
|
||||
include_root[: include_root.find("__main__/") + len("__main__/")]
|
||||
)
|
||||
elif "_main/" in include_root:
|
||||
return pathlib.Path(
|
||||
include_root[: include_root.find("_main/") + len("_main/")]
|
||||
)
|
||||
else:
|
||||
return pathlib.Path(include_root)
|
||||
|
||||
include_root = str(args[3]).replace("\\", "/")
|
||||
root_dir = find_root_dir(include_root)
|
||||
if "native" in include_root:
|
||||
# base_include_root = pathlib.Path(*args[3].relative_to(root_dir).parts[3:])
|
||||
base_include_file = args[2].relative_to(include_root)
|
||||
@@ -77,12 +60,9 @@ class HeaderToDatConfig:
|
||||
self.include_file = f"$(execpath :{fixup_native_lib_name('robotpy-native-' + base_library)}.copy_headers)/{base_include_file}"
|
||||
self.include_root = f"$(execpath :{fixup_native_lib_name('robotpy-native-' + base_library)}.copy_headers)"
|
||||
else:
|
||||
if root_dir.is_absolute():
|
||||
self.include_file = args[2].relative_to(root_dir)
|
||||
self.include_root = args[3].relative_to(root_dir)
|
||||
else:
|
||||
self.include_file = args[2]
|
||||
self.include_root = args[3]
|
||||
root_dir = pathlib.Path.cwd().absolute()
|
||||
self.include_file = pathlib.Path(args[2]).absolute().relative_to(root_dir)
|
||||
self.include_root = pathlib.Path(args[3]).absolute().relative_to(root_dir)
|
||||
# type casters = 4
|
||||
# dat file = 5
|
||||
# d file = 6
|
||||
|
||||
Reference in New Issue
Block a user