OLD | NEW |
1 #!/usr/bin/python2 | 1 #!/usr/bin/python2 |
2 | 2 |
3 # Copyright 2014 Google Inc. | 3 # Copyright 2014 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 """Skia's Chromium DEPS roll script. | 8 """Skia's Chromium DEPS roll script. |
9 | 9 |
10 This script: | 10 This script: |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 import optparse | 24 import optparse |
25 import os | 25 import os |
26 import re | 26 import re |
27 import shutil | 27 import shutil |
28 import subprocess | 28 import subprocess |
29 import sys | 29 import sys |
30 import tempfile | 30 import tempfile |
31 | 31 |
32 | 32 |
| 33 DEFAULT_BOTS_LIST = [ |
| 34 'android_clang_dbg', |
| 35 'android_dbg', |
| 36 'android_rel', |
| 37 'cros_daisy', |
| 38 'linux', |
| 39 'linux_asan', |
| 40 'linux_chromeos', |
| 41 'linux_chromeos_asan', |
| 42 'linux_gpu', |
| 43 'linux_layout', |
| 44 'linux_layout_rel', |
| 45 'mac', |
| 46 'mac_asan', |
| 47 'mac_gpu', |
| 48 'mac_layout', |
| 49 'mac_layout_rel', |
| 50 'win', |
| 51 'win_gpu', |
| 52 'win_layout', |
| 53 'win_layout_rel', |
| 54 ] |
| 55 |
| 56 |
33 class DepsRollConfig(object): | 57 class DepsRollConfig(object): |
34 """Contains configuration options for this module. | 58 """Contains configuration options for this module. |
35 | 59 |
36 Attributes: | 60 Attributes: |
37 git: (string) The git executable. | 61 git: (string) The git executable. |
38 chromium_path: (string) path to a local chromium git repository. | 62 chromium_path: (string) path to a local chromium git repository. |
39 save_branches: (boolean) iff false, delete temporary branches. | 63 save_branches: (boolean) iff false, delete temporary branches. |
40 verbose: (boolean) iff false, suppress the output from git-cl. | 64 verbose: (boolean) iff false, suppress the output from git-cl. |
41 search_depth: (int) how far back to look for the revision. | 65 search_depth: (int) how far back to look for the revision. |
42 skia_url: (string) Skia's git repository. | 66 skia_url: (string) Skia's git repository. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 @staticmethod | 101 @staticmethod |
78 def GetOptionParser(): | 102 def GetOptionParser(): |
79 # pylint: disable=I0011,C0103 | 103 # pylint: disable=I0011,C0103 |
80 """Returns an optparse.OptionParser object. | 104 """Returns an optparse.OptionParser object. |
81 | 105 |
82 Returns: | 106 Returns: |
83 An optparse.OptionParser object. | 107 An optparse.OptionParser object. |
84 | 108 |
85 Called by the main() function. | 109 Called by the main() function. |
86 """ | 110 """ |
87 default_bots_list = [ | |
88 'android_clang_dbg', | |
89 'android_dbg', | |
90 'android_rel', | |
91 'cros_daisy', | |
92 'linux', | |
93 'linux_asan', | |
94 'linux_chromeos', | |
95 'linux_chromeos_asan', | |
96 'linux_gpu', | |
97 'linux_layout', | |
98 'linux_layout_rel', | |
99 'mac', | |
100 'mac_asan', | |
101 'mac_gpu', | |
102 'mac_layout', | |
103 'mac_layout_rel', | |
104 'win', | |
105 'win_gpu', | |
106 'win_layout', | |
107 'win_layout_rel', | |
108 ] | |
109 | |
110 option_parser = optparse.OptionParser(usage=__doc__) | 111 option_parser = optparse.OptionParser(usage=__doc__) |
111 # Anyone using this script on a regular basis should set the | 112 # Anyone using this script on a regular basis should set the |
112 # CHROMIUM_CHECKOUT_PATH environment variable. | 113 # CHROMIUM_CHECKOUT_PATH environment variable. |
113 option_parser.add_option( | 114 option_parser.add_option( |
114 '-c', '--chromium_path', help='Path to local Chromium Git' | 115 '-c', '--chromium_path', help='Path to local Chromium Git' |
115 ' repository checkout, defaults to CHROMIUM_CHECKOUT_PATH' | 116 ' repository checkout, defaults to CHROMIUM_CHECKOUT_PATH' |
116 ' if that environment variable is set.', | 117 ' if that environment variable is set.', |
117 default=os.environ.get('CHROMIUM_CHECKOUT_PATH')) | 118 default=os.environ.get('CHROMIUM_CHECKOUT_PATH')) |
118 option_parser.add_option( | 119 option_parser.add_option( |
119 '-r', '--revision', type='int', default=None, | 120 '-r', '--revision', type='int', default=None, |
(...skipping 23 matching lines...) Expand all Loading... |
143 '', '--verbose', help='Do not suppress the output from `git cl`.', | 144 '', '--verbose', help='Do not suppress the output from `git cl`.', |
144 action='store_true', dest='verbose', default=False) | 145 action='store_true', dest='verbose', default=False) |
145 option_parser.add_option( | 146 option_parser.add_option( |
146 '', '--skip_cl_upload', help='Skip the cl upload step; useful' | 147 '', '--skip_cl_upload', help='Skip the cl upload step; useful' |
147 ' for testing or with --save_branches.', | 148 ' for testing or with --save_branches.', |
148 action='store_true', default=False) | 149 action='store_true', default=False) |
149 | 150 |
150 default_bots_help = ( | 151 default_bots_help = ( |
151 'Comma-separated list of bots, defaults to a list of %d bots.' | 152 'Comma-separated list of bots, defaults to a list of %d bots.' |
152 ' To skip `git cl try`, set this to an empty string.' | 153 ' To skip `git cl try`, set this to an empty string.' |
153 % len(default_bots_list)) | 154 % len(DEFAULT_BOTS_LIST)) |
154 default_bots = ','.join(default_bots_list) | 155 default_bots = ','.join(DEFAULT_BOTS_LIST) |
155 option_parser.add_option( | 156 option_parser.add_option( |
156 '', '--bots', help=default_bots_help, default=default_bots) | 157 '', '--bots', help=default_bots_help, default=default_bots) |
157 | 158 |
158 return option_parser | 159 return option_parser |
159 | 160 |
160 | 161 |
161 def test_git_executable(git_executable): | 162 def test_git_executable(git_executable): |
162 """Test the git executable. | 163 """Test the git executable. |
163 | 164 |
164 Args: | 165 Args: |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 if not test_git_executable(options.git_path): | 815 if not test_git_executable(options.git_path): |
815 option_parser.error('Invalid git executable.') | 816 option_parser.error('Invalid git executable.') |
816 | 817 |
817 config = DepsRollConfig(options) | 818 config = DepsRollConfig(options) |
818 find_hash_and_roll_deps(config, options.revision, options.git_hash) | 819 find_hash_and_roll_deps(config, options.revision, options.git_hash) |
819 | 820 |
820 | 821 |
821 if __name__ == '__main__': | 822 if __name__ == '__main__': |
822 main(sys.argv[1:]) | 823 main(sys.argv[1:]) |
823 | 824 |
OLD | NEW |