Bug 1469712 - Don't update mtime for backend file during --dry-run; r?Build
When we do a './mach build-backend --dry-run', no files in the objdir
should be written or touched. Updating the mtime of the backend file
during dry-run causes a future './mach build' to think that the backend
is up-to-date when it is not, which causes an incorrect build.
MozReview-Commit-ID: 2NA0rcSGrvL
--- a/python/mozbuild/mozbuild/backend/base.py
+++ b/python/mozbuild/mozbuild/backend/base.py
@@ -169,19 +169,20 @@ class BuildBackend(LoggingMixin):
pass
# Write out the list of backend files generated, if it changed.
if self._deleted_count or self._created_count or \
not os.path.exists(list_file):
with self._write_file(list_file) as fh:
fh.write('\n'.join(sorted(self._backend_output_files)))
else:
- # Always update its mtime.
- with open(list_file, 'a'):
- os.utime(list_file, None)
+ # Always update its mtime if we're not in dry-run mode.
+ if not self.dry_run:
+ with open(list_file, 'a'):
+ os.utime(list_file, None)
# Write out the list of input files for the backend
with self._write_file('%s.in' % list_file) as fh:
fh.write('\n'.join(sorted(
mozpath.normsep(f) for f in self.backend_input_files)))
@abstractmethod
def consume_object(self, obj):