mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1027890 - Reject builds with pymake. r=gps
This commit is contained in:
parent
c2eb7e096a
commit
d2e942160c
@ -18,13 +18,12 @@ if __name__ == '__main__':
|
|||||||
import subprocess
|
import subprocess
|
||||||
mozmake = os.path.join(os.path.dirname(__file__), '..', '..',
|
mozmake = os.path.join(os.path.dirname(__file__), '..', '..',
|
||||||
'mozmake.exe')
|
'mozmake.exe')
|
||||||
if os.path.exists(mozmake):
|
cmd = [mozmake]
|
||||||
cmd = [mozmake]
|
cmd.extend(sys.argv[1:])
|
||||||
cmd.extend(sys.argv[1:])
|
shell = os.environ.get('SHELL')
|
||||||
shell = os.environ.get('SHELL')
|
if shell and not shell.lower().endswith('.exe'):
|
||||||
if shell and not shell.lower().endswith('.exe'):
|
cmd += ['SHELL=%s.exe' % shell]
|
||||||
cmd += ['SHELL=%s.exe' % shell]
|
sys.exit(subprocess.call(cmd))
|
||||||
sys.exit(subprocess.call(cmd))
|
|
||||||
|
|
||||||
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
|
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
|
||||||
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
|
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
|
||||||
|
@ -25,9 +25,12 @@ _OBJ_SUFFIX := $(OBJ_SUFFIX)
|
|||||||
OBJ_SUFFIX = $(error config/config.mk needs to be included before using OBJ_SUFFIX)
|
OBJ_SUFFIX = $(error config/config.mk needs to be included before using OBJ_SUFFIX)
|
||||||
|
|
||||||
ifeq ($(HOST_OS_ARCH),WINNT)
|
ifeq ($(HOST_OS_ARCH),WINNT)
|
||||||
# We only support building with pymake or a non-msys gnu make version
|
# We only support building with a non-msys gnu make version
|
||||||
# strictly above 4.0.
|
# strictly above 4.0.
|
||||||
ifndef .PYMAKE
|
ifdef .PYMAKE
|
||||||
|
$(error Pymake is no longer supported. Please upgrade to MozillaBuild 1.9 or newer and build with 'mach' or 'mozmake')
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (a,$(firstword a$(subst /, ,$(abspath .))))
|
ifeq (a,$(firstword a$(subst /, ,$(abspath .))))
|
||||||
$(error MSYS make is not supported)
|
$(error MSYS make is not supported)
|
||||||
endif
|
endif
|
||||||
@ -37,7 +40,7 @@ endif
|
|||||||
ifneq (4.0-,$(firstword $(sort 4.0- $(MAKE_VERSION))))
|
ifneq (4.0-,$(firstword $(sort 4.0- $(MAKE_VERSION))))
|
||||||
$(error Make version too old. Only versions strictly greater than 4.0 are supported.)
|
$(error Make version too old. Only versions strictly greater than 4.0 are supported.)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
ifdef INCLUDED_AUTOCONF_MK
|
ifdef INCLUDED_AUTOCONF_MK
|
||||||
ifeq (a,$(firstword a$(subst /, ,$(srcdir))))
|
ifeq (a,$(firstword a$(subst /, ,$(srcdir))))
|
||||||
$(error MSYS-style srcdir are not supported for Windows builds.)
|
$(error MSYS-style srcdir are not supported for Windows builds.)
|
||||||
@ -45,11 +48,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif # WINNT
|
endif # WINNT
|
||||||
|
|
||||||
ifdef .PYMAKE
|
|
||||||
include_deps = $(eval $(if $(2),,-)includedeps $(1))
|
|
||||||
else
|
|
||||||
include_deps = $(eval $(if $(2),,-)include $(1))
|
include_deps = $(eval $(if $(2),,-)include $(1))
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef INCLUDED_AUTOCONF_MK
|
ifndef INCLUDED_AUTOCONF_MK
|
||||||
default::
|
default::
|
||||||
|
@ -396,7 +396,7 @@ class MozbuildObject(ProcessExecutionMixin):
|
|||||||
srcdir=False, allow_parallel=True, line_handler=None,
|
srcdir=False, allow_parallel=True, line_handler=None,
|
||||||
append_env=None, explicit_env=None, ignore_errors=False,
|
append_env=None, explicit_env=None, ignore_errors=False,
|
||||||
ensure_exit_code=0, silent=True, print_directory=True,
|
ensure_exit_code=0, silent=True, print_directory=True,
|
||||||
pass_thru=False, num_jobs=0, force_pymake=False):
|
pass_thru=False, num_jobs=0):
|
||||||
"""Invoke make.
|
"""Invoke make.
|
||||||
|
|
||||||
directory -- Relative directory to look for Makefile in.
|
directory -- Relative directory to look for Makefile in.
|
||||||
@ -408,11 +408,10 @@ class MozbuildObject(ProcessExecutionMixin):
|
|||||||
silent -- If True (the default), run make in silent mode.
|
silent -- If True (the default), run make in silent mode.
|
||||||
print_directory -- If True (the default), have make print directories
|
print_directory -- If True (the default), have make print directories
|
||||||
while doing traversal.
|
while doing traversal.
|
||||||
force_pymake -- If True, pymake will be used instead of GNU make.
|
|
||||||
"""
|
"""
|
||||||
self._ensure_objdir_exists()
|
self._ensure_objdir_exists()
|
||||||
|
|
||||||
args = self._make_path(force_pymake=force_pymake)
|
args = self._make_path()
|
||||||
|
|
||||||
if directory:
|
if directory:
|
||||||
args.extend(['-C', directory.replace(os.sep, '/')])
|
args.extend(['-C', directory.replace(os.sep, '/')])
|
||||||
@ -475,44 +474,28 @@ class MozbuildObject(ProcessExecutionMixin):
|
|||||||
|
|
||||||
return fn(**params)
|
return fn(**params)
|
||||||
|
|
||||||
def _make_path(self, force_pymake=False):
|
def _make_path(self):
|
||||||
if self._is_windows() and not force_pymake:
|
baseconfig = os.path.join(self.topsrcdir, 'config', 'baseconfig.mk')
|
||||||
# Use gnumake if it's available and we can verify it's a working
|
for test in ('gmake', 'make', 'mozmake', 'gnumake'):
|
||||||
# version.
|
|
||||||
baseconfig = os.path.join(self.topsrcdir, 'config', 'baseconfig.mk')
|
|
||||||
if os.path.exists(baseconfig):
|
|
||||||
try:
|
|
||||||
make = which.which('gnumake')
|
|
||||||
subprocess.check_call([make, '-f', baseconfig, 'HOST_OS_ARCH=WINNT'],
|
|
||||||
stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT)
|
|
||||||
return [make]
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
pass
|
|
||||||
except which.WhichError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Use mozmake if it's available.
|
|
||||||
try:
|
try:
|
||||||
return [which.which('mozmake')]
|
make = which.which(test)
|
||||||
|
if os.path.exists(baseconfig):
|
||||||
|
cmd = [make, '-f', baseconfig]
|
||||||
|
if self._is_windows():
|
||||||
|
cmd.append('HOST_OS_ARCH=WINNT')
|
||||||
|
subprocess.check_call(cmd, stdout=open(os.devnull, 'wb'),
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
|
return [make]
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
pass
|
||||||
except which.WhichError:
|
except which.WhichError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self._is_windows() or force_pymake:
|
if self._is_windows():
|
||||||
make_py = os.path.join(self.topsrcdir, 'build', 'pymake',
|
raise Exception('Could not find a suitable make implementation.\n'
|
||||||
'make.py').replace(os.sep, '/')
|
'Please use MozillaBuild 1.9 or newer')
|
||||||
|
else:
|
||||||
# We might want to consider invoking with the virtualenv's Python
|
raise Exception('Could not find a suitable make implementation.')
|
||||||
# some day. But, there is a chicken-and-egg problem w.r.t. when the
|
|
||||||
# virtualenv is created.
|
|
||||||
return [sys.executable, make_py]
|
|
||||||
|
|
||||||
for test in ['gmake', 'make']:
|
|
||||||
try:
|
|
||||||
return [which.which(test)]
|
|
||||||
except which.WhichError:
|
|
||||||
continue
|
|
||||||
|
|
||||||
raise Exception('Could not find a suitable make implementation.')
|
|
||||||
|
|
||||||
def _run_command_in_srcdir(self, **args):
|
def _run_command_in_srcdir(self, **args):
|
||||||
return self.run_process(cwd=self.topsrcdir, **args)
|
return self.run_process(cwd=self.topsrcdir, **args)
|
||||||
|
@ -267,15 +267,13 @@ class Build(MachCommandBase):
|
|||||||
@CommandArgument('--jobs', '-j', default='0', metavar='jobs', type=int,
|
@CommandArgument('--jobs', '-j', default='0', metavar='jobs', type=int,
|
||||||
help='Number of concurrent jobs to run. Default is the number of CPUs.')
|
help='Number of concurrent jobs to run. Default is the number of CPUs.')
|
||||||
@CommandArgument('what', default=None, nargs='*', help=BUILD_WHAT_HELP)
|
@CommandArgument('what', default=None, nargs='*', help=BUILD_WHAT_HELP)
|
||||||
@CommandArgument('-p', '--pymake', action='store_true',
|
|
||||||
help='Force using pymake over GNU make.')
|
|
||||||
@CommandArgument('-X', '--disable-extra-make-dependencies',
|
@CommandArgument('-X', '--disable-extra-make-dependencies',
|
||||||
default=False, action='store_true',
|
default=False, action='store_true',
|
||||||
help='Do not add extra make dependencies.')
|
help='Do not add extra make dependencies.')
|
||||||
@CommandArgument('-v', '--verbose', action='store_true',
|
@CommandArgument('-v', '--verbose', action='store_true',
|
||||||
help='Verbose output for what commands the build is running.')
|
help='Verbose output for what commands the build is running.')
|
||||||
def build(self, what=None, pymake=False,
|
def build(self, what=None, disable_extra_make_dependencies=None, jobs=0,
|
||||||
disable_extra_make_dependencies=None, jobs=0, verbose=False):
|
verbose=False):
|
||||||
import which
|
import which
|
||||||
from mozbuild.controller.building import BuildMonitor
|
from mozbuild.controller.building import BuildMonitor
|
||||||
from mozbuild.util import resolve_target_to_make
|
from mozbuild.util import resolve_target_to_make
|
||||||
@ -343,8 +341,8 @@ class Build(MachCommandBase):
|
|||||||
# comprehensive history lesson.
|
# comprehensive history lesson.
|
||||||
self._run_make(directory=self.topobjdir,
|
self._run_make(directory=self.topobjdir,
|
||||||
target='backend.RecursiveMakeBackend',
|
target='backend.RecursiveMakeBackend',
|
||||||
force_pymake=pymake, line_handler=output.on_line,
|
line_handler=output.on_line, log=False,
|
||||||
log=False, print_directory=False)
|
print_directory=False)
|
||||||
|
|
||||||
# Build target pairs.
|
# Build target pairs.
|
||||||
for make_dir, make_target in target_pairs:
|
for make_dir, make_target in target_pairs:
|
||||||
@ -355,8 +353,7 @@ class Build(MachCommandBase):
|
|||||||
status = self._run_make(directory=make_dir, target=make_target,
|
status = self._run_make(directory=make_dir, target=make_target,
|
||||||
line_handler=output.on_line, log=False, print_directory=False,
|
line_handler=output.on_line, log=False, print_directory=False,
|
||||||
ensure_exit_code=False, num_jobs=jobs, silent=not verbose,
|
ensure_exit_code=False, num_jobs=jobs, silent=not verbose,
|
||||||
append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'},
|
append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'})
|
||||||
force_pymake=pymake)
|
|
||||||
|
|
||||||
if status != 0:
|
if status != 0:
|
||||||
break
|
break
|
||||||
@ -365,7 +362,7 @@ class Build(MachCommandBase):
|
|||||||
status = self._run_make(srcdir=True, filename='client.mk',
|
status = self._run_make(srcdir=True, filename='client.mk',
|
||||||
line_handler=output.on_line, log=False, print_directory=False,
|
line_handler=output.on_line, log=False, print_directory=False,
|
||||||
allow_parallel=False, ensure_exit_code=False, num_jobs=jobs,
|
allow_parallel=False, ensure_exit_code=False, num_jobs=jobs,
|
||||||
silent=not verbose, force_pymake=pymake)
|
silent=not verbose)
|
||||||
|
|
||||||
make_extra = self.mozconfig['make_extra'] or []
|
make_extra = self.mozconfig['make_extra'] or []
|
||||||
make_extra = dict(m.split('=', 1) for m in make_extra)
|
make_extra = dict(m.split('=', 1) for m in make_extra)
|
||||||
@ -374,8 +371,7 @@ class Build(MachCommandBase):
|
|||||||
if moz_automation and status == 0:
|
if moz_automation and status == 0:
|
||||||
status = self._run_make(target='automation/build',
|
status = self._run_make(target='automation/build',
|
||||||
line_handler=output.on_line, log=False, print_directory=False,
|
line_handler=output.on_line, log=False, print_directory=False,
|
||||||
ensure_exit_code=False, num_jobs=jobs, silent=not verbose,
|
ensure_exit_code=False, num_jobs=jobs, silent=not verbose)
|
||||||
force_pymake=pymake)
|
|
||||||
|
|
||||||
self.log(logging.WARNING, 'warning_summary',
|
self.log(logging.WARNING, 'warning_summary',
|
||||||
{'count': len(monitor.warnings_database)},
|
{'count': len(monitor.warnings_database)},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user