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: dart/tools/bots/get_chromium_build.py

Issue 353993002: Multivm branch: Fetch reference build from archive using git hash, not revision. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
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 | deps/multivm.deps/DEPS » ('j') | 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) 2014 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Gets a Chromium archived build, and unpacks it 7 """Gets a Chromium archived build, and unpacks it
8 into a target directory. 8 into a target directory.
9 9
10 Use -r option to specify the revison number 10 Use -r option to specify the revison number
11 Use -t option to specify the directory to unzip the build into. 11 Use -t option to specify the directory to unzip the build into.
12 12
13 Usage: 13 Usage:
14 $ get_chromium_build.py -r <revision> -t <target> 14 $ get_chromium_build.py -r <revision> -t <target>
15 """ 15 """
16 16
17 import json
17 import logging 18 import logging
18 import optparse 19 import optparse
19 import os 20 import os
20 import platform 21 import platform
21 import shutil 22 import shutil
22 import subprocess 23 import subprocess
23 import sys 24 import sys
24 import time 25 import time
25 import urllib 26 import urllib
26 import urllib2 27 import urllib2
(...skipping 15 matching lines...) Expand all
42 'Windows': {'zipfiles': ['chrome-win32.zip', 43 'Windows': {'zipfiles': ['chrome-win32.zip',
43 'chrome-win32-syms.zip'], 44 'chrome-win32-syms.zip'],
44 'folder': 'chrome_win', 45 'folder': 'chrome_win',
45 'archive_path': 'Win'}} 46 'archive_path': 'Win'}}
46 47
47 def __init__(self, options): 48 def __init__(self, options):
48 platform_data = BuildUpdater._PLATFORM_PATHS_MAP[platform.system()] 49 platform_data = BuildUpdater._PLATFORM_PATHS_MAP[platform.system()]
49 self._zipfiles = platform_data['zipfiles'] 50 self._zipfiles = platform_data['zipfiles']
50 self._folder = platform_data['folder'] 51 self._folder = platform_data['folder']
51 self._archive_path = platform_data['archive_path'] 52 self._archive_path = platform_data['archive_path']
52 self._revision = int(options.revision) 53 self._revision = options.revision
53 self._target_dir = options.target_dir 54 self._target_dir = options.target_dir
54 self._download_dir = os.path.join(self._target_dir, 'downloads') 55 self._download_dir = os.path.join(self._target_dir, 'downloads')
55 56
56 def _GetBuildUrl(self, revision, filename): 57 def _GetBuildUrl(self, revision, filename):
57 return CHROMIUM_URL_FMT % (self._archive_path, revision, filename) 58 return CHROMIUM_URL_FMT % (self._archive_path, revision, filename)
58 59
59 def _FindBuildRevision(self, revision, filename): 60 def _FindBuildRevision(self, revision, filename):
60 MAX_REVISIONS_PER_BUILD = 100 61 git_hash = json.loads(revision)[platform.system()]
61 for revision_guess in xrange(revision, revision + MAX_REVISIONS_PER_BUILD): 62 if self._DoesBuildExist(git_hash, filename):
62 if self._DoesBuildExist(revision_guess, filename): 63 return git_hash
63 return revision_guess
64 else:
65 time.sleep(.1)
66 return None 64 return None
67 65
68 def _DoesBuildExist(self, revision_guess, filename): 66 def _DoesBuildExist(self, revision_guess, filename):
69 url = self._GetBuildUrl(revision_guess, filename) 67 url = self._GetBuildUrl(revision_guess, filename)
70 68
71 r = urllib2.Request(url) 69 r = urllib2.Request(url)
72 r.get_method = lambda: 'HEAD' 70 r.get_method = lambda: 'HEAD'
73 try: 71 try:
74 urllib2.urlopen(r) 72 urllib2.urlopen(r)
75 return True 73 return True
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 160
163 def main(argv): 161 def main(argv):
164 logging.getLogger().setLevel(logging.DEBUG) 162 logging.getLogger().setLevel(logging.DEBUG)
165 options = ParseOptions(argv) 163 options = ParseOptions(argv)
166 b = BuildUpdater(options) 164 b = BuildUpdater(options)
167 b.DownloadAndUpdateBuild() 165 b.DownloadAndUpdateBuild()
168 logging.info('Successfully got archived Chromium build.') 166 logging.info('Successfully got archived Chromium build.')
169 167
170 if __name__ == '__main__': 168 if __name__ == '__main__':
171 sys.exit(main(sys.argv)) 169 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | deps/multivm.deps/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698