From ae6c96511ef5938fdf81e3bc2dece99549f346f9 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 21 Aug 2024 10:49:21 -0700 Subject: [PATCH] iOS,macOS: Don't archive extra framework metadata (flutter/engine#54674) By default, zip archives don't just archive the files themselves, but also bundle extra metadata such as unix owner/group and unix timestamps. None of these is particularly important in the case of Flutter: owner/group information is likely to differ across machines and thus be overridden on the unarchiver's end. The tool checks for file presence and occasionally content hashes. This change results in more reproducible zip archives across runs/machines. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- engine/src/flutter/sky/tools/sky_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/sky/tools/sky_utils.py b/engine/src/flutter/sky/tools/sky_utils.py index e30fd034f3..1a19885911 100644 --- a/engine/src/flutter/sky/tools/sky_utils.py +++ b/engine/src/flutter/sky/tools/sky_utils.py @@ -186,9 +186,10 @@ def create_zip(cwd, zip_filename, paths): """Creates a zip archive in cwd, containing a set of cwd-relative files. In order to preserve the correct internal structure of macOS frameworks, - symlinks are preserved. + symlinks are preserved (-y). In order to generate reproducible builds, + owner/group and unix file timestamps are not included in the archive (-X). """ - subprocess.check_call(['zip', '-r', '-y', zip_filename] + paths, cwd=cwd) + subprocess.check_call(['zip', '-r', '-X', '-y', zip_filename] + paths, cwd=cwd) def _dsymutil_path():