| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Recipe to build windows depot_tools bootstrap zipfile.""" | 5 """Recipe to build windows depot_tools bootstrap zipfile.""" |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'recipe_engine/path', | 8 'recipe_engine/path', |
| 9 'recipe_engine/platform', | 9 'recipe_engine/platform', |
| 10 'recipe_engine/properties', | 10 'recipe_engine/properties', |
| 11 'recipe_engine/step', | 11 'recipe_engine/step', |
| 12 | 12 |
| 13 'depot_tools/git', | 13 'depot_tools/git', |
| 14 | 14 |
| 15 'file', | 15 'file', |
| 16 'gsutil', | 16 'gsutil', |
| 17 'zip', | 17 'zip', |
| 18 ] | 18 ] |
| 19 | 19 |
| 20 from recipe_engine.recipe_api import Property | 20 from recipe_engine.recipe_api import Property |
| 21 | 21 |
| 22 REPO_URL='https://chromium.googlesource.com/chromium/tools/depot_tools.git' | 22 REPO_URL='https://chromium.googlesource.com/chromium/tools/depot_tools.git' |
| 23 DOC_UPLOAD_URL='gs://chrome-infra-docs/flat/depot_tools/docs/' |
| 23 | 24 |
| 24 PROPERTIES = { | 25 PROPERTIES = { |
| 25 'revision': Property( | 26 'revision': Property( |
| 26 kind=str, help='The revision of depot_tools to check out'), | 27 kind=str, help='The revision of depot_tools to check out'), |
| 27 } | 28 } |
| 28 | 29 |
| 29 def RunSteps(api, revision): | 30 def RunSteps(api, revision): |
| 30 # prepare the output dir and zip paths | 31 # prepare the output dir and zip paths |
| 31 api.path['checkout'] = api.path['slave_build'].join('depot_tools') | 32 api.path['checkout'] = api.path['slave_build'].join('depot_tools') |
| 32 zip_out = api.path['slave_build'].join('depot_tools.zip') | 33 zip_out = api.path['slave_build'].join('depot_tools.zip') |
| 33 | 34 |
| 34 # clean up any previous stuff | 35 with api.step.nest('clean workspace'): |
| 35 api.file.rmtree('rm depot_tools', api.path['checkout']) | 36 api.file.rmtree('rm depot_tools', api.path['checkout']) |
| 36 api.file.remove('rm depot_tools.zip', zip_out, ok_ret=(0, 1)) | 37 api.file.remove('rm depot_tools.zip', zip_out, ok_ret=(0, 1)) |
| 37 | 38 |
| 38 # generate the new directory | 39 # generate the new directory |
| 39 api.step('mk depot_tools', ['mkdir', api.path['checkout']]) | 40 api.step('mk depot_tools', ['mkdir', api.path['checkout']]) |
| 40 | 41 |
| 41 # clone + checkout depot_tools | 42 with api.step.nest('clone + checkout'): |
| 42 api.git('clone', '--single-branch', '-n', REPO_URL, api.path['checkout']) | 43 api.git('clone', '--single-branch', '-n', REPO_URL, api.path['checkout']) |
| 43 api.git('config', 'core.autocrlf', 'false', name='set autocrlf') | 44 api.git('config', 'core.autocrlf', 'false', name='set autocrlf') |
| 44 api.git('config', 'core.filemode', 'false', name='set filemode') | 45 api.git('config', 'core.filemode', 'false', name='set filemode') |
| 45 api.git('config', 'core.symlinks', 'false', name='set symlinks') | 46 api.git('config', 'core.symlinks', 'false', name='set symlinks') |
| 46 api.git('checkout', 'origin/master') | 47 api.git('checkout', 'origin/master') |
| 47 api.git('reset', '--hard', revision) | 48 api.git('reset', '--hard', revision) |
| 48 api.git('reflog', 'expire', '--all') | 49 api.git('reflog', 'expire', '--all') |
| 49 api.git('gc', '--aggressive', '--prune=all') | 50 api.git('gc', '--aggressive', '--prune=all') |
| 50 | 51 |
| 51 # zip + upload repo | 52 # zip + upload repo |
| 52 api.zip.directory('zip it up', api.path['checkout'], zip_out) | 53 api.zip.directory('zip it up', api.path['checkout'], zip_out) |
| 53 api.gsutil.upload(zip_out, 'chrome-infra', 'depot_tools.zip', | 54 api.gsutil.upload(zip_out, 'chrome-infra', 'depot_tools.zip', |
| 54 args=['-a', 'public-read'], unauthenticated_url=True) | 55 args=['-a', 'public-read'], unauthenticated_url=True) |
| 55 | 56 |
| 56 # upload html docs | 57 # upload html docs |
| 57 api.gsutil(['cp', '-r', '-z', 'html', '-a', 'public-read', | 58 api.gsutil(['cp', '-r', '-z', 'html', '-a', 'public-read', |
| 58 api.path['checkout'].join('man', 'html'), | 59 api.path['checkout'].join('man', 'html'), DOC_UPLOAD_URL], |
| 59 'gs://chrome-infra-docs/flat/depot_tools/docs/'], | |
| 60 name='upload docs') | 60 name='upload docs') |
| 61 | 61 |
| 62 | 62 |
| 63 def GenTests(api): | 63 def GenTests(api): |
| 64 yield api.test('basic') + api.properties(revision='deadbeef') | 64 yield api.test('basic') + api.properties(revision='deadbeef') |
| OLD | NEW |