1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-08 18:02:05 +03:00

don't follow mount points when applying shipit transformation

Summary:
If a getdeps project creates a bind mount in a subdirectory, we don't
want the shipit transformer to copy all of the bind mount's contents
to the ship-transformed output.

This manifested when I was using Vagrant inside of Watchman and
`getdeps.py fetch watchman` would copy all of the Vagrant VMs too.

Reviewed By: ahornby

Differential Revision: D33855553

fbshipit-source-id: e2bc50ecfe0d067490c95be05d074d6a844f30d5
This commit is contained in:
Chad Austin
2022-02-03 12:05:46 -08:00
committed by Facebook GitHub Bot
parent 89e75aed28
commit d49dc0460c

View File

@@ -447,14 +447,28 @@ class ShipitPathMap(object):
# Record the full set of files that should be in the tree
full_file_list = set()
if sys.platform == "win32":
# Let's not assume st_dev has a consistent value on Windows.
def st_dev(path):
return 1
else:
def st_dev(path):
return os.lstat(path).st_dev
for fbsource_subdir in self.roots:
dir_to_mirror = os.path.join(fbsource_root, fbsource_subdir)
root_dev = st_dev(dir_to_mirror)
prefetch_dir_if_eden(dir_to_mirror)
if not os.path.exists(dir_to_mirror):
raise Exception(
"%s doesn't exist; check your sparse profile!" % dir_to_mirror
)
for root, _dirs, files in os.walk(dir_to_mirror):
for root, dirs, files in os.walk(dir_to_mirror):
dirs[:] = [d for d in dirs if root_dev == st_dev(os.path.join(root, d))]
for src_file in files:
full_name = os.path.join(root, src_file)
rel_name = os.path.relpath(full_name, fbsource_root)