Bug 962758 - Avoid build failures when js/src/configure.in changes in a way that doesn't change config.status. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 24 Jan 2014 07:57:54 +0900
changeset 181995 15899a6820f4ad558e00d08c1e9ac22f7aa7aeb7
parent 181994 dd67215720001b2988c43844b09d7f3cf8dd37b6
child 181996 6bf7a2906bc0b20801a13105f935751d1dea357f
push id462
push userraliiev@mozilla.com
push dateTue, 22 Apr 2014 00:22:30 +0000
treeherdermozilla-release@ac5db8c74ac0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs962758
milestone29.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 962758 - Avoid build failures when js/src/configure.in changes in a way that doesn't change config.status. r=gps
build/autoconf/hooks.m4
build/subconfigure.py
--- a/build/autoconf/hooks.m4
+++ b/build/autoconf/hooks.m4
@@ -29,17 +29,17 @@ case "$host" in
     fi
     ;;
 esac
 
 if test -d "$1"; then
     (cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py dump "$_CONFIG_SHELL")
 fi
 $2
-(cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py adjust)
+(cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py adjust $ac_sub_configure)
 ])
 
 define([AC_OUTPUT_SUBDIRS],
 [trap '' EXIT
 for moz_config_dir in $1; do
   MOZ_SUBCONFIGURE_WRAP([$moz_config_dir],[
     _MOZ_AC_OUTPUT_SUBDIRS($moz_config_dir)
   ])
--- a/build/subconfigure.py
+++ b/build/subconfigure.py
@@ -13,16 +13,24 @@ import pickle
 
 class File(object):
     def __init__(self, path):
         self._path = path
         self._content = open(path, 'rb').read()
         stat = os.stat(path)
         self._times = (stat.st_atime, stat.st_mtime)
 
+    @property
+    def path(self):
+        return self._path
+
+    @property
+    def mtime(self):
+        return self._times[1]
+
     def update_time(self):
         '''If the file hasn't changed since the instance was created,
            restore its old modification time.'''
         if not os.path.exists(self._path):
             return
         if open(self._path, 'rb').read() == self._content:
             os.utime(self._path, self._times)
 
@@ -92,33 +100,38 @@ def dump(dump_file, shell):
             for f in (couple.split(':')[0] for couple in line.split()):
                 if os.path.isfile(f):
                     config_files.append(File(f))
 
     with open(dump_file, 'wb') as f:
         pickle.dump(config_files, f)
 
 
-def adjust(dump_file):
+def adjust(dump_file, configure):
     if not os.path.exists(dump_file):
         return
 
     config_files = []
 
     try:
         with open(dump_file, 'rb') as f:
             config_files = pickle.load(f)
     except Exception:
         pass
 
     for f in config_files:
+        # Still touch config.status if configure is newer than its original
+        # mtime.
+        if configure and os.path.basename(f.path) == 'config.status' and \
+                os.path.getmtime(configure) > f.mtime:
+            continue
         f.update_time()
 
     os.remove(dump_file)
 
 
 CONFIG_DUMP = 'config_files.pkl'
 
 if __name__ == '__main__':
     if sys.argv[1] == 'dump':
         dump(CONFIG_DUMP, sys.argv[2])
     elif sys.argv[1] == 'adjust':
-        adjust(CONFIG_DUMP)
+        adjust(CONFIG_DUMP, sys.argv[2] if len(sys.argv) > 2 else None)