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
--- 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