Skip to content

Commit

Permalink
Backed out 4 changesets (bug 1769405) for causing regression in Bug 1…
Browse files Browse the repository at this point in the history
…774100. CLOSED TREE

Backed out changeset 813147df341c (bug 1769405)
Backed out changeset 6de9495c467d (bug 1769405)
Backed out changeset 9099ba749b1f (bug 1769405)
Backed out changeset 5f8e0141a0ed (bug 1769405)
  • Loading branch information
Marian-Vasile Laza committed Jun 13, 2022
1 parent 894d3bd commit 8d68418
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 118 deletions.
18 changes: 0 additions & 18 deletions build/moz.configure/init.configure
Original file line number Diff line number Diff line change
Expand Up @@ -402,24 +402,6 @@ def default_project(build_env, js_package):
option("--enable-project", nargs=1, default=default_project, help="Project to build")


# Artifact builds
# ==============================================================

option(
"--enable-artifact-builds",
env="MOZ_ARTIFACT_BUILDS",
help="Download and use prebuilt binary artifacts.",
)


@depends("--enable-artifact-builds")
def artifact_builds(value):
if value:
return True


set_config("MOZ_ARTIFACT_BUILDS", artifact_builds)

# Host and target systems
# ==============================================================
option("--host", nargs=1, help="Define the system type performing the build")
Expand Down
15 changes: 15 additions & 0 deletions moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ include("build/moz.configure/init.configure")
# - Spidermonkey-specific options and rules should go in js/moz.configure.
# - etc.

option(
"--enable-artifact-builds",
env="MOZ_ARTIFACT_BUILDS",
help="Download and use prebuilt binary artifacts.",
)


@depends("--enable-artifact-builds")
def artifact_builds(value):
if value:
return True


set_config("MOZ_ARTIFACT_BUILDS", artifact_builds)

imply_option(
"--enable-artifact-build-symbols",
depends(artifact_builds)(lambda v: False if v is None else None),
Expand Down
103 changes: 17 additions & 86 deletions python/mozboot/mozboot/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
from mozboot.void import VoidBootstrapper
from mozboot.windows import WindowsBootstrapper
from mozboot.mozillabuild import MozillaBuildBootstrapper
from mozboot.mozconfig import MozconfigBuilder
from mozboot.mozconfig import find_mozconfig, MozconfigBuilder
from mozfile import which
from mozbuild.base import MozbuildObject

# Use distro package to retrieve linux platform information
import distro
Expand Down Expand Up @@ -82,21 +81,6 @@
<<<
"""

MOZCONFIG_MISMATCH_WARNING_TEMPLATE = """
WARNING! Mismatch detected between the selected build target and the
mozconfig file %s:
Current config
>>>
%s
<<<
Expected config
>>>
%s
<<<
"""

CONFIGURE_MERCURIAL = """
Mozilla recommends a number of changes to Mercurial to enhance your
experience with it.
Expand Down Expand Up @@ -387,8 +371,6 @@ def bootstrap(self, settings):
if not self.instance.no_interactive and not settings.mach_telemetry.is_set_up:
initialize_telemetry_setting(settings, str(checkout_root), str(state_dir))

self._output_mozconfig(application, mozconfig_builder)

print(FINISHED % name)
if not (
which("rustc")
Expand All @@ -399,54 +381,7 @@ def bootstrap(self, settings):
% name
)

def _default_mozconfig_path(self):
return Path(self.mach_context.topdir) / "mozconfig"

def _read_default_mozconfig(self):
path = self._default_mozconfig_path()
with open(path, "r") as mozconfig_file:
return mozconfig_file.read()

def _write_default_mozconfig(self, raw_mozconfig):
path = self._default_mozconfig_path()
with open(path, "w") as mozconfig_file:
mozconfig_file.write(raw_mozconfig)
print(f'Your requested configuration has been written to "{path}".')

def _show_mozconfig_suggestion(self, raw_mozconfig):
suggestion = MOZCONFIG_SUGGESTION_TEMPLATE % (
self._default_mozconfig_path(),
raw_mozconfig,
)
print(suggestion, end="")

def _check_default_mozconfig_mismatch(
self, current_mozconfig_info, expected_application, expected_raw_mozconfig
):
current_raw_mozconfig = self._read_default_mozconfig()
current_application = current_mozconfig_info["project"][0].replace("/", "_")
if current_mozconfig_info["artifact-builds"]:
current_application += "_artifact_mode"

if expected_application == current_application:
if expected_raw_mozconfig == current_raw_mozconfig:
return

# There's minor difference, show the suggestion.
self._show_mozconfig_suggestion(expected_raw_mozconfig)
return

warning = MOZCONFIG_MISMATCH_WARNING_TEMPLATE % (
self._default_mozconfig_path(),
current_raw_mozconfig,
expected_raw_mozconfig,
)
print(warning)

if not self.instance.prompt_yesno("Do you want to overwrite the config?"):
return

self._write_default_mozconfig(expected_raw_mozconfig)
self._output_mozconfig(application, mozconfig_builder)

def _output_mozconfig(self, application, mozconfig_builder):
# Like 'generate_browser_mozconfig' or 'generate_mobile_android_mozconfig'.
Expand All @@ -457,26 +392,22 @@ def _output_mozconfig(self, application, mozconfig_builder):
mozconfig_builder.append(additional_mozconfig)
raw_mozconfig = mozconfig_builder.generate()

current_mozconfig_info = MozbuildObject.get_base_mozconfig_info(
self.mach_context.topdir, None, ""
)
current_mozconfig_path = current_mozconfig_info["mozconfig"]["path"]

if current_mozconfig_path:
# mozconfig file exists
if Path.samefile(
Path(current_mozconfig_path), self._default_mozconfig_path()
):
# This mozconfig file may be created by bootstrap.
self._check_default_mozconfig_mismatch(
current_mozconfig_info, application, raw_mozconfig
if raw_mozconfig:
mozconfig_path = find_mozconfig(Path(self.mach_context.topdir))
if not mozconfig_path:
# No mozconfig file exists yet
mozconfig_path = Path(self.mach_context.topdir) / "mozconfig"
with open(mozconfig_path, "w") as mozconfig_file:
mozconfig_file.write(raw_mozconfig)
print(
f'Your requested configuration has been written to "{mozconfig_path}".'
)
else:
suggestion = MOZCONFIG_SUGGESTION_TEMPLATE % (
mozconfig_path,
raw_mozconfig,
)
elif raw_mozconfig:
# The mozconfig file is created by user.
self._show_mozconfig_suggestion(raw_mozconfig)
elif raw_mozconfig:
# No mozconfig file exists yet
self._write_default_mozconfig(raw_mozconfig)
print(suggestion, end="")

def _validate_python_environment(self, topsrcdir):
valid = True
Expand Down
24 changes: 10 additions & 14 deletions python/mozbuild/mozbuild/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def virtualenv_manager(self):

@staticmethod
@memoize
def get_base_mozconfig_info(topsrcdir, path, env_mozconfig):
def get_mozconfig_and_target(topsrcdir, path, env_mozconfig):
# env_mozconfig is only useful for unittests, which change the value of
# the environment variable, which has an impact on autodetection (when
# path is MozconfigLoader.AUTODETECT), and memoization wouldn't account
Expand Down Expand Up @@ -321,29 +321,25 @@ def depends_impl(self, *args, **kwargs):
sandbox = ReducedConfigureSandbox(
{},
environ=env,
argv=["mach"],
argv=["mach", "--help"],
logger=logger,
)
base_dir = os.path.join(topsrcdir, "build", "moz.configure")
try:
sandbox.include_file(os.path.join(base_dir, "init.configure"))
# Force mozconfig options injection before getting the target.
sandbox._value_for(sandbox["mozconfig_options"])
return {
"mozconfig": sandbox._value_for(sandbox["mozconfig"]),
"target": sandbox._value_for(sandbox["real_target"]),
"project": sandbox._value_for(sandbox._options["project"]),
"artifact-builds": sandbox._value_for(
sandbox._options["artifact-builds"]
),
}
return (
sandbox._value_for(sandbox["mozconfig"]),
sandbox._value_for(sandbox["real_target"]),
)
except SystemExit:
print(out.getvalue())
raise

@property
def base_mozconfig_info(self):
return self.get_base_mozconfig_info(
def mozconfig_and_target(self):
return self.get_mozconfig_and_target(
self.topsrcdir, self._mozconfig, os.environ.get("MOZCONFIG")
)

Expand All @@ -353,7 +349,7 @@ def mozconfig(self):
This a dict as returned by MozconfigLoader.read_mozconfig()
"""
return self.base_mozconfig_info["mozconfig"]
return self.mozconfig_and_target[0]

@property
def config_environment(self):
Expand Down Expand Up @@ -573,7 +569,7 @@ def get_binary_path(self, what="app", validate_exists=True, where="default"):
return path

def resolve_config_guess(self):
return self.base_mozconfig_info["target"].alias
return self.mozconfig_and_target[1].alias

def notify(self, msg):
"""Show a desktop notification with the supplied message
Expand Down

0 comments on commit 8d68418

Please sign in to comment.