Beispiel #1
0
    def get_download_url(
        self,
        channel,
        version,
        platform,
        locale,
        force_direct=False,
        force_full_installer=False,
        force_funnelcake=False,
        funnelcake_id=None,
        locale_in_transition=False,
    ):
        """
        Get direct download url for the product.
        :param channel: one of self.version_map.keys().
        :param version: a firefox version. one of self.latest_version.
        :param platform: OS. one of self.platform_labels.keys().
        :param locale: e.g. pt-BR. one exception is ja-JP-mac.
        :param force_direct: Force the download URL to be direct.
                always True for non-release URLs.
        :param force_full_installer: Force the installer download to not be
                the stub installer (for aurora).
        :param force_funnelcake: Force the download version for en-US Windows to be
                'latest', which bouncer will translate to the funnelcake build.
        :param funnelcake_id: ID for the the funnelcake build.
        :param locale_in_transition: Include the locale in the transition URL
        :return: string url
        """
        # no longer used, but still passed in. leaving here for now
        # as it will likely be used in future.
        # _version = version
        _locale = "ja-JP-mac" if platform == "osx" and locale == "ja" else locale
        channel = "devedition" if channel == "alpha" else channel
        force_direct = True if channel != "release" else force_direct
        stub_platforms = ["win", "win64"]
        esr_channels = ["esr", "esr_next"]
        include_funnelcake_param = False

        # support optional MSI installer downloads
        # bug 1493205
        is_msi = platform.endswith("-msi")
        if is_msi:
            platform = platform[:-4]

        # Bug 1345467 - Only allow specifically configured funnelcake builds
        if funnelcake_id:
            fc_platforms = config(f"FUNNELCAKE_{funnelcake_id}_PLATFORMS",
                                  default="",
                                  parser=ListOf(str))
            fc_locales = config(f"FUNNELCAKE_{funnelcake_id}_LOCALES",
                                default="",
                                parser=ListOf(str))
            include_funnelcake_param = platform in fc_platforms and _locale in fc_locales

        # Check if direct download link has been requested
        # if not just use transition URL
        if not force_direct:
            # build a link to the transition page
            transition_url = self.download_base_url_transition
            if funnelcake_id:
                # include funnelcake in scene 2 URL
                transition_url += f"?f={funnelcake_id}"

            if locale_in_transition:
                transition_url = f"/{locale}{transition_url}"

            return transition_url

        # otherwise build a full download URL
        prod_name = "firefox" if channel == "release" else f"firefox-{channel}"
        suffix = "latest-ssl"
        if is_msi:
            suffix = "msi-" + suffix

        if channel in esr_channels:
            # nothing special about ESR other than there is no stub.
            # included in this contitional to avoid the following elif.
            if channel == "esr_next":
                prod_name = "firefox-esr-next"
        elif platform in stub_platforms and not is_msi and not force_full_installer:
            # Use the stub installer for approved platforms
            # append funnelcake id to version if we have one
            if include_funnelcake_param:
                suffix = f"stub-f{funnelcake_id}"
            else:
                suffix = "stub"
        elif channel == "nightly" and locale != "en-US":
            # Nightly uses a different product name for localized builds,
            # and is the only one ಠ_ಠ
            suffix = "latest-l10n-ssl"
            if is_msi:
                suffix = "msi-" + suffix

        product = f"{prod_name}-{suffix}"

        return "?".join([
            self.bouncer_url,
            urlencode([
                ("product", product),
                ("os", platform),
                # Order matters, lang must be last for bouncer.
                ("lang", _locale),
            ]),
        ])
Beispiel #2
0
    def get_download_url(self,
                         channel,
                         version,
                         platform,
                         locale,
                         force_direct=False,
                         force_full_installer=False,
                         force_funnelcake=False,
                         funnelcake_id=None,
                         locale_in_transition=False):
        """
        Get direct download url for the product.
        :param channel: one of self.version_map.keys().
        :param version: a firefox version. one of self.latest_version.
        :param platform: OS. one of self.platform_labels.keys().
        :param locale: e.g. pt-BR. one exception is ja-JP-mac.
        :param force_direct: Force the download URL to be direct.
                always True for non-release URLs.
        :param force_full_installer: Force the installer download to not be
                the stub installer (for aurora).
        :param force_funnelcake: Force the download version for en-US Windows to be
                'latest', which bouncer will translate to the funnelcake build.
        :param funnelcake_id: ID for the the funnelcake build.
        :param locale_in_transition: Include the locale in the transition URL
        :return: string url
        """
        # no longer used, but still passed in. leaving here for now
        # as it will likely be used in future.
        # _version = version
        _locale = 'ja-JP-mac' if platform == 'osx' and locale == 'ja' else locale
        channel = 'devedition' if channel == 'alpha' else channel
        force_direct = True if channel != 'release' else force_direct
        stub_platforms = ['win', 'win64']
        esr_channels = ['esr', 'esr_next']
        include_funnelcake_param = False

        # support optional MSI installer downloads
        # bug 1493205
        is_msi = platform.endswith('-msi')
        if is_msi:
            platform = platform[:-4]

        # Bug 1345467 - Only allow specifically configured funnelcake builds
        if funnelcake_id:
            fc_platforms = config('FUNNELCAKE_%s_PLATFORMS' % funnelcake_id,
                                  default='',
                                  parser=ListOf(str))
            fc_locales = config('FUNNELCAKE_%s_LOCALES' % funnelcake_id,
                                default='',
                                parser=ListOf(str))
            include_funnelcake_param = platform in fc_platforms and _locale in fc_locales

        # Check if direct download link has been requested
        # if not just use transition URL
        if not force_direct:
            # build a link to the transition page
            transition_url = self.download_base_url_transition
            if funnelcake_id:
                # include funnelcake in scene 2 URL
                transition_url += '?f=%s' % funnelcake_id

            if locale_in_transition:
                transition_url = '/%s%s' % (locale, transition_url)

            return transition_url

        # otherwise build a full download URL
        prod_name = 'firefox' if channel == 'release' else 'firefox-%s' % channel
        suffix = 'latest-ssl'
        if is_msi:
            suffix = 'msi-' + suffix

        if channel in esr_channels:
            # nothing special about ESR other than there is no stub.
            # included in this contitional to avoid the following elif.
            if channel == 'esr_next':
                prod_name = 'firefox-esr-next'
        elif platform in stub_platforms and not is_msi and not force_full_installer:
            # Use the stub installer for approved platforms
            # append funnelcake id to version if we have one
            if include_funnelcake_param:
                suffix = 'stub-f%s' % funnelcake_id
            else:
                suffix = 'stub'
        elif channel == 'nightly' and locale != 'en-US':
            # Nightly uses a different product name for localized builds,
            # and is the only one ಠ_ಠ
            suffix = 'latest-l10n-ssl'
            if is_msi:
                suffix = 'msi-' + suffix

        product = '%s-%s' % (prod_name, suffix)

        return '?'.join([
            self.bouncer_url,
            urlencode([
                ('product', product),
                ('os', platform),
                # Order matters, lang must be last for bouncer.
                ('lang', _locale),
            ])
        ])
Beispiel #3
0
    def get_download_url(self, channel, version, platform, locale,
                         force_direct=False, force_full_installer=False,
                         force_funnelcake=False, funnelcake_id=None,
                         locale_in_transition=False):
        """
        Get direct download url for the product.
        :param channel: one of self.version_map.keys().
        :param version: a firefox version. one of self.latest_version.
        :param platform: OS. one of self.platform_labels.keys().
        :param locale: e.g. pt-BR. one exception is ja-JP-mac.
        :param force_direct: Force the download URL to be direct.
                always True for non-release URLs.
        :param force_full_installer: Force the installer download to not be
                the stub installer (for aurora).
        :param force_funnelcake: Force the download version for en-US Windows to be
                'latest', which bouncer will translate to the funnelcake build.
        :param funnelcake_id: ID for the the funnelcake build.
        :param locale_in_transition: Include the locale in the transition URL
        :return: string url
        """
        _version = version
        _locale = 'ja-JP-mac' if platform == 'osx' and locale == 'ja' else locale
        channel = 'devedition' if channel == 'alpha' else channel
        force_direct = True if channel != 'release' else force_direct
        stub_platforms = ['win', 'win64']
        esr_channels = ['esr', 'esr_next']
        include_funnelcake_param = False

        # Bug 1345467 - Only allow specifically configured funnelcake builds
        if funnelcake_id:
            fc_platforms = config('FUNNELCAKE_%s_PLATFORMS' % funnelcake_id, default='', parser=ListOf(str))
            fc_locales = config('FUNNELCAKE_%s_LOCALES' % funnelcake_id, default='', parser=ListOf(str))
            include_funnelcake_param = platform in fc_platforms and _locale in fc_locales

        # Check if direct download link has been requested
        # if not just use transition URL
        if not force_direct:
            # build a link to the transition page
            transition_url = self.download_base_url_transition
            if funnelcake_id:
                # include funnelcake in scene 2 URL
                transition_url += '?f=%s' % funnelcake_id

            if locale_in_transition:
                transition_url = '/%s%s' % (locale, transition_url)

            return transition_url

        # otherwise build a full download URL
        prod_name = 'firefox' if channel == 'release' else 'firefox-%s' % channel
        suffix = 'latest-ssl'
        if channel in esr_channels:
            # nothing special about ESR other than there is no stub.
            # included in this contitional to avoid the following elif.
            if channel == 'esr_next':
                # no firefox-esr-next-latest-ssl alias just yet
                # could come in future in bug 1408868
                prod_name = 'firefox'
                suffix = '%s-SSL' % _version
        elif platform in stub_platforms and not force_full_installer:
            # Use the stub installer for approved platforms
            # append funnelcake id to version if we have one
            if include_funnelcake_param:
                suffix = 'stub-f%s' % funnelcake_id
            else:
                suffix = 'stub'
        elif channel == 'nightly' and locale != 'en-US':
            # Nightly uses a different product name for localized builds,
            # and is the only one ಠ_ಠ
            suffix = 'latest-l10n-ssl'

        product = '%s-%s' % (prod_name, suffix)

        return '?'.join([self.bouncer_url,
                        urlencode([
                            ('product', product),
                            ('os', platform),
                            # Order matters, lang must be last for bouncer.
                            ('lang', _locale),
                        ])])