Bug 1904776 - Allow dangling symlinks when unpacking upstream tarball with mach vendor r=glandium

As a side effect, also propagate dangling symlink option when called
recursively.

Differential Revision: https://phabricator.services.mozilla.com/D214924
This commit is contained in:
serge-sans-paille 2024-07-03 07:22:27 +00:00
Родитель f1136726b1
Коммит 69bac7b60d
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -604,7 +604,9 @@ class VendorManifest(MozbuildObject):
# Then copy over the directories
if self.should_perform_step("move-contents"):
self.logInfo({"d": vendor_dir}, "Copying to {d}.")
mozfile.copy_contents(tmpextractdir.name, vendor_dir)
mozfile.copy_contents(
tmpextractdir.name, vendor_dir, ignore_dangling_symlinks=True
)
else:
self.logInfo({}, "Skipping copying contents into tree.")
self._extract_directory = lambda: tmpextractdir.name

Просмотреть файл

@ -332,7 +332,11 @@ def copy_contents(srcdir, dstdir, ignore_dangling_symlinks=False):
linkto = os.readlink(srcname)
os.symlink(linkto, dstname)
elif os.path.isdir(srcname):
copy_contents(srcname, dstname)
copy_contents(
srcname,
dstname,
ignore_dangling_symlinks=ignore_dangling_symlinks,
)
else:
_call_windows_retry(shutil.copy2, (srcname, dstname))
except OSError as why: