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

Side by Side Diff: chrome-update.py

Issue 2253013004: Remove old unused SVN related scripts from depot_tools (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 4 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 | « chrome-update.bat ('k') | chrome-update-create-task.bat » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7 import re
8 import subprocess
9 import sys
10 import urllib
11
12 IS_WIN = sys.platform.startswith('win')
13 BASE_URL = 'http://src.chromium.org/svn/trunk/tools/buildbot/scripts/'
14 COMPILE_URL = BASE_URL + 'slave/compile.py'
15 UTILS_URL = BASE_URL + 'common/chromium_utils.py'
16
17
18 def Fetch(url, filename):
19 if not os.path.exists(filename):
20 urllib.urlretrieve(url, filename)
21
22
23 def GetLastestRevision():
24 """Returns the revision number of the last build that was archived, or
25 None on failure."""
26 url = 'http://build.chromium.org/buildbot/continuous/'
27 if sys.platform.startswith('win'):
28 url += 'win/'
29 elif sys.platform.startswith('linux'):
30 url += 'linux/'
31 elif sys.platform.startswith('darwin'):
32 url += 'mac/'
33 else:
34 # This path is actually win.
35 pass
36 url += 'LATEST/REVISION'
37 text = urllib.urlopen(url).read()
38 if text:
39 match = re.search(r"(\d+)", text)
40 if match:
41 return int(match.group(1))
42 return None
43
44
45 def DoUpdate(chrome_root):
46 """gclient sync to the latest build."""
47 cmd = ["gclient", "sync"]
48 rev = GetLastestRevision()
49 if rev:
50 cmd.extend(['--revision', 'src@%d' % rev])
51 return subprocess.call(cmd, cwd=chrome_root, shell=IS_WIN)
52
53
54 def DoBuild(chrome_root, args):
55 """Download compile.py and run it."""
56 compile_path = os.path.join(chrome_root, 'compile.py')
57 Fetch(COMPILE_URL, compile_path)
58 Fetch(UTILS_URL, os.path.join(chrome_root, 'chromium_utils.py'))
59 cmd = ['python', compile_path] + args
60 return subprocess.call(cmd, cwd=chrome_root, shell=IS_WIN)
61
62
63 def main(args):
64 if len(args) < 3:
65 print('Usage: chrome-update.py <path> [options]')
66 print('See options from compile.py at')
67 print(' %s' % COMPILE_URL)
68 print('\nFor more example, see the compile steps on the waterfall')
69 return 1
70
71 chrome_root = args[1]
72 if not os.path.isdir(chrome_root):
73 print('Path to chrome root (%s) not found.' % chrome_root)
74 return 1
75
76 rv = DoUpdate(chrome_root)
77 if rv != 0:
78 print('Update Failed. Bailing.')
79 return rv
80
81 DoBuild(chrome_root, args[2:])
82 print('Success!')
83 return 0
84
85
86 if __name__ == "__main__":
87 try:
88 sys.exit(main(sys.argv))
89 except KeyboardInterrupt:
90 sys.stderr.write('interrupted\n')
91 sys.exit(1)
OLDNEW
« no previous file with comments | « chrome-update.bat ('k') | chrome-update-create-task.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698