From 67283c06a55366b290fb98d042b147d0ce1358ed Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 13 Jul 2020 21:38:44 +0000 Subject: [PATCH] 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/+/2296219 Reviewed-by: Edward Lesmes Commit-Queue: Lei Zhang --- gclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gclient.py b/gclient.py index f53106574..a8b1c8730 100755 --- a/gclient.py +++ b/gclient.py @@ -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'))