Skip to content

Commit

Permalink
Bug 1828783 - Allow to selectively opt in or out of bootstrapping spe…
Browse files Browse the repository at this point in the history
…cific toolchains in mach bootstrap. r=firefox-build-system-reviewers,ahochheiden

Differential Revision: https://phabricator.services.mozilla.com/D175826
  • Loading branch information
glandium committed Apr 20, 2023
1 parent a218a1e commit 60eb923
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
6 changes: 5 additions & 1 deletion python/mozboot/mozboot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,16 @@ def install_toolchain_artifact_impl(

subprocess.check_call(cmd, cwd=str(install_dir))

def auto_bootstrap(self, application):
def auto_bootstrap(self, application, exclude=[]):
args = ["--with-ccache=sccache"]
if application.endswith("_artifact_mode"):
args.append("--enable-artifact-builds")
application = application[: -len("_artifact_mode")]
args.append("--enable-project={}".format(application.replace("_", "/")))
if exclude:
args.append(
"--enable-bootstrap={}".format(",".join(f"-{x}" for x in exclude))
)
bootstrap_all_toolchains_for(args)

def run_as_root(self, command, may_use_sudo=True):
Expand Down
4 changes: 3 additions & 1 deletion python/mozboot/mozboot/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,14 @@ def __init__(
no_interactive=False,
hg_configure=False,
no_system_changes=False,
exclude=[],
mach_context=None,
):
self.instance = None
self.choice = choice
self.hg_configure = hg_configure
self.no_system_changes = no_system_changes
self.exclude = exclude
self.mach_context = mach_context
cls = None
args = {
Expand Down Expand Up @@ -257,7 +259,7 @@ def maybe_install_private_packages_or_exit(self, application):
# Also install the clang static-analysis package by default
# The best place to install our packages is in the state directory
# we have. We should have created one above in non-interactive mode.
self.instance.auto_bootstrap(application)
self.instance.auto_bootstrap(application, self.exclude)
self.instance.install_toolchain_artifact("fix-stacks")
self.instance.install_toolchain_artifact("minidump-stackwalk")
if not self.instance.artifact_mode:
Expand Down
10 changes: 9 additions & 1 deletion python/mozboot/mozboot/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,22 @@
action="store_true",
help="Only execute actions that leave the system configuration alone.",
)
def bootstrap(command_context, application_choice=None, no_system_changes=False):
@CommandArgument(
"--exclude",
nargs="+",
help="A list of bootstrappable elements not to bootstrap.",
)
def bootstrap(
command_context, application_choice=None, no_system_changes=False, exclude=[]
):
"""Bootstrap system and mach for optimal development experience."""
from mozboot.bootstrap import Bootstrapper

bootstrapper = Bootstrapper(
choice=application_choice,
no_interactive=not command_context._mach_context.is_interactive,
no_system_changes=no_system_changes,
exclude=exclude,
mach_context=command_context._mach_context,
)
bootstrapper.bootstrap(command_context.settings)
Expand Down
4 changes: 2 additions & 2 deletions python/mozbuild/mozbuild/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def _raw_sandbox(extra_args=[]):
sandbox = ConfigureSandbox(
{},
argv=["configure"]
+ extra_args
+ ["--enable-bootstrap", f"MOZCONFIG={os.devnull}"],
+ ["--enable-bootstrap", f"MOZCONFIG={os.devnull}"]
+ extra_args,
logger=logger,
)
return sandbox
Expand Down

0 comments on commit 60eb923

Please sign in to comment.