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

Side by Side Diff: tools/dom/scripts/idlsync.py

Issue 1682783002: Dartium 45 roll (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: removed htmlcommon Created 4 years, 10 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
« tools/dom/dom.json ('K') | « tools/dom/scripts/idlnode.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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 import optparse 6 import optparse
7 import os 7 import os
8 import os.path 8 import os.path
9 import re 9 import re
10 import requests
10 import shutil 11 import shutil
11 import subprocess 12 import subprocess
12 import sys 13 import sys
13 import tempfile 14 import tempfile
14 15
15 SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) 16 SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
16 DART_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, '..', '..', '..')) 17 DART_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, '..', '..', '..'))
17 18
18 # Dartium DEPS file with Chrome and WebKit revisions. 19 # Dartium DEPS file from the DEPS file checked into the dart-lang/sdk integratio n
19 DEPS = ('http://dart.googlecode.com/svn/branches/' 20 # branch.
20 'bleeding_edge/deps/dartium.deps/DEPS') 21 DEPS_GIT = ('https://raw.githubusercontent.com/dart-lang/sdk/'
22 'integration/tools/deps/dartium.deps/DEPS')
21 23
22 # Whitelist of files to keep. 24 # Whitelist of files to keep.
23 WHITELIST = [ 25 WHITELIST = [
24 r'LICENSE(\S+)', 26 r'LICENSE(\S+)',
25 r'(\S+)\.idl', 27 r'(\S+)\.idl',
26 r'(\S+)\.json', 28 r'(\S+)\.json',
27 r'(\S+)\.py', 29 r'(\S+)\.py',
28 r'(\S+)\.txt', 30 r'(\S+)\.txt',
29 ] 31 ]
30 32
31 # WebKit / WebCore info. 33 # WebKit / WebCore info.
32 CHROME_TRUNK = "http://src.chromium.org" 34 CHROME_TRUNK = "https://src.chromium.org"
33 WEBKIT_URL_PATTERN = r'"dartium_webkit_branch": "(\S+)",' 35 WEBKIT_URL_PATTERN = r'"dartium_webkit_branch": "(\S+)",'
34 WEBKIT_REV_PATTERN = r'"dartium_webkit_revision": "(\d+)",' 36 WEBKIT_REV_PATTERN = r'"dartium_webkit_revision": "(\d+)",'
35 WEBCORE_SUBPATH = 'Source/core' 37 WEBCORE_SUBPATH = 'Source/core'
36 MODULES_SUBPATH = 'Source/modules' 38 MODULES_SUBPATH = 'Source/modules'
37 BINDINGS_SUBPATH = 'Source/bindings' 39 BINDINGS_SUBPATH = 'Source/bindings'
38 40
39 LOCAL_WEBKIT_IDL_PATH = os.path.join(DART_PATH, 'third_party', 'WebCore') 41 LOCAL_WEBKIT_IDL_PATH = os.path.join(DART_PATH, 'third_party', 'WebCore')
40 LOCAL_WEBKIT_README = """\ 42 LOCAL_WEBKIT_README = """\
41 This directory contains a copy of WebKit/WebCore IDL files. 43 This directory contains a copy of WebKit/WebCore IDL files.
42 See the attached LICENSE-* files in this directory. 44 See the attached LICENSE-* files in this directory.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 Please see the corresponding LICENSE file at 79 Please see the corresponding LICENSE file at
78 %(url)s/trunk/src/LICENSE. 80 %(url)s/trunk/src/LICENSE.
79 """ 81 """
80 DEPTH_FILES = 'files' 82 DEPTH_FILES = 'files'
81 DEPTH_INFINITY = 'infinity' 83 DEPTH_INFINITY = 'infinity'
82 84
83 # Regular expressions corresponding to URL/revision patters in the 85 # Regular expressions corresponding to URL/revision patters in the
84 # DEPS file. 86 # DEPS file.
85 DEPS_PATTERNS = { 87 DEPS_PATTERNS = {
86 'webkit': (CHROME_TRUNK, WEBKIT_URL_PATTERN, WEBKIT_REV_PATTERN), 88 'webkit': (CHROME_TRUNK, WEBKIT_URL_PATTERN, WEBKIT_REV_PATTERN),
87 'chrome': (CHROME_TRUNK, CHROME_URL_PATTERN, CHROME_REV_PATTERN), 89 # 'chrome': (CHROME_TRUNK, CHROME_URL_PATTERN, CHROME_REV_PATTERN),
88 } 90 }
89 91
90 # List of components to update. 92 # List of components to update.
91 UPDATE_LIST = [ 93 UPDATE_LIST = [
92 # (component, remote subpath, local path, local readme file, depth) 94 # (component, remote subpath, local path, local readme file, depth)
93 95
94 # WebKit IDL. 96 # WebKit IDL.
95 ('webkit', WEBCORE_SUBPATH, os.path.join(LOCAL_WEBKIT_IDL_PATH, 'core'), 97 ('webkit', WEBCORE_SUBPATH, os.path.join(LOCAL_WEBKIT_IDL_PATH, 'core'),
96 LOCAL_WEBKIT_README, DEPTH_INFINITY), 98 LOCAL_WEBKIT_README, DEPTH_INFINITY),
97 ('webkit', MODULES_SUBPATH, os.path.join(LOCAL_WEBKIT_IDL_PATH, 'modules'), 99 ('webkit', MODULES_SUBPATH, os.path.join(LOCAL_WEBKIT_IDL_PATH, 'modules'),
(...skipping 25 matching lines...) Expand all
123 print ' '.join(cmd) 125 print ' '.join(cmd)
124 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 126 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
125 output = pipe.communicate() 127 output = pipe.communicate()
126 if pipe.returncode in valid_exits: 128 if pipe.returncode in valid_exits:
127 return output[0] 129 return output[0]
128 else: 130 else:
129 print output[1] 131 print output[1]
130 print 'FAILED. RET_CODE=%d' % pipe.returncode 132 print 'FAILED. RET_CODE=%d' % pipe.returncode
131 sys.exit(pipe.returncode) 133 sys.exit(pipe.returncode)
132 134
133 135 def GetDepsFromGit():
134 def GetDeps(): 136 req = requests.get(DEPS_GIT)
135 """Returns the DEPS file contents with pinned revision info.""" 137 return req.text
136 return RunCommand(['svn', 'cat', DEPS])
137
138 138
139 def GetSvnRevision(deps, component): 139 def GetSvnRevision(deps, component):
140 """Returns a tuple with the (dartium webkit repo, latest revision).""" 140 """Returns a tuple with the (dartium webkit repo, latest revision)."""
141 url_base, url_pattern, rev_pattern = DEPS_PATTERNS[component] 141 url_base, url_pattern, rev_pattern = DEPS_PATTERNS[component]
142 url = url_base + re.search(url_pattern, deps).group(1) 142 url = url_base + re.search(url_pattern, deps).group(1)
143 revision = re.search(rev_pattern, deps).group(1) 143 revision = re.search(rev_pattern, deps).group(1)
144 return (url, revision) 144 return (url, revision)
145 145
146 146
147 def RefreshFiles(url, revision, remote_path, local_path, depth): 147 def RefreshFiles(url, revision, remote_path, local_path, depth):
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if os.path.exists(archive_path): 201 if os.path.exists(archive_path):
202 RunCommand(['unzip', ZIP_ARCHIVE, '-d', '.']) 202 RunCommand(['unzip', ZIP_ARCHIVE, '-d', '.'])
203 RunCommand(['rm', ZIP_ARCHIVE]) 203 RunCommand(['rm', ZIP_ARCHIVE])
204 204
205 def ParseOptions(): 205 def ParseOptions():
206 parser = optparse.OptionParser() 206 parser = optparse.OptionParser()
207 parser.add_option('--webkit-revision', '-w', dest='webkit_revision', 207 parser.add_option('--webkit-revision', '-w', dest='webkit_revision',
208 help='WebKit IDL revision to install', default=None) 208 help='WebKit IDL revision to install', default=None)
209 parser.add_option('--chrome-revision', '-c', dest='chrome_revision', 209 parser.add_option('--chrome-revision', '-c', dest='chrome_revision',
210 help='Chrome IDL revision to install', default=None) 210 help='Chrome IDL revision to install', default=None)
211 parser.add_option('--update', '-u', dest='update',
212 help='IDL to update (webkit | chrome | all)',
213 default='webkit')
214 args, _ = parser.parse_args() 211 args, _ = parser.parse_args()
215 update = {} 212 update = {}
216 if args.update == 'all' or args.update == 'chrome': 213 update['webkit'] = args.webkit_revision
217 update['chrome'] = args.chrome_revision
218 if args.update == 'all' or args.update == 'webkit':
219 update['webkit'] = args.webkit_revision
220 return update 214 return update
221 215
222 216
223 def main(): 217 def main():
224 deps = GetDeps()
225 update = ParseOptions() 218 update = ParseOptions()
219 deps = GetDepsFromGit()
226 for (component, remote_path, local_path, readme, depth) in UPDATE_LIST: 220 for (component, remote_path, local_path, readme, depth) in UPDATE_LIST:
227 if component in update.keys(): 221 if component in update.keys():
228 revision = update[component] 222 revision = update[component]
229 url, latest = GetSvnRevision(deps, component) 223 url, latest = GetSvnRevision(deps, component)
230 if revision is None: 224 if revision is None:
231 revision = latest 225 revision = latest
232 SaveVersionControlDir(local_path); 226 SaveVersionControlDir(local_path);
233 RefreshFiles(url, revision, remote_path, local_path, depth) 227 RefreshFiles(url, revision, remote_path, local_path, depth)
234 PruneExtraFiles(local_path) 228 PruneExtraFiles(local_path)
235 GenerateReadme(local_path, readme, url, revision) 229 GenerateReadme(local_path, readme, url, revision)
236 RestoreVersionControlDir(local_path); 230 RestoreVersionControlDir(local_path);
237 231
238 if __name__ == '__main__': 232 if __name__ == '__main__':
239 main() 233 main()
OLDNEW
« tools/dom/dom.json ('K') | « tools/dom/scripts/idlnode.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698