Make Strip Sparkle build phase resilient to rm -rf races

The post-embed strip script was intermittently failing with "Directory
not empty" when rm -rf raced against codesign/Spotlight/Xcode touching
the freshly-embedded framework. Atomically rename the framework out of
the embed path first, then rm -rf with a short retry loop, so a clean
build is no longer needed to recover.
This commit is contained in:
Arkadiusz Fal
2026-05-08 07:40:32 +02:00
parent b163864628
commit df0f144ced

View File

@@ -384,7 +384,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "if [ \"${CONFIGURATION}\" != \"Release-DeveloperID\" ]; then\n FW=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework\"\n if [ -d \"$FW\" ]; then\n echo \"Stripping Sparkle.framework (config=${CONFIGURATION})\"\n rm -rf \"$FW\"\n fi\nfi\n"; shellScript = "if [ \"${CONFIGURATION}\" != \"Release-DeveloperID\" ]; then\n FW=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework\"\n if [ -d \"$FW\" ]; then\n echo \"Stripping Sparkle.framework (config=${CONFIGURATION})\"\n chflags -R nouchg \"$FW\" 2>/dev/null || true\n chmod -R u+w \"$FW\" 2>/dev/null || true\n TMP=\"${FW}.stripping.$$\"\n if mv \"$FW\" \"$TMP\" 2>/dev/null; then\n TARGET=\"$TMP\"\n else\n TARGET=\"$FW\"\n fi\n for i in 1 2 3 4 5; do\n rm -rf \"$TARGET\" && break\n sleep 0.2\n done\n if [ -e \"$TARGET\" ]; then\n echo \"warning: failed to fully remove $TARGET\" >&2\n exit 1\n fi\n fi\nfi\n";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */