def fetch_release_candidate_metadata(session, record):
"""A JSON file containing build info is published along the nightly build archive.
"""
global _rc_metadata
url = record['download']['url']
# Make sure the rc URL is turned into a en-US one.
rc_url = localize_release_candidate_url(url)
if rc_url in _rc_metadata:
return _rc_metadata[rc_url]
product = record['source']['product']
if product == 'devedition':
product = 'firefox'
if product == 'fennec':
metadata_url = re.sub('\.({})$'.format(FILE_EXTENSIONS), '.json', rc_url)
else:
major_version = record['target']['version'].split('rc')[0]
parts = rc_url.split('/')
parts[-1] = '{}-{}.json'.format(product, major_version)
metadata_url = '/'.join(parts)
try:
metadata = await fetch_json(session, metadata_url)
except aiohttp.ClientError as e:
# Old RC like https://archive.mozilla.org/pub/firefox/releases/1.0rc1/
# don't have metadata.
logger.warning("Could not fetch metadata for '%s' from '%s'" % (record['id'],
metadata_url))
_rc_metadata[rc_url] = None # Don't try it anymore.
return None
m = re.search('/build(\d+)/', url)
metadata['buildnumber'] = int(m.group(1))
_rc_metadata[rc_url] = metadata
return metadata
评论列表
文章目录