Bug 1372381 - Temporarily skip certain problematic binaries in the Tup backend. draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 30 Apr 2018 11:10:21 -0700
changeset 790015 f8b4f26441635a9cf112570eb79b007ae777eed1
parent 790014 b822242f5720d0c39b9dd88e0a6e03e101c8cd0b
child 790016 5a28305e85311bb38b39e467600f80d5369be660
push id108388
push userbmo:cmanchester@mozilla.com
push dateMon, 30 Apr 2018 23:35:47 +0000
bugs1372381
milestone61.0a1
Bug 1372381 - Temporarily skip certain problematic binaries in the Tup backend. MozReview-Commit-ID: 7lopI8UQPSZ
python/mozbuild/mozbuild/backend/tup.py
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -77,32 +77,45 @@ class BackendTupfile(object):
         self.sources = defaultdict(list)
         self.host_sources = defaultdict(list)
         self.variables = {}
         self.static_lib = None
         self.shared_lib = None
         self.program = None
         self.exports = set()
 
+        # These files are special, ignore anything that generates them or
+        # depends on them.
+        self._skip_files = [
+            'signmar',
+            'libxul.so',
+            'libtestcrasher.so',
+        ]
+
         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 include_rules(self):
         if not self.rules_included:
             self.write('include_rules\n')
             self.rules_included = True
 
     def rule(self, cmd, inputs=None, outputs=None, display=None,
              extra_inputs=None, extra_outputs=None, check_unchanged=False):
         inputs = inputs or []
         outputs = outputs or []
+
+        for f in inputs + outputs:
+            if any(f.endswith(skip_file) for skip_file in self._skip_files):
+                return
+
         display = display or ""
         self.include_rules()
         flags = ""
         if check_unchanged:
             # This flag causes tup to compare the outputs with the previous run
             # of the command, and skip the rest of the DAG for any that are the
             # same.
             flags += "o"
@@ -278,19 +291,16 @@ class TupBackend(CommonBackend):
         return cmd
 
     def _lib_paths(self, objdir, libs):
         return [mozpath.relpath(mozpath.join(l.objdir, l.import_name), objdir)
                 for l in libs]
 
     def _gen_shared_library(self, backend_file):
         shlib = backend_file.shared_lib
-        if shlib.name == 'libxul.so':
-            # This will fail to link currently due to missing rust symbols.
-            return
 
         if shlib.cxx_link:
             mkshlib = (
                 [backend_file.environment.substs['CXX']] +
                 backend_file.local_flags['CXX_LDFLAGS']
             )
         else:
             mkshlib = (
@@ -308,19 +318,16 @@ class TupBackend(CommonBackend):
         objs, _, shared_libs, os_libs, static_libs = self._expand_libs(shlib)
         static_libs = self._lib_paths(backend_file.objdir, static_libs)
         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
 
         list_file_name = '%s.list' % shlib.name.replace('.', '_')
         list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
 
         inputs = objs + static_libs + shared_libs
-        if any(i.endswith('libxul.so') for i in inputs):
-            # Don't attempt to link anything that depends on libxul.
-            return
 
         symbols_file = []
         if shlib.symbols_file:
             inputs.append(shlib.symbols_file)
             # TODO: Assumes GNU LD
             symbols_file = ['-Wl,--version-script,%s' % shlib.symbols_file]
 
         cmd = (
@@ -348,19 +355,16 @@ class TupBackend(CommonBackend):
 
     def _gen_program(self, backend_file):
         cc_or_cxx = 'CXX' if backend_file.program.cxx_link else 'CC'
         objs, _, shared_libs, os_libs, static_libs = self._expand_libs(backend_file.program)
         static_libs = self._lib_paths(backend_file.objdir, static_libs)
         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
 
         inputs = objs + static_libs + shared_libs
-        if any(i.endswith('libxul.so') for i in inputs):
-            # Don't attempt to link anything that depends on libxul.
-            return
 
         list_file_name = '%s.list' % backend_file.program.name.replace('.', '_')
         list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
 
         outputs = [mozpath.relpath(backend_file.program.output_path.full_path,
                                    backend_file.objdir)]
         cmd = (
             [backend_file.environment.substs[cc_or_cxx], '-o', '%o'] +