blob: 8d76b801dca7758d50fbd863f92b1eec6c796104 [file] [log] [blame]
borenet1ed2ae42016-07-26 11:52:17 -07001# Copyright 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
8import argparse
9import os
10import subprocess
11import sys
12
13sys.path.insert(0, os.path.join(os.getcwd(), 'common'))
14# pylint:disable=F0401
15from py.utils import git_utils
16
17
18
19CHROMIUM_SKIA = 'https://chromium.googlesource.com/skia.git'
20COMMIT_MSG = '''Update SKP version
21
22Automatic commit by the RecreateSKPs bot.
23
24TBR=
25NO_MERGE_BUILDS
26'''
27SKIA_COMMITTER_EMAIL = 'skia.buildbots@gmail.com'
28SKIA_COMMITTER_NAME = 'skia.buildbots'
29SKIA_REPO = 'https://skia.googlesource.com/skia.git'
30
31
32def main(target_dir):
33 subprocess.check_call(['git', 'config', '--local', 'user.name',
34 SKIA_COMMITTER_NAME])
35 subprocess.check_call(['git', 'config', '--local', 'user.email',
36 SKIA_COMMITTER_EMAIL])
37 if CHROMIUM_SKIA in subprocess.check_output(['git', 'remote', '-v']):
38 subprocess.check_call(['git', 'remote', 'set-url', 'origin', SKIA_REPO,
39 CHROMIUM_SKIA])
40
41 # Download CIPD.
42 cipd_sha1 = os.path.join(os.getcwd(), 'infra', 'bots', 'tools', 'luci-go',
43 'linux64', 'cipd.sha1')
44 subprocess.check_call(['download_from_google_storage', '-s', cipd_sha1,
45 '--bucket', 'chromium-luci'])
46
47 with git_utils.GitBranch(branch_name='update_skp_version',
48 commit_msg=COMMIT_MSG,
49 commit_queue=True):
50 upload_script = os.path.join(
51 os.getcwd(), 'infra', 'bots', 'assets', 'skp', 'upload.py')
52 subprocess.check_call(['python', upload_script, '-t', target_dir])
53
54
55if '__main__' == __name__:
56 parser = argparse.ArgumentParser()
57 parser.add_argument("--target_dir")
58 args = parser.parse_args()
59 main(args.target_dir)