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

Side by Side Diff: tools/dartium/fetch_dartium.py

Issue 400183002: Convenience script for fetching dartium (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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
(Empty)
1 #!/usr/bin/python
2 #
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file.
6
7 # A script to fetch and build dartium branches into an empty directory.
8 #
9 # Main dev directories - src, src/third_party/WebKit, src/dart - are checked out
10 # via git. A custom_deps entry is added to the .gclient file.
11 #
12 # Usage:
13 # .../fetch_dartium.py --branch=[trunk|bleeding_edge|dartium_integration|1.4|... ]
14 # --path=path [--build]
15 #
16 # Default branch is bleeding_edge. The path must be created by this script.
17
18 import optparse
19 import os
20 import os.path
21 import re
22 import shutil
23 import subprocess
24 import sys
25
26 def Run(cmd, path = '.', isPiped = False):
27 print 'Running in ' + path + ': ' + ' '.join(cmd)
28 cwd = os.getcwd()
29 os.chdir(path)
30 if isPiped:
31 p = subprocess.Popen(cmd, stdout = subprocess.PIPE)
32 else:
33 p = subprocess.Popen(cmd)
34 os.chdir(cwd)
35 return p
36
37 def RunSync(cmd):
38 print "\n[%s]\n$ %s" % (os.getcwd(), " ".join(cmd))
39 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
40 output = pipe.communicate()
41 if pipe.returncode == 0:
42 return output[0]
43 else:
44 print output[1]
45 print "FAILED. RET_CODE=%d" % pipe.returncode
46 sys.exit(pipe.returncode)
47
48
49 def main():
50 option_parser = optparse.OptionParser()
51 option_parser.add_option('', '--branch', help="Checkout a branch of Dartium, e .g., [bleeding_edge|dartium_integration|trunk|1.4]",
52 action="store", dest="branch", default="bleeding_edge ")
53 option_parser.add_option('', '--build', help="Compile",
54 action="store_true", dest="build")
55 option_parser.add_option('', '--path', help="Path to checkout to",
56 action="store", dest="path", default=None)
57 options, args = option_parser.parse_args()
58
59 path = options.path
terry 2014/07/18 13:33:03 My path is '/usr/local/google/home/terry' couldn't
vsm 2014/07/29 14:48:42 Done.
60 if not path:
61 print 'Please set a path'
62 exit(1)
63 if os.path.isfile(path) or os.path.isdir(path):
64 print 'Path %s already exists' % path
65 os.mkdir(path)
66 os.chdir(path)
67
68 if options.branch != 'trunk':
69 branch = 'branches/' + options.branch
70 else:
71 branch = 'trunk'
72 deps_path = 'https://dart.googlecode.com/svn/%s/deps/dartium.deps' % branch
73
74 Run(['gclient', 'config', deps_path]).wait()
75
76 # Mark chrome, blink, and dart as custom. We'll check them out separately
77 # via git.
78 f = open('.gclient', 'r')
79 lines = f.readlines()
80 f.close()
81 f = open('.gclient', 'w')
82 for line in lines:
83 f.write(line)
84 if 'custom_deps' in line:
85 f.write(
86 ' "src": None,\n'
87 ' "src/third_party/WebKit": None,\n'
88 ' "src/dart": None,\n'
89 )
90 f.close()
91
92 # Find branches from the DEPS file.
93 DEPS = RunSync(['svn', 'cat', deps_path + '/DEPS'])
94 chrome_base = 'svn://svn.chromium.org/'
95 chrome_branch = re.search('dartium_chromium_branch":\s*"(.+)"', DEPS).group(1)
96 blink_branch = re.search('dartium_webkit_branch":\s*"(.+)"', DEPS).group(1)
97 dart_base = 'https://dart.googlecode.com/svn/'
98 dart_branch = re.search('dart_branch":\s*"(.+)"', DEPS).group(1)
99
100 chrome_url = chrome_base + chrome_branch
101 blink_url = chrome_base + blink_branch
102 dart_url = dart_base + dart_branch + '/dart'
103
104 # Fetch dart, chrome, and blink via git-svn and everything else via
105 # gclient sync.
106 blink_fetch = Run(['git', 'svn', 'clone', '-rHEAD', blink_url, 'blink'])
rmacnak 2014/07/18 18:27:16 These are shallow checkouts without the other bran
vsm 2014/07/29 14:48:42 Comment added at the top. I use this to get going
107 dart_fetch = Run(['git', 'svn', 'clone', '-rHEAD', dart_url, 'dart'])
108 Run(['git', 'svn', 'clone', '-rHEAD', chrome_url, 'src']).wait()
109 sync = Run(['gclient', 'sync', '--nohooks'])
110 ps = [blink_fetch, dart_fetch, sync]
111
112 # Spin until everything is done.
113 while True:
114 ps_status = [p.poll() for p in ps]
115 if all([x is not None for x in ps_status]):
116 break
117
118 # Move blink and dart to the right locations.
119 webkit_relative_path = os.path.join('src', 'third_party', 'WebKit')
120 if os.path.isdir(webkit_relative_path):
121 shutil.rmtree(webkit_relative_path)
122 Run(['mv', 'blink', webkit_relative_path]).wait()
123 dart_relative_path = os.path.join('src', 'dart')
124 if os.path.isdir(dart_relative_path):
125 shutil.rmtree(dart_relative_path)
126 Run(['mv', 'dart', dart_relative_path]).wait()
127 os.chdir('src')
128
129 # Sync again and runhooks.
130 Run(['gclient', 'sync']).wait()
131 Run(['gclient', 'runhooks']).wait()
132
133 # Build if requested.
134 if options.build:
135 Run([os.path.join('.', 'dart', 'tools', 'dartium', 'build.py'), '--mode=Rele ase'])
136
137 if '__main__' == __name__:
138 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698