[output-scanner] Disable on Mac
Also remove the previous impl for `realpath`, which doesn't account for
`--relative-to`, and practically disabled this check.
See linked bug for more details.
Bug: 95130
Fixed: 95003
Change-Id: I61c3971340f5af5c436ffbbcb82ab6c5102dacf3
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/654542
Reviewed-by: Shai Barack <shayba@google.com>
Fuchsia-Auto-Submit: Jay Zhuang <jayzhuang@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index e4d6c75..2c9ca2c 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -1096,30 +1096,34 @@
] + _args
}
- # To suppress checking for output dir leaks, in the invoker:
- # no_output_dir_leaks = false
- no_output_dir_leaks = true
- if (defined(invoker.no_output_dir_leaks)) {
- no_output_dir_leaks = invoker.no_output_dir_leaks
- }
+ # TODO(https://fxbug.dev/95130): Re-enable output-scanner on Mac when it's
+ # portable.
+ if (host_os != "mac") {
+ # To suppress checking for output dir leaks, in the invoker:
+ # no_output_dir_leaks = false
+ no_output_dir_leaks = true
+ if (defined(invoker.no_output_dir_leaks)) {
+ no_output_dir_leaks = invoker.no_output_dir_leaks
+ }
- if (!no_output_dir_leaks) {
- deps += [ "//build:output_dir_leaking_allowlist" ]
- }
+ if (!no_output_dir_leaks) {
+ deps += [ "//build:output_dir_leaking_allowlist" ]
+ }
- if (no_output_dir_leaks && check_output_dir_leaks) {
- _args = []
- _args = [
- "--label",
- get_label_info(":$target_name", "label_with_toolchain"),
- ] + rebase_path(outputs, root_build_dir) +
- [
- "--",
- rebase_path(script, root_build_dir),
- ] + args
- args = []
- args = _args
- script = "//build/rbe/output-scanner.sh"
+ if (no_output_dir_leaks && check_output_dir_leaks) {
+ _args = []
+ _args = [
+ "--label",
+ get_label_info(":$target_name", "label_with_toolchain"),
+ ] + rebase_path(outputs, root_build_dir) +
+ [
+ "--",
+ rebase_path(script, root_build_dir),
+ ] + args
+ args = []
+ args = _args
+ script = "//build/rbe/output-scanner.sh"
+ }
}
metadata = {
diff --git a/build/rbe/output-scanner.sh b/build/rbe/output-scanner.sh
index c131f7e..71ef06b 100755
--- a/build/rbe/output-scanner.sh
+++ b/build/rbe/output-scanner.sh
@@ -14,13 +14,6 @@
# The value is an absolute path.
project_root="$(readlink -f "$script_dir"/../..)"
-# The `realpath` command is not available on all systems, so we reimplement it
-# here in pure bash. It converts relative paths to absolute, and leaves
-# absolute paths as-is.
-realpath() {
- [[ $1 == /* ]] && echo "$1" || echo "$PWD/${1#./}"
-}
-
build_subdir="$(realpath --relative-to="$project_root" . )"
project_root_rel="$(realpath --relative-to=. "$project_root")"