| OLD | NEW |
| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 foundURL = False | 153 foundURL = False |
| 154 while not foundURL: | 154 while not foundURL: |
| 155 # Test to ensure this URL exists because the dartium-archive builds can | 155 # Test to ensure this URL exists because the dartium-archive builds can |
| 156 # have unusual numbering (a range of CL numbers) sometimes. | 156 # have unusual numbering (a range of CL numbers) sometimes. |
| 157 result, out = Gsutil('ls', permanent_prefix % {'osname' : osname, | 157 result, out = Gsutil('ls', permanent_prefix % {'osname' : osname, |
| 158 'num1': '*', 'num2': revision_num }) | 158 'num1': '*', 'num2': revision_num }) |
| 159 if result == 0: | 159 if result == 0: |
| 160 # First try to find one with the the second number the same as the | 160 # First try to find one with the the second number the same as the |
| 161 # requested number. | 161 # requested number. |
| 162 latest = out.split()[0] | 162 latest = out.split()[0] |
| 163 foundURL = True | 163 # Now test that the permissions are correct so you can actually |
| 164 # download it. |
| 165 temp_dir = tempfile.mkdtemp() |
| 166 temp_zip = os.path.join(temp_dir, 'foo.zip') |
| 167 returncode, out = Gsutil('cp', latest, 'file://' + temp_zip) |
| 168 if returncode == 0: |
| 169 foundURL = True |
| 170 else: |
| 171 # Unable to download this item (most likely because something went |
| 172 # wrong on the upload and the permissions are bad). Keep looking for |
| 173 # a different URL. |
| 174 revision_num = int(revision_num) - 1 |
| 175 shutil.rmtree(temp_dir) |
| 164 else: | 176 else: |
| 165 # Now try to find one with a nearby CL num. | 177 # Now try to find one with a nearby CL num. |
| 166 revision_num = int(revision_num) - 1 | 178 revision_num = int(revision_num) - 1 |
| 167 if revision_num <= 0: | 179 if revision_num <= 0: |
| 168 TooEarlyError() | 180 TooEarlyError() |
| 169 return latest | 181 return latest |
| 170 | 182 |
| 171 GetFromGsutil(name, directory, version_file, latest_pattern, osdict, | 183 GetFromGsutil(name, directory, version_file, latest_pattern, osdict, |
| 172 FindPermanentUrl, revision_num) | 184 FindPermanentUrl, revision_num) |
| 173 | 185 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 elif positional[0] == 'drt': | 340 elif positional[0] == 'drt': |
| 329 GetDartiumRevision('DumpRenderTree', DRT_DIR, DRT_VERSION, | 341 GetDartiumRevision('DumpRenderTree', DRT_DIR, DRT_VERSION, |
| 330 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, | 342 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, |
| 331 args.revision) | 343 args.revision) |
| 332 else: | 344 else: |
| 333 print ('Please specify the target you wish to download from Google Storage ' | 345 print ('Please specify the target you wish to download from Google Storage ' |
| 334 '("drt", "dartium", "chromedriver", or "sdk")') | 346 '("drt", "dartium", "chromedriver", or "sdk")') |
| 335 | 347 |
| 336 if __name__ == '__main__': | 348 if __name__ == '__main__': |
| 337 sys.exit(main()) | 349 sys.exit(main()) |
| OLD | NEW |