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

Side by Side Diff: scripts/slave/recipe_modules/chromedriver/archive.py

Issue 1274723004: Converted Android Chromedriver buildbot scripts to recipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 5 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
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 class Url(object):
6 GS_CHROMIUM_CONTINUOUS_URL = 'gs://chromium-browser-continuous'
7 GS_CHROMIUM_SNAPSHOT_URL = 'gs://chromium-browser-snapshots'
8 GS_CHROMIUM_BLINK_SNAPSHOT_URL = 'gs://chromium-webkit-snapshots'
9
10
11 class Archive(object):
12 """Downloads items from the Chromium continuous archive."""
13
14 CHROME_42_REVISION = '317499'
15 CHROME_43_REVISION = '323865'
16 CHROME_44_REVISION = '330231'
17
18 def __init__(self, api):
19 self.api = api
luqui 2015/08/06 00:57:37 Glancing through this, it appears that you only ev
mikecase (-- gone --) 2016/04/04 21:46:42 Done
20
21 def get_latest_revision(self, site=Url.GS_CHROMIUM_CONTINUOUS_URL):
22 """Returns the latest revision (as a string) available for this platform.
23
24 Args:
25 site: the archive site to check against, default to the continuous one.
26 """
27 url = site + '/%s/LAST_CHANGE'
28 step_result = self.api.m.gsutil.cat(
29 name='get latest revision',
30 url=url,
31 stdout=self.api.m.raw_io.output(),
32 step_test_data=lambda: self.api.m.raw_io.test_api.stream_output(
33 '444444', stream='stdout'))
34 return step_result.stdout
35
36 def download_chrome(self, revision, dest_dir,
37 site=Url.GS_CHROMIUM_CONTINUOUS_URL):
38 """Downloads the packaged Chrome from the archive to the given directory.
39
40 Args:
41 revision: the revision of Chrome to download.
42 dest_dir: the directory to download Chrome to.
43 site: the archive site to download from, default to the continuous one.
44
45 Returns:
46 The path to the unzipped Chrome binary.
47 """
48 def get_zip_name():
49 if self.api.m.platform.is_win:
50 return 'chrome-win32'
51 elif self.api.m.platform.is_mac:
52 return 'chrome-mac'
53 elif self.api.m.platform.is_linux:
54 return 'chrome-linux'
55 def get_chrome_path_from_package():
56 if self.api.m.platform.is_win:
57 return 'chrome.exe'
58 elif self.api.m.platform.is_mac:
59 return 'Chromium.app/Contents/MacOS/Chromium'
60 elif self.api.m.platform.is_linux:
61 return 'chrome'
62 zip_path = self.api.m.path.join(dest_dir, 'chrome-%s.zip' % revision)
63 if not self.api.m.path.exists(zip_path):
64 url = site + '/%s/%s/%s.zip' % (self.get_download_platform(), revision,
65 get_zip_name())
66 temp_zip_path = self.api.m.path.mkdtemp('chrome_zip').join(
67 'chrome-%s.zip' % revision)
68 self.api.m.gsutil.download_url(
69 name='download chrome',
70 url=url,
71 dest=temp_zip_path)
72 self.api.m.zip.unzip(step_name='unzip chrome',
73 zip_file=zip_path,
74 output=dest_dir)
75 return self.api.m.path.join(
76 dest_dir, get_zip_name(), get_chrome_path_from_package())
77
78 def get_download_platform(self):
79 """Returns the name for this platform on the archive site."""
80 if self.api.m.platform.is_win:
81 return 'Win'
82 elif self.api.m.platform.is_mac:
83 return 'Mac'
84 elif self.api.m.platform.is_linux:
85 if self.api.m.platform.bits == 64:
86 return 'Linux_x64'
87 else:
88 return 'Linux'
89
90 def get_latest_snapshot_version(self):
91 """Returns the latest revision of snapshot build."""
92 return self.get_latest_revision(self.get_snapshot_download_site())
93
94 def get_snapshot_download_site(self):
95 """Returns the site to download snapshot build according to the platform.
96
97 For Linux 32-bit, it is chromium snapshot build.
98 For other platform, it is blink snapshot build.
99 Because there is no linux32 blink snapshot build.
100 """
101 if self.get_download_platform() in ('Linux', 'Linux_x64', 'Mac'):
102 return Url.GS_CHROMIUM_SNAPSHOT_URL
103 else:
104 return Url.GS_CHROMIUM_BLINK_SNAPSHOT_URL
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698