Commit 72fceee5 authored by Michael Moss's avatar Michael Moss Committed by Commit Bot

Make sure dsymutil can find hermetic tools (e.g. lipo).

This fixes errors while building universal binary diff tools on official
builders. This didn't surface in https://crrev.com/c/2462242 because the
trybots don't build with official settings, so don't run dsymutil.

BUG=1119472

Change-Id: Ic6a29205cff50746ad25a0944bf961907af910a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2488710Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarMichael Moss <mmoss@chromium.org>
Commit-Queue: Michael Moss <mmoss@chromium.org>
Auto-Submit: Michael Moss <mmoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819536}
parent e0b224a5
...@@ -160,7 +160,14 @@ def RunDsymUtil(dsym_path_prefix, full_args): ...@@ -160,7 +160,14 @@ def RunDsymUtil(dsym_path_prefix, full_args):
# Remove old dSYMs before invoking dsymutil. # Remove old dSYMs before invoking dsymutil.
_RemovePath(dsym_out) _RemovePath(dsym_out)
subprocess.check_call(DSYMUTIL_INVOKE + ['-o', dsym_out, linker_out])
tools_paths = _FindToolsPaths(full_args)
if os.environ.get('PATH'):
tools_paths.append(os.environ['PATH'])
dsymutil_env = os.environ.copy()
dsymutil_env['PATH'] = ':'.join(tools_paths)
subprocess.check_call(DSYMUTIL_INVOKE + ['-o', dsym_out, linker_out],
env=dsymutil_env)
return [dsym_out] return [dsym_out]
...@@ -259,6 +266,19 @@ def _FindLinkerOutput(full_args): ...@@ -259,6 +266,19 @@ def _FindLinkerOutput(full_args):
return full_args[output_flag_index + 1] return full_args[output_flag_index + 1]
def _FindToolsPaths(full_args):
"""Finds all paths where the script should look for additional tools."""
paths = []
for idx, arg in enumerate(full_args):
if arg in ['-B', '--prefix']:
paths.append(full_args[idx + 1])
elif arg.startswith('-B'):
paths.append(arg[2:])
elif arg.startswith('--prefix='):
paths.append(arg[9:])
return paths
def _RemovePath(path): def _RemovePath(path):
"""Removes the file or directory at |path| if it exists.""" """Removes the file or directory at |path| if it exists."""
if os.path.exists(path): if os.path.exists(path):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment