Backed out changeset 738ee02dfc2a (bug 1802405) for causing build bustages. CLOSED TREE

This commit is contained in:
Marian-Vasile Laza 2022-11-26 01:57:53 +02:00
parent 9fd296590d
commit 6b7ee54e9b
5 changed files with 37 additions and 53 deletions

View file

@ -116,9 +116,11 @@ def _maybe_activate_mozillabuild_environment():
paths_to_add = [mozillabuild_msys_tools_path, mozillabuild / "bin"]
existing_paths = [Path(p) for p in os.environ.get("PATH", "").split(os.pathsep)]
# It's important that we prepend to the path rather than append,
# in case mach is getting called from another msys2 environment.
for new_path in paths_to_add:
if new_path not in existing_paths:
os.environ["PATH"] += f"{os.pathsep}{new_path}"
os.environ["PATH"] = f"{new_path}{os.pathsep}" + os.environ["PATH"]
def initialize(topsrcdir):

View file

@ -794,12 +794,6 @@ def target_is_windows(target):
return True
@depends(host)
def host_is_windows(host):
if host.kernel == "WINNT":
return True
set_define("_WINDOWS", target_is_windows)
set_define("WIN32", target_is_windows)
set_define("XP_WIN", target_is_windows)
@ -829,12 +823,6 @@ def target_is_osx(target):
return True
@depends(host)
def host_is_osx(host):
if host.os == "OSX":
return True
set_define("XP_MACOSX", target_is_osx)
@ -1132,23 +1120,6 @@ def mozbuild_state_path(path, _):
return normalize_path(os.path.expanduser(os.path.join("~", ".mozbuild")))
@depends("MOZILLABUILD", shell, when=host_is_windows)
@imports(_from="pathlib", _import="Path")
def mozillabuild_bin_paths(mozillabuild, shell):
paths = []
if not mozillabuild:
return paths
paths.append(os.path.dirname(shell))
paths.append(str(Path(mozillabuild[0]) / "bin"))
return paths
@depends(mozillabuild_bin_paths)
@imports("os")
def prefer_mozillabuild_path(mozillabuild_bin_paths):
return mozillabuild_bin_paths + os.environ["PATH"].split(os.pathsep)
# A template providing a shorthand for setting a variable. The created
# option will only be settable with imply_option.
# It is expected that a project-specific moz.configure will call imply_option

View file

@ -11,7 +11,6 @@ m4 = check_prog(
"gm4",
"m4",
),
paths=prefer_mozillabuild_path,
)
@ -122,11 +121,11 @@ def old_configure_for(old_configure_path, extra_env=None):
@depends(
prepare_configure,
prepare_configure_options,
prefer_mozillabuild_path,
altered_path,
extra_env,
build_environment,
old_configure_path,
"MOZILLABUILD",
awk,
m4,
shell,
@ -148,23 +147,17 @@ def old_configure_for(old_configure_path, extra_env=None):
def old_configure(
prepare_configure,
prepare_configure_options,
prefer_mozillabuild_path,
altered_path,
extra_env,
build_env,
old_configure,
mozillabuild,
awk,
m4,
shell,
):
# Use prepare_configure to make lint happy
prepare_configure
if altered_path:
path = altered_path
else:
path = os.pathsep.join(prefer_mozillabuild_path)
refresh = True
if os.path.exists(old_configure):
mtime = os.path.getmtime(old_configure)
@ -190,7 +183,6 @@ def old_configure_for(old_configure_path, extra_env=None):
env["M4"] = m4
env["AWK"] = awk
env["AC_MACRODIR"] = os.path.join(build_env.topsrcdir, "build", "autoconf")
env["PATH"] = path
try:
script = subprocess.check_output(
@ -207,6 +199,17 @@ def old_configure_for(old_configure_path, extra_env=None):
env=env,
)
except CalledProcessError as exc:
# Autoconf on win32 may break due to a bad $PATH. Let the user know
# their $PATH is suspect.
if mozillabuild:
mozillabuild_path = normsep(mozillabuild[0])
sh_path = normsep(find_program("sh"))
if mozillabuild_path not in sh_path:
log.warning(
"The '{}msys/bin' directory is not first in $PATH. "
"This may cause autoconf to fail. ($PATH is currently "
"set to: {})".format(mozillabuild_path, os.environ["PATH"])
)
die("autoconf exited with return code {}".format(exc.returncode))
if not script:
@ -256,7 +259,8 @@ def old_configure_for(old_configure_path, extra_env=None):
log_size = os.path.getsize(config_log.baseFilename)
break
env["PATH"] = path
if altered_path:
env["PATH"] = altered_path
if extra_env:
env.update(extra_env)

View file

@ -68,6 +68,12 @@ with only_when(target_is_osx):
return value[0]
@depends(host)
def host_is_osx(host):
if host.os == "OSX":
return True
with only_when(host_is_osx | target_is_osx):
# MacOS SDK
# =========
@ -525,6 +531,12 @@ def get_vc_paths(topsrcdir):
yield (Version(install["installationVersion"]), tools_path)
@depends(host)
def host_is_windows(host):
if host.kernel == "WINNT":
return True
option(
"--with-visual-studio-version",
nargs=1,
@ -650,17 +662,13 @@ def rust_search_path(rust_path, search_order, original_path):
# As a workaround until bug 1516228 and bug 1516253 are fixed, set the PATH
# variable for the build to contain the toolchain search path.
#
# FIXME(bug 1802573): The two bugs above are fixed, do we still need that?
#
# Prepend the mozilla-build msys2 path, since otherwise we can get mismatched
# cygwin dll errors during configure if we get called from another msys2
# environment, see bug 1801826.
@depends(mozillabuild_bin_paths, vc_toolchain_search_path)
@depends(vc_toolchain_search_path)
@imports("os")
def altered_path(mozillabuild_bin_paths, vc_toolchain_search_path):
altered_path = mozillabuild_bin_paths + list(vc_toolchain_search_path)
for p in os.environ["PATH"].split(os.pathsep):
@imports(_from="os", _import="environ")
def altered_path(vc_toolchain_search_path):
path = environ["PATH"].split(os.pathsep)
altered_path = list(vc_toolchain_search_path)
for p in path:
if p not in altered_path:
altered_path.append(p)
return os.pathsep.join(altered_path)

View file

@ -189,7 +189,6 @@ set_config("ENABLE_UNIFIED_BUILD", True, when="--disable-unified-build")
include("build/moz.configure/bootstrap.configure")
# The execution model of the configure sandbox doesn't allow for
# check_prog to use bootstrap_search_path directly because check_prog
# comes first, so we use a trick to allow it. Uses of check_prog
@ -519,7 +518,7 @@ add_old_configure_assignment("CLANG_PLUGIN", clang_plugin_path)
# Awk detection
# ==============================================================
awk = check_prog("AWK", ("gawk", "mawk", "nawk", "awk"), paths=prefer_mozillabuild_path)
awk = check_prog("AWK", ("gawk", "mawk", "nawk", "awk"))
# Until the AWK variable is not necessary in old-configure