Skip to content

Commit

Permalink
Fix Bug 1320662 - Serve Firefox Nightly stub installer by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshino committed Nov 28, 2016
1 parent 5a6ce51 commit 0b001bd
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 13 deletions.
4 changes: 4 additions & 0 deletions bedrock/firefox/firefox_details.py
Expand Up @@ -245,6 +245,10 @@ def get_download_url(self, channel, version, platform, locale,
_dir = self.nightly_url_base + ('' if locale == 'en-US' else '-l10n')
_suffix = self.platform_file_suffixes.get(_platform)

# Use a different file name for the Windows stub installer
if _platform in ['win', 'win64'] and not force_full_installer:
_suffix = 'win32.installer-stub.exe'

return '{dir}/firefox-{version}.{locale}.{suffix}'.format(
dir=_dir, version=_version, locale=_locale, suffix=_suffix)

Expand Down
13 changes: 12 additions & 1 deletion bedrock/firefox/templatetags/helpers.py
Expand Up @@ -132,6 +132,17 @@ def download_firefox(ctx, channel='release', platform='all',

if show_desktop:
for plat_os, plat_os_pretty in firefox_desktop.platform_labels.iteritems():
os_pretty = plat_os_pretty

# Firefox Nightly: The Windows stub installer is now universal,
# automatically detecting a 32-bit and 64-bit desktop, so the
# win64-specific entry can be skipped.
if channel == 'nightly':
if plat_os == 'win':
os_pretty = 'Windows 32/64-bit'
if plat_os == 'win64':
continue

# Fallback to en-US if this plat_os/version isn't available
# for the current locale
_locale = locale if plat_os_pretty in platforms else 'en-US'
Expand Down Expand Up @@ -162,7 +173,7 @@ def download_firefox(ctx, channel='release', platform='all',
download_link_direct = False

builds.append({'os': plat_os,
'os_pretty': plat_os_pretty,
'os_pretty': os_pretty,
'download_link': download_link,
'download_link_direct': download_link_direct})

Expand Down
4 changes: 2 additions & 2 deletions bedrock/firefox/tests/test_base.py
Expand Up @@ -129,8 +129,8 @@ def test_no_search_query(self):
"""
resp = self.client.get(self._get_url())
doc = pq(resp.content)
eq_(len(doc('.build-table')), 2)
eq_(len(doc('.not-found.hide')), 2)
eq_(len(doc('.build-table')), 1)
eq_(len(doc('.not-found.hide')), 1)

num_builds = len(firefox_desktop.get_filtered_full_builds('release'))
num_builds += len(firefox_desktop.get_filtered_test_builds('release'))
Expand Down

Large diffs are not rendered by default.

@@ -1 +1 @@
{"LATEST_FIREFOX_VERSION":"17.0.1","LATEST_FIREFOX_DEVEL_VERSION":"18.0b2","LATEST_FIREFOX_RELEASED_DEVEL_VERSION":"18.0b2","LATEST_FIREFOX_OLDER_VERSION":"3.6.28","FIREFOX_AURORA":"19.0a2","FIREFOX_ESR":"10.0.11esr"}
{"FIREFOX_NIGHTLY":"53.0a1","FIREFOX_AURORA":"52.0a2","FIREFOX_ESR":"45.5.0esr","FIREFOX_ESR_NEXT":"","LATEST_FIREFOX_DEVEL_VERSION":"51.0b3","LATEST_FIREFOX_OLDER_VERSION":"3.6.28","LATEST_FIREFOX_RELEASED_DEVEL_VERSION":"51.0b3","LATEST_FIREFOX_VERSION":"50.0"}
57 changes: 49 additions & 8 deletions bedrock/firefox/tests/test_firefox_details.py
Expand Up @@ -157,34 +157,75 @@ def test_get_download_url_aurora_l10n(self):
('os', 'linux64'),
('lang', 'pt-BR')])

def test_get_download_url_nightly(self):
"""The Nightly version should give us a direct url."""
def test_get_download_url_nightly_stub(self):
"""
The Nightly version should give us a direct url. For Windows platforms,
a universal stub installer is served by default.
"""
url_base = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/'
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win', 'en-US', True),
url_base + 'firefox-50.0a1.en-US.win32.installer.exe')
url_base + 'firefox-50.0a1.en-US.win32.installer-stub.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win64', 'en-US', True),
url_base + 'firefox-50.0a1.en-US.win64.installer.exe')
url_base + 'firefox-50.0a1.en-US.win32.installer-stub.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'osx', 'en-US', True),
url_base + 'firefox-50.0a1.en-US.mac.dmg')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux', 'en-US', True),
url_base + 'firefox-50.0a1.en-US.linux-i686.tar.bz2')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux64', 'en-US', True),
url_base + 'firefox-50.0a1.en-US.linux-x86_64.tar.bz2')

def test_get_download_url_nightly_l10n(self):
"""Nightly non en-US should have a slightly different directory name."""
def test_get_download_url_nightly_full(self):
"""
The Nightly version should give us a direct url. For Windows platforms,
a full installer is served if the force_full_installer option is enabled.
"""
url_base = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/'
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win', 'en-US', True, True),
url_base + 'firefox-50.0a1.en-US.win32.installer.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win64', 'en-US', True, True),
url_base + 'firefox-50.0a1.en-US.win64.installer.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'osx', 'en-US', True, True),
url_base + 'firefox-50.0a1.en-US.mac.dmg')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux', 'en-US', True, True),
url_base + 'firefox-50.0a1.en-US.linux-i686.tar.bz2')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux64', 'en-US', True, True),
url_base + 'firefox-50.0a1.en-US.linux-x86_64.tar.bz2')

def test_get_download_url_nightly_l10n_stub(self):
"""
Nightly non en-US should have a slightly different directory name. For
Windows platforms, a universal stub installer is served by default.
"""
url_base = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central-l10n/'
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win', 'pt-BR', True),
url_base + 'firefox-50.0a1.pt-BR.win32.installer.exe')
url_base + 'firefox-50.0a1.pt-BR.win32.installer-stub.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win64', 'pt-BR', True),
url_base + 'firefox-50.0a1.pt-BR.win64.installer.exe')
url_base + 'firefox-50.0a1.pt-BR.win32.installer-stub.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'osx', 'pt-BR', True),
url_base + 'firefox-50.0a1.pt-BR.mac.dmg')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux', 'pt-BR', True),
url_base + 'firefox-50.0a1.pt-BR.linux-i686.tar.bz2')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux64', 'pt-BR', True),
url_base + 'firefox-50.0a1.pt-BR.linux-x86_64.tar.bz2')

def test_get_download_url_nightly_l10n_full(self):
"""
Nightly non en-US should have a slightly different directory name. For
Windows platforms, a full installer is served if the force_full_installer
option is enabled.
"""
url_base = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central-l10n/'
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win', 'pt-BR', True, True),
url_base + 'firefox-50.0a1.pt-BR.win32.installer.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'win64', 'pt-BR', True, True),
url_base + 'firefox-50.0a1.pt-BR.win64.installer.exe')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'osx', 'pt-BR', True, True),
url_base + 'firefox-50.0a1.pt-BR.mac.dmg')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux', 'pt-BR', True, True),
url_base + 'firefox-50.0a1.pt-BR.linux-i686.tar.bz2')
eq_(firefox_desktop.get_download_url('nightly', '50.0a1', 'linux64', 'pt-BR', True, True),
url_base + 'firefox-50.0a1.pt-BR.linux-x86_64.tar.bz2')

def test_get_download_url_scene2_funnelcake(self):
scene2 = firefox_desktop.download_base_url_transition
url = firefox_desktop.get_download_url('release', '45.0', 'win', 'en-US')
Expand Down
20 changes: 20 additions & 0 deletions bedrock/firefox/tests/test_helpers.py
Expand Up @@ -145,6 +145,26 @@ def test_stub_aurora_installer_override_locale(self):
for link in links:
ok_('stub' not in pq(link).attr('href'))

def test_nightly_desktop(self):
"""
The Nightly channel should have the Windows universal stub installer
instead of the Windows 64-bit build
"""
rf = RequestFactory()
get_request = rf.get('/fake')
get_request.locale = 'fr'
doc = pq(render("{{ download_firefox('nightly', platform='desktop') }}",
{'request': get_request}))

list = doc('.download-list li')
eq_(list.length, 5)
eq_(pq(list[0]).attr('class'), 'os_winsha1')
eq_(pq(list[1]).attr('class'), 'os_win')
eq_(pq(list[2]).attr('class'), 'os_osx')
eq_(pq(list[3]).attr('class'), 'os_linux')
eq_(pq(list[4]).attr('class'), 'os_linux64')
ok_('stub' in pq(pq(list[1]).find('a')[0]).attr('href'))

def test_aurora_desktop(self):
"""The Aurora channel should have Windows 64 build"""
rf = RequestFactory()
Expand Down

0 comments on commit 0b001bd

Please sign in to comment.