archive.py: undo unrelated changes from #43851 (#44947)

This commit is contained in:
Harmen Stoppels 2024-07-01 11:35:32 +02:00 committed by GitHub
parent 6b0fefff29
commit fa3f27e8e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -195,14 +195,12 @@ def reproducible_tarfile_from_prefix(
file_info = tarfile.TarInfo(path_to_name(entry.path)) file_info = tarfile.TarInfo(path_to_name(entry.path))
if entry.is_symlink(): if entry.is_symlink():
# strip off long path reg prefix on Windows file_info.type = tarfile.SYMTYPE
link_dest = readlink(entry.path) file_info.linkname = readlink(entry.path)
file_info.linkname = link_dest
# According to POSIX: "the value of the file mode bits returned in the # According to POSIX: "the value of the file mode bits returned in the
# st_mode field of the stat structure is unspecified." So we set it to # st_mode field of the stat structure is unspecified." So we set it to
# something sensible without lstat'ing the link. # something sensible without lstat'ing the link.
file_info.mode = 0o755 file_info.mode = 0o755
file_info.type = tarfile.SYMTYPE
tar.addfile(file_info) tar.addfile(file_info)
elif entry.is_file(follow_symlinks=False): elif entry.is_file(follow_symlinks=False):