mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
contrib: macdeploy: make gen-sdk deterministic
This commit is contained in:
@@ -75,14 +75,21 @@ def run():
|
||||
tarinfo.name = str(pathlib.Path(alt_base_dir, tarinfo.name))
|
||||
if tarinfo.linkname and tarinfo.linkname.startswith("./"):
|
||||
tarinfo.linkname = str(pathlib.Path(alt_base_dir, tarinfo.linkname))
|
||||
# make metadata deterministic
|
||||
tarinfo.mtime = 0
|
||||
tarinfo.uid, tarinfo.uname = 0, ''
|
||||
tarinfo.gid, tarinfo.gname = 0, ''
|
||||
# don't use isdir() as there are also executable files present
|
||||
tarinfo.mode = 0o0755 if tarinfo.mode & 0o0100 else 0x0644
|
||||
return tarinfo
|
||||
with cd(dir_to_add):
|
||||
# recursion already adds entries in sorted order
|
||||
tarfp.add(".", recursive=True, filter=change_tarinfo_base)
|
||||
|
||||
print("Creating output .tar.gz file...")
|
||||
with out_sdktgz_path.open("wb") as fp:
|
||||
with gzip.GzipFile(fileobj=fp, mode='wb', compresslevel=9, mtime=0) as gzf:
|
||||
with tarfile.open(mode="w", fileobj=gzf) as tarfp:
|
||||
with tarfile.open(mode="w", fileobj=gzf, format=tarfile.GNU_FORMAT) as tarfp:
|
||||
print("Adding MacOSX SDK {} files...".format(sdk_version))
|
||||
tarfp_add_with_base_change(tarfp, sdk_dir, out_name)
|
||||
print("Adding libc++ headers...")
|
||||
|
||||
Reference in New Issue
Block a user