Bug 1424417 - Use dry-run flag for backend.mk files; r?glandium draft
authorMike Shal <mshal@mozilla.com>
Wed, 13 Dec 2017 11:31:16 -0500
changeset 712218 901cbc46df41ed0aafaff2c1affdbbe2deda5c38
parent 711178 defccba824aa91e8d4d820b1defaadfdca34bac7
child 744001 d42788b0c2393e088eda7c53c54c1eb8fe3ef18d
push id93279
push userbmo:mshal@mozilla.com
push dateFri, 15 Dec 2017 20:45:15 +0000
reviewersglandium
bugs1424417
milestone59.0a1
Bug 1424417 - Use dry-run flag for backend.mk files; r?glandium For cases like BackendMakefile where we don't have access to BuildBackend._write_file(), we need to make sure that FileAvoidWrite uses the dry-run flag in order to avoid writing out files during a config.status --dry-run. MozReview-Commit-ID: ApsSQPySImt
python/mozbuild/mozbuild/backend/recursivemake.py
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -196,27 +196,27 @@ class BackendMakeFile(object):
     invalidate all make targets across the whole tree! This would effectively
     undermine incremental builds as any mozbuild change would cause the entire
     tree to rebuild!
 
     The solution is to not update the mtimes of backend.mk files unless they
     actually change. We use FileAvoidWrite to accomplish this.
     """
 
-    def __init__(self, srcdir, objdir, environment, topsrcdir, topobjdir):
+    def __init__(self, srcdir, objdir, environment, topsrcdir, topobjdir, dry_run):
         self.topsrcdir = topsrcdir
         self.srcdir = srcdir
         self.objdir = objdir
         self.relobjdir = mozpath.relpath(objdir, topobjdir)
         self.environment = environment
         self.name = mozpath.join(objdir, 'backend.mk')
 
         self.xpt_name = None
 
-        self.fh = FileAvoidWrite(self.name, capture_diff=True)
+        self.fh = FileAvoidWrite(self.name, capture_diff=True, dry_run=dry_run)
         self.fh.write('# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.\n')
         self.fh.write('\n')
 
     def write(self, buf):
         self.fh.write(buf)
 
     def write_once(self, buf):
         if isinstance(buf, unicode):
@@ -428,17 +428,17 @@ class RecursiveMakeBackend(CommonBackend
                        makefile_in=self._makefile_in_count,
                        makefile_out=self._makefile_out_count)
         return summary
 
     def _get_backend_file_for(self, obj):
         if obj.objdir not in self._backend_files:
             self._backend_files[obj.objdir] = \
                 BackendMakeFile(obj.srcdir, obj.objdir, obj.config,
-                    obj.topsrcdir, self.environment.topobjdir)
+                    obj.topsrcdir, self.environment.topobjdir, self.dry_run)
         return self._backend_files[obj.objdir]
 
     def consume_object(self, obj):
         """Write out build files necessary to build with recursive make."""
 
         if not isinstance(obj, ContextDerived):
             return False