diff --git a/recipe_modules/bot_update/api.py b/recipe_modules/bot_update/api.py index 9bee87cb5..7e84b8508 100644 --- a/recipe_modules/bot_update/api.py +++ b/recipe_modules/bot_update/api.py @@ -8,13 +8,6 @@ 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): def __init__(self, mastername, buildername, slavename, issue, patchset, @@ -242,10 +235,9 @@ class BotUpdateApi(recipe_api.RecipeApi): cmd.append('--gerrit_rebase_patch_ref') # Inject Json output for testing. - git_mode = self._mastername not in SVN_MASTERS first_sln = cfg.solutions[0].name 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, output_manifest=output_manifest, fixed_revisions=fixed_revisions) diff --git a/recipe_modules/bot_update/example.expected/basic.json b/recipe_modules/bot_update/example.expected/basic.json index 16a32972d..7d9aea311 100644 --- a/recipe_modules/bot_update/example.expected/basic.json +++ b/recipe_modules/bot_update/example.expected/basic.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-m1", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/basic_output_manifest.json b/recipe_modules/bot_update/example.expected/basic_output_manifest.json index 147c0f6cc..1bca91edb 100644 --- a/recipe_modules/bot_update/example.expected/basic_output_manifest.json +++ b/recipe_modules/bot_update/example.expected/basic_output_manifest.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-m1", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json b/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json index fa34310bf..b085aa3a2 100644 --- a/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json +++ b/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-m1", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/clobber.json b/recipe_modules/bot_update/example.expected/clobber.json index c3c20ebaa..693e5af02 100644 --- a/recipe_modules/bot_update/example.expected/clobber.json +++ b/recipe_modules/bot_update/example.expected/clobber.json @@ -11,7 +11,7 @@ "--slave", "somehost", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/forced.json b/recipe_modules/bot_update/example.expected/forced.json index a5104bb23..a360331a8 100644 --- a/recipe_modules/bot_update/example.expected/forced.json +++ b/recipe_modules/bot_update/example.expected/forced.json @@ -11,7 +11,7 @@ "--slave", "somehost", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/gerrit_no_reset.json b/recipe_modules/bot_update/example.expected/gerrit_no_reset.json index 25de50541..28640b15f 100644 --- a/recipe_modules/bot_update/example.expected/gerrit_no_reset.json +++ b/recipe_modules/bot_update/example.expected/gerrit_no_reset.json @@ -11,7 +11,7 @@ "--slave", "somehost", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/gerrit_rebase_patch_ref.json b/recipe_modules/bot_update/example.expected/gerrit_rebase_patch_ref.json index 105a47f07..2d4257e77 100644 --- a/recipe_modules/bot_update/example.expected/gerrit_rebase_patch_ref.json +++ b/recipe_modules/bot_update/example.expected/gerrit_rebase_patch_ref.json @@ -11,7 +11,7 @@ "--slave", "somehost", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/no_shallow.json b/recipe_modules/bot_update/example.expected/no_shallow.json index 40a7c4847..427e200ab 100644 --- a/recipe_modules/bot_update/example.expected/no_shallow.json +++ b/recipe_modules/bot_update/example.expected/no_shallow.json @@ -11,7 +11,7 @@ "--slave", "somehost", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/off.json b/recipe_modules/bot_update/example.expected/off.json index d6ec5891d..5a72b96ae 100644 --- a/recipe_modules/bot_update/example.expected/off.json +++ b/recipe_modules/bot_update/example.expected/off.json @@ -11,7 +11,7 @@ "--slave", "somehost", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json b/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json index 7b6c2f892..0e73fe28e 100644 --- a/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json +++ b/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json @@ -11,7 +11,7 @@ "--slave", "somehost", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/svn_mode.json b/recipe_modules/bot_update/example.expected/svn_mode.json deleted file mode 100644 index b047ab526..000000000 --- a/recipe_modules/bot_update/example.expected/svn_mode.json +++ /dev/null @@ -1,59 +0,0 @@ -[ - { - "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 diff --git a/recipe_modules/bot_update/example.expected/trychange.json b/recipe_modules/bot_update/example.expected/trychange.json index ce0ac798d..bcf144838 100644 --- a/recipe_modules/bot_update/example.expected/trychange.json +++ b/recipe_modules/bot_update/example.expected/trychange.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-c4", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/trychange_oauth2.json b/recipe_modules/bot_update/example.expected/trychange_oauth2.json index 0908c3be1..65b1e3d84 100644 --- a/recipe_modules/bot_update/example.expected/trychange_oauth2.json +++ b/recipe_modules/bot_update/example.expected/trychange_oauth2.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-c4", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/tryjob.json b/recipe_modules/bot_update/example.expected/tryjob.json index a9118a61c..17a96e32f 100644 --- a/recipe_modules/bot_update/example.expected/tryjob.json +++ b/recipe_modules/bot_update/example.expected/tryjob.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-c4", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/tryjob_fail.json b/recipe_modules/bot_update/example.expected/tryjob_fail.json index 03354ed7a..091f5eac0 100644 --- a/recipe_modules/bot_update/example.expected/tryjob_fail.json +++ b/recipe_modules/bot_update/example.expected/tryjob_fail.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-c4", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json b/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json index c4f96b571..5b1e89cdc 100644 --- a/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +++ b/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-c4", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json b/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json index dca5a2580..0418ae59d 100644 --- a/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +++ b/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-c4", "--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", "src", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json b/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json index fa19f202c..94f7fe1c0 100644 --- a/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json +++ b/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json @@ -11,7 +11,7 @@ "--slave", "TestSlavename", "--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", "src/third_party/angle", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/tryjob_v8.json b/recipe_modules/bot_update/example.expected/tryjob_v8.json index 4b811d49a..3d9c1f8fd 100644 --- a/recipe_modules/bot_update/example.expected/tryjob_v8.json +++ b/recipe_modules/bot_update/example.expected/tryjob_v8.json @@ -11,7 +11,7 @@ "--slave", "totallyaslave-c4", "--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", "src/v8", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json b/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json index 8f16290b8..3fbe3974a 100644 --- a/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json +++ b/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json @@ -11,7 +11,7 @@ "--slave", "TestSlavename", "--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", "src/v8", "--revision_mapping_file", diff --git a/recipe_modules/bot_update/example.py b/recipe_modules/bot_update/example.py index 6020f9127..fd2c5fc99 100644 --- a/recipe_modules/bot_update/example.py +++ b/recipe_modules/bot_update/example.py @@ -12,10 +12,10 @@ DEPS = [ def RunSteps(api): 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.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') api.gclient.c = src_cfg api.gclient.c.revisions.update(api.properties.get('revisions', {})) @@ -140,12 +140,6 @@ def GenTests(api): buildername='Experimental Builder', 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( mastername='experimental', buildername='Experimental Builder', diff --git a/recipe_modules/bot_update/test_api.py b/recipe_modules/bot_update/test_api.py index 64eab8ab1..c14d98adb 100644 --- a/recipe_modules/bot_update/test_api.py +++ b/recipe_modules/bot_update/test_api.py @@ -15,7 +15,7 @@ import bot_update class BotUpdateTestApi(recipe_test_api.RecipeTestApi): 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): """Deterministically synthesize json.output test data for gclient's --output-json option. @@ -30,23 +30,15 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi): # Add in extra json output if active. if active: 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() } properties.update({ '%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() }) - # 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({ 'patch_root': root or first_sln, 'root': first_sln, @@ -59,7 +51,7 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi): 'manifest': { 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 } @@ -77,10 +69,13 @@ class BotUpdateTestApi(recipe_test_api.RecipeTestApi): return self.m.json.output(output) @staticmethod - def gen_revision(project, GIT_MODE): - """Hash project to bogus deterministic revision values.""" + def gen_revision(project): + """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) - if GIT_MODE: - return h.hexdigest() - else: - return struct.unpack('!I', h.digest()[:4])[0] % 300000 + return struct.unpack('!I', h.digest()[:4])[0] % 300000 diff --git a/recipe_modules/gclient/api.py b/recipe_modules/gclient/api.py index 7462e22c6..9182d6a1f 100644 --- a/recipe_modules/gclient/api.py +++ b/recipe_modules/gclient/api.py @@ -151,40 +151,30 @@ class GclientApi(recipe_api.RecipeApi): test_data_paths = set(cfg.got_revision_mapping.keys() + [s.name for s in cfg.solutions]) step_test_data = lambda: ( - self.test_api.output_json(test_data_paths, cfg.GIT_MODE)) + self.test_api.output_json(test_data_paths)) try: - if not cfg.GIT_MODE: # pragma: no cover - args = ['sync', '--nohooks', '--force', '--verbose'] - if cfg.delete_unversioned_trees: - args.append('--delete_unversioned_trees') - if with_branch_heads: - args.append('--with_branch_heads') - self('sync', args + revisions + ['--output-json', self.m.json.output()], - step_test_data=step_test_data, - **kwargs) - else: - # clean() isn't used because the gclient sync flags passed in checkout() - # do much the same thing, and they're more correct than doing a separate - # 'gclient revert' because it makes sure the other args are correct when - # a repo was deleted and needs to be re-cloned (notably - # --with_branch_heads), whereas 'revert' uses default args for clone - # operations. - # - # TODO(mmoss): To be like current official builders, this step could - # just delete the whole /build/ directory and start each - # build from scratch. That might be the least bad solution, at least - # until we have a reliable gclient method to produce a pristine working - # dir for git-based builds (e.g. maybe some combination of 'git - # 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) + # clean() isn't used because the gclient sync flags passed in checkout() + # do much the same thing, and they're more correct than doing a separate + # 'gclient revert' because it makes sure the other args are correct when + # a repo was deleted and needs to be re-cloned (notably + # --with_branch_heads), whereas 'revert' uses default args for clone + # operations. + # + # TODO(mmoss): To be like current official builders, this step could + # just delete the whole /build/ directory and start each + # build from scratch. That might be the least bad solution, at least + # until we have a reliable gclient method to produce a pristine working + # dir for git-based builds (e.g. maybe some combination of 'git + # 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: result = self.m.step.active_result data = result.json.output @@ -239,25 +229,16 @@ class GclientApi(recipe_api.RecipeApi): sync_step = None try: - if not cfg.GIT_MODE: # pragma: no cover - try: - if revert: - self.revert(**kwargs) - finally: - sync_step = self.sync(cfg, with_branch_heads=with_branch_heads, - **kwargs) - else: - sync_step = self.sync(cfg, with_branch_heads=with_branch_heads, - **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) - + sync_step = self.sync(cfg, with_branch_heads=with_branch_heads, + **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: cwd = kwargs.get('cwd', self.m.path['slave_build']) if 'checkout' not in self.m.path: diff --git a/recipe_modules/gclient/config.py b/recipe_modules/gclient/config.py index 31d0a4d22..a1fc349c8 100644 --- a/recipe_modules/gclient/config.py +++ b/recipe_modules/gclient/config.py @@ -10,17 +10,16 @@ from recipe_engine.config import ConfigList, Dict, Single, Static, Set, List 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, **_kwargs): - deps = '.DEPS.git' if GIT_MODE else 'DEPS' cache_dir = str(CACHE_DIR) if CACHE_DIR else None return ConfigGroup( solutions = ConfigList( lambda: ConfigGroup( name = 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), managed = Single(bool, empty_val=True, required=False, hidden=False), custom_deps = Dict(value_type=(basestring, types.NoneType)), @@ -86,7 +85,6 @@ def BaseConfig(USE_MIRROR=True, GIT_MODE=True, CACHE_DIR=None, required=False, hidden=True), - GIT_MODE = Static(bool(GIT_MODE)), USE_MIRROR = Static(bool(USE_MIRROR)), # TODO(tandrii): remove PATCH_PROJECT field. # DON'T USE THIS. WILL BE REMOVED. @@ -105,18 +103,10 @@ def ChromiumGitURL(_c, *pieces): return '/'.join(('https://chromium.googlesource.com',) + pieces) def ChromiumSrcURL(c): - # TODO(phajdan.jr): Move to proper repo and add coverage. - if c.GIT_MODE: - return ChromiumGitURL(c, 'chromium', 'src.git') - else: # pragma: no cover - return ChromiumSvnSubURL(c, 'chrome', 'trunk', 'src') + return ChromiumGitURL(c, 'chromium', 'src.git') def BlinkURL(c): - # TODO(phajdan.jr): Move to proper repo and add coverage. - if c.GIT_MODE: - return ChromiumGitURL(c, 'chromium', 'blink.git') - else: # pragma: no cover - return ChromiumSvnSubURL(c, 'blink', 'trunk') + return ChromiumGitURL(c, 'chromium', 'blink.git') def ChromeSvnSubURL(c, *pieces): # pragma: no cover BASES = ('svn://svn.chromium.org', @@ -128,11 +118,7 @@ def ChromeInternalGitURL(_c, *pieces): # pragma: no cover return '/'.join(('https://chrome-internal.googlesource.com',) + pieces) def ChromeInternalSrcURL(c): - # TODO(phajdan.jr): Move to proper repo and add coverage. - if c.GIT_MODE: - return ChromeInternalGitURL(c, 'chrome', 'src-internal.git') - else: # pragma: no cover - return ChromeSvnSubURL(c, 'chrome-internal', 'trunk', 'src-internal') + return ChromeInternalGitURL(c, 'chrome', 'src-internal.git') def mirror_only(c, obj, default=None): return obj if c.USE_MIRROR else (default or obj.__class__()) @@ -277,8 +263,6 @@ def v8_canary(c): @config_ctx(includes=['chromium']) def oilpan(c): # pragma: no cover - if c.GIT_MODE: - raise BadConf("Oilpan requires SVN for now") c.solutions[0].custom_vars = { 'webkit_trunk': ChromiumSvnSubURL(c, 'blink', 'branches', 'oilpan') } @@ -349,49 +333,39 @@ def gyp(c): m = c.got_revision_mapping m['gyp'] = 'got_revision' -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() def build(c): - if not c.GIT_MODE: # pragma: no cover - raise BadConf('build only supports git') s = c.solutions.add() s.name = 'build' s.url = ChromiumGitURL(c, 'chromium', 'tools', 'build.git') m = c.got_revision_mapping m['build'] = 'got_revision' -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() def depot_tools(c): # pragma: no cover - if not c.GIT_MODE: - raise BadConf('depot_tools only supports git') s = c.solutions.add() s.name = 'depot_tools' s.url = ChromiumGitURL(c, 'chromium', 'tools', 'depot_tools.git') m = c.got_revision_mapping m['depot_tools'] = 'got_revision' -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() def skia(c): # pragma: no cover - if not c.GIT_MODE: - raise BadConf('skia only supports git') s = c.solutions.add() s.name = 'skia' s.url = 'https://skia.googlesource.com/skia.git' m = c.got_revision_mapping m['skia'] = 'got_revision' -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() def chrome_golo(c): # pragma: no cover - if not c.GIT_MODE: - raise BadConf('chrome_golo only supports git') s = c.solutions.add() s.name = 'chrome_golo' s.url = 'https://chrome-internal.googlesource.com/chrome-golo/chrome-golo.git' c.got_revision_mapping['chrome_golo'] = 'got_revision' -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() def build_internal(c): - if not c.GIT_MODE: # pragma: no cover - raise BadConf('build_internal only supports git') s = c.solutions.add() s.name = 'build_internal' s.url = 'https://chrome-internal.googlesource.com/chrome/tools/build.git' @@ -402,10 +376,8 @@ def build_internal(c): build(c) c.got_revision_mapping['build'] = 'got_build_revision' -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() 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.name = 'build_internal/scripts/slave' s.url = ('https://chrome-internal.googlesource.com/' @@ -536,7 +508,7 @@ def dart(c): soln.deps_file = 'DEPS' soln.managed = False -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() def infra(c): soln = c.solutions.add() soln.name = 'infra' @@ -549,7 +521,7 @@ def infra(c): p['recipes-py'] = ('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 soln = c.solutions.add() soln.name = 'infra_internal' @@ -600,7 +572,7 @@ def recipes_py(c): del m['infra'] m['infra/recipes-py'] = 'got_revision' -@config_ctx(config_vars={'GIT_MODE': True}) +@config_ctx() def recipes_py_bare(c): soln = c.solutions.add() soln.name = 'recipes-py' @@ -627,7 +599,7 @@ def catapult(c): 'catapult-project/catapult.git') 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): soln = c.solutions.add() soln.name = 'infra-data-master-manager' diff --git a/recipe_modules/gclient/example.py b/recipe_modules/gclient/example.py index 8cdfb7dbd..7da82ee42 100644 --- a/recipe_modules/gclient/example.py +++ b/recipe_modules/gclient/example.py @@ -61,7 +61,7 @@ def RunSteps(api): for config_name in TEST_CONFIGS: 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.name = 'src' soln.url = 'https://chromium.googlesource.com/chromium/src.git' diff --git a/recipe_modules/gclient/test_api.py b/recipe_modules/gclient/test_api.py index 499651bbc..58d678419 100644 --- a/recipe_modules/gclient/test_api.py +++ b/recipe_modules/gclient/test_api.py @@ -7,13 +7,12 @@ import hashlib from recipe_engine import recipe_test_api 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 --output-json option. Args: 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 # synthesized json output from this method will always use @@ -21,17 +20,13 @@ class GclientTestApi(recipe_test_api.RecipeTestApi): # specified, we should use those values instead. return self.m.json.output({ 'solutions': dict( - (p+'/', {'revision': self.gen_revision(p, git_mode)}) + (p+'/', {'revision': self.gen_revision(p)}) for p in projects ) }) @staticmethod - def gen_revision(project, GIT_MODE): + def gen_revision(project): """Hash project to bogus deterministic revision values.""" h = hashlib.sha1(project) - if GIT_MODE: - return h.hexdigest() - else: # pragma: no cover - import struct - return struct.unpack('!I', h.digest()[:4])[0] % 300000 + return h.hexdigest()