scripts: Create symlinks for Bazel with relative paths
So that the symlinks generated by running Alchemy in cros sdk chroot can
be recognized by tools running outside the chroot.
Absolute paths generated inside the chroot look like "/mnt/host/..."
and don't work outside the chroot.
BUG=None
TEST=bazel build @portage//sys-apps/attr
Change-Id: I1334672f79d62c6c31b705a65e8c7b6b2a7dda13
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4780493
Tested-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
diff --git a/scripts/bazel.py b/scripts/bazel.py
index e1fe280..b3463e7 100644
--- a/scripts/bazel.py
+++ b/scripts/bazel.py
@@ -55,7 +55,8 @@
):
for path in workspace.iterdir():
osutils.SafeSymlink(
- path, constants.BAZEL_WORKSPACE_ROOT / path.name
+ path.relative_to(constants.BAZEL_WORKSPACE_ROOT),
+ constants.BAZEL_WORKSPACE_ROOT / path.name,
)
known_symlinks.add(path.name)