Bug 1466401 - Re-run configure in js/src based on dependencies generated by python configure. r=mshal
authorChris Manchester <cmanchester@mozilla.com>
Thu, 07 Jun 2018 15:50:06 -0700
changeset 422876 a8e245778a34a18bd77b0acd62a0172de53a3e30
parent 422875 7c4f5978d9dae436b58446cf5523d1730821d9c0
child 422877 d41073f73725a3a8326d1fe057656094350cf071
push id34157
push userrgurzau@mozilla.com
push dateTue, 19 Jun 2018 10:01:19 +0000
treeherdermozilla-central@4432fb67de2d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1466401
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466401 - Re-run configure in js/src based on dependencies generated by python configure. r=mshal MozReview-Commit-ID: 3ueBBHiux3M
build/subconfigure.py
moz.configure
--- a/build/subconfigure.py
+++ b/build/subconfigure.py
@@ -278,31 +278,38 @@ def run(objdir):
     # However, a few don't, or are tagged with a directory name (and their
     # command is just to create that directory)
     for f in command_files:
         if os.path.isfile(f):
             contents.append(File(f))
 
     # Only run configure if one of the following is true:
     # - config.status doesn't exist
-    # - config.status is older than configure
+    # - config.status is older than an input to configure
     # - the configure arguments changed
     # - the environment changed in a way that requires a cache clear.
     configure = mozpath.join(data['srcdir'], 'old-configure')
     config_status_path = mozpath.join(objdir, 'config.status')
     skip_configure = True
     if not os.path.exists(config_status_path):
         skip_configure = False
         config_status = None
     else:
         config_status = File(config_status_path)
-        if config_status.mtime < os.path.getmtime(configure) or \
-                data.get('previous-args', data['args']) != data['args'] or \
-                cleared_cache:
+        config_status_deps = mozpath.join(objdir, 'config_status_deps.in')
+        if not os.path.exists(config_status_deps):
             skip_configure = False
+        else:
+            with open(config_status_deps, 'r') as fh:
+                dep_files = fh.read().splitlines() + [configure]
+            if (any(not os.path.exists(f) or (config_status.mtime < os.path.getmtime(f))
+                    for f in dep_files) or
+                data.get('previous-args', data['args']) != data['args'] or
+                cleared_cache):
+                skip_configure = False
 
     if not skip_configure:
         if mozpath.normsep(relobjdir) == 'js/src':
             # Because configure is a shell script calling a python script
             # calling a shell script, on Windows, with msys screwing the
             # environment, we lose the benefits from our own efforts in this
             # script to get past the msys problems. So manually call the python
             # script instead, so that we don't do a native->msys transition
@@ -330,21 +337,16 @@ def run(objdir):
         print(prefix_lines('configuring', relobjdir))
         print(prefix_lines('running %s' % ' '.join(command[:-1]), relobjdir))
         sys.stdout.flush()
         returncode = execute_and_prefix(command, cwd=objdir, env=data['env'],
                                         prefix=relobjdir)
         if returncode:
             return returncode
 
-        # Leave config.status with a new timestamp if configure is newer than
-        # its original mtime.
-        if config_status and os.path.getmtime(configure) <= config_status.mtime:
-            config_status.update_time()
-
     # Only run config.status if one of the following is true:
     # - config.status changed or did not exist
     # - one of the templates for config files is newer than the corresponding
     #   config file.
     skip_config_status = True
     if mozpath.normsep(relobjdir) == 'js/src':
         # Running config.status in js/src actually does nothing, so we just
         # skip it.
--- a/moz.configure
+++ b/moz.configure
@@ -604,30 +604,37 @@ include('build/moz.configure/old.configu
 @depends(check_build_environment, build_project)
 @imports('__sandbox__')
 @imports('glob')
 def config_status_deps(build_env, build_project):
 
     topsrcdir = build_env.topsrcdir
     topobjdir = build_env.topobjdir
 
-    return list(__sandbox__._all_paths) + [
-        os.path.join(topsrcdir, build_project, 'confvars.sh'),
+    if not build_env.topobjdir.endswith('js/src'):
+        extra_deps = [
+            os.path.join(topsrcdir, build_project, 'confvars.sh'),
+            os.path.join(topobjdir, '.mozconfig.json'),
+        ]
+    else:
+        # mozconfig changes may impact js configure.
+        extra_deps = [os.path.join(topobjdir[:-7], '.mozconfig.json')]
+
+    return list(__sandbox__._all_paths) + extra_deps + [
         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'),
         os.path.join(topsrcdir, 'config', 'milestone.txt'),
         os.path.join(topsrcdir, 'browser', 'config', 'version.txt'),
         os.path.join(topsrcdir, 'browser', 'config', 'version_display.txt'),
         os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'),
         os.path.join(topsrcdir, 'python', 'mozbuild', 'mozbuild', 'virtualenv.py'),
         os.path.join(topsrcdir, 'testing', 'mozbase', 'packages.txt'),
-        os.path.join(topobjdir, '.mozconfig.json'),
         os.path.join(topsrcdir, 'aclocal.m4'),
         os.path.join(topsrcdir, 'old-configure.in'),
         os.path.join(topsrcdir, 'js', 'src', 'aclocal.m4'),
         os.path.join(topsrcdir, 'js', 'src', 'old-configure.in'),
     ] + glob.glob(os.path.join(topsrcdir, 'build', 'autoconf', '*.m4'))
 
 set_config('CONFIG_STATUS_DEPS', config_status_deps)
 # Please do not add anything after setting config_dep_paths.