From 5623aeebe84fec98b7ae313368d1e57a6abfad65 Mon Sep 17 00:00:00 2001 From: Takuto Ikuta Date: Thu, 10 May 2018 07:36:09 +0900 Subject: [PATCH] Introduce GIT_TRACE for chromium/src in bot_update step This CL is tested on https://ci.chromium.org/swarming/task/3d5fde091e610010?server=chromium-swarm.appspot.com api.py change is for auto roller Bug: 840592 Change-Id: Ib6195dc1f4539c8f02fe0696dc140b4cf0973baf Reviewed-on: https://chromium-review.googlesource.com/1049987 Commit-Queue: Takuto Ikuta Reviewed-by: Andrii Shyshkalov --- recipes/recipe_modules/bot_update/api.py | 1 - .../recipe_modules/bot_update/resources/bot_update.py | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index bd155dd895..ffe39bf830 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. - """Recipe module to ensure a checkout is consistent on a bot.""" from recipe_engine import recipe_api diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index aa2400f6b6..e293f99c41 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -150,7 +150,7 @@ def call(*args, **kwargs): # pragma: no cover kwargs['stdin'] = subprocess.PIPE out = cStringIO.StringIO() new_env = kwargs.get('env', {}) - env = copy.copy(os.environ) + env = os.environ.copy() env.update(new_env) kwargs['env'] = env @@ -672,11 +672,16 @@ def _git_checkout(sln, sln_dir, revisions, shallow, refs, git_cache_dir, for ref in refs: populate_cmd.extend(['--ref', ref]) + env = {} + if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL: + # This is for performance investigation of `git fetch` in chromium/src. + env = {'GIT_TRACE': 'true'} + # Step 1: populate/refresh cache, if necessary. pin = get_target_pin(name, url, revisions) if not pin: # Refresh only once. - git(*populate_cmd) + git(*populate_cmd, env=env) elif _has_in_git_cache(pin, git_cache_dir, url): # No need to fetch at all, because we already have needed revision. pass @@ -690,7 +695,7 @@ def _git_checkout(sln, sln_dir, revisions, shallow, refs, git_cache_dir, # TODO(tandrii): propagate the pin to git server per recommendation of # maintainers of *.googlesource.com (workaround git server replication # lag). - git(*populate_cmd) + git(*populate_cmd, env=env) if _has_in_git_cache(pin, git_cache_dir, url): break overrun = time.time() - soft_deadline