Commit e672f939 authored by Nodir Turakulov's avatar Nodir Turakulov Committed by Commit Bot

deprecate git_cache path

We cannot easily move git cache location on all buildbot bots, but we
need to define a new value for LUCI.
Introduce infra_paths.default_git_cache_dir which must be used instead
of using path['git_cache'] directly.

R=iannucci@chromium.org, martiniss@chromium.org
BUG=662586

Change-Id: I5244d7a761da94858df798abbd423c85f55936af
Reviewed-on: https://chromium-review.googlesource.com/411993
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
parent ff416a73
......@@ -117,7 +117,7 @@ class GclientApi(recipe_api.RecipeApi):
def get_config_defaults(self):
return {
'USE_MIRROR': self.use_mirror,
'CACHE_DIR': self.m.path['git_cache'],
'CACHE_DIR': self.m.infra_paths.default_git_cache_dir,
}
@staticmethod
......
......@@ -215,13 +215,15 @@ class GitApi(recipe_api.RecipeApi):
if use_git_cache:
with self.m.step.context({'env': {'PATH': path}}):
self('retry', 'cache', 'populate', '-c', self.m.path['git_cache'], url,
self('retry', 'cache', 'populate', '-c',
self.m.infra_paths.default_git_cache_dir, url,
name='populate cache',
can_fail_build=can_fail_build,
cwd=dir_path)
dir_cmd = self(
'cache', 'exists', '--quiet',
'--cache-dir', self.m.path['git_cache'], url,
'--cache-dir', self.m.infra_paths.default_git_cache_dir, url,
can_fail_build=can_fail_build,
stdout=self.m.raw_io.output(),
step_test_data=lambda:
......
......@@ -6,7 +6,23 @@ from recipe_engine import recipe_api
class InfraPathsApi(recipe_api.RecipeApi):
"""infra_paths module is glue for design mistakes. It will be removed."""
def initialize(self):
# TODO(phajdan.jr): remove dupes from the engine and delete infra_ prefix.
self.m.path.set_config(
'infra_' + self.m.properties.get('path_config', 'buildbot'))
@property
def default_git_cache_dir(self):
"""Returns the location of the default git cache directory.
This property should be used instead of using path['git_cache'] directly.
It returns git_cache path if it is defined (Buildbot world), otherwise
uses the more generic [CACHE]/git path (LUCI world).
"""
try:
return self.m.path['git_cache']
except KeyError: # pragma: no cover | TODO(nodir): cover
return self.m.path['cache'].join('git')
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -3,7 +3,9 @@
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_TEXT@[CACHE]@@@"
"@@@STEP_LOG_LINE@result@[CACHE]@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
......
......@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
DEPS = [
'infra_paths',
'recipe_engine/path',
......@@ -13,7 +15,10 @@ DEPS = [
def RunSteps(api):
api.step('show cache path', [])
api.step.active_result.presentation.step_text = str(api.path['cache'])
api.step.active_result.presentation.logs['result'] = [
str(api.path['cache']),
str(api.infra_paths.default_git_cache_dir),
]
def GenTests(api):
......
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