Commit 8b5b5941 authored by Nodir Turakulov's avatar Nodir Turakulov Committed by Commit Bot

add "generic" infra path config

It proved to be dangerous to introduce conditional logic into recipes
and recipe modules to alternate between buildbot and luci modes, namely
it touches buildbot code paths, which can be very dangerous.

Instead, introduce "generic" default path config that configures
existing base paths from the built-in ones.

Also remove swarmbucket path config because it is not used.

R=iannucci@chromium.org
BUG=660481

Change-Id: Ide0e1f64913fe35766b997ab5b55f01f4c63aa58
Reviewed-on: https://chromium-review.googlesource.com/459234
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
parent d2db5a22
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'builder'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'builder'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'builder'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
"RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py",
"config", "config",
"--spec", "--spec",
"cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]"
], ],
"cwd": "[START_DIR]/src/third_party", "cwd": "[START_DIR]/src/third_party",
"env": { "env": {
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
"RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py",
"config", "config",
"--spec", "--spec",
"cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]"
], ],
"cwd": "[START_DIR]/src/third_party", "cwd": "[START_DIR]/src/third_party",
"env": { "env": {
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
"RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py",
"config", "config",
"--spec", "--spec",
"cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]"
], ],
"cwd": "[START_DIR]/src/third_party", "cwd": "[START_DIR]/src/third_party",
"env": { "env": {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"cache", "cache",
"populate", "populate",
"-c", "-c",
"[CACHE]/git", "[GIT_CACHE]",
"https://chromium.googlesource.com/chromium/src.git" "https://chromium.googlesource.com/chromium/src.git"
], ],
"cwd": "[START_DIR]/src", "cwd": "[START_DIR]/src",
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"exists", "exists",
"--quiet", "--quiet",
"--cache-dir", "--cache-dir",
"[CACHE]/git", "[GIT_CACHE]",
"https://chromium.googlesource.com/chromium/src.git" "https://chromium.googlesource.com/chromium/src.git"
], ],
"cwd": "[START_DIR]/src", "cwd": "[START_DIR]/src",
......
...@@ -9,21 +9,10 @@ class InfraPathsApi(recipe_api.RecipeApi): ...@@ -9,21 +9,10 @@ class InfraPathsApi(recipe_api.RecipeApi):
"""infra_paths module is glue for design mistakes. It will be removed.""" """infra_paths module is glue for design mistakes. It will be removed."""
def initialize(self): def initialize(self):
path_config = self.m.properties.get('path_config') path_config = self.m.properties.get('path_config', 'generic')
if path_config: self.m.path.set_config('infra_' + path_config)
# TODO(phajdan.jr): remove dupes from the engine and delete infra_ prefix.
self.m.path.set_config('infra_' + path_config)
@property @property
def default_git_cache_dir(self): def default_git_cache_dir(self):
"""Returns the location of the default git cache directory. """Returns the location of the default git cache directory."""
return self.m.path['git_cache']
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:
return self.m.path['cache'].join('git')
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'builder'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[CACHE]/git@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'depot_tools': ('depot_tools',), 'build_internal': ('build_internal',), 'cache': ('build', 'slave', 'cache'), 'goma_cache': ('build', 'slave', 'goma_cache'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'build': ('build',), 'git_cache': ('build', 'slave', 'cache_dir'), 'root': (), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'depot_tools': ('depot_tools',), 'build_internal': ('build_internal',), 'cache': ('build', 'slave', 'cache'), 'goma_cache': ('build', 'slave', 'goma_cache'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'build': ('build',), 'git_cache': ('build', 'slave', 'cache_dir'), 'root': (), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'depot_tools': ('depot_tools',), 'build_internal': ('build_internal',), 'cache': ('build', 'slave', 'cache'), 'goma_cache': ('build', 'slave', 'goma_cache'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'build': ('build',), 'git_cache': ('build', 'slave', 'cache_dir'), 'root': (), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
[
{
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'builder'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]
\ No newline at end of file
[
{
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'builder'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]
\ No newline at end of file
[
{
"cmd": [],
"name": "show cache path",
"~followup_annotations": [
"@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'builder'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_END@result@@@"
]
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]
\ No newline at end of file
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'b'), 'goma_deps_cache': ('/', 'b', 'c', 'goma_deps_cache'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma_cache'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git_cache'), 'root': ('/', 'b', 'FakeTestingCWD'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'b'), 'goma_deps_cache': ('/', 'b', 'c', 'goma_deps_cache'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma_cache'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git_cache'), 'root': ('/', 'b', 'FakeTestingCWD'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
"cmd": [], "cmd": [],
"name": "show cache path", "name": "show cache path",
"~followup_annotations": [ "~followup_annotations": [
"@@@STEP_LOG_LINE@result@[CACHE]@@@", "@@@STEP_LOG_LINE@result@base_paths: {'builder_cache': ('/', 'b', 'c', 'b'), 'goma_deps_cache': ('/', 'b', 'c', 'goma_deps_cache'), 'cache': ('/', 'b', 'c'), 'goma_cache': ('/', 'b', 'c', 'goma_cache'), 'start_dir': ('/', 'b', 'FakeTestingCWD'), 'git_cache': ('/', 'b', 'c', 'git_cache'), 'root': ('/', 'b', 'FakeTestingCWD'), 'tmp_base': ('/',)}@@@",
"@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@",
"@@@STEP_LOG_END@result@@@" "@@@STEP_LOG_END@result@@@"
] ]
}, },
......
...@@ -16,8 +16,7 @@ DEPS = [ ...@@ -16,8 +16,7 @@ DEPS = [
def RunSteps(api): def RunSteps(api):
api.step('show cache path', []) api.step('show cache path', [])
api.step.active_result.presentation.logs['result'] = [ api.step.active_result.presentation.logs['result'] = [
str(api.path['cache']), 'base_paths: %r' % (api.path.c.base_paths,),
str(api.infra_paths.default_git_cache_dir),
] ]
...@@ -25,7 +24,7 @@ def GenTests(api): ...@@ -25,7 +24,7 @@ def GenTests(api):
yield api.test('basic') yield api.test('basic')
for platform in ('linux', 'mac', 'win'): for platform in ('linux', 'mac', 'win'):
for path_config in ('buildbot', 'kitchen', 'swarmbucket'): for path_config in ('buildbot', 'kitchen', 'generic'):
yield ( yield (
api.test('paths_%s_%s' % (path_config, platform)) + api.test('paths_%s_%s' % (path_config, platform)) +
api.platform.name(platform) + api.platform.name(platform) +
......
...@@ -51,6 +51,8 @@ def infra_kitchen(c): ...@@ -51,6 +51,8 @@ def infra_kitchen(c):
c.base_paths[path] = c.base_paths['cache'] + (path,) c.base_paths[path] = c.base_paths['cache'] + (path,)
@CONFIG_CTX(includes=['infra_buildbot']) @CONFIG_CTX()
def infra_swarmbucket(c): def infra_generic(c):
c.base_paths['git_cache'] = c.START_DIR + ('git_cache',) c.base_paths['builder_cache'] = c.base_paths['cache'] + ('builder',)
c.base_paths['git_cache'] = c.base_paths['cache'] + ('git',)
c.base_paths['goma_cache'] = c.base_paths['cache'] + ('goma',)
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