Bug 1416465 - Remove files that are actually linked or copied. r?Build draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 17 Nov 2017 01:53:35 +0900
changeset 699099 fb11c49c9f2e9bd5a799fd64559a21b2e88a13fd
parent 699098 b421be3fb8bf42daed6941f4a2d5577d5b92a880
child 740536 7fc2b4b82ecb1aee1e7a20feda8d3bf168ba539b
push id89465
push userVYV03354@nifty.ne.jp
push dateThu, 16 Nov 2017 17:05:26 +0000
reviewersBuild
bugs1416465
milestone59.0a1
Bug 1416465 - Remove files that are actually linked or copied. r?Build If multiple source direcotries share the same destination, process_manifest did not match patterns correctly. This patch will fix the bug using the follwing steps: 1. Match the pattern under the base directory. 2. Join the dest path and the match result. MozReview-Commit-ID: 1hFhXIxt69h
python/mozbuild/mozbuild/action/process_install_manifest.py
--- a/python/mozbuild/mozbuild/action/process_install_manifest.py
+++ b/python/mozbuild/mozbuild/action/process_install_manifest.py
@@ -15,16 +15,17 @@ from mozpack.copier import (
 )
 from mozpack.files import (
     BaseFile,
     FileFinder,
 )
 from mozpack.manifests import (
     InstallManifest,
 )
+import mozpack.path as mozpath
 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.'
 
 
@@ -36,19 +37,24 @@ def process_manifest(destdir, paths, tra
         # We use the same format as install manifests for the tracking
         # data.
         manifest = InstallManifest(path=track)
         remove_unaccounted = FileRegistry()
         dummy_file = BaseFile()
 
         finder = FileFinder(destdir, find_dotfiles=True)
         for dest in manifest._dests:
-            for p, f in finder.find(dest):
-                remove_unaccounted.add(p, dummy_file)
-
+            entry = manifest._dests[dest]
+            if entry[0] in (manifest.PATTERN_LINK, manifest.PATTERN_COPY):
+                basefinder = FileFinder(entry[1])
+                for p, f in basefinder.find(entry[2]):
+                    remove_unaccounted.add(mozpath.join(entry[3], p), dummy_file)
+            else:
+                for p, f in finder.find(dest):
+                    remove_unaccounted.add(p, dummy_file)
         remove_empty_directories=True
         remove_all_directory_symlinks=True
 
     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