From 2dd8f7dde38d261cc0e6981b0e2efaf802bce6a8 Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Fri, 13 Dec 2024 21:28:07 +0100
Subject: [PATCH] darwin_app: hdiutil create now also causes issues on GH CI.

---
 packages/darwin_app/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/darwin_app/Makefile b/packages/darwin_app/Makefile
index ca1adfb2e..d0ec193cc 100644
--- a/packages/darwin_app/Makefile
+++ b/packages/darwin_app/Makefile
@@ -191,6 +191,8 @@ dmg:
 	rm -f build.dmg
 	hdiutil create -format UDRW -fs HFS+ -srcfolder "$(BUILD_BASE)" \
 		-volname $(VOLUME_NAME) build.dmg
+# GH runner often fails here, do max 10 retries
+	nretries=10; until [[ $$nretries -le 0 ]] || hdiutil create -format UDRW -fs HFS+ -srcfolder "$(BUILD_BASE)" -volname $(VOLUME_NAME) build.dmg; do echo "hdiutil create failed, retrying"; sleep 5; nretries=$$(expr $$nretries - 1); done
 # detach one with the same name first
 	-hdiutil detach "/Volumes/$(VOLUME_NAME)"
 	hdiutil attach build.dmg
@@ -216,8 +218,8 @@ dmg:
 	$(MAKE) -C $(packages_src) \
 		DESTDIR="/Volumes/$(VOLUME_NAME)/*.app/Contents/Resources" doc_format
 	chmod -R a-w /Volumes/$(VOLUME_NAME)/*.app/Contents/Resources
-# max 5 retries
-	nretries=10; volm=$$(mount | grep $(VOLUME_NAME) | cut -d ' ' -f 1); sleep 5; until [[ $$nretries -le 0 ]] || hdiutil detach $$volm; do echo "detach failed, retrying"; sleep 5; nretries=$$(expr $$nretries - 1); done
+# max 10 retries
+	nretries=10; volm=$$(mount | grep $(VOLUME_NAME) | cut -d ' ' -f 1); sleep 5; until [[ $$nretries -le 0 ]] || hdiutil detach $$volm; do echo "hdiutil detach failed, retrying"; sleep 5; nretries=$$(expr $$nretries - 1); done
 	rm -f "$(PACKAGE_NAME).dmg"
 	hdiutil convert -format UDZO -o "$(PACKAGE_NAME).dmg" build.dmg
 	rm -f build.dmg
-- 
GitLab