Adds bot_update to depot_tools.
This CL imports the bot_update script, along with the bot_update and gclient recipe modules from build. This should allow for recipes to run on swarming. Also moves the recipe stuff into the infra folder. bot_update has been modified. See full diff at https://paste.googleplex.com/4969207737352192 TBR=phajdan.jr@chromium.org BUG= Review URL: https://codereview.chromium.org/1641363002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298490 0039d316-1c4b-4281-b951-d872f2087c98changes/01/332501/1
							parent
							
								
									259b9f2305
								
							
						
					
					
						commit
						816d1ec60f
					
				@ -0,0 +1 @@
 | 
			
		||||
martiniss@chromium.org
 | 
			
		||||
@ -0,0 +1,27 @@
 | 
			
		||||
from recipe_engine.recipe_api import Property
 | 
			
		||||
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'gclient',
 | 
			
		||||
  'recipe_engine/json',
 | 
			
		||||
  'recipe_engine/path',
 | 
			
		||||
  'recipe_engine/platform',
 | 
			
		||||
  'recipe_engine/properties',
 | 
			
		||||
  'recipe_engine/python',
 | 
			
		||||
  'recipe_engine/raw_io',
 | 
			
		||||
  'rietveld',
 | 
			
		||||
  'recipe_engine/step',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
PROPERTIES = {
 | 
			
		||||
  'deps_revision_overrides': Property(default={}),
 | 
			
		||||
  'event_patchSet_ref': Property(param_name="event_patchSet_ref", default=None),
 | 
			
		||||
  'issue': Property(default=None),
 | 
			
		||||
  'fail_patch': Property(default=False),
 | 
			
		||||
  'failure_type': Property(default=None),
 | 
			
		||||
  'parent_got_revision': Property(default=None),
 | 
			
		||||
  'patchset': Property(default=None),
 | 
			
		||||
  'patch_url': Property(default=None),
 | 
			
		||||
  'rietveld': Property(default=None),
 | 
			
		||||
  'repository': Property(default=None),
 | 
			
		||||
  'revision': Property(default=None),
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,280 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# 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 consistant on a bot."""
 | 
			
		||||
 | 
			
		||||
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',
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def jsonish_to_python(spec, is_top=False):
 | 
			
		||||
  """Turn a json spec into a python parsable object.
 | 
			
		||||
 | 
			
		||||
  This exists because Gclient specs, while resembling json, is actually
 | 
			
		||||
  ingested using a python "eval()".  Therefore a bit of plumming is required
 | 
			
		||||
  to turn our newly constructed Gclient spec into a gclient-readable spec.
 | 
			
		||||
  """
 | 
			
		||||
  ret = ''
 | 
			
		||||
  if is_top:  # We're the 'top' level, so treat this dict as a suite.
 | 
			
		||||
    ret = '\n'.join(
 | 
			
		||||
      '%s = %s' % (k, jsonish_to_python(spec[k])) for k in sorted(spec)
 | 
			
		||||
    )
 | 
			
		||||
  else:
 | 
			
		||||
    if isinstance(spec, dict):
 | 
			
		||||
      ret += '{'
 | 
			
		||||
      ret += ', '.join(
 | 
			
		||||
        "%s: %s" % (repr(str(k)), jsonish_to_python(spec[k]))
 | 
			
		||||
        for k in sorted(spec)
 | 
			
		||||
      )
 | 
			
		||||
      ret += '}'
 | 
			
		||||
    elif isinstance(spec, list):
 | 
			
		||||
      ret += '['
 | 
			
		||||
      ret += ', '.join(jsonish_to_python(x) for x in spec)
 | 
			
		||||
      ret += ']'
 | 
			
		||||
    elif isinstance(spec, basestring):
 | 
			
		||||
      ret = repr(str(spec))
 | 
			
		||||
    else:
 | 
			
		||||
      ret = repr(spec)
 | 
			
		||||
  return ret
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BotUpdateApi(recipe_api.RecipeApi):
 | 
			
		||||
 | 
			
		||||
  def __init__(self, deps_revision_overrides, issue, event_patchSet_ref,
 | 
			
		||||
               fail_patch, failure_type, parent_got_revision, patchset,
 | 
			
		||||
               patch_url, rietveld, repository, revision, *args, **kwargs):
 | 
			
		||||
    # I love my properties
 | 
			
		||||
    self._deps_revision_overrides = deps_revision_overrides
 | 
			
		||||
    self._issue = issue
 | 
			
		||||
    self._event_patchSet_ref = event_patchSet_ref
 | 
			
		||||
    self._fail_patch = fail_patch
 | 
			
		||||
    self._failure_type = failure_type
 | 
			
		||||
    self._parent_got_revision = parent_got_revision
 | 
			
		||||
    self._patchset = patchset
 | 
			
		||||
    self._patch_url = patch_url
 | 
			
		||||
    self._rietveld = rietveld
 | 
			
		||||
    self._repository = repository
 | 
			
		||||
    self._revision = revision
 | 
			
		||||
 | 
			
		||||
    self._properties = {}
 | 
			
		||||
    super(BotUpdateApi, self).__init__(*args, **kwargs)
 | 
			
		||||
 | 
			
		||||
  def __call__(self, name, cmd, **kwargs):
 | 
			
		||||
    """Wrapper for easy calling of bot_update."""
 | 
			
		||||
    assert isinstance(cmd, (list, tuple))
 | 
			
		||||
    bot_update_path = self.resource('bot_update.py')
 | 
			
		||||
    kwargs.setdefault('infra_step', True)
 | 
			
		||||
    return self.m.python(name, bot_update_path, cmd, **kwargs)
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def properties(self):
 | 
			
		||||
      return self._properties
 | 
			
		||||
 | 
			
		||||
  def ensure_checkout(self, gclient_config=None, suffix=None,
 | 
			
		||||
                      patch=True, update_presentation=True,
 | 
			
		||||
                      force=False, patch_root=None, no_shallow=False,
 | 
			
		||||
                      with_branch_heads=False, refs=None,
 | 
			
		||||
                      patch_project_roots=None, patch_oauth2=False,
 | 
			
		||||
                      output_manifest=True, clobber=False,
 | 
			
		||||
                      root_solution_revision=None, **kwargs):
 | 
			
		||||
    refs = refs or []
 | 
			
		||||
    # We can re-use the gclient spec from the gclient module, since all the
 | 
			
		||||
    # data bot_update needs is already configured into the gclient spec.
 | 
			
		||||
    cfg = gclient_config or self.m.gclient.c
 | 
			
		||||
    spec_string = jsonish_to_python(cfg.as_jsonish(), True)
 | 
			
		||||
 | 
			
		||||
    # Construct our bot_update command.  This basically be inclusive of
 | 
			
		||||
    # everything required for bot_update to know:
 | 
			
		||||
    root = patch_root
 | 
			
		||||
    if root is None:
 | 
			
		||||
      root = cfg.solutions[0].name
 | 
			
		||||
      additional = self.m.rietveld.calculate_issue_root(patch_project_roots)
 | 
			
		||||
      if additional:
 | 
			
		||||
        root = self.m.path.join(root, additional)
 | 
			
		||||
 | 
			
		||||
    if patch:
 | 
			
		||||
      issue = self._issue
 | 
			
		||||
      patchset = self._patchset
 | 
			
		||||
      patch_url = self._patch_url
 | 
			
		||||
      gerrit_repo = self._repository
 | 
			
		||||
      gerrit_ref = self._event_patchSet_ref
 | 
			
		||||
    else:
 | 
			
		||||
      # The trybot recipe sometimes wants to de-apply the patch. In which case
 | 
			
		||||
      # we pretend the issue/patchset/patch_url never existed.
 | 
			
		||||
      issue = patchset = patch_url = email_file = key_file = None
 | 
			
		||||
      gerrit_repo = gerrit_ref = None
 | 
			
		||||
 | 
			
		||||
    # Issue and patchset must come together.
 | 
			
		||||
    if issue:
 | 
			
		||||
      assert patchset
 | 
			
		||||
    if patchset:
 | 
			
		||||
      assert issue
 | 
			
		||||
    if patch_url:
 | 
			
		||||
      # If patch_url is present, bot_update will actually ignore issue/ps.
 | 
			
		||||
      issue = patchset = None
 | 
			
		||||
 | 
			
		||||
    # The gerrit_ref and gerrit_repo must be together or not at all.  If one is
 | 
			
		||||
    # missing, clear both of them.
 | 
			
		||||
    if not gerrit_ref or not gerrit_repo:
 | 
			
		||||
      gerrit_repo = gerrit_ref = None
 | 
			
		||||
    assert (gerrit_ref != None) == (gerrit_repo != None)
 | 
			
		||||
 | 
			
		||||
    # Point to the oauth2 auth files if specified.
 | 
			
		||||
    # These paths are where the bots put their credential files.
 | 
			
		||||
    if patch_oauth2:
 | 
			
		||||
      email_file = self.m.path['build'].join(
 | 
			
		||||
          'site_config', '.rietveld_client_email')
 | 
			
		||||
      key_file = self.m.path['build'].join(
 | 
			
		||||
          'site_config', '.rietveld_secret_key')
 | 
			
		||||
    else:
 | 
			
		||||
      email_file = key_file = None
 | 
			
		||||
 | 
			
		||||
    rev_map = {}
 | 
			
		||||
    if self.m.gclient.c:
 | 
			
		||||
      rev_map = self.m.gclient.c.got_revision_mapping.as_jsonish()
 | 
			
		||||
 | 
			
		||||
    flags = [
 | 
			
		||||
        # 1. What do we want to check out (spec/root/rev/rev_map).
 | 
			
		||||
        ['--spec', spec_string],
 | 
			
		||||
        ['--root', root],
 | 
			
		||||
        ['--revision_mapping_file', self.m.json.input(rev_map)],
 | 
			
		||||
 | 
			
		||||
        # 2. How to find the patch, if any (issue/patchset/patch_url).
 | 
			
		||||
        ['--issue', issue],
 | 
			
		||||
        ['--patchset', patchset],
 | 
			
		||||
        ['--patch_url', patch_url],
 | 
			
		||||
        ['--rietveld_server', self._rietveld],
 | 
			
		||||
        ['--gerrit_repo', gerrit_repo],
 | 
			
		||||
        ['--gerrit_ref', gerrit_ref],
 | 
			
		||||
        ['--apply_issue_email_file', email_file],
 | 
			
		||||
        ['--apply_issue_key_file', key_file],
 | 
			
		||||
 | 
			
		||||
        # 3. Hookups to JSON output back into recipes.
 | 
			
		||||
        ['--output_json', self.m.json.output()],]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # Collect all fixed revisions to simulate them in the json output.
 | 
			
		||||
    # Fixed revision are the explicit input revisions of bot_update.py, i.e.
 | 
			
		||||
    # every command line parameter "--revision name@value".
 | 
			
		||||
    fixed_revisions = {}
 | 
			
		||||
 | 
			
		||||
    revisions = {}
 | 
			
		||||
    for solution in cfg.solutions:
 | 
			
		||||
      if solution.revision:
 | 
			
		||||
        revisions[solution.name] = solution.revision
 | 
			
		||||
      elif solution == cfg.solutions[0]:
 | 
			
		||||
        revisions[solution.name] = (
 | 
			
		||||
            self._parent_got_revision or
 | 
			
		||||
            self._revision or
 | 
			
		||||
            'HEAD')
 | 
			
		||||
    if self.m.gclient.c and self.m.gclient.c.revisions:
 | 
			
		||||
      revisions.update(self.m.gclient.c.revisions)
 | 
			
		||||
    if cfg.solutions and root_solution_revision:
 | 
			
		||||
      revisions[cfg.solutions[0].name] = root_solution_revision
 | 
			
		||||
    # Allow for overrides required to bisect into rolls.
 | 
			
		||||
    revisions.update(self._deps_revision_overrides)
 | 
			
		||||
    for name, revision in sorted(revisions.items()):
 | 
			
		||||
      fixed_revision = self.m.gclient.resolve_revision(revision)
 | 
			
		||||
      if fixed_revision:
 | 
			
		||||
        fixed_revisions[name] = fixed_revision
 | 
			
		||||
        flags.append(['--revision', '%s@%s' % (name, fixed_revision)])
 | 
			
		||||
 | 
			
		||||
    # Add extra fetch refspecs.
 | 
			
		||||
    for ref in refs:
 | 
			
		||||
      flags.append(['--refs', ref])
 | 
			
		||||
 | 
			
		||||
    # Filter out flags that are None.
 | 
			
		||||
    cmd = [item for flag_set in flags
 | 
			
		||||
           for item in flag_set if flag_set[1] is not None]
 | 
			
		||||
 | 
			
		||||
    if clobber:
 | 
			
		||||
      cmd.append('--clobber')
 | 
			
		||||
    if no_shallow:
 | 
			
		||||
      cmd.append('--no_shallow')
 | 
			
		||||
    if output_manifest:
 | 
			
		||||
      cmd.append('--output_manifest')
 | 
			
		||||
    if with_branch_heads or cfg.with_branch_heads:
 | 
			
		||||
      cmd.append('--with_branch_heads')
 | 
			
		||||
 | 
			
		||||
    # Inject Json output for testing.
 | 
			
		||||
    # TODO(martinis, hinoka) remove me
 | 
			
		||||
    git_mode = True
 | 
			
		||||
    first_sln = cfg.solutions[0].name
 | 
			
		||||
    step_test_data = lambda: self.test_api.output_json(
 | 
			
		||||
        root, first_sln, rev_map, git_mode, force,
 | 
			
		||||
        self._fail_patch,
 | 
			
		||||
        output_manifest=output_manifest, fixed_revisions=fixed_revisions)
 | 
			
		||||
 | 
			
		||||
    # Add suffixes to the step name, if specified.
 | 
			
		||||
    name = 'bot_update'
 | 
			
		||||
    if not patch:
 | 
			
		||||
      name += ' (without patch)'
 | 
			
		||||
    if suffix:
 | 
			
		||||
      name += ' - %s' % suffix
 | 
			
		||||
 | 
			
		||||
    # Ah hah! Now that everything is in place, lets run bot_update!
 | 
			
		||||
    try:
 | 
			
		||||
      # 87 and 88 are the 'patch failure' codes for patch download and patch
 | 
			
		||||
      # apply, respectively. We don't actually use the error codes, and instead
 | 
			
		||||
      # rely on emitted json to determine cause of failure.
 | 
			
		||||
      self(name, cmd, step_test_data=step_test_data,
 | 
			
		||||
           ok_ret=(0, 87, 88), **kwargs)
 | 
			
		||||
    finally:
 | 
			
		||||
      step_result = self.m.step.active_result
 | 
			
		||||
      self._properties = step_result.json.output.get('properties', {})
 | 
			
		||||
 | 
			
		||||
      if update_presentation:
 | 
			
		||||
        # Set properties such as got_revision.
 | 
			
		||||
        for prop_name, prop_value in self.properties.iteritems():
 | 
			
		||||
          step_result.presentation.properties[prop_name] = prop_value
 | 
			
		||||
      # Add helpful step description in the step UI.
 | 
			
		||||
      if 'step_text' in step_result.json.output:
 | 
			
		||||
        step_text = step_result.json.output['step_text']
 | 
			
		||||
        step_result.presentation.step_text = step_text
 | 
			
		||||
      # Add log line output.
 | 
			
		||||
      if 'log_lines' in step_result.json.output:
 | 
			
		||||
        for log_name, log_lines in step_result.json.output['log_lines']:
 | 
			
		||||
          step_result.presentation.logs[log_name] = log_lines.splitlines()
 | 
			
		||||
 | 
			
		||||
      # Set the "checkout" path for the main solution.
 | 
			
		||||
      # This is used by the Chromium module to figure out where to look for
 | 
			
		||||
      # the checkout.
 | 
			
		||||
      # If there is a patch failure, emit another step that said things failed.
 | 
			
		||||
      if step_result.json.output.get('patch_failure'):
 | 
			
		||||
        return_code = step_result.json.output.get('patch_apply_return_code')
 | 
			
		||||
        if return_code == 3:
 | 
			
		||||
          # This is download failure, hence an infra failure.
 | 
			
		||||
          # Sadly, python.failing_step doesn't support kwargs.
 | 
			
		||||
          self.m.python.inline(
 | 
			
		||||
              'Patch failure',
 | 
			
		||||
              ('import sys;'
 | 
			
		||||
               'print "Patch download failed. See bot_update step for details";'
 | 
			
		||||
               'sys.exit(1)'),
 | 
			
		||||
              infra_step=True,
 | 
			
		||||
              step_test_data=lambda: self.m.raw_io.test_api.output(
 | 
			
		||||
                'Patch download failed. See bot_update step for details',
 | 
			
		||||
                retcode=1)
 | 
			
		||||
              )
 | 
			
		||||
        else:
 | 
			
		||||
          # This is actual patch failure.
 | 
			
		||||
          step_result.presentation.properties['failure_type'] = 'PATCH_FAILURE'
 | 
			
		||||
          self.m.python.failing_step(
 | 
			
		||||
              'Patch failure', 'Check the bot_update step for details')
 | 
			
		||||
 | 
			
		||||
      # bot_update actually just sets root to be the folder name of the
 | 
			
		||||
      # first solution.
 | 
			
		||||
      if step_result.json.output['did_run']:
 | 
			
		||||
        co_root = step_result.json.output['root']
 | 
			
		||||
        cwd = kwargs.get('cwd', self.m.path['slave_build'])
 | 
			
		||||
        if 'checkout' not in self.m.path:
 | 
			
		||||
          self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep))
 | 
			
		||||
 | 
			
		||||
    return step_result
 | 
			
		||||
@ -0,0 +1,46 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@abc"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "bot_update (without patch)",
 | 
			
		||||
    "~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\": \"abc\"@@@",
 | 
			
		||||
      "@@@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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,53 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD",
 | 
			
		||||
      "--output_manifest"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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@  \"manifest\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"src\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"repository\": \"https://fake.org/src.git\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }@@@",
 | 
			
		||||
      "@@@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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,47 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD",
 | 
			
		||||
      "--with_branch_heads"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "bot_update - with branch heads",
 | 
			
		||||
    "~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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,47 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD",
 | 
			
		||||
      "--clobber"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,47 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD",
 | 
			
		||||
      "--no_shallow"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,46 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@revision"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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\": \"revision\"@@@",
 | 
			
		||||
      "@@@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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,48 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD",
 | 
			
		||||
      "--refs",
 | 
			
		||||
      "+refs/change/1/2/333"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,50 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--apply_issue_email_file",
 | 
			
		||||
      "[BUILD]/site_config/.rietveld_client_email",
 | 
			
		||||
      "--apply_issue_key_file",
 | 
			
		||||
      "[BUILD]/site_config/.rietveld_secret_key",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,48 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--patch_url",
 | 
			
		||||
      "http://src.chromium.org/foo/bar",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,50 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--patch_url",
 | 
			
		||||
      "http://src.chromium.org/foo/bar",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "bot_update",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "step returned non-zero exit code: 1",
 | 
			
		||||
      "@@@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\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@@@",
 | 
			
		||||
      "@@@STEP_EXCEPTION@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "reason": "Infra Failure: Step('bot_update') returned 1",
 | 
			
		||||
    "status_code": 1
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,72 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--patch_url",
 | 
			
		||||
      "http://src.chromium.org/foo/bar",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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@  \"log_lines\": [@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    [@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"patch error\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"Patch failed to apply\"@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    ]@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  ], @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_apply_return_code\": 1, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_failure\": true, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_root\": \"src\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"properties\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@patch error@Patch failed to apply@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@patch error@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@failure_type@\"PATCH_FAILURE\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "import sys; sys.exit(1)"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "Patch failure",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "step returned non-zero exit code: 1",
 | 
			
		||||
      "@@@STEP_TEXT@Check the bot_update step for details@@@",
 | 
			
		||||
      "@@@STEP_FAILURE@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "reason": "Step('Patch failure') failed with return_code 1",
 | 
			
		||||
    "status_code": 1
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,72 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--patch_url",
 | 
			
		||||
      "http://src.chromium.org/foo/bar",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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@  \"log_lines\": [@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    [@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"patch error\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"Patch failed to apply\"@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    ]@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  ], @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_apply_return_code\": 3, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_failure\": true, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_root\": \"src\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"properties\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@patch error@Patch failed to apply@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@patch error@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "import sys;print \"Patch download failed. See bot_update step for details\";sys.exit(1)"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "Patch failure",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "step returned non-zero exit code: 1",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@import sys;print \"Patch download failed. See bot_update step for details\";sys.exit(1)@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@python.inline@@@",
 | 
			
		||||
      "@@@STEP_EXCEPTION@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "reason": "Infra Failure: Step('Patch failure') returned 1",
 | 
			
		||||
    "status_code": 1
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,51 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_MODULE[depot_tools.bot_update]/resources/bot_update.py",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'src', 'url': 'svn://svn.chromium.org/chrome/trunk/src'}]",
 | 
			
		||||
      "--root",
 | 
			
		||||
      "src/v8",
 | 
			
		||||
      "--revision_mapping_file",
 | 
			
		||||
      "{\"src\": \"got_cr_revision\"}",
 | 
			
		||||
      "--patch_url",
 | 
			
		||||
      "http://src.chromium.org/foo/bar",
 | 
			
		||||
      "--output_json",
 | 
			
		||||
      "/path/to/tmp/json",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src/v8@abc"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "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@    \"src/v8\": \"abc\"@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  }, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_failure\": false, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"patch_root\": \"src/v8\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"properties\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
 | 
			
		||||
      "@@@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@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,107 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
from recipe_engine.recipe_api import Property
 | 
			
		||||
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'bot_update',
 | 
			
		||||
  'gclient',
 | 
			
		||||
  'recipe_engine/path',
 | 
			
		||||
  'recipe_engine/properties',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
PROPERTIES = {
 | 
			
		||||
  'clobber': Property(default=False, kind=bool),
 | 
			
		||||
  'no_shallow': Property(default=False, kind=bool),
 | 
			
		||||
  'oauth2': Property(default=False, kind=bool),
 | 
			
		||||
  'output_manifest': Property(default=False, kind=bool),
 | 
			
		||||
  'patch': Property(default=True, kind=bool),
 | 
			
		||||
  'refs': Property(default=[]),
 | 
			
		||||
  'revision': Property(default=None),
 | 
			
		||||
  'revisions': Property(default={}),
 | 
			
		||||
  'root_solution_revision': Property(default=None),
 | 
			
		||||
  'suffix': Property(default=None),
 | 
			
		||||
  'with_branch_heads': Property(default=False, kind=bool),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
def RunSteps(api, clobber, no_shallow, oauth2, output_manifest, patch, refs,
 | 
			
		||||
             revision, revisions, root_solution_revision, suffix,
 | 
			
		||||
             with_branch_heads):
 | 
			
		||||
  api.gclient.use_mirror = True
 | 
			
		||||
 | 
			
		||||
  src_cfg = api.gclient.make_config()
 | 
			
		||||
  soln = src_cfg.solutions.add()
 | 
			
		||||
  soln.name = 'src'
 | 
			
		||||
  soln.url = 'svn://svn.chromium.org/chrome/trunk/src'
 | 
			
		||||
  soln.revision = revision
 | 
			
		||||
  api.gclient.c = src_cfg
 | 
			
		||||
  api.gclient.c.revisions = revisions
 | 
			
		||||
  api.gclient.c.got_revision_mapping['src'] = 'got_cr_revision'
 | 
			
		||||
 | 
			
		||||
  api.bot_update.ensure_checkout(no_shallow=no_shallow,
 | 
			
		||||
                                 patch=patch,
 | 
			
		||||
                                 with_branch_heads=with_branch_heads,
 | 
			
		||||
                                 output_manifest=output_manifest,
 | 
			
		||||
                                 refs=refs, patch_oauth2=oauth2,
 | 
			
		||||
                                 clobber=clobber,
 | 
			
		||||
                                 root_solution_revision=root_solution_revision,
 | 
			
		||||
                                 suffix=suffix)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def GenTests(api):
 | 
			
		||||
  yield api.test('basic') + api.properties(
 | 
			
		||||
      patch=False,
 | 
			
		||||
      revision='abc'
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('basic_with_branch_heads') + api.properties(
 | 
			
		||||
      with_branch_heads=True,
 | 
			
		||||
      suffix='with branch heads'
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('basic_output_manifest') + api.properties(
 | 
			
		||||
      output_manifest=True,
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('tryjob') + api.properties(
 | 
			
		||||
      issue=12345,
 | 
			
		||||
      patchset=654321,
 | 
			
		||||
      patch_url='http://src.chromium.org/foo/bar'
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('trychange') + api.properties(
 | 
			
		||||
      refs=['+refs/change/1/2/333'],
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('trychange_oauth2') + api.properties(
 | 
			
		||||
      oauth2=True,
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('tryjob_fail') + api.properties(
 | 
			
		||||
      issue=12345,
 | 
			
		||||
      patchset=654321,
 | 
			
		||||
      patch_url='http://src.chromium.org/foo/bar',
 | 
			
		||||
  ) + api.step_data('bot_update', retcode=1)
 | 
			
		||||
  yield api.test('tryjob_fail_patch') + api.properties(
 | 
			
		||||
      issue=12345,
 | 
			
		||||
      patchset=654321,
 | 
			
		||||
      patch_url='http://src.chromium.org/foo/bar',
 | 
			
		||||
      fail_patch='apply',
 | 
			
		||||
  ) + api.step_data('bot_update', retcode=88)
 | 
			
		||||
  yield api.test('tryjob_fail_patch_download') + api.properties(
 | 
			
		||||
      issue=12345,
 | 
			
		||||
      patchset=654321,
 | 
			
		||||
      patch_url='http://src.chromium.org/foo/bar',
 | 
			
		||||
      fail_patch='download'
 | 
			
		||||
  ) + api.step_data('bot_update', retcode=87)
 | 
			
		||||
  yield api.test('no_shallow') + api.properties(
 | 
			
		||||
      no_shallow=True
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('clobber') + api.properties(
 | 
			
		||||
      clobber=True
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('reset_root_solution_revision') + api.properties(
 | 
			
		||||
      root_solution_revision='revision',
 | 
			
		||||
  )
 | 
			
		||||
  yield api.test('tryjob_v8') + api.properties(
 | 
			
		||||
      issue=12345,
 | 
			
		||||
      patchset=654321,
 | 
			
		||||
      patch_url='http://src.chromium.org/foo/bar',
 | 
			
		||||
      patch_project='v8',
 | 
			
		||||
      revisions={'src/v8': 'abc'}
 | 
			
		||||
  )
 | 
			
		||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								@ -0,0 +1,74 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
import hashlib
 | 
			
		||||
import os
 | 
			
		||||
import struct
 | 
			
		||||
import sys
 | 
			
		||||
from recipe_engine import recipe_test_api
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
 | 
			
		||||
  def output_json(self, root, first_sln, revision_mapping, git_mode,
 | 
			
		||||
                  force=False, fail_patch=False, output_manifest=False,
 | 
			
		||||
                  fixed_revisions=None):
 | 
			
		||||
    """Deterministically synthesize json.output test data for gclient's
 | 
			
		||||
    --output-json option.
 | 
			
		||||
    """
 | 
			
		||||
    active = True
 | 
			
		||||
 | 
			
		||||
    output = {
 | 
			
		||||
        'did_run': active,
 | 
			
		||||
        'patch_failure': False
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Add in extra json output if active.
 | 
			
		||||
    if active:
 | 
			
		||||
      properties = {
 | 
			
		||||
          property_name: self.gen_revision(project_name, git_mode)
 | 
			
		||||
          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))
 | 
			
		||||
          for project_name, property_name in revision_mapping.iteritems()
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      output.update({
 | 
			
		||||
          'patch_root': root or first_sln,
 | 
			
		||||
          'root': first_sln,
 | 
			
		||||
          'properties': properties,
 | 
			
		||||
          'step_text': 'Some step text'
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      if output_manifest:
 | 
			
		||||
        output.update({
 | 
			
		||||
          'manifest': {
 | 
			
		||||
            project_name: {
 | 
			
		||||
              'repository': 'https://fake.org/%s.git' % project_name,
 | 
			
		||||
              'revision': self.gen_revision(project_name, git_mode),
 | 
			
		||||
            }
 | 
			
		||||
            for project_name in revision_mapping
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
      if fixed_revisions:
 | 
			
		||||
        output['fixed_revisions'] = fixed_revisions
 | 
			
		||||
 | 
			
		||||
      if fail_patch:
 | 
			
		||||
        output['log_lines'] = [('patch error', 'Patch failed to apply'),]
 | 
			
		||||
        output['patch_failure'] = True
 | 
			
		||||
        output['patch_apply_return_code'] = 1
 | 
			
		||||
        if fail_patch == 'download':
 | 
			
		||||
          output['patch_apply_return_code'] = 3
 | 
			
		||||
    return self.m.json.output(output)
 | 
			
		||||
 | 
			
		||||
  @staticmethod
 | 
			
		||||
  def gen_revision(project, GIT_MODE):
 | 
			
		||||
    """Hash project to bogus deterministic revision values."""
 | 
			
		||||
    h = hashlib.sha1(project)
 | 
			
		||||
    if GIT_MODE:
 | 
			
		||||
      return h.hexdigest()
 | 
			
		||||
    else:
 | 
			
		||||
      return struct.unpack('!I', h.digest()[:4])[0] % 300000
 | 
			
		||||
@ -0,0 +1 @@
 | 
			
		||||
DEPS = []
 | 
			
		||||
@ -0,0 +1,12 @@
 | 
			
		||||
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
"""Entry point for interacting with depot_tools from recipes."""
 | 
			
		||||
 | 
			
		||||
from recipe_engine import recipe_api
 | 
			
		||||
 | 
			
		||||
class DepotToolsApi(recipe_api.RecipeApi):
 | 
			
		||||
  @property
 | 
			
		||||
  def gclient_py(self):
 | 
			
		||||
    return self.package_resource('gclient.py')
 | 
			
		||||
@ -0,0 +1,17 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "--help"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient help"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,14 @@
 | 
			
		||||
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'recipe_engine/python',
 | 
			
		||||
  'depot_tools',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
def RunSteps(api):
 | 
			
		||||
  api.python('gclient help', api.depot_tools.gclient_py, ['--help'])
 | 
			
		||||
 | 
			
		||||
def GenTests(api):
 | 
			
		||||
  yield api.test('basic')
 | 
			
		||||
@ -0,0 +1,10 @@
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'recipe_engine/json',
 | 
			
		||||
  'recipe_engine/path',
 | 
			
		||||
  'recipe_engine/platform',
 | 
			
		||||
  'recipe_engine/properties',
 | 
			
		||||
  'recipe_engine/python',
 | 
			
		||||
  'recipe_engine/step',
 | 
			
		||||
  'hacky_tryserver_detection',
 | 
			
		||||
  'depot_tools',
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,309 @@
 | 
			
		||||
# Copyright 2013 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
from recipe_engine import recipe_api
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class RevisionResolver(object):
 | 
			
		||||
  """Resolves the revision based on build properties."""
 | 
			
		||||
 | 
			
		||||
  def resolve(self, properties):  # pragma: no cover
 | 
			
		||||
    raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class RevisionFallbackChain(RevisionResolver):
 | 
			
		||||
  """Specify that a given project's sync revision follows the fallback chain."""
 | 
			
		||||
  def __init__(self, default=None):
 | 
			
		||||
    self._default = default
 | 
			
		||||
 | 
			
		||||
  def resolve(self, properties):
 | 
			
		||||
    """Resolve the revision via the revision fallback chain.
 | 
			
		||||
 | 
			
		||||
    If the given revision was set using the revision_fallback_chain() function,
 | 
			
		||||
    this function will follow the chain, looking at relevant build properties
 | 
			
		||||
    until it finds one set or reaches the end of the chain and returns the
 | 
			
		||||
    default. If the given revision was not set using revision_fallback_chain(),
 | 
			
		||||
    this function just returns it as-is.
 | 
			
		||||
    """
 | 
			
		||||
    return (properties.get('parent_got_revision') or
 | 
			
		||||
            properties.get('orig_revision') or
 | 
			
		||||
            properties.get('revision') or
 | 
			
		||||
            self._default)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def jsonish_to_python(spec, is_top=False):
 | 
			
		||||
  ret = ''
 | 
			
		||||
  if is_top:  # We're the 'top' level, so treat this dict as a suite.
 | 
			
		||||
    ret = '\n'.join(
 | 
			
		||||
      '%s = %s' % (k, jsonish_to_python(spec[k])) for k in sorted(spec)
 | 
			
		||||
    )
 | 
			
		||||
  else:
 | 
			
		||||
    if isinstance(spec, dict):
 | 
			
		||||
      ret += '{'
 | 
			
		||||
      ret += ', '.join(
 | 
			
		||||
        "%s: %s" % (repr(str(k)), jsonish_to_python(spec[k]))
 | 
			
		||||
        for k in sorted(spec)
 | 
			
		||||
      )
 | 
			
		||||
      ret += '}'
 | 
			
		||||
    elif isinstance(spec, list):
 | 
			
		||||
      ret += '['
 | 
			
		||||
      ret += ', '.join(jsonish_to_python(x) for x in spec)
 | 
			
		||||
      ret += ']'
 | 
			
		||||
    elif isinstance(spec, basestring):
 | 
			
		||||
      ret = repr(str(spec))
 | 
			
		||||
    else:
 | 
			
		||||
      ret = repr(spec)
 | 
			
		||||
  return ret
 | 
			
		||||
 | 
			
		||||
class GclientApi(recipe_api.RecipeApi):
 | 
			
		||||
  # Singleton object to indicate to checkout() that we should run a revert if
 | 
			
		||||
  # we detect that we're on the tryserver.
 | 
			
		||||
  RevertOnTryserver = object()
 | 
			
		||||
 | 
			
		||||
  def __init__(self, **kwargs):
 | 
			
		||||
    super(GclientApi, self).__init__(**kwargs)
 | 
			
		||||
    self.USE_MIRROR = None
 | 
			
		||||
    self._spec_alias = None
 | 
			
		||||
 | 
			
		||||
  def __call__(self, name, cmd, infra_step=True, **kwargs):
 | 
			
		||||
    """Wrapper for easy calling of gclient steps."""
 | 
			
		||||
    assert isinstance(cmd, (list, tuple))
 | 
			
		||||
    prefix = 'gclient '
 | 
			
		||||
    if self.spec_alias:
 | 
			
		||||
      prefix = ('[spec: %s] ' % self.spec_alias) + prefix
 | 
			
		||||
 | 
			
		||||
    return self.m.python(prefix + name,
 | 
			
		||||
                         self.m.depot_tools.gclient_py,
 | 
			
		||||
                         cmd,
 | 
			
		||||
                         infra_step=infra_step,
 | 
			
		||||
                         **kwargs)
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def use_mirror(self):
 | 
			
		||||
    """Indicates if gclient will use mirrors in its configuration."""
 | 
			
		||||
    if self.USE_MIRROR is None:
 | 
			
		||||
      self.USE_MIRROR = self.m.properties.get('use_mirror', True)
 | 
			
		||||
    return self.USE_MIRROR
 | 
			
		||||
 | 
			
		||||
  @use_mirror.setter
 | 
			
		||||
  def use_mirror(self, val):  # pragma: no cover
 | 
			
		||||
    self.USE_MIRROR = val
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def spec_alias(self):
 | 
			
		||||
    """Optional name for the current spec for step naming."""
 | 
			
		||||
    return self._spec_alias
 | 
			
		||||
 | 
			
		||||
  @spec_alias.setter
 | 
			
		||||
  def spec_alias(self, name):
 | 
			
		||||
    self._spec_alias = name
 | 
			
		||||
 | 
			
		||||
  @spec_alias.deleter
 | 
			
		||||
  def spec_alias(self):
 | 
			
		||||
    self._spec_alias = None
 | 
			
		||||
 | 
			
		||||
  def get_config_defaults(self):
 | 
			
		||||
    ret = {
 | 
			
		||||
      'USE_MIRROR': self.use_mirror
 | 
			
		||||
    }
 | 
			
		||||
    ret['CACHE_DIR'] = self.m.path['root'].join('git_cache')
 | 
			
		||||
    return ret
 | 
			
		||||
 | 
			
		||||
  def resolve_revision(self, revision):
 | 
			
		||||
    if hasattr(revision, 'resolve'):
 | 
			
		||||
      return revision.resolve(self.m.properties)
 | 
			
		||||
    return revision
 | 
			
		||||
 | 
			
		||||
  def sync(self, cfg, with_branch_heads=False, **kwargs):
 | 
			
		||||
    revisions = []
 | 
			
		||||
    for i, s in enumerate(cfg.solutions):
 | 
			
		||||
      if s.safesync_url:  # prefer safesync_url in gclient mode
 | 
			
		||||
        continue
 | 
			
		||||
      if i == 0 and s.revision is None:
 | 
			
		||||
        s.revision = RevisionFallbackChain()
 | 
			
		||||
 | 
			
		||||
      if s.revision is not None and s.revision != '':
 | 
			
		||||
        fixed_revision = self.resolve_revision(s.revision)
 | 
			
		||||
        if fixed_revision:
 | 
			
		||||
          revisions.extend(['--revision', '%s@%s' % (s.name, fixed_revision)])
 | 
			
		||||
 | 
			
		||||
    for name, revision in sorted(cfg.revisions.items()):
 | 
			
		||||
      fixed_revision = self.resolve_revision(revision)
 | 
			
		||||
      if fixed_revision:
 | 
			
		||||
        revisions.extend(['--revision', '%s@%s' % (name, fixed_revision)])
 | 
			
		||||
 | 
			
		||||
    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))
 | 
			
		||||
    try:
 | 
			
		||||
      if not cfg.GIT_MODE:
 | 
			
		||||
        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 <slave_name>/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
 | 
			
		||||
      for path, info in data['solutions'].iteritems():
 | 
			
		||||
        # gclient json paths always end with a slash
 | 
			
		||||
        path = path.rstrip('/')
 | 
			
		||||
        if path in cfg.got_revision_mapping:
 | 
			
		||||
          propname = cfg.got_revision_mapping[path]
 | 
			
		||||
          result.presentation.properties[propname] = info['revision']
 | 
			
		||||
 | 
			
		||||
    return result
 | 
			
		||||
 | 
			
		||||
  def inject_parent_got_revision(self, gclient_config=None, override=False):
 | 
			
		||||
    """Match gclient config to build revisions obtained from build_properties.
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
      gclient_config (gclient config object) - The config to manipulate. A value
 | 
			
		||||
        of None manipulates the module's built-in config (self.c).
 | 
			
		||||
      override (bool) - If True, will forcibly set revision and custom_vars
 | 
			
		||||
        even if the config already contains values for them.
 | 
			
		||||
    """
 | 
			
		||||
    cfg = gclient_config or self.c
 | 
			
		||||
 | 
			
		||||
    for prop, custom_var in cfg.parent_got_revision_mapping.iteritems():
 | 
			
		||||
      val = str(self.m.properties.get(prop, ''))
 | 
			
		||||
      # TODO(infra): Fix coverage.
 | 
			
		||||
      if val:  # pragma: no cover
 | 
			
		||||
        # Special case for 'src', inject into solutions[0]
 | 
			
		||||
        if custom_var is None:
 | 
			
		||||
          # This is not covered because we are deprecating this feature and
 | 
			
		||||
          # it is no longer used by the public recipes.
 | 
			
		||||
          if cfg.solutions[0].revision is None or override:  # pragma: no cover
 | 
			
		||||
            cfg.solutions[0].revision = val
 | 
			
		||||
        else:
 | 
			
		||||
          if custom_var not in cfg.solutions[0].custom_vars or override:
 | 
			
		||||
            cfg.solutions[0].custom_vars[custom_var] = val
 | 
			
		||||
 | 
			
		||||
  def checkout(self, gclient_config=None, revert=RevertOnTryserver,
 | 
			
		||||
               inject_parent_got_revision=True, with_branch_heads=False,
 | 
			
		||||
               **kwargs):
 | 
			
		||||
    """Return a step generator function for gclient checkouts."""
 | 
			
		||||
    cfg = gclient_config or self.c
 | 
			
		||||
    assert cfg.complete()
 | 
			
		||||
 | 
			
		||||
    if revert is self.RevertOnTryserver:
 | 
			
		||||
      revert = self.m.hacky_tryserver_detection.is_tryserver
 | 
			
		||||
 | 
			
		||||
    if inject_parent_got_revision:
 | 
			
		||||
      self.inject_parent_got_revision(cfg, override=True)
 | 
			
		||||
 | 
			
		||||
    spec_string = jsonish_to_python(cfg.as_jsonish(), True)
 | 
			
		||||
 | 
			
		||||
    self('setup', ['config', '--spec', spec_string], **kwargs)
 | 
			
		||||
 | 
			
		||||
    sync_step = None
 | 
			
		||||
    try:
 | 
			
		||||
      if not cfg.GIT_MODE:
 | 
			
		||||
        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)
 | 
			
		||||
 | 
			
		||||
    finally:
 | 
			
		||||
      cwd = kwargs.get('cwd', self.m.path['slave_build'])
 | 
			
		||||
      if 'checkout' not in self.m.path:
 | 
			
		||||
        self.m.path['checkout'] = cwd.join(
 | 
			
		||||
          *cfg.solutions[0].name.split(self.m.path.sep))
 | 
			
		||||
 | 
			
		||||
    return sync_step
 | 
			
		||||
 | 
			
		||||
  def revert(self, **kwargs):
 | 
			
		||||
    """Return a gclient_safe_revert step."""
 | 
			
		||||
    # Not directly calling gclient, so don't use self().
 | 
			
		||||
    alias = self.spec_alias
 | 
			
		||||
    prefix = '%sgclient ' % (('[spec: %s] ' % alias) if alias else '')
 | 
			
		||||
 | 
			
		||||
    return self.m.python(prefix + 'revert',
 | 
			
		||||
        self.m.path['build'].join('scripts', 'slave', 'gclient_safe_revert.py'),
 | 
			
		||||
        ['.', self.m.path['depot_tools'].join('gclient',
 | 
			
		||||
                                              platform_ext={'win': '.bat'})],
 | 
			
		||||
        infra_step=True,
 | 
			
		||||
        **kwargs
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
  def runhooks(self, args=None, name='runhooks', **kwargs):
 | 
			
		||||
    args = args or []
 | 
			
		||||
    assert isinstance(args, (list, tuple))
 | 
			
		||||
    return self(
 | 
			
		||||
      name, ['runhooks'] + list(args), infra_step=False, **kwargs)
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def is_blink_mode(self):
 | 
			
		||||
    """ Indicates wether the caller is to use the Blink config rather than the
 | 
			
		||||
    Chromium config. This may happen for one of two reasons:
 | 
			
		||||
    1. The builder is configured to always use TOT Blink. (factory property
 | 
			
		||||
       top_of_tree_blink=True)
 | 
			
		||||
    2. A try job comes in that applies to the Blink tree. (patch_project is
 | 
			
		||||
       blink)
 | 
			
		||||
    """
 | 
			
		||||
    return (
 | 
			
		||||
      self.m.properties.get('top_of_tree_blink') or
 | 
			
		||||
      self.m.properties.get('patch_project') == 'blink')
 | 
			
		||||
 | 
			
		||||
  def break_locks(self):
 | 
			
		||||
    """Remove all index.lock files. If a previous run of git crashed, bot was
 | 
			
		||||
    reset, etc... we might end up with leftover index.lock files.
 | 
			
		||||
    """
 | 
			
		||||
    self.m.python.inline(
 | 
			
		||||
      'cleanup index.lock',
 | 
			
		||||
      """
 | 
			
		||||
        import os, sys
 | 
			
		||||
 | 
			
		||||
        build_path = sys.argv[1]
 | 
			
		||||
        if os.path.exists(build_path):
 | 
			
		||||
          for (path, dir, files) in os.walk(build_path):
 | 
			
		||||
            for cur_file in files:
 | 
			
		||||
              if cur_file.endswith('index.lock'):
 | 
			
		||||
                path_to_file = os.path.join(path, cur_file)
 | 
			
		||||
                print 'deleting %s' % path_to_file
 | 
			
		||||
                os.remove(path_to_file)
 | 
			
		||||
      """,
 | 
			
		||||
      args=[self.m.path['slave_build']],
 | 
			
		||||
      infra_step=True,
 | 
			
		||||
    )
 | 
			
		||||
@ -0,0 +1,80 @@
 | 
			
		||||
# Copyright 2013 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
import types
 | 
			
		||||
 | 
			
		||||
from recipe_engine.config import config_item_context, ConfigGroup, BadConf
 | 
			
		||||
from recipe_engine.config import ConfigList, Dict, Single, Static, Set, List
 | 
			
		||||
 | 
			
		||||
from . import api as gclient_api
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def BaseConfig(USE_MIRROR=True, GIT_MODE=False, CACHE_DIR=None,
 | 
			
		||||
               PATCH_PROJECT=None, BUILDSPEC_VERSION=None,
 | 
			
		||||
               **_kwargs):
 | 
			
		||||
  deps = '.DEPS.git' if GIT_MODE else 'DEPS'
 | 
			
		||||
  cache_dir = str(CACHE_DIR) if GIT_MODE and 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,
 | 
			
		||||
                           hidden=False),
 | 
			
		||||
        managed = Single(bool, empty_val=True, required=False, hidden=False),
 | 
			
		||||
        custom_deps = Dict(value_type=(basestring, types.NoneType)),
 | 
			
		||||
        custom_vars = Dict(value_type=basestring),
 | 
			
		||||
        safesync_url = Single(basestring, required=False),
 | 
			
		||||
 | 
			
		||||
        revision = Single(
 | 
			
		||||
            (basestring, gclient_api.RevisionResolver),
 | 
			
		||||
            required=False, hidden=True),
 | 
			
		||||
      )
 | 
			
		||||
    ),
 | 
			
		||||
    deps_os = Dict(value_type=basestring),
 | 
			
		||||
    hooks = List(basestring),
 | 
			
		||||
    target_os = Set(basestring),
 | 
			
		||||
    target_os_only = Single(bool, empty_val=False, required=False),
 | 
			
		||||
    cache_dir = Static(cache_dir, hidden=False),
 | 
			
		||||
 | 
			
		||||
    # If supplied, use this as the source root (instead of the first solution's
 | 
			
		||||
    # checkout).
 | 
			
		||||
    src_root = Single(basestring, required=False, hidden=True),
 | 
			
		||||
 | 
			
		||||
    # Maps 'solution' -> build_property
 | 
			
		||||
    got_revision_mapping = Dict(hidden=True),
 | 
			
		||||
 | 
			
		||||
    # Addition revisions we want to pass in.  For now theres a duplication
 | 
			
		||||
    # of code here of setting custom vars AND passing in --revision. We hope
 | 
			
		||||
    # to remove custom vars later.
 | 
			
		||||
    revisions = Dict(
 | 
			
		||||
        value_type=(basestring, gclient_api.RevisionResolver),
 | 
			
		||||
        hidden=True),
 | 
			
		||||
 | 
			
		||||
    # TODO(iannucci): HACK! The use of None here to indicate that we apply this
 | 
			
		||||
    #   to the solution.revision field is really terrible. I mostly blame
 | 
			
		||||
    #   gclient.
 | 
			
		||||
    # Maps 'parent_build_property' -> 'custom_var_name'
 | 
			
		||||
    # Maps 'parent_build_property' -> None
 | 
			
		||||
    # If value is None, the property value will be applied to
 | 
			
		||||
    # solutions[0].revision. Otherwise, it will be applied to
 | 
			
		||||
    # solutions[0].custom_vars['custom_var_name']
 | 
			
		||||
    parent_got_revision_mapping = Dict(hidden=True),
 | 
			
		||||
    delete_unversioned_trees = Single(bool, empty_val=True, required=False),
 | 
			
		||||
 | 
			
		||||
    # Check out refs/branch-heads.
 | 
			
		||||
    # TODO (machenbach): Only implemented for bot_update atm.
 | 
			
		||||
    with_branch_heads = Single(
 | 
			
		||||
        bool,
 | 
			
		||||
        empty_val=False,
 | 
			
		||||
        required=False,
 | 
			
		||||
        hidden=True),
 | 
			
		||||
 | 
			
		||||
    GIT_MODE = Static(bool(GIT_MODE)),
 | 
			
		||||
    USE_MIRROR = Static(bool(USE_MIRROR)),
 | 
			
		||||
    PATCH_PROJECT = Static(str(PATCH_PROJECT), hidden=True),
 | 
			
		||||
    BUILDSPEC_VERSION= Static(BUILDSPEC_VERSION, hidden=True),
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
config_ctx = config_item_context(BaseConfig)
 | 
			
		||||
@ -0,0 +1,157 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "config",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = '[ROOT]/git_cache'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient setup"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "sync",
 | 
			
		||||
      "--verbose",
 | 
			
		||||
      "--with_branch_heads",
 | 
			
		||||
      "--nohooks",
 | 
			
		||||
      "-j8",
 | 
			
		||||
      "--reset",
 | 
			
		||||
      "--force",
 | 
			
		||||
      "--upstream",
 | 
			
		||||
      "--no-nag-max",
 | 
			
		||||
      "--delete_unversioned_trees",
 | 
			
		||||
      "--output-json",
 | 
			
		||||
      "/path/to/tmp/json"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient sync",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@{@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"solutions\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"src/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@}@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@json.output@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "recurse",
 | 
			
		||||
      "git",
 | 
			
		||||
      "config",
 | 
			
		||||
      "user.name",
 | 
			
		||||
      "local_bot"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient recurse (git config user.name)"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "recurse",
 | 
			
		||||
      "git",
 | 
			
		||||
      "config",
 | 
			
		||||
      "user.email",
 | 
			
		||||
      "local_bot@example.com"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient recurse (git config user.email)"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "config",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'WebKit', 'safesync_url': 'https://blink-status.appspot.com/lkgr', 'url': 'svn://svn.chromium.org/blink/trunk'}]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]/src/third_party",
 | 
			
		||||
    "name": "[spec: WebKit] gclient setup"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "sync",
 | 
			
		||||
      "--nohooks",
 | 
			
		||||
      "--force",
 | 
			
		||||
      "--verbose",
 | 
			
		||||
      "--delete_unversioned_trees",
 | 
			
		||||
      "--with_branch_heads",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "third_party/WebKit@123",
 | 
			
		||||
      "--output-json",
 | 
			
		||||
      "/path/to/tmp/json"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]/src/third_party",
 | 
			
		||||
    "name": "[spec: WebKit] gclient sync",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@{@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"solutions\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"WebKit/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": 241198@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"src/blatley/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": 248087@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@}@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@json.output@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_blatley_revision@248087@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "\nimport os, sys\n\nbuild_path = sys.argv[1]\nif os.path.exists(build_path):\n  for (path, dir, files) in os.walk(build_path):\n    for cur_file in files:\n      if cur_file.endswith('index.lock'):\n        path_to_file = os.path.join(path, cur_file)\n        print 'deleting %s' % path_to_file\n        os.remove(path_to_file)\n",
 | 
			
		||||
      "[SLAVE_BUILD]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "cleanup index.lock",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@import os, sys@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@build_path = sys.argv[1]@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@if os.path.exists(build_path):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@  for (path, dir, files) in os.walk(build_path):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@    for cur_file in files:@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@      if cur_file.endswith('index.lock'):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        path_to_file = os.path.join(path, cur_file)@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        print 'deleting %s' % path_to_file@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        os.remove(path_to_file)@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@python.inline@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "runhooks"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient runhooks"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,159 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "config",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = '[ROOT]/git_cache'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient setup"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "sync",
 | 
			
		||||
      "--verbose",
 | 
			
		||||
      "--with_branch_heads",
 | 
			
		||||
      "--nohooks",
 | 
			
		||||
      "-j8",
 | 
			
		||||
      "--reset",
 | 
			
		||||
      "--force",
 | 
			
		||||
      "--upstream",
 | 
			
		||||
      "--no-nag-max",
 | 
			
		||||
      "--delete_unversioned_trees",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@abc",
 | 
			
		||||
      "--output-json",
 | 
			
		||||
      "/path/to/tmp/json"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient sync",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@{@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"solutions\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"src/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@}@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@json.output@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "recurse",
 | 
			
		||||
      "git",
 | 
			
		||||
      "config",
 | 
			
		||||
      "user.name",
 | 
			
		||||
      "local_bot"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient recurse (git config user.name)"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "recurse",
 | 
			
		||||
      "git",
 | 
			
		||||
      "config",
 | 
			
		||||
      "user.email",
 | 
			
		||||
      "local_bot@example.com"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient recurse (git config user.email)"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "config",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'WebKit', 'safesync_url': 'https://blink-status.appspot.com/lkgr', 'url': 'svn://svn.chromium.org/blink/trunk'}]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]/src/third_party",
 | 
			
		||||
    "name": "[spec: WebKit] gclient setup"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "sync",
 | 
			
		||||
      "--nohooks",
 | 
			
		||||
      "--force",
 | 
			
		||||
      "--verbose",
 | 
			
		||||
      "--delete_unversioned_trees",
 | 
			
		||||
      "--with_branch_heads",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "third_party/WebKit@123",
 | 
			
		||||
      "--output-json",
 | 
			
		||||
      "/path/to/tmp/json"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]/src/third_party",
 | 
			
		||||
    "name": "[spec: WebKit] gclient sync",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@{@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"solutions\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"WebKit/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": 241198@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"src/blatley/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": 248087@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@}@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@json.output@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_blatley_revision@248087@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "\nimport os, sys\n\nbuild_path = sys.argv[1]\nif os.path.exists(build_path):\n  for (path, dir, files) in os.walk(build_path):\n    for cur_file in files:\n      if cur_file.endswith('index.lock'):\n        path_to_file = os.path.join(path, cur_file)\n        print 'deleting %s' % path_to_file\n        os.remove(path_to_file)\n",
 | 
			
		||||
      "[SLAVE_BUILD]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "cleanup index.lock",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@import os, sys@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@build_path = sys.argv[1]@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@if os.path.exists(build_path):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@  for (path, dir, files) in os.walk(build_path):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@    for cur_file in files:@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@      if cur_file.endswith('index.lock'):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        path_to_file = os.path.join(path, cur_file)@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        print 'deleting %s' % path_to_file@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        os.remove(path_to_file)@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@python.inline@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "runhooks"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient runhooks"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,170 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "config",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = '[ROOT]/git_cache'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient setup"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "sync",
 | 
			
		||||
      "--verbose",
 | 
			
		||||
      "--with_branch_heads",
 | 
			
		||||
      "--nohooks",
 | 
			
		||||
      "-j8",
 | 
			
		||||
      "--reset",
 | 
			
		||||
      "--force",
 | 
			
		||||
      "--upstream",
 | 
			
		||||
      "--no-nag-max",
 | 
			
		||||
      "--delete_unversioned_trees",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "src@HEAD",
 | 
			
		||||
      "--output-json",
 | 
			
		||||
      "/path/to/tmp/json"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient sync",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@{@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"solutions\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"src/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@}@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@json.output@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "recurse",
 | 
			
		||||
      "git",
 | 
			
		||||
      "config",
 | 
			
		||||
      "user.name",
 | 
			
		||||
      "local_bot"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient recurse (git config user.name)"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "recurse",
 | 
			
		||||
      "git",
 | 
			
		||||
      "config",
 | 
			
		||||
      "user.email",
 | 
			
		||||
      "local_bot@example.com"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient recurse (git config user.email)"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "config",
 | 
			
		||||
      "--spec",
 | 
			
		||||
      "cache_dir = None\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'WebKit', 'safesync_url': 'https://blink-status.appspot.com/lkgr', 'url': 'svn://svn.chromium.org/blink/trunk'}]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]/src/third_party",
 | 
			
		||||
    "name": "[spec: WebKit] gclient setup"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "[BUILD]/scripts/slave/gclient_safe_revert.py",
 | 
			
		||||
      ".",
 | 
			
		||||
      "[DEPOT_TOOLS]/gclient"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]/src/third_party",
 | 
			
		||||
    "name": "[spec: WebKit] gclient revert"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "sync",
 | 
			
		||||
      "--nohooks",
 | 
			
		||||
      "--force",
 | 
			
		||||
      "--verbose",
 | 
			
		||||
      "--delete_unversioned_trees",
 | 
			
		||||
      "--with_branch_heads",
 | 
			
		||||
      "--revision",
 | 
			
		||||
      "third_party/WebKit@123",
 | 
			
		||||
      "--output-json",
 | 
			
		||||
      "/path/to/tmp/json"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]/src/third_party",
 | 
			
		||||
    "name": "[spec: WebKit] gclient sync",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@{@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  \"solutions\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"WebKit/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": 241198@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }, @@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    \"src/blatley/\": {@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@      \"revision\": 248087@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@    }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@  }@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@json.output@}@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@json.output@@@",
 | 
			
		||||
      "@@@SET_BUILD_PROPERTY@got_blatley_revision@248087@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "\nimport os, sys\n\nbuild_path = sys.argv[1]\nif os.path.exists(build_path):\n  for (path, dir, files) in os.walk(build_path):\n    for cur_file in files:\n      if cur_file.endswith('index.lock'):\n        path_to_file = os.path.join(path, cur_file)\n        print 'deleting %s' % path_to_file\n        os.remove(path_to_file)\n",
 | 
			
		||||
      "[SLAVE_BUILD]"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "cleanup index.lock",
 | 
			
		||||
    "~followup_annotations": [
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@import os, sys@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@build_path = sys.argv[1]@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@if os.path.exists(build_path):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@  for (path, dir, files) in os.walk(build_path):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@    for cur_file in files:@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@      if cur_file.endswith('index.lock'):@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        path_to_file = os.path.join(path, cur_file)@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        print 'deleting %s' % path_to_file@@@",
 | 
			
		||||
      "@@@STEP_LOG_LINE@python.inline@        os.remove(path_to_file)@@@",
 | 
			
		||||
      "@@@STEP_LOG_END@python.inline@@@"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "python",
 | 
			
		||||
      "-u",
 | 
			
		||||
      "RECIPE_PACKAGE[depot_tools]/gclient.py",
 | 
			
		||||
      "runhooks"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "gclient runhooks"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,51 @@
 | 
			
		||||
# Copyright 2013 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'gclient',
 | 
			
		||||
  'recipe_engine/path',
 | 
			
		||||
  'recipe_engine/properties',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
def RunSteps(api):
 | 
			
		||||
  src_cfg = api.gclient.make_config(GIT_MODE=True)
 | 
			
		||||
  soln = src_cfg.solutions.add()
 | 
			
		||||
  soln.name = 'src'
 | 
			
		||||
  soln.url = 'https://chromium.googlesource.com/chromium/src.git'
 | 
			
		||||
  soln.revision = api.properties.get('revision')
 | 
			
		||||
  src_cfg.parent_got_revision_mapping['parent_got_revision'] = 'got_revision'
 | 
			
		||||
  api.gclient.c = src_cfg
 | 
			
		||||
  api.gclient.checkout()
 | 
			
		||||
 | 
			
		||||
  api.gclient.spec_alias = 'WebKit'
 | 
			
		||||
  bl_cfg = api.gclient.make_config()
 | 
			
		||||
  soln = bl_cfg.solutions.add()
 | 
			
		||||
  soln.name = 'WebKit'
 | 
			
		||||
  soln.url = 'svn://svn.chromium.org/blink/trunk'
 | 
			
		||||
  bl_cfg.revisions['third_party/WebKit'] = '123'
 | 
			
		||||
 | 
			
		||||
  # Use safesync url for lkgr.
 | 
			
		||||
  soln.safesync_url = 'https://blink-status.appspot.com/lkgr'
 | 
			
		||||
 | 
			
		||||
  bl_cfg.got_revision_mapping['src/blatley'] = 'got_blatley_revision'
 | 
			
		||||
  api.gclient.checkout(
 | 
			
		||||
      gclient_config=bl_cfg,
 | 
			
		||||
      with_branch_heads=True,
 | 
			
		||||
      cwd=api.path['slave_build'].join('src', 'third_party'))
 | 
			
		||||
 | 
			
		||||
  api.gclient.break_locks()
 | 
			
		||||
 | 
			
		||||
  del api.gclient.spec_alias
 | 
			
		||||
 | 
			
		||||
  api.gclient.runhooks()
 | 
			
		||||
 | 
			
		||||
  assert not api.gclient.is_blink_mode
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def GenTests(api):
 | 
			
		||||
  yield api.test('basic')
 | 
			
		||||
 | 
			
		||||
  yield api.test('revision') + api.properties(revision='abc')
 | 
			
		||||
 | 
			
		||||
  yield api.test('tryserver') + api.properties.tryserver()
 | 
			
		||||
@ -0,0 +1,37 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
import hashlib
 | 
			
		||||
 | 
			
		||||
from recipe_engine import recipe_test_api
 | 
			
		||||
 | 
			
		||||
class GclientTestApi(recipe_test_api.RecipeTestApi):
 | 
			
		||||
  def output_json(self, projects, git_mode=False):
 | 
			
		||||
    """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
 | 
			
		||||
    # gen_revision(project), but if parent_got_revision and its ilk are
 | 
			
		||||
    # specified, we should use those values instead.
 | 
			
		||||
    return self.m.json.output({
 | 
			
		||||
      'solutions': dict(
 | 
			
		||||
        (p+'/', {'revision': self.gen_revision(p, git_mode)})
 | 
			
		||||
        for p in projects
 | 
			
		||||
      )
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
  @staticmethod
 | 
			
		||||
  def gen_revision(project, GIT_MODE):
 | 
			
		||||
    """Hash project to bogus deterministic revision values."""
 | 
			
		||||
    h = hashlib.sha1(project)
 | 
			
		||||
    if GIT_MODE:
 | 
			
		||||
      return h.hexdigest()
 | 
			
		||||
    else:
 | 
			
		||||
      import struct
 | 
			
		||||
      return struct.unpack('!I', h.digest()[:4])[0] % 300000
 | 
			
		||||
@ -0,0 +1,7 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'recipe_engine/properties',
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,46 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
from recipe_engine import recipe_api
 | 
			
		||||
 | 
			
		||||
PATCH_STORAGE_GIT = 'git'
 | 
			
		||||
 | 
			
		||||
class HackyTryserverDetectionApi(recipe_api.RecipeApi):
 | 
			
		||||
  @property
 | 
			
		||||
  def patch_url(self):
 | 
			
		||||
    """Reads patch_url property and corrects it if needed."""
 | 
			
		||||
    url = self.m.properties.get('patch_url')
 | 
			
		||||
    return url
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def is_tryserver(self):
 | 
			
		||||
    """Returns true iff we can apply_issue or patch."""
 | 
			
		||||
    return (self.can_apply_issue or self.is_patch_in_svn or
 | 
			
		||||
            self.is_patch_in_git or self.is_gerrit_issue)
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def can_apply_issue(self):
 | 
			
		||||
    """Returns true iff the properties exist to apply_issue from rietveld."""
 | 
			
		||||
    return (self.m.properties.get('rietveld')
 | 
			
		||||
            and 'issue' in self.m.properties
 | 
			
		||||
            and 'patchset' in self.m.properties)
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def is_gerrit_issue(self):
 | 
			
		||||
    """Returns true iff the properties exist to match a Gerrit issue."""
 | 
			
		||||
    return ('event.patchSet.ref' in self.m.properties and
 | 
			
		||||
            'event.change.url' in self.m.properties and
 | 
			
		||||
            'event.change.id' in self.m.properties)
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def is_patch_in_svn(self):
 | 
			
		||||
    """Returns true iff the properties exist to patch from a patch URL."""
 | 
			
		||||
    return self.patch_url
 | 
			
		||||
 | 
			
		||||
  @property
 | 
			
		||||
  def is_patch_in_git(self):
 | 
			
		||||
    return (self.m.properties.get('patch_storage') == PATCH_STORAGE_GIT and
 | 
			
		||||
            self.m.properties.get('patch_repo_url') and
 | 
			
		||||
            self.m.properties.get('patch_ref'))
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,15 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmd": [
 | 
			
		||||
      "echo",
 | 
			
		||||
      "False"
 | 
			
		||||
    ],
 | 
			
		||||
    "cwd": "[SLAVE_BUILD]",
 | 
			
		||||
    "name": "am i a tryserver?"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,17 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'recipe_engine/step',
 | 
			
		||||
  'hacky_tryserver_detection',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def RunSteps(api):
 | 
			
		||||
  api.step(
 | 
			
		||||
      "am i a tryserver?", ['echo', api.hacky_tryserver_detection.is_tryserver])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def GenTests(api):
 | 
			
		||||
  yield api.test('basic')
 | 
			
		||||
@ -0,0 +1,4 @@
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'recipe_engine/path',
 | 
			
		||||
  'recipe_engine/properties',
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,45 @@
 | 
			
		||||
# Copyright 2013 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
import urlparse
 | 
			
		||||
 | 
			
		||||
from recipe_engine import recipe_api
 | 
			
		||||
 | 
			
		||||
class RietveldApi(recipe_api.RecipeApi):
 | 
			
		||||
  def calculate_issue_root(self, extra_patch_project_roots=None):
 | 
			
		||||
    """Returns path where a patch should be applied to based on "patch_project".
 | 
			
		||||
 | 
			
		||||
    Maps Rietveld's "patch_project" to a path of directories relative to
 | 
			
		||||
    api.gclient.c.solutions[0].name which describe where to place the patch.
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
      extra_patch_project_roots: Dict mapping project names to relative roots.
 | 
			
		||||
 | 
			
		||||
    Returns:
 | 
			
		||||
      Relative path or empty string if patch_project is not set or path for a
 | 
			
		||||
      given is unknown.
 | 
			
		||||
    """
 | 
			
		||||
    # Property 'patch_project' is set by Rietveld, 'project' is set by git-try
 | 
			
		||||
    # when TRYSERVER_PROJECT is present in codereview.settings.
 | 
			
		||||
    patch_project = (self.m.properties.get('patch_project') or
 | 
			
		||||
                     self.m.properties.get('project'))
 | 
			
		||||
 | 
			
		||||
    # Please avoid adding projects into this hard-coded list unless your project
 | 
			
		||||
    # CLs are being run by multiple recipes. Instead pass patch_project_roots to
 | 
			
		||||
    # ensure_checkout.
 | 
			
		||||
    patch_project_roots = {
 | 
			
		||||
      'angle/angle': ['third_party', 'angle'],
 | 
			
		||||
      'blink': ['third_party', 'WebKit'],
 | 
			
		||||
      'v8': ['v8'],
 | 
			
		||||
      'luci-py': ['luci'],
 | 
			
		||||
      'recipes-py': ['recipes-py'],
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Make sure to update common projects (above) with extra projects (and not
 | 
			
		||||
    # vice versa, so that recipes can override default values if needed.
 | 
			
		||||
    if extra_patch_project_roots:
 | 
			
		||||
      patch_project_roots.update(extra_patch_project_roots)
 | 
			
		||||
 | 
			
		||||
    path_parts = patch_project_roots.get(patch_project)
 | 
			
		||||
    return self.m.path.join(*path_parts) if path_parts else ''
 | 
			
		||||
@ -0,0 +1,7 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "name": "$result",
 | 
			
		||||
    "recipe_result": null,
 | 
			
		||||
    "status_code": 0
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,16 @@
 | 
			
		||||
# Copyright 2014 The Chromium Authors. All rights reserved.
 | 
			
		||||
# Use of this source code is governed by a BSD-style license that can be
 | 
			
		||||
# found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
DEPS = [
 | 
			
		||||
  'recipe_engine/path',
 | 
			
		||||
  'rietveld',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
def RunSteps(api):
 | 
			
		||||
  api.path['checkout'] = api.path['slave_build']
 | 
			
		||||
  api.rietveld.calculate_issue_root({'project': ['']})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def GenTests(api):
 | 
			
		||||
  yield api.test('basic')
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue