Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: tools/bisect_utils.py

Issue 14265008: Delete webkit directory on initial sync as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/bisect-perf-regression.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 """Set of operations/utilities related to checking out the depot, and 5 """Set of operations/utilities related to checking out the depot, and
6 outputting annotations on the buildbot waterfall. These are intended to be 6 outputting annotations on the buildbot waterfall. These are intended to be
7 used by the bisection scripts.""" 7 used by the bisection scripts."""
8 8
9 import errno 9 import errno
10 import os 10 import os
11 import shutil
11 import subprocess 12 import subprocess
12 13
13 14
14 GCLIENT_SPEC = """ 15 GCLIENT_SPEC = """
15 solutions = [ 16 solutions = [
16 { "name" : "src", 17 { "name" : "src",
17 "url" : "https://chromium.googlesource.com/chromium/src.git", 18 "url" : "https://chromium.googlesource.com/chromium/src.git",
18 "deps_file" : ".DEPS.git", 19 "deps_file" : ".DEPS.git",
19 "managed" : True, 20 "managed" : True,
20 "custom_deps" : { 21 "custom_deps" : {
21 "src/data/page_cycler": "https://chrome-internal.googlesource.com/" + 22 "src/data/page_cycler": "https://chrome-internal.googlesource.com/" +
22 "chrome/data/page_cycler/.git", 23 "chrome/data/page_cycler/.git",
23 "src/tools/perf/data": "https://chrome-internal.googlesource.com/" + 24 "src/tools/perf/data": "https://chrome-internal.googlesource.com/" +
24 "chrome/tools/perf/data/.git", 25 "chrome/tools/perf/data/.git",
25 "src/v8_bleeding_edge": "git://github.com/v8/v8.git", 26 "src/v8_bleeding_edge": "git://github.com/v8/v8.git",
26 }, 27 },
27 "safesync_url": "", 28 "safesync_url": "",
28 }, 29 },
29 ] 30 ]
30 """ 31 """
31 GCLIENT_SPEC = ''.join([l for l in GCLIENT_SPEC.splitlines()]) 32 GCLIENT_SPEC = ''.join([l for l in GCLIENT_SPEC.splitlines()])
33 FILE_DEPS_GIT = '.DEPS.git'
32 34
33 35
34 def OutputAnnotationStepStart(name): 36 def OutputAnnotationStepStart(name):
35 """Outputs appropriate annotation to signal the start of a step to 37 """Outputs appropriate annotation to signal the start of a step to
36 a trybot. 38 a trybot.
37 39
38 Args: 40 Args:
39 name: The name of the step. 41 name: The name of the step.
40 """ 42 """
41 print 43 print
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 """Runs gclient and creates a config containing both src and src-internal. 98 """Runs gclient and creates a config containing both src and src-internal.
97 99
98 Returns: 100 Returns:
99 The return code of the call. 101 The return code of the call.
100 """ 102 """
101 return_code = RunGClient( 103 return_code = RunGClient(
102 ['config', '--spec=%s' % GCLIENT_SPEC, '--git-deps']) 104 ['config', '--spec=%s' % GCLIENT_SPEC, '--git-deps'])
103 return return_code 105 return return_code
104 106
105 107
108 def IsDepsFileBlink():
109 """Reads .DEPS.git and returns whether or not we're using blink.
110
111 Returns:
112 True if blink, false if webkit.
113 """
114 locals = {'Var': lambda _: locals["vars"][_],
115 'From': lambda *args: None}
116 execfile(FILE_DEPS_GIT, {}, locals)
117 return 'blink.git' in locals['vars']['webkit_url']
118
119
120 def RemoveThirdPartyWebkitDirectory():
121 """Removes third_party/WebKit.
122
123 Returns:
124 True on success.
125 """
126 try:
127 path_to_dir = os.path.join(os.getcwd(), 'third_party', 'WebKit')
128 if os.path.exists(path_to_dir):
129 shutil.rmtree(path_to_dir)
130 except OSError, e:
131 if e.errno != errno.ENOENT:
132 return False
133 return True
134
135
106 def RunGClientAndSync(reset): 136 def RunGClientAndSync(reset):
107 """Runs gclient and does a normal sync. 137 """Runs gclient and does a normal sync.
108 138
109 Args: 139 Args:
110 reset: Whether to reset any changes to the depot. 140 reset: Whether to reset any changes to the depot.
111 141
112 Returns: 142 Returns:
113 The return code of the call. 143 The return code of the call.
114 """ 144 """
115 params = ['sync', '--verbose'] 145 params = ['sync', '--verbose']
(...skipping 14 matching lines...) Expand all
130 otherwise. 160 otherwise.
131 """ 161 """
132 name = 'Setting up Bisection Depot' 162 name = 'Setting up Bisection Depot'
133 163
134 if output_buildbot_annotations: 164 if output_buildbot_annotations:
135 OutputAnnotationStepStart(name) 165 OutputAnnotationStepStart(name)
136 166
137 passed = False 167 passed = False
138 168
139 if not RunGClientAndCreateConfig(): 169 if not RunGClientAndCreateConfig():
140 if not RunGClientAndSync(reset): 170 passed_deps_check = True
171 if os.path.isfile(os.path.join('src', FILE_DEPS_GIT)):
172 cwd = os.getcwd()
173 os.chdir('src')
174 if not IsDepsFileBlink():
175 passed_deps_check = RemoveThirdPartyWebkitDirectory()
176 else:
177 passed_deps_check = True
178 os.chdir(cwd)
179
180 if passed_deps_check and not RunGClientAndSync(reset):
141 passed = True 181 passed = True
142 182
143 if output_buildbot_annotations: 183 if output_buildbot_annotations:
144 print 184 print
145 OutputAnnotationStepClosed() 185 OutputAnnotationStepClosed()
146 186
147 return passed 187 return passed
148 188
149 189
150 def CreateBisectDirectoryAndSetupDepot(opts, reset=False): 190 def CreateBisectDirectoryAndSetupDepot(opts, reset=False):
(...skipping 11 matching lines...) Expand all
162 print 'Error: Could not create bisect directory.' 202 print 'Error: Could not create bisect directory.'
163 print 203 print
164 return 1 204 return 1
165 205
166 if not SetupGitDepot(opts.output_buildbot_annotations, reset): 206 if not SetupGitDepot(opts.output_buildbot_annotations, reset):
167 print 'Error: Failed to grab source.' 207 print 'Error: Failed to grab source.'
168 print 208 print
169 return 1 209 return 1
170 210
171 return 0 211 return 0
OLDNEW
« no previous file with comments | « tools/bisect-perf-regression.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698