CP: Fix permissions on macos artifacts (#45598) (#45900)
CP: 0cf5971438b45d8054a6d6fe14f9547abed39747
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py
index c138252..bb78320 100755
--- a/sky/tools/create_macos_framework.py
+++ b/sky/tools/create_macos_framework.py
@@ -81,6 +81,7 @@
shutil.rmtree(fat_framework, True)
shutil.copytree(arm64_framework, fat_framework, symlinks=True)
+
regenerate_symlinks(fat_framework)
fat_framework_binary = os.path.join(
@@ -91,6 +92,21 @@
subprocess.check_call([
'lipo', arm64_dylib, x64_dylib, '-create', '-output', fat_framework_binary
])
+
+ # Add group and other readability to all files.
+ versions_path = os.path.join(fat_framework, 'Versions')
+ subprocess.check_call(['chmod', '-R', 'og+r', versions_path])
+ # Find all the files below the target dir with owner execute permission
+ find_subprocess = subprocess.Popen([
+ 'find', versions_path, '-perm', '-100', '-print0'
+ ],
+ stdout=subprocess.PIPE)
+ # Add execute permission for other and group for all files that had it for owner.
+ xargs_subprocess = subprocess.Popen(['xargs', '-0', 'chmod', 'og+x'],
+ stdin=find_subprocess.stdout)
+ find_subprocess.wait()
+ xargs_subprocess.wait()
+
process_framework(dst, args, fat_framework, fat_framework_binary)
return 0