Bug 1319226 - allow symlinks to point to files with a different basename; r=chmanchester
authorMike Shal <mshal@mozilla.com>
Wed, 24 May 2017 15:41:40 -0400
changeset 409623 9bce19249d9b7fd841f8c85c7974b0e08d0f4440
parent 409622 970698e1bb620df117a6da3964b9e4d9a7e7f7c2
child 409624 9e738d40b62dd65294529c666bd7505ba9ece8d4
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1319226
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1319226 - allow symlinks to point to files with a different basename; r=chmanchester Some jar.mn files create symlinks with a different name than the file they point to. The tup backend should support this by using the object's target_basename as the destination filename. MozReview-Commit-ID: IB4moXA7KWH
python/mozbuild/mozbuild/backend/tup.py
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -81,18 +81,18 @@ class BackendTupfile(object):
         self.write(': %(inputs)s |> %(display)s%(cmd)s |> %(outputs)s%(extra_outputs)s\n' % {
             'inputs': ' '.join(inputs),
             'display': '^%s^ ' % caret_text if caret_text else '',
             'cmd': ' '.join(cmd),
             'outputs': ' '.join(outputs),
             'extra_outputs': ' | ' + ' '.join(extra_outputs) if extra_outputs else '',
         })
 
-    def symlink_rule(self, source, output_group=None):
-        outputs = [mozpath.basename(source)]
+    def symlink_rule(self, source, output=None, output_group=None):
+        outputs = [output] if output else [mozpath.basename(source)]
         if output_group:
             outputs.append(output_group)
 
         # The !tup_ln macro does a symlink or file copy (depending on the
         # platform) without shelling out to a subprocess.
         self.rule(
             cmd=['!tup_ln'],
             inputs=[source],
@@ -292,17 +292,17 @@ class TupOnly(CommonBackend, PartialBack
 
                             # TODO: This is only needed for Windows, so we can
                             # skip this for now.
                             pass
                         else:
                             # TODO: This is needed for tests
                             pass
                     else:
-                        backend_file.symlink_rule(f.full_path, output_group=self._installed_files)
+                        backend_file.symlink_rule(f.full_path, output=f.target_basename, output_group=self._installed_files)
                 else:
                     # TODO: Support installing generated files
                     pass
 
     def _process_final_target_pp_files(self, obj, backend_file):
         for i, (path, files) in enumerate(obj.files.walk()):
             for f in files:
                 self._preprocess(backend_file, f.full_path,