OLD | NEW |
1 import re | 1 import re |
2 import os | 2 import os |
3 import sys | 3 import sys |
4 import json | 4 import json |
5 import urllib | 5 import urllib |
6 import errno | 6 import errno |
7 import logging | 7 import logging |
8 import time | 8 import time |
9 from xml.dom import minidom | 9 from xml.dom import minidom |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 <updatecheck/> | 23 <updatecheck/> |
24 </app> | 24 </app> |
25 <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome"> | 25 <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome"> |
26 <updatecheck/> | 26 <updatecheck/> |
27 </app> | 27 </app> |
28 </request>''' | 28 </request>''' |
29 | 29 |
30 cache = {} | 30 cache = {} |
31 | 31 |
32 | 32 |
33 def get_mozilla_version(product, origin_version, channel, | 33 def get_json_versions(product): |
34 minor=False, subdomain='aus4', origin_build='-', | 34 urls = { |
35 attribute='appVersion', platform='WINNT_x86-msvc'): | 35 'Firefox': |
36 response = urllib.urlopen('https://%s.mozilla.org/update/3/%s/%s/%s/%s/en-US
/%s/-/default/default/update.xml?force=1' % ( | 36 'https://product-details.mozilla.org/1.0/firefox_versions.json', |
37 subdomain, | 37 'Thunderbird': |
38 product, | 38 'https://product-details.mozilla.org/1.0/thunderbird_versions.json', |
39 origin_version, | 39 'Seamonkey': |
40 origin_build, | 40 'http://www.seamonkey-project.org/seamonkey_versions.json' |
41 platform, | 41 } |
42 channel | 42 response = urllib.urlopen(urls[product]) |
43 )) | |
44 try: | 43 try: |
45 doc = minidom.parse(response) | 44 doc = json.load(response) |
46 finally: | 45 finally: |
47 response.close() | 46 response.close() |
48 | 47 for key, value in doc.iteritems(): |
49 updates = doc.getElementsByTagName('update') | 48 doc[key] = re.split(r'([a-zA-z])', value)[0] |
50 if not updates: | 49 return doc |
51 raise Exception('No updates for %s in %s channel' % (product, channel)) | |
52 full_version = updates[0].getAttribute(attribute) | |
53 | |
54 match = re.search(r'^(\d+)(?:\.\d+)?', full_version) | |
55 if minor: | |
56 return match.group(0) | |
57 return match.group(1) | |
58 | 50 |
59 | 51 |
60 def get_mozilla_versions(product, origin_version, release_minor=False): | 52 def get_firefox_versions(): |
| 53 versions = get_json_versions('Firefox') |
61 return { | 54 return { |
62 'current': get_mozilla_version(product, origin_version, 'release', relea
se_minor), | 55 'current': versions['LATEST_FIREFOX_VERSION'], |
| 56 'unreleased': [ |
| 57 versions['LATEST_FIREFOX_DEVEL_VERSION'], |
| 58 versions['FIREFOX_AURORA'], |
| 59 versions['FIREFOX_NIGHTLY'], |
| 60 ] |
| 61 } |
| 62 |
| 63 |
| 64 def get_thunderbird_versions(): |
| 65 versions = get_json_versions('Thunderbird') |
| 66 firefox_versions = get_json_versions('Firefox') |
| 67 return { |
| 68 'current': versions['LATEST_THUNDERBIRD_VERSION'], |
63 'unreleased': [ | 69 'unreleased': [ |
64 get_mozilla_version(product, origin_version, 'beta'), | 70 versions['LATEST_THUNDERBIRD_DEVEL_VERSION'], |
65 get_mozilla_version(product, origin_version, 'aurora'), | 71 versions['LATEST_THUNDERBIRD_ALPHA'], |
66 get_mozilla_version(product, origin_version, 'nightly'), | 72 firefox_versions['FIREFOX_NIGHTLY'], |
67 ] | 73 ] |
68 } | 74 } |
69 | 75 |
70 BROWSERS['firefox'] = lambda: get_mozilla_versions('Firefox', '37.0') | 76 BROWSERS['firefox'] = lambda: get_firefox_versions() |
71 BROWSERS['thunderbird'] = lambda: get_mozilla_versions('Thunderbird', '31.0', Tr
ue) | 77 BROWSERS['thunderbird'] = lambda: get_thunderbird_versions() |
72 | |
73 | |
74 def get_seamonkey_version(origin_version, origin_build, channel, **kw): | |
75 return get_mozilla_version('SeaMonkey', origin_version, channel, True, | |
76 'aus2-community', origin_build, 'version', **kw) | |
77 | 78 |
78 | 79 |
79 def get_seamonkey_versions(): | 80 def get_seamonkey_versions(): |
| 81 seamonkey_versions = get_json_versions('Seamonkey') |
80 versions = { | 82 versions = { |
81 'current': get_seamonkey_version('2.32', '20150112201917', 'release'), | 83 'current': seamonkey_versions['LATEST_SEAMONKEY_VERSION'], |
82 'unreleased': [get_seamonkey_version('2.32', '20150101215737', 'beta')] | 84 'unreleased': [ |
| 85 seamonkey_versions['LATEST_SEAMONKEY_MILESTONE_VERSION'], |
| 86 seamonkey_versions['LATEST_SEAMONKEY_TESTING_VERSION'], |
| 87 seamonkey_versions['LATEST_SEAMONKEY_DEVEL_VERSION'], |
| 88 ] |
83 } | 89 } |
84 | 90 |
85 # Aurora and Nightly builds for Windows are permantently broken. | |
86 # Occasionally, builds for other platforms are broken as well. | |
87 # https://bugzilla.mozilla.org/show_bug.cgi?id=1086553 | |
88 for channel in ('aurora', 'nightly'): | |
89 try: | |
90 version = get_seamonkey_version('2.32', '-', channel, platform='Linu
x_x86-gcc3') | |
91 except Exception: | |
92 continue | |
93 versions['unreleased'].append(version) | |
94 | |
95 return versions | 91 return versions |
96 | 92 |
97 BROWSERS['seamonkey'] = get_seamonkey_versions | 93 BROWSERS['seamonkey'] = get_seamonkey_versions |
98 | 94 |
99 | 95 |
100 def get_chrome_version(manifest): | 96 def get_chrome_version(manifest): |
101 return manifest.getAttribute('version').split('.')[0] | 97 return manifest.getAttribute('version').split('.')[0] |
102 | 98 |
103 | 99 |
104 def get_chrome_versions(): | 100 def get_chrome_versions(): |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 file.seek(0) | 241 file.seek(0) |
246 json.dump(persistent_cache, file) | 242 json.dump(persistent_cache, file) |
247 file.truncate() | 243 file.truncate() |
248 | 244 |
249 if not versions['previous']: | 245 if not versions['previous']: |
250 logging.warning("Couldn't determine previous browser version, " | 246 logging.warning("Couldn't determine previous browser version, " |
251 'please set %s.previous in %s', browser, filename) | 247 'please set %s.previous in %s', browser, filename) |
252 | 248 |
253 cache[browser] = versions | 249 cache[browser] = versions |
254 return versions | 250 return versions |
OLD | NEW |