Commit 7090f652 authored by agable's avatar agable Committed by Commit bot

Remove all references to GIT_MODE from depot_tools

BUG=640251,472386

Review-Url: https://codereview.chromium.org/2286793003
parent 0b7cf885
...@@ -8,13 +8,6 @@ ...@@ -8,13 +8,6 @@
from recipe_engine import recipe_api from recipe_engine import recipe_api
# This is just for testing, to indicate if a master is using a Git scheduler
# or not.
SVN_MASTERS = (
'experimental.svn',
)
class BotUpdateApi(recipe_api.RecipeApi): class BotUpdateApi(recipe_api.RecipeApi):
def __init__(self, mastername, buildername, slavename, issue, patchset, def __init__(self, mastername, buildername, slavename, issue, patchset,
...@@ -242,10 +235,9 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -242,10 +235,9 @@ class BotUpdateApi(recipe_api.RecipeApi):
cmd.append('--gerrit_rebase_patch_ref') cmd.append('--gerrit_rebase_patch_ref')
# Inject Json output for testing. # Inject Json output for testing.
git_mode = self._mastername not in SVN_MASTERS
first_sln = cfg.solutions[0].name first_sln = cfg.solutions[0].name
step_test_data = lambda: self.test_api.output_json( step_test_data = lambda: self.test_api.output_json(
master, builder, slave, root, first_sln, rev_map, git_mode, force, master, builder, slave, root, first_sln, rev_map, force,
self._fail_patch, self._fail_patch,
output_manifest=output_manifest, fixed_revisions=fixed_revisions) output_manifest=output_manifest, fixed_revisions=fixed_revisions)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-m1", "totallyaslave-m1",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-m1", "totallyaslave-m1",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-m1", "totallyaslave-m1",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"somehost", "somehost",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"somehost", "somehost",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"somehost", "somehost",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"somehost", "somehost",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"somehost", "somehost",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"somehost", "somehost",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"somehost", "somehost",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
[
{
"cmd": [
"python",
"-u",
"RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py",
"--master",
"experimental.svn",
"--builder",
"Experimental SVN Builder",
"--slave",
"somehost",
"--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
"--root",
"src",
"--revision_mapping_file",
"{\"src\": \"got_cr_revision\"}",
"--git-cache-dir",
"[GIT_CACHE]",
"--output_json",
"/path/to/tmp/json",
"--revision",
"src@HEAD",
"--force"
],
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]"
},
"name": "bot_update",
"~followup_annotations": [
"@@@STEP_TEXT@Some step text@@@",
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@",
"@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"src\": \"HEAD\"@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@",
"@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"src\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"got_cr_revision\": 170242, @@@",
"@@@STEP_LOG_LINE@json.output@ \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"got_cr_revision_git\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"root\": \"src\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
"@@@STEP_LOG_END@json.output@@@",
"@@@SET_BUILD_PROPERTY@got_cr_revision@170242@@@",
"@@@SET_BUILD_PROPERTY@got_cr_revision_git@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
"@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
]
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-c4", "totallyaslave-c4",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-c4", "totallyaslave-c4",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-c4", "totallyaslave-c4",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-c4", "totallyaslave-c4",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-c4", "totallyaslave-c4",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-c4", "totallyaslave-c4",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src", "src",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"TestSlavename", "TestSlavename",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src/third_party/angle", "src/third_party/angle",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"totallyaslave-c4", "totallyaslave-c4",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src/v8", "src/v8",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"--slave", "--slave",
"TestSlavename", "TestSlavename",
"--spec", "--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]", "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root", "--root",
"src/v8", "src/v8",
"--revision_mapping_file", "--revision_mapping_file",
......
...@@ -12,10 +12,10 @@ DEPS = [ ...@@ -12,10 +12,10 @@ DEPS = [
def RunSteps(api): def RunSteps(api):
api.gclient.use_mirror = True api.gclient.use_mirror = True
src_cfg = api.gclient.make_config(GIT_MODE=True, CACHE_DIR='[GIT_CACHE]') src_cfg = api.gclient.make_config(CACHE_DIR='[GIT_CACHE]')
soln = src_cfg.solutions.add() soln = src_cfg.solutions.add()
soln.name = 'src' soln.name = 'src'
soln.url = 'svn://svn.chromium.org/chrome/trunk/src' soln.url = 'https://chromium.googlesource.com/chromium/src.git'
soln.revision = api.properties.get('revision') soln.revision = api.properties.get('revision')
api.gclient.c = src_cfg api.gclient.c = src_cfg
api.gclient.c.revisions.update(api.properties.get('revisions', {})) api.gclient.c.revisions.update(api.properties.get('revisions', {}))
...@@ -140,12 +140,6 @@ def GenTests(api): ...@@ -140,12 +140,6 @@ def GenTests(api):
buildername='Experimental Builder', buildername='Experimental Builder',
slavename='somehost', slavename='somehost',
) )
yield api.test('svn_mode') + api.properties(
mastername='experimental.svn',
buildername='Experimental SVN Builder',
slavename='somehost',
force=1
)
yield api.test('clobber') + api.properties( yield api.test('clobber') + api.properties(
mastername='experimental', mastername='experimental',
buildername='Experimental Builder', buildername='Experimental Builder',
......
...@@ -15,7 +15,7 @@ import bot_update ...@@ -15,7 +15,7 @@ import bot_update
class BotUpdateTestApi(recipe_test_api.RecipeTestApi): class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
def output_json(self, master, builder, slave, root, first_sln, def output_json(self, master, builder, slave, root, first_sln,
revision_mapping, git_mode, force=False, fail_patch=False, revision_mapping, force=False, fail_patch=False,
output_manifest=False, fixed_revisions=None): output_manifest=False, fixed_revisions=None):
"""Deterministically synthesize json.output test data for gclient's """Deterministically synthesize json.output test data for gclient's
--output-json option. --output-json option.
...@@ -30,23 +30,15 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi): ...@@ -30,23 +30,15 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
# Add in extra json output if active. # Add in extra json output if active.
if active: if active:
properties = { properties = {
property_name: self.gen_revision(project_name, git_mode) property_name: self.gen_revision(project_name)
for project_name, property_name in revision_mapping.iteritems() for project_name, property_name in revision_mapping.iteritems()
} }
properties.update({ properties.update({
'%s_cp' % property_name: ('refs/heads/master@{#%s}' % '%s_cp' % property_name: ('refs/heads/master@{#%s}' %
self.gen_revision(project_name, False)) self.gen_commit_position(project_name))
for project_name, property_name in revision_mapping.iteritems() for project_name, property_name in revision_mapping.iteritems()
}) })
# We also want to simulate outputting "got_revision_git": ...
# when git mode is off to match what bot_update.py does.
if not git_mode:
properties.update({
'%s_git' % property_name: self.gen_revision(project_name, True)
for project_name, property_name in revision_mapping.iteritems()
})
output.update({ output.update({
'patch_root': root or first_sln, 'patch_root': root or first_sln,
'root': first_sln, 'root': first_sln,
...@@ -59,7 +51,7 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi): ...@@ -59,7 +51,7 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
'manifest': { 'manifest': {
project_name: { project_name: {
'repository': 'https://fake.org/%s.git' % project_name, 'repository': 'https://fake.org/%s.git' % project_name,
'revision': self.gen_revision(project_name, git_mode), 'revision': self.gen_revision(project_name),
} }
for project_name in revision_mapping for project_name in revision_mapping
} }
...@@ -77,10 +69,13 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi): ...@@ -77,10 +69,13 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
return self.m.json.output(output) return self.m.json.output(output)
@staticmethod @staticmethod
def gen_revision(project, GIT_MODE): def gen_revision(project):
"""Hash project to bogus deterministic revision values.""" """Hash project to bogus deterministic git hash values."""
h = hashlib.sha1(project)
return h.hexdigest()
@staticmethod
def gen_commit_position(project):
"""Hash project to bogus deterministic Cr-Commit-Position values."""
h = hashlib.sha1(project) h = hashlib.sha1(project)
if GIT_MODE: return struct.unpack('!I', h.digest()[:4])[0] % 300000
return h.hexdigest()
else:
return struct.unpack('!I', h.digest()[:4])[0] % 300000
...@@ -151,40 +151,30 @@ class GclientApi(recipe_api.RecipeApi): ...@@ -151,40 +151,30 @@ class GclientApi(recipe_api.RecipeApi):
test_data_paths = set(cfg.got_revision_mapping.keys() + test_data_paths = set(cfg.got_revision_mapping.keys() +
[s.name for s in cfg.solutions]) [s.name for s in cfg.solutions])
step_test_data = lambda: ( step_test_data = lambda: (
self.test_api.output_json(test_data_paths, cfg.GIT_MODE)) self.test_api.output_json(test_data_paths))
try: try:
if not cfg.GIT_MODE: # pragma: no cover # clean() isn't used because the gclient sync flags passed in checkout()
args = ['sync', '--nohooks', '--force', '--verbose'] # do much the same thing, and they're more correct than doing a separate
if cfg.delete_unversioned_trees: # 'gclient revert' because it makes sure the other args are correct when
args.append('--delete_unversioned_trees') # a repo was deleted and needs to be re-cloned (notably
if with_branch_heads: # --with_branch_heads), whereas 'revert' uses default args for clone
args.append('--with_branch_heads') # operations.
self('sync', args + revisions + ['--output-json', self.m.json.output()], #
step_test_data=step_test_data, # TODO(mmoss): To be like current official builders, this step could
**kwargs) # just delete the whole <slave_name>/build/ directory and start each
else: # build from scratch. That might be the least bad solution, at least
# clean() isn't used because the gclient sync flags passed in checkout() # until we have a reliable gclient method to produce a pristine working
# do much the same thing, and they're more correct than doing a separate # dir for git-based builds (e.g. maybe some combination of 'git
# 'gclient revert' because it makes sure the other args are correct when # reset/clean -fx' and removing the 'out' directory).
# a repo was deleted and needs to be re-cloned (notably j = '-j2' if self.m.platform.is_win else '-j8'
# --with_branch_heads), whereas 'revert' uses default args for clone args = ['sync', '--verbose', '--with_branch_heads', '--nohooks', j,
# operations. '--reset', '--force', '--upstream', '--no-nag-max']
# if cfg.delete_unversioned_trees:
# TODO(mmoss): To be like current official builders, this step could args.append('--delete_unversioned_trees')
# just delete the whole <slave_name>/build/ directory and start each self('sync', args + revisions +
# build from scratch. That might be the least bad solution, at least ['--output-json', self.m.json.output()],
# until we have a reliable gclient method to produce a pristine working step_test_data=step_test_data,
# dir for git-based builds (e.g. maybe some combination of 'git **kwargs)
# reset/clean -fx' and removing the 'out' directory).
j = '-j2' if self.m.platform.is_win else '-j8'
args = ['sync', '--verbose', '--with_branch_heads', '--nohooks', j,
'--reset', '--force', '--upstream', '--no-nag-max']
if cfg.delete_unversioned_trees:
args.append('--delete_unversioned_trees')
self('sync', args + revisions +
['--output-json', self.m.json.output()],
step_test_data=step_test_data,
**kwargs)
finally: finally:
result = self.m.step.active_result result = self.m.step.active_result
data = result.json.output data = result.json.output
...@@ -239,25 +229,16 @@ class GclientApi(recipe_api.RecipeApi): ...@@ -239,25 +229,16 @@ class GclientApi(recipe_api.RecipeApi):
sync_step = None sync_step = None
try: try:
if not cfg.GIT_MODE: # pragma: no cover sync_step = self.sync(cfg, with_branch_heads=with_branch_heads,
try: **kwargs)
if revert:
self.revert(**kwargs) cfg_cmds = [
finally: ('user.name', 'local_bot'),
sync_step = self.sync(cfg, with_branch_heads=with_branch_heads, ('user.email', 'local_bot@example.com'),
**kwargs) ]
else: for var, val in cfg_cmds:
sync_step = self.sync(cfg, with_branch_heads=with_branch_heads, name = 'recurse (git config %s)' % var
**kwargs) self(name, ['recurse', 'git', 'config', var, val], **kwargs)
cfg_cmds = [
('user.name', 'local_bot'),
('user.email', 'local_bot@example.com'),
]
for var, val in cfg_cmds:
name = 'recurse (git config %s)' % var
self(name, ['recurse', 'git', 'config', var, val], **kwargs)
finally: finally:
cwd = kwargs.get('cwd', self.m.path['slave_build']) cwd = kwargs.get('cwd', self.m.path['slave_build'])
if 'checkout' not in self.m.path: if 'checkout' not in self.m.path:
......
...@@ -10,17 +10,16 @@ from recipe_engine.config import ConfigList, Dict, Single, Static, Set, List ...@@ -10,17 +10,16 @@ from recipe_engine.config import ConfigList, Dict, Single, Static, Set, List
from . import api as gclient_api from . import api as gclient_api
def BaseConfig(USE_MIRROR=True, GIT_MODE=True, CACHE_DIR=None, def BaseConfig(USE_MIRROR=True, CACHE_DIR=None,
PATCH_PROJECT=None, BUILDSPEC_VERSION=None, PATCH_PROJECT=None, BUILDSPEC_VERSION=None,
**_kwargs): **_kwargs):
deps = '.DEPS.git' if GIT_MODE else 'DEPS'
cache_dir = str(CACHE_DIR) if CACHE_DIR else None cache_dir = str(CACHE_DIR) if CACHE_DIR else None
return ConfigGroup( return ConfigGroup(
solutions = ConfigList( solutions = ConfigList(
lambda: ConfigGroup( lambda: ConfigGroup(
name = Single(basestring), name = Single(basestring),
url = Single(basestring), url = Single(basestring),
deps_file = Single(basestring, empty_val=deps, required=False, deps_file = Single(basestring, empty_val='.DEPS.git', required=False,
hidden=False), hidden=False),
managed = Single(bool, empty_val=True, required=False, hidden=False), managed = Single(bool, empty_val=True, required=False, hidden=False),
custom_deps = Dict(value_type=(basestring, types.NoneType)), custom_deps = Dict(value_type=(basestring, types.NoneType)),
...@@ -86,7 +85,6 @@ def BaseConfig(USE_MIRROR=True, GIT_MODE=True, CACHE_DIR=None, ...@@ -86,7 +85,6 @@ def BaseConfig(USE_MIRROR=True, GIT_MODE=True, CACHE_DIR=None,
required=False, required=False,
hidden=True), hidden=True),
GIT_MODE = Static(bool(GIT_MODE)),
USE_MIRROR = Static(bool(USE_MIRROR)), USE_MIRROR = Static(bool(USE_MIRROR)),
# TODO(tandrii): remove PATCH_PROJECT field. # TODO(tandrii): remove PATCH_PROJECT field.
# DON'T USE THIS. WILL BE REMOVED. # DON'T USE THIS. WILL BE REMOVED.
...@@ -105,18 +103,10 @@ def ChromiumGitURL(_c, *pieces): ...@@ -105,18 +103,10 @@ def ChromiumGitURL(_c, *pieces):
return '/'.join(('https://chromium.googlesource.com',) + pieces) return '/'.join(('https://chromium.googlesource.com',) + pieces)
def ChromiumSrcURL(c): def ChromiumSrcURL(c):
# TODO(phajdan.jr): Move to proper repo and add coverage. return ChromiumGitURL(c, 'chromium', 'src.git')
if c.GIT_MODE:
return ChromiumGitURL(c, 'chromium', 'src.git')
else: # pragma: no cover
return ChromiumSvnSubURL(c, 'chrome', 'trunk', 'src')
def BlinkURL(c): def BlinkURL(c):
# TODO(phajdan.jr): Move to proper repo and add coverage. return ChromiumGitURL(c, 'chromium', 'blink.git')
if c.GIT_MODE:
return ChromiumGitURL(c, 'chromium', 'blink.git')
else: # pragma: no cover
return ChromiumSvnSubURL(c, 'blink', 'trunk')
def ChromeSvnSubURL(c, *pieces): # pragma: no cover def ChromeSvnSubURL(c, *pieces): # pragma: no cover
BASES = ('svn://svn.chromium.org', BASES = ('svn://svn.chromium.org',
...@@ -128,11 +118,7 @@ def ChromeInternalGitURL(_c, *pieces): # pragma: no cover ...@@ -128,11 +118,7 @@ def ChromeInternalGitURL(_c, *pieces): # pragma: no cover
return '/'.join(('https://chrome-internal.googlesource.com',) + pieces) return '/'.join(('https://chrome-internal.googlesource.com',) + pieces)
def ChromeInternalSrcURL(c): def ChromeInternalSrcURL(c):
# TODO(phajdan.jr): Move to proper repo and add coverage. return ChromeInternalGitURL(c, 'chrome', 'src-internal.git')
if c.GIT_MODE:
return ChromeInternalGitURL(c, 'chrome', 'src-internal.git')
else: # pragma: no cover
return ChromeSvnSubURL(c, 'chrome-internal', 'trunk', 'src-internal')
def mirror_only(c, obj, default=None): def mirror_only(c, obj, default=None):
return obj if c.USE_MIRROR else (default or obj.__class__()) return obj if c.USE_MIRROR else (default or obj.__class__())
...@@ -277,8 +263,6 @@ def v8_canary(c): ...@@ -277,8 +263,6 @@ def v8_canary(c):
@config_ctx(includes=['chromium']) @config_ctx(includes=['chromium'])
def oilpan(c): # pragma: no cover def oilpan(c): # pragma: no cover
if c.GIT_MODE:
raise BadConf("Oilpan requires SVN for now")
c.solutions[0].custom_vars = { c.solutions[0].custom_vars = {
'webkit_trunk': ChromiumSvnSubURL(c, 'blink', 'branches', 'oilpan') 'webkit_trunk': ChromiumSvnSubURL(c, 'blink', 'branches', 'oilpan')
} }
...@@ -349,49 +333,39 @@ def gyp(c): ...@@ -349,49 +333,39 @@ def gyp(c):
m = c.got_revision_mapping m = c.got_revision_mapping
m['gyp'] = 'got_revision' m['gyp'] = 'got_revision'
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def build(c): def build(c):
if not c.GIT_MODE: # pragma: no cover
raise BadConf('build only supports git')
s = c.solutions.add() s = c.solutions.add()
s.name = 'build' s.name = 'build'
s.url = ChromiumGitURL(c, 'chromium', 'tools', 'build.git') s.url = ChromiumGitURL(c, 'chromium', 'tools', 'build.git')
m = c.got_revision_mapping m = c.got_revision_mapping
m['build'] = 'got_revision' m['build'] = 'got_revision'
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def depot_tools(c): # pragma: no cover def depot_tools(c): # pragma: no cover
if not c.GIT_MODE:
raise BadConf('depot_tools only supports git')
s = c.solutions.add() s = c.solutions.add()
s.name = 'depot_tools' s.name = 'depot_tools'
s.url = ChromiumGitURL(c, 'chromium', 'tools', 'depot_tools.git') s.url = ChromiumGitURL(c, 'chromium', 'tools', 'depot_tools.git')
m = c.got_revision_mapping m = c.got_revision_mapping
m['depot_tools'] = 'got_revision' m['depot_tools'] = 'got_revision'
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def skia(c): # pragma: no cover def skia(c): # pragma: no cover
if not c.GIT_MODE:
raise BadConf('skia only supports git')
s = c.solutions.add() s = c.solutions.add()
s.name = 'skia' s.name = 'skia'
s.url = 'https://skia.googlesource.com/skia.git' s.url = 'https://skia.googlesource.com/skia.git'
m = c.got_revision_mapping m = c.got_revision_mapping
m['skia'] = 'got_revision' m['skia'] = 'got_revision'
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def chrome_golo(c): # pragma: no cover def chrome_golo(c): # pragma: no cover
if not c.GIT_MODE:
raise BadConf('chrome_golo only supports git')
s = c.solutions.add() s = c.solutions.add()
s.name = 'chrome_golo' s.name = 'chrome_golo'
s.url = 'https://chrome-internal.googlesource.com/chrome-golo/chrome-golo.git' s.url = 'https://chrome-internal.googlesource.com/chrome-golo/chrome-golo.git'
c.got_revision_mapping['chrome_golo'] = 'got_revision' c.got_revision_mapping['chrome_golo'] = 'got_revision'
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def build_internal(c): def build_internal(c):
if not c.GIT_MODE: # pragma: no cover
raise BadConf('build_internal only supports git')
s = c.solutions.add() s = c.solutions.add()
s.name = 'build_internal' s.name = 'build_internal'
s.url = 'https://chrome-internal.googlesource.com/chrome/tools/build.git' s.url = 'https://chrome-internal.googlesource.com/chrome/tools/build.git'
...@@ -402,10 +376,8 @@ def build_internal(c): ...@@ -402,10 +376,8 @@ def build_internal(c):
build(c) build(c)
c.got_revision_mapping['build'] = 'got_build_revision' c.got_revision_mapping['build'] = 'got_build_revision'
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def build_internal_scripts_slave(c): def build_internal_scripts_slave(c):
if not c.GIT_MODE: # pragma: no cover
raise BadConf('build_internal_scripts_slave only supports git')
s = c.solutions.add() s = c.solutions.add()
s.name = 'build_internal/scripts/slave' s.name = 'build_internal/scripts/slave'
s.url = ('https://chrome-internal.googlesource.com/' s.url = ('https://chrome-internal.googlesource.com/'
...@@ -536,7 +508,7 @@ def dart(c): ...@@ -536,7 +508,7 @@ def dart(c):
soln.deps_file = 'DEPS' soln.deps_file = 'DEPS'
soln.managed = False soln.managed = False
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def infra(c): def infra(c):
soln = c.solutions.add() soln = c.solutions.add()
soln.name = 'infra' soln.name = 'infra'
...@@ -549,7 +521,7 @@ def infra(c): ...@@ -549,7 +521,7 @@ def infra(c):
p['recipes-py'] = ('infra/recipes-py', 'HEAD') p['recipes-py'] = ('infra/recipes-py', 'HEAD')
p['recipe_engine'] = ('infra/recipes-py', 'HEAD') p['recipe_engine'] = ('infra/recipes-py', 'HEAD')
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def infra_internal(c): # pragma: no cover def infra_internal(c): # pragma: no cover
soln = c.solutions.add() soln = c.solutions.add()
soln.name = 'infra_internal' soln.name = 'infra_internal'
...@@ -600,7 +572,7 @@ def recipes_py(c): ...@@ -600,7 +572,7 @@ def recipes_py(c):
del m['infra'] del m['infra']
m['infra/recipes-py'] = 'got_revision' m['infra/recipes-py'] = 'got_revision'
@config_ctx(config_vars={'GIT_MODE': True}) @config_ctx()
def recipes_py_bare(c): def recipes_py_bare(c):
soln = c.solutions.add() soln = c.solutions.add()
soln.name = 'recipes-py' soln.name = 'recipes-py'
...@@ -627,7 +599,7 @@ def catapult(c): ...@@ -627,7 +599,7 @@ def catapult(c):
'catapult-project/catapult.git') 'catapult-project/catapult.git')
c.got_revision_mapping['catapult'] = 'got_revision' c.got_revision_mapping['catapult'] = 'got_revision'
@config_ctx(includes=['infra_internal'], config_vars={'GIT_MODE': True}) @config_ctx(includes=['infra_internal'])
def infradata_master_manager(c): def infradata_master_manager(c):
soln = c.solutions.add() soln = c.solutions.add()
soln.name = 'infra-data-master-manager' soln.name = 'infra-data-master-manager'
......
...@@ -61,7 +61,7 @@ def RunSteps(api): ...@@ -61,7 +61,7 @@ def RunSteps(api):
for config_name in TEST_CONFIGS: for config_name in TEST_CONFIGS:
api.gclient.make_config(config_name) api.gclient.make_config(config_name)
src_cfg = api.gclient.make_config(GIT_MODE=True, CACHE_DIR='[ROOT]/git_cache') src_cfg = api.gclient.make_config(CACHE_DIR='[ROOT]/git_cache')
soln = src_cfg.solutions.add() soln = src_cfg.solutions.add()
soln.name = 'src' soln.name = 'src'
soln.url = 'https://chromium.googlesource.com/chromium/src.git' soln.url = 'https://chromium.googlesource.com/chromium/src.git'
......
...@@ -7,13 +7,12 @@ import hashlib ...@@ -7,13 +7,12 @@ import hashlib
from recipe_engine import recipe_test_api from recipe_engine import recipe_test_api
class GclientTestApi(recipe_test_api.RecipeTestApi): class GclientTestApi(recipe_test_api.RecipeTestApi):
def output_json(self, projects, git_mode=False): def output_json(self, projects):
"""Deterministically synthesize json.output test data for gclient's """Deterministically synthesize json.output test data for gclient's
--output-json option. --output-json option.
Args: Args:
projects - a list of project paths (e.g. ['src', 'src/dependency']) projects - a list of project paths (e.g. ['src', 'src/dependency'])
git_mode - Return git hashes instead of svn revs.
""" """
# TODO(iannucci): Account for parent_got_revision_mapping. Right now the # TODO(iannucci): Account for parent_got_revision_mapping. Right now the
# synthesized json output from this method will always use # synthesized json output from this method will always use
...@@ -21,17 +20,13 @@ class GclientTestApi(recipe_test_api.RecipeTestApi): ...@@ -21,17 +20,13 @@ class GclientTestApi(recipe_test_api.RecipeTestApi):
# specified, we should use those values instead. # specified, we should use those values instead.
return self.m.json.output({ return self.m.json.output({
'solutions': dict( 'solutions': dict(
(p+'/', {'revision': self.gen_revision(p, git_mode)}) (p+'/', {'revision': self.gen_revision(p)})
for p in projects for p in projects
) )
}) })
@staticmethod @staticmethod
def gen_revision(project, GIT_MODE): def gen_revision(project):
"""Hash project to bogus deterministic revision values.""" """Hash project to bogus deterministic revision values."""
h = hashlib.sha1(project) h = hashlib.sha1(project)
if GIT_MODE: return h.hexdigest()
return h.hexdigest()
else: # pragma: no cover
import struct
return struct.unpack('!I', h.digest()[:4])[0] % 300000
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