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

Side by Side Diff: tools/get_archive.py

Issue 10828291: Fix get_archive to deal with ranges of numbers that appear in the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | 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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 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. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is 7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is
8 # used for running browser tests of client applications. 8 # used for running browser tests of client applications.
9 9
10 import json 10 import json
(...skipping 16 matching lines...) Expand all
27 os.chdir(dart_src) 27 os.chdir(dart_src)
28 28
29 GSUTIL_DIR = os.path.join('third_party', 'gsutil') 29 GSUTIL_DIR = os.path.join('third_party', 'gsutil')
30 GSUTIL = GSUTIL_DIR + '/gsutil' 30 GSUTIL = GSUTIL_DIR + '/gsutil'
31 31
32 DRT_DIR = os.path.join('client', 'tests', 'drt') 32 DRT_DIR = os.path.join('client', 'tests', 'drt')
33 DRT_VERSION = os.path.join(DRT_DIR, 'LAST_VERSION') 33 DRT_VERSION = os.path.join(DRT_DIR, 'LAST_VERSION')
34 DRT_LATEST_PATTERN = ( 34 DRT_LATEST_PATTERN = (
35 'gs://dartium-archive/latest/drt-%(osname)s-inc-*.zip') 35 'gs://dartium-archive/latest/drt-%(osname)s-inc-*.zip')
36 DRT_PERMANENT_PATTERN = ('gs://dartium-archive/drt-%(osname)s-inc/drt-' 36 DRT_PERMANENT_PATTERN = ('gs://dartium-archive/drt-%(osname)s-inc/drt-'
37 '%(osname)s-inc-%(num)s.%(num)s.zip') 37 '%(osname)s-inc-%(num1)s.%(num2)s.zip')
38 38
39 DARTIUM_DIR = os.path.join('client', 'tests', 'dartium') 39 DARTIUM_DIR = os.path.join('client', 'tests', 'dartium')
40 DARTIUM_VERSION = os.path.join(DARTIUM_DIR, 'LAST_VERSION') 40 DARTIUM_VERSION = os.path.join(DARTIUM_DIR, 'LAST_VERSION')
41 DARTIUM_LATEST_PATTERN = ( 41 DARTIUM_LATEST_PATTERN = (
42 'gs://dartium-archive/latest/dartium-%(osname)s-inc-*.zip') 42 'gs://dartium-archive/latest/dartium-%(osname)s-inc-*.zip')
43 DARTIUM_PERMANENT_PATTERN = ('gs://dartium-archive/dartium-%(osname)s-inc/' 43 DARTIUM_PERMANENT_PATTERN = ('gs://dartium-archive/dartium-%(osname)s-inc/'
44 'dartium-%(osname)s-inc-%(num)s.%(num)s.zip') 44 'dartium-%(osname)s-inc-%(num1)s.%(num2)s.zip')
45 45
46 CHROMEDRIVER_DIR = os.path.join('tools', 'testing', 'dartium-chromedriver') 46 CHROMEDRIVER_DIR = os.path.join('tools', 'testing', 'dartium-chromedriver')
47 CHROMEDRIVER_VERSION = os.path.join(CHROMEDRIVER_DIR, 'LAST_VERSION') 47 CHROMEDRIVER_VERSION = os.path.join(CHROMEDRIVER_DIR, 'LAST_VERSION')
48 CHROMEDRIVER_LATEST_PATTERN = ( 48 CHROMEDRIVER_LATEST_PATTERN = (
49 'gs://dartium-archive/latest/chromedriver-%(osname)s-inc-*.zip') 49 'gs://dartium-archive/latest/chromedriver-%(osname)s-inc-*.zip')
50 CHROMEDRIVER_PERMANENT_PATTERN = ('gs://dartium-archive/chromedriver-%(osname)s' 50 CHROMEDRIVER_PERMANENT_PATTERN = ('gs://dartium-archive/chromedriver-%(osname)s'
51 '-inc/chromedriver-%(osname)s-inc-%(num)s.' 51 '-inc/chromedriver-%(osname)s-inc-%(num1)s.'
52 '%(num)s.zip') 52 '%(num2)s.zip')
53 53
54 SDK_DIR = os.path.join(utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32'), 54 SDK_DIR = os.path.join(utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32'),
55 'dart-sdk') 55 'dart-sdk')
56 SDK_VERSION = os.path.join(SDK_DIR, 'LAST_VERSION') 56 SDK_VERSION = os.path.join(SDK_DIR, 'LAST_VERSION')
57 SDK_LATEST_PATTERN = 'gs://dart-editor-archive-continuous/latest/VERSION' 57 SDK_LATEST_PATTERN = 'gs://dart-editor-archive-continuous/latest/VERSION'
58 # TODO(efortuna): Once the x64 VM also is optimized, select the version 58 # TODO(efortuna): Once the x64 VM also is optimized, select the version
59 # based on whether we are running on a 32-bit or 64-bit system. 59 # based on whether we are running on a 32-bit or 64-bit system.
60 SDK_PERMANENT = ('gs://dart-editor-archive-continuous/%(version_num)s/' + 60 SDK_PERMANENT = ('gs://dart-editor-archive-continuous/%(version_num)s/' +
61 'dartsdk-%(osname)s-32.zip') 61 'dartsdk-%(osname)s-32.zip')
62 62
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 permanent_prefix, revision_num=None): 125 permanent_prefix, revision_num=None):
126 """Get the latest binary that is stored in the dartium archive. 126 """Get the latest binary that is stored in the dartium archive.
127 127
128 Args: 128 Args:
129 name: the name of the desired download. 129 name: the name of the desired download.
130 directory: target directory (recreated) to install binary 130 directory: target directory (recreated) to install binary
131 version_file: name of file with the current version stamp 131 version_file: name of file with the current version stamp
132 latest_pattern: the google store url pattern pointing to the latest binary 132 latest_pattern: the google store url pattern pointing to the latest binary
133 permanent_prefix: stable google store folder used to download versions 133 permanent_prefix: stable google store folder used to download versions
134 revision_num: The desired revision number to retrieve. If revision_num is 134 revision_num: The desired revision number to retrieve. If revision_num is
135 None, we return the latest revision. 135 None, we return the latest revision. If the revision number is specified
136 but unavailable, find the nearest older revision and use that instead.
136 """ 137 """
137 osdict = {'Darwin':'mac', 'Linux':'lucid64', 'Windows':'win'} 138 osdict = {'Darwin':'mac', 'Linux':'lucid64', 'Windows':'win'}
138 139
139 def find_permanent_url(out, osname, revision_num): 140 def find_permanent_url(out, osname, revision_num):
140 output_lines = out.split() 141 output_lines = out.split()
141 latest = output_lines[-1] 142 latest = output_lines[-1]
142 if not revision_num: 143 if not revision_num:
143 revision_num = latest[latest.rindex('-') + 1 : latest.index('.')] 144 revision_num = latest[latest.rindex('-') + 1 : latest.index('.')]
144 latest = (permanent_prefix % { 'osname' : osname, 'num' : revision_num }) 145 latest = (permanent_prefix[:permanent_prefix.rindex('/')] % { 'osname' :
146 osname } + latest[latest.rindex('/'):])
147 else:
148 latest = (permanent_prefix % { 'osname' : osname, 'num1' : revision_num,
149 'num2' : revision_num })
150 foundURL = False
151 while not foundURL:
152 # Test to ensure this URL exists because the dartium-archive builds can
153 # have unusual numbering (a range of CL numbers) sometimes.
154 result, out = gsutil('ls', permanent_prefix % {'osname' : osname,
155 'num1': '*', 'num2': revision_num })
156 if result == 0:
157 # First try to find one with the the second number the same as the
158 # requested number.
159 latest = out.split()[0]
160 foundURL = True
161 else:
162 # Now try to find one with a nearby CL num.
163 revision_num = int(revision_num) - 1
145 return latest 164 return latest
146 165
147 get_from_gsutil(name, directory, version_file, latest_pattern, osdict, 166 get_from_gsutil(name, directory, version_file, latest_pattern, osdict,
148 find_permanent_url, revision_num) 167 find_permanent_url, revision_num)
149 168
150 def get_sdk_revision(name, directory, version_file, latest_pattern, 169 def get_sdk_revision(name, directory, version_file, latest_pattern,
151 permanent_prefix, revision_num): 170 permanent_prefix, revision_num):
152 """Get a revision of the SDK from the editor build archive. 171 """Get a revision of the SDK from the editor build archive.
153 172
154 Args: 173 Args:
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 elif positional[0] == 'drt': 309 elif positional[0] == 'drt':
291 get_dartium_revision('DumpRenderTree', DRT_DIR, DRT_VERSION, 310 get_dartium_revision('DumpRenderTree', DRT_DIR, DRT_VERSION,
292 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, 311 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN,
293 args.revision) 312 args.revision)
294 else: 313 else:
295 print ('Please specify the target you wish to download from Google Storage ' 314 print ('Please specify the target you wish to download from Google Storage '
296 '("drt", "dartium", "chromedriver", or "sdk")') 315 '("drt", "dartium", "chromedriver", or "sdk")')
297 316
298 if __name__ == '__main__': 317 if __name__ == '__main__':
299 sys.exit(main()) 318 sys.exit(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