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 ab63671285
commit edd4af1b15
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"] paths_to_add = [mozillabuild_msys_tools_path, mozillabuild / "bin"]
existing_paths = [Path(p) for p in os.environ.get("PATH", "").split(os.pathsep)] 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: for new_path in paths_to_add:
if new_path not in existing_paths: 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): def initialize(topsrcdir):

View File

@@ -794,12 +794,6 @@ def target_is_windows(target):
return True return True
@depends(host)
def host_is_windows(host):
if host.kernel == "WINNT":
return True
set_define("_WINDOWS", target_is_windows) set_define("_WINDOWS", target_is_windows)
set_define("WIN32", target_is_windows) set_define("WIN32", target_is_windows)
set_define("XP_WIN", target_is_windows) set_define("XP_WIN", target_is_windows)
@@ -829,12 +823,6 @@ def target_is_osx(target):
return True return True
@depends(host)
def host_is_osx(host):
if host.os == "OSX":
return True
set_define("XP_MACOSX", target_is_osx) 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"))) 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 # A template providing a shorthand for setting a variable. The created
# option will only be settable with imply_option. # option will only be settable with imply_option.
# It is expected that a project-specific moz.configure will call 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", "gm4",
"m4", "m4",
), ),
paths=prefer_mozillabuild_path,
) )
@@ -122,11 +121,11 @@ def old_configure_for(old_configure_path, extra_env=None):
@depends( @depends(
prepare_configure, prepare_configure,
prepare_configure_options, prepare_configure_options,
prefer_mozillabuild_path,
altered_path, altered_path,
extra_env, extra_env,
build_environment, build_environment,
old_configure_path, old_configure_path,
"MOZILLABUILD",
awk, awk,
m4, m4,
shell, shell,
@@ -148,23 +147,17 @@ def old_configure_for(old_configure_path, extra_env=None):
def old_configure( def old_configure(
prepare_configure, prepare_configure,
prepare_configure_options, prepare_configure_options,
prefer_mozillabuild_path,
altered_path, altered_path,
extra_env, extra_env,
build_env, build_env,
old_configure, old_configure,
mozillabuild,
awk, awk,
m4, m4,
shell, shell,
): ):
# Use prepare_configure to make lint happy # Use prepare_configure to make lint happy
prepare_configure prepare_configure
if altered_path:
path = altered_path
else:
path = os.pathsep.join(prefer_mozillabuild_path)
refresh = True refresh = True
if os.path.exists(old_configure): if os.path.exists(old_configure):
mtime = os.path.getmtime(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["M4"] = m4
env["AWK"] = awk env["AWK"] = awk
env["AC_MACRODIR"] = os.path.join(build_env.topsrcdir, "build", "autoconf") env["AC_MACRODIR"] = os.path.join(build_env.topsrcdir, "build", "autoconf")
env["PATH"] = path
try: try:
script = subprocess.check_output( script = subprocess.check_output(
@@ -207,6 +199,17 @@ def old_configure_for(old_configure_path, extra_env=None):
env=env, env=env,
) )
except CalledProcessError as exc: 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)) die("autoconf exited with return code {}".format(exc.returncode))
if not script: 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) log_size = os.path.getsize(config_log.baseFilename)
break break
env["PATH"] = path if altered_path:
env["PATH"] = altered_path
if extra_env: if extra_env:
env.update(extra_env) env.update(extra_env)

View File

@@ -68,6 +68,12 @@ with only_when(target_is_osx):
return value[0] 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): with only_when(host_is_osx | target_is_osx):
# MacOS SDK # MacOS SDK
# ========= # =========
@@ -525,6 +531,12 @@ def get_vc_paths(topsrcdir):
yield (Version(install["installationVersion"]), tools_path) yield (Version(install["installationVersion"]), tools_path)
@depends(host)
def host_is_windows(host):
if host.kernel == "WINNT":
return True
option( option(
"--with-visual-studio-version", "--with-visual-studio-version",
nargs=1, 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 # As a workaround until bug 1516228 and bug 1516253 are fixed, set the PATH
# variable for the build to contain the toolchain search path. # variable for the build to contain the toolchain search path.
# @depends(vc_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)
@imports("os") @imports("os")
def altered_path(mozillabuild_bin_paths, vc_toolchain_search_path): @imports(_from="os", _import="environ")
altered_path = mozillabuild_bin_paths + list(vc_toolchain_search_path) def altered_path(vc_toolchain_search_path):
for p in os.environ["PATH"].split(os.pathsep): path = environ["PATH"].split(os.pathsep)
altered_path = list(vc_toolchain_search_path)
for p in path:
if p not in altered_path: if p not in altered_path:
altered_path.append(p) altered_path.append(p)
return os.pathsep.join(altered_path) 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") include("build/moz.configure/bootstrap.configure")
# The execution model of the configure sandbox doesn't allow for # The execution model of the configure sandbox doesn't allow for
# check_prog to use bootstrap_search_path directly because check_prog # 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 # 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 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 # Until the AWK variable is not necessary in old-configure