Bug 1424417 - Use dry-run flag for backend.mk files; r?Build draft
authorMike Shal <mshal@mozilla.com>
Wed, 13 Dec 2017 11:31:16 -0500
changeset 712216 a931b990028d2d54e9612ccbe259f37fa8b951ee
parent 711178 defccba824aa91e8d4d820b1defaadfdca34bac7
child 743999 f242213e651473dbc4d4cb93be695f478e2d65bc
push id93277
push userbmo:mshal@mozilla.com
push dateFri, 15 Dec 2017 20:43:44 +0000
reviewersBuild
bugs1424417
milestone59.0a1
Bug 1424417 - Use dry-run flag for backend.mk files; r?Build 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