Bug 1255667 - Don't read the mozconfig for the js configure draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 11 Mar 2016 11:30:54 +0900
changeset 339369 9e5b83752e5b70ef4fd637f78eac5aa204011377
parent 339368 bbfa5b7750d7f73554674161498517776a1e700a
child 515971 47be26e56b7a986cd63c05b8d6b133becff4e9d5
push id12710
push userbmo:mh+mozilla@glandium.org
push dateFri, 11 Mar 2016 02:36:50 +0000
bugs1255667
milestone48.0a1
Bug 1255667 - Don't read the mozconfig for the js configure While the long term goal is that js and top-level use the same configure and the same overall setup, including the possibility to use mozconfigs, figuring out what we want to do wrt mozconfig vs. command line and environment variable is not a clear-cut case, and it's more important to fix the immediate problem mozconfig causes to js developers by "temporarily" returning to the previous behavior of not loading the mozconfig for the js configure. This was already done in the case of running it as a subconfigure, this extends the exception. Unfortunately, there is no direct way to tell whether the running configure is the js configure. The indirect way is to look at the OLD_CONFIGURE path, which points to js/src/old-configure. I expect we'll have figured things out for mozconfigs well before old-configure dies.
build/moz.configure/init.configure
build/moz.configure/old.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -56,32 +56,38 @@ def check_build_environment(help, dist):
             '  *   To clean up the source tree:\n'
             '  *     1. cd %s\n'
             '  *     2. gmake distclean\n'
             '  ***'
             % ('\n  '.join(conflict_files), topsrcdir)
         )
 
 
+option(env='OLD_CONFIGURE', nargs=1, help='Path to the old configure script')
+
 option(env='MOZ_CURRENT_PROJECT', nargs=1, help='Current build project')
 option(env='MOZCONFIG', nargs=1, help='Mozconfig location')
 
 # Read user mozconfig
 # ==============================================================
 # Note: the dependency on --help is only there to always read the mozconfig,
 # even when --help is passed. Without this dependency, the function wouldn't
 # be called when --help is passed, and the mozconfig wouldn't be read.
-@depends('MOZ_CURRENT_PROJECT', 'MOZCONFIG', check_build_environment, '--help')
+@depends('MOZ_CURRENT_PROJECT', 'MOZCONFIG', 'OLD_CONFIGURE',
+         check_build_environment, '--help')
 @advanced
-def mozconfig(current_project, mozconfig,  build_env, help):
+def mozconfig(current_project, mozconfig, old_configure, build_env, help):
     from mozbuild.mozconfig import MozconfigLoader
 
+    if not old_configure:
+        error('The OLD_CONFIGURE environment variable must be set')
+
     # Don't read the mozconfig for the js configure (yay backwards
     # compatibility)
-    if build_env['TOPOBJDIR'].endswith('/js/src'):
+    if os.path.dirname(old_configure[0]).endswith('/js/src'):
         return {'path': None}
 
     loader = MozconfigLoader(build_env['TOPSRCDIR'])
     current_project = current_project[0] if current_project else None
     mozconfig = mozconfig[0] if mozconfig else None
     mozconfig = loader.find_mozconfig(env={'MOZCONFIG': mozconfig})
     mozconfig = loader.read_mozconfig(mozconfig, moz_build_app=current_project)
 
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -52,18 +52,16 @@ def autoconf(mozconfig, autoconf):
 
     if not autoconf:
         error('Could not find autoconf 2.13')
 
     set_config('AUTOCONF', autoconf)
     return autoconf
 
 
-option(env='OLD_CONFIGURE', nargs=1, help='Path to the old configure script')
-
 @depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell,
          virtualenv_python, compile_environment, build_project,
          extra_old_configure_args, '--with-external-source-dir',
          '--enable-shared-js', old_configure_assignments)
 @advanced
 def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
                       python, compile_env, build_project,
                       extra_old_configure_args, external_source_dir,
@@ -72,19 +70,16 @@ def prepare_configure(old_configure, moz
     import itertools
     import subprocess
     import sys
     # Import getmtime without overwriting the sandbox os.path.
     from os.path import getmtime
 
     from mozbuild.shellutil import quote
 
-    if not old_configure:
-        error('The OLD_CONFIGURE environment variable must be set')
-
     # os.path.abspath in the sandbox will ensure forward slashes on Windows,
     # which is actually necessary because this path actually ends up literally
     # as $0, and backslashes there breaks autoconf's detection of the source
     # directory.
     old_configure = os.path.abspath(old_configure[0])
 
     refresh = True
     if os.path.exists(old_configure):