| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 """Create a CL to update the SKP version.""" | |
| 6 | |
| 7 | |
| 8 import os | |
| 9 import sys | |
| 10 | |
| 11 from build_step import BuildStep | |
| 12 from config_private import SKIA_GIT_URL | |
| 13 from py.utils.git_utils import GIT | |
| 14 from py.utils import git_utils | |
| 15 from py.utils import misc | |
| 16 from py.utils import shell_utils | |
| 17 | |
| 18 | |
| 19 CHROMIUM_SKIA = 'https://chromium.googlesource.com/skia.git' | |
| 20 COMMIT_MSG = '''Update SKP version to %s | |
| 21 | |
| 22 Automatic commit by the RecreateSKPs bot. | |
| 23 | |
| 24 TBR= | |
| 25 ''' | |
| 26 PATH_TO_SKIA = os.path.join('third_party', 'skia') | |
| 27 SKIA_COMMITTER_EMAIL = 'borenet@google.com' | |
| 28 SKIA_COMMITTER_NAME = 'Eric Boren' | |
| 29 | |
| 30 class UpdateSkpVersion(BuildStep): | |
| 31 def __init__(self, timeout=28800, **kwargs): | |
| 32 super(UpdateSkpVersion, self).__init__(timeout=timeout, **kwargs) | |
| 33 | |
| 34 def _Run(self): | |
| 35 with misc.ChDir(PATH_TO_SKIA): | |
| 36 shell_utils.run([GIT, 'config', '--local', 'user.name', | |
| 37 SKIA_COMMITTER_NAME]) | |
| 38 shell_utils.run([GIT, 'config', '--local', 'user.email', | |
| 39 SKIA_COMMITTER_EMAIL]) | |
| 40 if CHROMIUM_SKIA in shell_utils.run([GIT, 'remote', '-v']): | |
| 41 shell_utils.run([GIT, 'remote', 'set-url', 'origin', SKIA_GIT_URL, | |
| 42 CHROMIUM_SKIA]) | |
| 43 | |
| 44 version_file = 'SKP_VERSION' | |
| 45 skp_version = self._args.get('skp_version') | |
| 46 with git_utils.GitBranch(branch_name='update_skp_version', | |
| 47 commit_msg=COMMIT_MSG % skp_version, | |
| 48 commit_queue=not self._is_try): | |
| 49 | |
| 50 # First, upload a version of the CL with just the SKP version changed. | |
| 51 with open(version_file, 'w') as f: | |
| 52 f.write(skp_version) | |
| 53 | |
| 54 | |
| 55 if '__main__' == __name__: | |
| 56 sys.exit(BuildStep.RunBuildStep(UpdateSkpVersion)) | |
| OLD | NEW |