Source code

Revision control

Copy as Markdown

Other Tools

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at
from __future__ import absolute_import, print_function, unicode_literals
from mozboot.base import BaseBootstrapper
from mozboot.linux_common import LinuxBootstrapper
import sys
Mercurial releases a new version every 3 months and your distro's package
may become out of date. This may cause incompatibility with some
Mercurial extensions that rely on new Mercurial features. As a result,
you may not have an optimal version control experience.
To have the best Mercurial experience possible, we recommend installing
Mercurial via the "pip" Python packaging utility. This will likely result
in files being placed in /usr/local/bin and /usr/local/lib.
How would you like to continue?
1. Install a modern Mercurial via pip [default]
2. Install a legacy Mercurial via apt
3. Do not install Mercurial
Your choice: """
class DebianBootstrapper(LinuxBootstrapper, BaseBootstrapper):
# These are common packages for all Debian-derived distros (such as
# Ubuntu).
# These are common packages for building Firefox for Desktop
# (browser) for all Debian-derived distros (such as Ubuntu).
# These are common packages for building Firefox for Android
# (mobile/android) for all Debian-derived distros (such as Ubuntu).
"libncurses5", # For native debugging in Android Studio
def __init__(self, distro, version, dist_id, codename, **kwargs):
BaseBootstrapper.__init__(self, **kwargs)
self.distro = distro
self.version = version
self.dist_id = dist_id
self.codename = codename
self.packages = list(self.COMMON_PACKAGES)
version_number = int(version)
except ValueError:
version_number = None
if (version_number and (version_number >= 11)) or version == "unstable":
self.packages += ["watchman"]
def suggest_install_distutils(self):
"HINT: Try installing distutils with "
"`apt-get install python3-distutils`.",
def suggest_install_pip3(self):
"HINT: Try installing pip3 with `apt-get install python3-pip`.",
def install_system_packages(self):
def install_browser_packages(self, mozconfig_builder, artifact_mode=False):
# TODO: Figure out what not to install for artifact mode
def install_browser_artifact_mode_packages(self, mozconfig_builder):
self.install_browser_packages(mozconfig_builder, artifact_mode=True)
def install_mobile_android_packages(self, mozconfig_builder, artifact_mode=False):
# Multi-part process:
# 1. System packages.
# 2. Android SDK. Android NDK only if we are not in artifact mode. Android packages.
# 2. Android pieces.
mozconfig_builder, artifact_mode=artifact_mode
def _update_package_manager(self):
def upgrade_mercurial(self, current):
"""Install Mercurial from pip because Debian packages typically lag."""
if self.no_interactive:
# Install via Apt in non-interactive mode because it is the more
# conservative option and less likely to make people upset.
res = self.prompt_int(MERCURIAL_INSTALL_PROMPT, 1, 3)
# Apt.
if res == 2:
return False
# No Mercurial.
if res == 3:
print("Not installing Mercurial.")
return False
# pip.
assert res == 1
self.run_as_root(["pip3", "install", "--upgrade", "Mercurial"])