Commit 8d68418a authored by Marian-Vasile Laza's avatar Marian-Vasile Laza
Browse files

Backed out 4 changesets (bug 1769405) for causing regression in Bug 1774100. 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)
parent 894d3bd8
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -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")
+15 −0
Original line number Diff line number Diff line
@@ -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),
+17 −86
Original line number Diff line number Diff line
@@ -37,9 +37,8 @@ from mozboot.solus import SolusBootstrapper
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
@@ -82,21 +81,6 @@ Paste the lines between the chevrons (>>> and <<<) into
<<<
"""

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.
@@ -387,8 +371,6 @@ class Bootstrapper(object):
        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")
@@ -399,54 +381,7 @@ class Bootstrapper(object):
                % 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'.
@@ -457,26 +392,22 @@ class Bootstrapper(object):
            mozconfig_builder.append(additional_mozconfig)
        raw_mozconfig = mozconfig_builder.generate()

        current_mozconfig_info = MozbuildObject.get_base_mozconfig_info(
            self.mach_context.topdir, None, ""
        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}".'
                )
        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
            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
+10 −14
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ class MozbuildObject(ProcessExecutionMixin):

    @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
@@ -321,7 +321,7 @@ class MozbuildObject(ProcessExecutionMixin):
        sandbox = ReducedConfigureSandbox(
            {},
            environ=env,
            argv=["mach"],
            argv=["mach", "--help"],
            logger=logger,
        )
        base_dir = os.path.join(topsrcdir, "build", "moz.configure")
@@ -329,21 +329,17 @@ class MozbuildObject(ProcessExecutionMixin):
            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")
        )

@@ -353,7 +349,7 @@ class MozbuildObject(ProcessExecutionMixin):

        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):
@@ -573,7 +569,7 @@ class MozbuildObject(ProcessExecutionMixin):
        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