Commit 67283c06 authored by Lei Zhang's avatar Lei Zhang Committed by LUCI CQ

Fix gclient_gn_args_file calculation when use_relative_paths=True.

With https://chromium-review.googlesource.com/2279874, gclient started
taking |use_relative_paths| into account when calculating the path to
gclient_args.gni from |gclient_gn_args_file|. This CL introduced an
issue where the calculation depends on the current working directory.
e.g. Running gclient from ~/repo and ~/repo/sub_dir produced different
results for gclient_args.gni.

Fix this by prepending the root path, which is absolute, when
calculating the path to gclient_args.gni.

Bug: chromium:1102833
Change-Id: I970e38352aea77d857e49dc7dca58f21ba8e0331
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2296219Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
parent 271a78ac
......@@ -1042,7 +1042,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# When use_relative_paths is set, gn_args_file is relative to this DEPS
path_prefix = self.root.root_dir
if self._use_relative_paths:
path_prefix = self.name
path_prefix = os.path.join(path_prefix, self.name)
with open(os.path.join(path_prefix, self._gn_args_file), 'wb') as f:
f.write('\n'.join(lines).encode('utf-8', 'replace'))
......
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