Bug 1143421 - install file copies instead of symlinks for Spidermonkey. r=glandium
authorYen Chi Hsuan <yan12125@gmail.com>
Thu, 25 Aug 2016 15:51:55 +0800
changeset 314605 dd4cbc33bad46f7112fc48488b3dbb2661d2d373
parent 314604 ca56b87ab094316069d793db86b1300a8ce25370
child 314606 9546409302784cb6e97371b448132194bbba8ecb
push id30732
push usercbook@mozilla.com
push dateWed, 21 Sep 2016 10:04:03 +0000
treeherdermozilla-central@560b2c805bf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1143421
milestone52.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 1143421 - install file copies instead of symlinks for Spidermonkey. r=glandium
js/src/Makefile.in
python/mozbuild/mozbuild/action/process_install_manifest.py
python/mozbuild/mozpack/manifests.py
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -192,17 +192,17 @@ install:: js-config.h
 #          js/src/ds/* public headers
 #        gc/
 #          js/src/gc/* public headers
 #        mozilla/
 #          mfbt headers
 #
 
 install::
-	$(call py_action,process_install_manifest,--no-remove $(DESTDIR)$(includedir) $(DEPTH)/_build_manifests/install/dist_include)
+	$(call py_action,process_install_manifest,--no-remove --no-symlinks $(DESTDIR)$(includedir) $(DEPTH)/_build_manifests/install/dist_include)
 
 #
 # END SpiderMonkey header installation
 #############################################
 
 install:: $(SCRIPTS)
 	$(SYSINSTALL) $^ $(DESTDIR)$(bindir)
 
--- a/python/mozbuild/mozbuild/action/process_install_manifest.py
+++ b/python/mozbuild/mozbuild/action/process_install_manifest.py
@@ -12,29 +12,33 @@ import time
 from mozpack.copier import (
     FileCopier,
     FileRegistry,
 )
 from mozpack.files import (
     BaseFile,
     FileFinder,
 )
-from mozpack.manifests import InstallManifest
+from mozpack.manifests import (
+    InstallManifest,
+    InstallManifestNoSymlinks,
+)
 from mozbuild.util import DefinesAction
 
 
 COMPLETE = 'Elapsed: {elapsed:.2f}s; From {dest}: Kept {existing} existing; ' \
     'Added/updated {updated}; ' \
     'Removed {rm_files} files and {rm_dirs} directories.'
 
 
 def process_manifest(destdir, paths, track=None,
         remove_unaccounted=True,
         remove_all_directory_symlinks=True,
         remove_empty_directories=True,
+        no_symlinks=False,
         defines={}):
 
     if track:
         if os.path.exists(track):
             # We use the same format as install manifests for the tracking
             # data.
             manifest = InstallManifest(path=track)
             remove_unaccounted = FileRegistry()
@@ -48,19 +52,20 @@ def process_manifest(destdir, paths, tra
 
         else:
             # If tracking is enabled and there is no file, we don't want to
             # be removing anything.
             remove_unaccounted=False
             remove_empty_directories=False
             remove_all_directory_symlinks=False
 
-    manifest = InstallManifest()
+    manifest_cls = InstallManifestNoSymlinks if no_symlinks else InstallManifest
+    manifest = manifest_cls()
     for path in paths:
-        manifest |= InstallManifest(path=path)
+        manifest |= manifest_cls(path=path)
 
     copier = FileCopier()
     manifest.populate_registry(copier, defines_override=defines)
     result = copier.copy(destdir,
         remove_unaccounted=remove_unaccounted,
         remove_all_directory_symlinks=remove_all_directory_symlinks,
         remove_empty_directories=remove_empty_directories)
 
@@ -77,30 +82,33 @@ def main(argv):
     parser.add_argument('destdir', help='Destination directory.')
     parser.add_argument('manifests', nargs='+', help='Path to manifest file(s).')
     parser.add_argument('--no-remove', action='store_true',
         help='Do not remove unaccounted files from destination.')
     parser.add_argument('--no-remove-all-directory-symlinks', action='store_true',
         help='Do not remove all directory symlinks from destination.')
     parser.add_argument('--no-remove-empty-directories', action='store_true',
         help='Do not remove empty directories from destination.')
+    parser.add_argument('--no-symlinks', action='store_true',
+        help='Do not install symbolic links. Always copy files')
     parser.add_argument('--track', metavar="PATH",
         help='Use installed files tracking information from the given path.')
     parser.add_argument('-D', action=DefinesAction,
         dest='defines', metavar="VAR[=VAL]",
         help='Define a variable to override what is specified in the manifest')
 
     args = parser.parse_args(argv)
 
     start = time.time()
 
     result = process_manifest(args.destdir, args.manifests,
         track=args.track, remove_unaccounted=not args.no_remove,
         remove_all_directory_symlinks=not args.no_remove_all_directory_symlinks,
         remove_empty_directories=not args.no_remove_empty_directories,
+        no_symlinks=args.no_symlinks,
         defines=args.defines)
 
     elapsed = time.time() - start
 
     print(COMPLETE.format(
         elapsed=elapsed,
         dest=args.destdir,
         existing=result.existing_files_count,
--- a/python/mozbuild/mozpack/manifests.py
+++ b/python/mozbuild/mozpack/manifests.py
@@ -392,8 +392,21 @@ class InstallManifest(object):
                 # GeneratedFile expect the buffer interface, which the unicode
                 # type doesn't have, so encode to a str.
                 content = self._decode_field_entry(entry[1]).encode('utf-8')
                 registry.add(dest, GeneratedFile(content))
                 continue
 
             raise Exception('Unknown install type defined in manifest: %d' %
                 install_type)
+
+
+class InstallManifestNoSymlinks(InstallManifest):
+    """Like InstallManifest, but files are never installed as symbolic links.
+    Instead, they are always copied.
+    """
+
+    def add_symlink(self, source, dest):
+        """A wrapper that accept symlink entries and install file copies.
+
+        source will be copied to dest.
+        """
+        self.add_copy(source, dest)