Bug 1027890 - Reject builds with pymake. r=gps

--HG--
extra : rebase_source : a662b896b5f431a37a1250ec19451324ebed3d14
This commit is contained in:
Mike Hommey 2014-06-25 08:38:12 +09:00
Родитель 7ccb4ebd5a
Коммит c45c7baa9c
5 изменённых файлов: 55 добавлений и 59 удалений

Просмотреть файл

@ -97,6 +97,8 @@ GARBAGE += $(MOZ_PKG_MANIFEST)
endif
ifdef FXOS_SIMULATOR
export MAKE
.PHONY: simulator
simulator: make-package
@echo 'Building simulator addon...'

Просмотреть файл

@ -18,7 +18,6 @@ if __name__ == '__main__':
import subprocess
mozmake = os.path.join(os.path.dirname(__file__), '..', '..',
'mozmake.exe')
if os.path.exists(mozmake):
cmd = [mozmake]
cmd.extend(sys.argv[1:])
shell = os.environ.get('SHELL')

Просмотреть файл

@ -25,9 +25,12 @@ _OBJ_SUFFIX := $(OBJ_SUFFIX)
OBJ_SUFFIX = $(error config/config.mk needs to be included before using OBJ_SUFFIX)
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.
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 .))))
$(error MSYS make is not supported)
endif
@ -37,7 +40,7 @@ endif
ifneq (4.0-,$(firstword $(sort 4.0- $(MAKE_VERSION))))
$(error Make version too old. Only versions strictly greater than 4.0 are supported.)
endif
endif
ifdef INCLUDED_AUTOCONF_MK
ifeq (a,$(firstword a$(subst /, ,$(srcdir))))
$(error MSYS-style srcdir are not supported for Windows builds.)
@ -45,11 +48,7 @@ endif
endif
endif # WINNT
ifdef .PYMAKE
include_deps = $(eval $(if $(2),,-)includedeps $(1))
else
include_deps = $(eval $(if $(2),,-)include $(1))
endif
ifndef INCLUDED_AUTOCONF_MK
default::

Просмотреть файл

@ -396,7 +396,7 @@ class MozbuildObject(ProcessExecutionMixin):
srcdir=False, allow_parallel=True, line_handler=None,
append_env=None, explicit_env=None, ignore_errors=False,
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.
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.
print_directory -- If True (the default), have make print directories
while doing traversal.
force_pymake -- If True, pymake will be used instead of GNU make.
"""
self._ensure_objdir_exists()
args = self._make_path(force_pymake=force_pymake)
args = self._make_path()
if directory:
args.extend(['-C', directory.replace(os.sep, '/')])
@ -475,43 +474,44 @@ class MozbuildObject(ProcessExecutionMixin):
return fn(**params)
def _make_path(self, force_pymake=False):
if self._is_windows() and not force_pymake:
# Use gnumake if it's available and we can verify it's a working
# version.
def _make_path(self):
baseconfig = os.path.join(self.topsrcdir, 'config', 'baseconfig.mk')
if os.path.exists(baseconfig):
def validate_make(make):
if os.path.exists(baseconfig) and os.path.exists(make):
cmd = [make, '-f', baseconfig]
if self._is_windows():
cmd.append('HOST_OS_ARCH=WINNT')
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]
subprocess.check_call(cmd, stdout=open(os.devnull, 'wb'),
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError:
pass
except which.WhichError:
pass
return False
return True
return False
# Use mozmake if it's available.
possible_makes = ['gmake', 'make', 'mozmake', 'gnumake']
if 'MAKE' in os.environ:
make = os.environ['MAKE']
if os.path.isabs(make):
if validate_make(make):
return [make]
else:
possible_makes.insert(0, make)
for test in possible_makes:
try:
return [which.which('mozmake')]
except which.WhichError:
pass
if self._is_windows() or force_pymake:
make_py = os.path.join(self.topsrcdir, 'build', 'pymake',
'make.py').replace(os.sep, '/')
# We might want to consider invoking with the virtualenv's Python
# 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)]
make = which.which(test)
except which.WhichError:
continue
if validate_make(make):
return [make]
if self._is_windows():
raise Exception('Could not find a suitable make implementation.\n'
'Please use MozillaBuild 1.9 or newer')
else:
raise Exception('Could not find a suitable make implementation.')
def _run_command_in_srcdir(self, **args):

Просмотреть файл

@ -267,15 +267,13 @@ class Build(MachCommandBase):
@CommandArgument('--jobs', '-j', default='0', metavar='jobs', type=int,
help='Number of concurrent jobs to run. Default is the number of CPUs.')
@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',
default=False, action='store_true',
help='Do not add extra make dependencies.')
@CommandArgument('-v', '--verbose', action='store_true',
help='Verbose output for what commands the build is running.')
def build(self, what=None, pymake=False,
disable_extra_make_dependencies=None, jobs=0, verbose=False):
def build(self, what=None, disable_extra_make_dependencies=None, jobs=0,
verbose=False):
import which
from mozbuild.controller.building import BuildMonitor
from mozbuild.util import resolve_target_to_make
@ -343,8 +341,8 @@ class Build(MachCommandBase):
# comprehensive history lesson.
self._run_make(directory=self.topobjdir,
target='backend.RecursiveMakeBackend',
force_pymake=pymake, line_handler=output.on_line,
log=False, print_directory=False)
line_handler=output.on_line, log=False,
print_directory=False)
# Build 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,
line_handler=output.on_line, log=False, print_directory=False,
ensure_exit_code=False, num_jobs=jobs, silent=not verbose,
append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'},
force_pymake=pymake)
append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'})
if status != 0:
break
@ -365,7 +362,7 @@ class Build(MachCommandBase):
status = self._run_make(srcdir=True, filename='client.mk',
line_handler=output.on_line, log=False, print_directory=False,
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 = dict(m.split('=', 1) for m in make_extra)
@ -374,8 +371,7 @@ class Build(MachCommandBase):
if moz_automation and status == 0:
status = self._run_make(target='automation/build',
line_handler=output.on_line, log=False, print_directory=False,
ensure_exit_code=False, num_jobs=jobs, silent=not verbose,
force_pymake=pymake)
ensure_exit_code=False, num_jobs=jobs, silent=not verbose)
self.log(logging.WARNING, 'warning_summary',
{'count': len(monitor.warnings_database)},