зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1725895: Add support for MSYS2 MozillaBuild r=glandium
MSYS2 has a slightly different directory structure (binaries are now under "/usr/bin/" instead of "/bin/"), and we're now plonking it in `%MOZILLABUILD%\msys2` instead of `%MOZILLABUILD%\msys` so that MSYS1 files don't interfere with MSYS2 after a pave-over install. Speaking of pave-over installs: if both `msys2` and `msys` are available, this patch prefers `msys2`. This is because MozillaBuild installations with MSYS2 are going to _assume_ they're using MSYS2, and therefore be most compatible with the versions of packages shipped with MSYS2. Differential Revision: https://phabricator.services.mozilla.com/D133549
This commit is contained in:
Родитель
92a19e0eb9
Коммит
47520dab98
|
@ -104,12 +104,16 @@ option(env="CONFIG_SHELL", nargs=1, help="Path to a POSIX shell")
|
|||
@depends("CONFIG_SHELL", "MOZILLABUILD")
|
||||
@checking("for a shell")
|
||||
@imports("sys")
|
||||
@imports(_from="pathlib", _import="Path")
|
||||
def shell(value, mozillabuild):
|
||||
if value:
|
||||
return find_program(value[0])
|
||||
shell = "sh"
|
||||
if mozillabuild:
|
||||
shell = mozillabuild[0] + "/msys/bin/sh"
|
||||
if (Path(mozillabuild[0]) / "msys2").exists():
|
||||
shell = mozillabuild[0] + "/msys2/usr/bin/sh"
|
||||
else:
|
||||
shell = mozillabuild[0] + "/msys/bin/sh"
|
||||
if sys.platform == "win32":
|
||||
shell = shell + ".exe"
|
||||
return find_program(shell)
|
||||
|
|
|
@ -35,8 +35,8 @@ def FixupMsysPath(path):
|
|||
trying to pass an absolute path on a remote server. This function attempts
|
||||
to un-mangle such paths."""
|
||||
if "OSTYPE" in os.environ and os.environ["OSTYPE"] == "msys":
|
||||
# sort of awful, find out where our shell is (should be in msys/bin)
|
||||
# and strip the first part of that path out of the other path
|
||||
# sort of awful, find out where our shell is (should be in msys2/usr/bin
|
||||
# or msys/bin) and strip the first part of that path out of the other path
|
||||
if "SHELL" in os.environ:
|
||||
sh = os.environ["SHELL"]
|
||||
msys = sh[: sh.find("/bin")]
|
||||
|
|
|
@ -11,6 +11,7 @@ import os
|
|||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from typing import Optional
|
||||
from mozprocess.processhandler import ProcessHandlerMixin
|
||||
|
@ -24,7 +25,11 @@ from .logging import LoggingMixin
|
|||
if "SHELL" in os.environ:
|
||||
_current_shell = os.environ["SHELL"]
|
||||
elif "MOZILLABUILD" in os.environ:
|
||||
_current_shell = os.environ["MOZILLABUILD"] + "/msys/bin/sh.exe"
|
||||
mozillabuild = os.environ["MOZILLABUILD"]
|
||||
if (Path(mozillabuild) / "msys2").exists():
|
||||
_current_shell = mozillabuild + "/msys2/usr/bin/sh.exe"
|
||||
else:
|
||||
_current_shell = mozillabuild + "/msys/bin/sh.exe"
|
||||
elif "COMSPEC" in os.environ:
|
||||
_current_shell = os.environ["COMSPEC"]
|
||||
elif sys.platform != "win32":
|
||||
|
|
|
@ -12,6 +12,7 @@ import os
|
|||
import re
|
||||
import sys
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
from xml.dom import getDOMImplementation
|
||||
|
||||
|
@ -466,11 +467,16 @@ class VisualStudioBackend(CommonBackend):
|
|||
fh.write(b"$expanded = $bashargs -join ' '\r\n")
|
||||
fh.write(b'$procargs = "-c", $expanded\r\n')
|
||||
|
||||
if (Path(os.environ["MOZILLABUILD"]) / "msys2").exists():
|
||||
bash_path = rb"msys2\usr\bin\bash"
|
||||
else:
|
||||
bash_path = rb"msys\bin\bash"
|
||||
|
||||
fh.write(
|
||||
b"Start-Process -WorkingDirectory $env:TOPOBJDIR "
|
||||
b"-FilePath $env:MOZILLABUILD\\msys\\bin\\bash "
|
||||
b"-FilePath $env:MOZILLABUILD\\%b "
|
||||
b"-ArgumentList $procargs "
|
||||
b"-Wait -NoNewWindow\r\n"
|
||||
b"-Wait -NoNewWindow\r\n" % bash_path
|
||||
)
|
||||
|
||||
def _write_mach_batch(self, fh):
|
||||
|
@ -492,12 +498,17 @@ class VisualStudioBackend(CommonBackend):
|
|||
self.environment.topsrcdir, self.environment.topobjdir
|
||||
).replace("\\", "/")
|
||||
|
||||
if (Path(os.environ["MOZILLABUILD"]) / "msys2").exists():
|
||||
bash_path = rb"msys2\usr\bin\bash"
|
||||
else:
|
||||
bash_path = rb"msys\bin\bash"
|
||||
|
||||
# We go through mach because it has the logic for choosing the most
|
||||
# appropriate build tool.
|
||||
fh.write(
|
||||
b'"%%MOZILLABUILD%%\\msys\\bin\\bash" '
|
||||
b'"%%MOZILLABUILD%%\\%b" '
|
||||
b'-c "%s/mach --log-no-times %%1 %%2 %%3 %%4 %%5 %%6 %%7"'
|
||||
% relpath.encode("utf-8")
|
||||
% (bash_path, relpath.encode("utf-8"))
|
||||
)
|
||||
|
||||
def _write_vs_project(self, out_dir, basename, name, **kwargs):
|
||||
|
|
|
@ -10,6 +10,7 @@ import six
|
|||
import sys
|
||||
import subprocess
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from textwrap import dedent
|
||||
|
||||
from mozboot.mozconfig import find_mozconfig
|
||||
|
@ -132,7 +133,11 @@ class MozconfigLoader(object):
|
|||
# directly calling sh mozconfig_loader.
|
||||
shell = "sh"
|
||||
if "MOZILLABUILD" in os.environ:
|
||||
shell = os.environ["MOZILLABUILD"] + "/msys/bin/sh"
|
||||
mozillabuild = os.environ["MOZILLABUILD"]
|
||||
if (Path(mozillabuild) / "msys2").exists():
|
||||
shell = mozillabuild + "/msys2/usr/bin/sh"
|
||||
else:
|
||||
shell = mozillabuild + "/msys/bin/sh"
|
||||
if sys.platform == "win32":
|
||||
shell = shell + ".exe"
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import shutil
|
|||
import zipfile
|
||||
import tarfile
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mozbuild.repackaging.application_ini import get_application_ini_value
|
||||
from mozbuild.util import ensureParentDir
|
||||
|
@ -83,7 +85,12 @@ def repackage_mar(topsrcdir, package, mar, output, arch=None, mar_channel_id=Non
|
|||
if sys.platform == "win32":
|
||||
# make_full_update.sh is a bash script, and Windows needs to
|
||||
# explicitly call out the shell to execute the script from Python.
|
||||
cmd.insert(0, env["MOZILLABUILD"] + "/msys/bin/bash.exe")
|
||||
|
||||
mozillabuild = os.environ["MOZILLABUILD"]
|
||||
if (Path(mozillabuild) / "msys2").exists():
|
||||
cmd.insert(0, mozillabuild + "/msys2/usr/bin/bash.exe")
|
||||
else:
|
||||
cmd.insert(0, mozillabuild + "/msys/bin/bash.exe")
|
||||
subprocess.check_call(cmd, env=env)
|
||||
|
||||
finally:
|
||||
|
|
Загрузка…
Ссылка в новой задаче