Read relative symlinks correctly in staging_dir_builder

Some symlinks are now relative. When using readlink(), we were resolving
those relative paths, but using them as relative to the current working
directory rather than relative to the symlink.

The workaround before was to assume that the symlinks were always
emitting enough ../'s to reach the root of the execroot from their
location. Then we would find the execroot ourselves, realtive to the
cwd instead of relative to the symlink, and change the number of ../'s
in the symlink's path.

Instead, just join the symlink target with the symlink's location, so
we use it's value relative to the symlink itself.

Bug: 259191764
Test: m && (move source tree and prepare_moved_top.sh) && m
Change-Id: I08d5039046ddf527df556251ddfb64ec5a93a118
1 file changed
tree: defae682f77b69d71ed66af31146ed25d958af6e
  1. api_surfaces/
  2. bazel_sandwich/
  3. bin/
  4. ci/
  5. compliance/
  6. docs/
  7. examples/
  8. flags/
  9. json_module_graph/
  10. mk2rbc/
  11. mkcompare/
  12. platforms/
  13. product_config/
  14. rules/
  15. scripts/
  16. tests/
  17. toolchains/
  18. utils/
  19. vendor/
  20. .gitignore
  21. bazel.BUILD
  22. bazel.WORKSPACE
  23. buildifier_hook.sh
  24. common.bazelrc
  25. constants_exported_to_soong.bzl
  26. darwin.bazelrc
  27. linux.bazelrc
  28. OWNERS
  29. PREUPLOAD.cfg
  30. README.md
README.md

Bazel

The code in this directory is experimental. Bazel support for Android Platform is undergoing active development and workflow stability is currently not guaranteed.