From 9252175982a47690c0855682fb25e0031904b645 Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Tue, 20 Oct 2020 00:16:22 +0300 Subject: [PATCH] Backed out changeset e34634758f51 (bug 1671424) for bustages on configure.py . CLOSED TREE --- client.mk | 39 ++++++++++++++++++- configure.in | 1 + configure.py | 3 -- moz.configure | 2 + python/mozbuild/mozbuild/base.py | 4 +- .../mozbuild/mozbuild/controller/building.py | 39 +++++++------------ 6 files changed, 56 insertions(+), 32 deletions(-) diff --git a/client.mk b/client.mk index 95b61418dd12..c795374bdce6 100644 --- a/client.mk +++ b/client.mk @@ -58,6 +58,10 @@ endif MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR) +# 'configure' scripts generated by autoconf. +CONFIGURES := $(TOPSRCDIR)/configure +CONFIGURES += $(TOPSRCDIR)/js/src/configure + ####################################################################### # Rules @@ -82,6 +86,38 @@ build:: $(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env SCCACHE_LOG=sccache=debug SCCACHE_ERROR_LOG=$(UPLOAD_PATH)/sccache.log $(MOZBUILD_MANAGE_SCCACHE_DAEMON) --start-server endif +#################################### +# Configure + +$(CONFIGURES): %: %.in + @echo Generating $@ + cp -f $< $@ + chmod +x $@ + +CONFIGURE_ENV_ARGS += \ + MAKE='$(MAKE)' \ + $(NULL) + +# configure uses the program name to determine @srcdir@. Calling it without +# $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full +# path of $(TOPSRCDIR). +ifeq ($(TOPSRCDIR),$(OBJDIR)) + CONFIGURE = ./configure +else + CONFIGURE = $(TOPSRCDIR)/configure +endif + +configure:: $(CONFIGURES) + $(call BUILDSTATUS,TIERS configure) + $(call BUILDSTATUS,TIER_START configure) + @echo cd $(OBJDIR); + @echo $(CONFIGURE) $(CONFIGURE_ARGS) + @cd $(OBJDIR) && $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \ + || ( echo '*** Fix above errors and then restart with\ + "./mach build"' && exit 1 ) + @touch $(OBJDIR)/Makefile + $(call BUILDSTATUS,TIER_FINISH configure) + #################################### # Build it @@ -99,4 +135,5 @@ endif .NOTPARALLEL: .PHONY: \ - build + build \ + configure diff --git a/configure.in b/configure.in index 619f9f448b74..6f8e59bdf51d 100644 --- a/configure.in +++ b/configure.in @@ -15,5 +15,6 @@ SRCDIR=$(dirname $0) TOPSRCDIR="$SRCDIR" PYTHON3="${PYTHON3:-python3}" +export OLD_CONFIGURE="$SRCDIR"/old-configure exec "$PYTHON3" "$TOPSRCDIR/configure.py" "$@" diff --git a/configure.py b/configure.py index 394eadfc13cf..5b9c9494e58f 100644 --- a/configure.py +++ b/configure.py @@ -40,9 +40,6 @@ import six def main(argv): config = {} - if 'OLD_CONFIGURE' not in os.environ: - os.environ['OLD_CONFIGURE'] = os.path.join(base_dir, 'old-configure') - sandbox = ConfigureSandbox(config, os.environ, argv) clobber_file = 'CLOBBER' diff --git a/moz.configure b/moz.configure index 527564be1c50..f60da5be5cf3 100755 --- a/moz.configure +++ b/moz.configure @@ -762,6 +762,8 @@ def config_status_deps(build_env, build_project): return list(__sandbox__._all_paths) + extra_deps + [ os.path.join(topsrcdir, 'CLOBBER'), + os.path.join(topsrcdir, 'configure'), + os.path.join(topsrcdir, 'js', 'src', 'configure'), os.path.join(topsrcdir, 'configure.in'), os.path.join(topsrcdir, 'js', 'src', 'configure.in'), os.path.join(topsrcdir, 'nsprpub', 'configure'), diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 54489f72fbf6..76d5d7a94a76 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -671,7 +671,7 @@ class MozbuildObject(ProcessExecutionMixin): """ self._ensure_objdir_exists() - args = [self._make_path()] + args = self._make_path() if directory: args.extend(['-C', directory.replace(os.sep, '/')]) @@ -795,7 +795,7 @@ class MozbuildObject(ProcessExecutionMixin): continue result, xcode_lisense_error_tmp = validate_make(make) if result: - return make + return [make] if xcode_lisense_error_tmp: xcode_lisense_error = True diff --git a/python/mozbuild/mozbuild/controller/building.py b/python/mozbuild/mozbuild/controller/building.py index 06bd4e980ab8..9330ac295e50 100644 --- a/python/mozbuild/mozbuild/controller/building.py +++ b/python/mozbuild/mozbuild/controller/building.py @@ -31,7 +31,6 @@ except Exception: psutil = None from mach.mixin.logging import LoggingMixin -from mozboot.util import get_mach_virtualenv_binary import mozfile from mozsystemmonitor.resourcemonitor import SystemResourceMonitor from mozterm.widgets import Footer @@ -54,6 +53,9 @@ from ..compilation.warnings import ( WarningsCollector, WarningsDatabase, ) +from ..shellutil import ( + quote as shell_quote, +) from ..util import ( FileAvoidWrite, mkdir, @@ -1405,34 +1407,19 @@ class BuildDriver(MozbuildObject): line_handler = line_handler or on_line + options = ' '.join(shell_quote(o) for o in options or ()) append_env = dict(append_env or {}) - append_env['MAKE'] = self._make_path() + append_env['CONFIGURE_ARGS'] = options - if six.PY3: - python = sys.executable - else: - # Try to get the mach virtualenv Python if we can. - python = get_mach_virtualenv_binary() - if not os.path.exists(python): - python = 'python3' + # Only print build status messages when we have an active + # monitor. + if not buildstatus_messages: + append_env['NO_BUILDSTATUS_MESSAGES'] = '1' + status = self._run_client_mk(target='configure', + line_handler=line_handler, + append_env=append_env) - command = [python, os.path.join(self.topsrcdir, 'configure.py')] - if options: - command.extend(options) - - if buildstatus_messages: - line_handler('BUILDSTATUS TIERS configure') - line_handler('BUILDSTATUS TIER_START configure') - status = self._run_command_in_objdir( - args=command, - line_handler=line_handler, - append_env=append_env, - ) - if buildstatus_messages: - line_handler('BUILDSTATUS TIER_FINISH configure') - if status: - print('*** Fix above errors and then restart with "./mach build"') - else: + if not status: print('Configure complete!') print('Be sure to run |mach build| to pick up any changes')