diff --git a/.github/workflows/appimage10.yml b/.github/workflows/appimage10.yml index 04e7a93b..f2e21ac7 100644 --- a/.github/workflows/appimage10.yml +++ b/.github/workflows/appimage10.yml @@ -78,6 +78,32 @@ jobs: set -euo pipefail known_sha() { + retry_ls_remote() { + local refs="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tcl.git "$refs"; then + return 0 + fi + echo "Retry $attempt/3 failed for tcl ls-remote $refs" >&2 + sleep "$attempt" + done + return 1 + } + + tk_tag_exists() { + local ref="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$ref" | grep -q .; then + return 0 + fi + echo "Retry $attempt/3 failed for tk ls-remote refs/tags/$ref" >&2 + sleep "$attempt" + done + return 1 + } + case "$1/$2" in tcl/8.6.18) echo "8b9b554f3539b37bea20ee6cef14faa63df1259896e466328f596eca9f0c49a5" ;; tk/8.6.18) echo "8c1d775126c39124c89752737c32c23636b3cd308d0445977aec58cfbc42c46c" ;; @@ -96,12 +122,12 @@ jobs: tcl_ref="$TCL_REF_INPUT" echo "Using workflow_dispatch TCL ref: $tcl_ref" else - tcl_ref=$(git ls-remote --tags --refs https://github.com/tcltk/tcl.git "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) + tcl_ref=$(retry_ls_remote "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) test -n "$tcl_ref" echo "Auto-resolved latest Tcl ref: $tcl_ref" fi - if ! git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$tcl_ref" | grep -q .; then + if ! tk_tag_exists "$tcl_ref"; then echo "Missing matching Tk tag for Tcl ref: $tcl_ref" >&2 exit 1 fi diff --git a/.github/workflows/appimage7.yml b/.github/workflows/appimage7.yml index 230f0c52..8705ffd1 100644 --- a/.github/workflows/appimage7.yml +++ b/.github/workflows/appimage7.yml @@ -78,6 +78,32 @@ jobs: set -euo pipefail known_sha() { + retry_ls_remote() { + local refs="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tcl.git "$refs"; then + return 0 + fi + echo "Retry $attempt/3 failed for tcl ls-remote $refs" >&2 + sleep "$attempt" + done + return 1 + } + + tk_tag_exists() { + local ref="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$ref" | grep -q .; then + return 0 + fi + echo "Retry $attempt/3 failed for tk ls-remote refs/tags/$ref" >&2 + sleep "$attempt" + done + return 1 + } + case "$1/$2" in tcl/8.6.18) echo "8b9b554f3539b37bea20ee6cef14faa63df1259896e466328f596eca9f0c49a5" ;; tk/8.6.18) echo "8c1d775126c39124c89752737c32c23636b3cd308d0445977aec58cfbc42c46c" ;; @@ -96,12 +122,12 @@ jobs: tcl_ref="$TCL_REF_INPUT" echo "Using workflow_dispatch TCL ref: $tcl_ref" else - tcl_ref=$(git ls-remote --tags --refs https://github.com/tcltk/tcl.git "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) + tcl_ref=$(retry_ls_remote "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) test -n "$tcl_ref" echo "Auto-resolved latest Tcl ref: $tcl_ref" fi - if ! git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$tcl_ref" | grep -q .; then + if ! tk_tag_exists "$tcl_ref"; then echo "Missing matching Tk tag for Tcl ref: $tcl_ref" >&2 exit 1 fi diff --git a/.github/workflows/appimage8.yml b/.github/workflows/appimage8.yml index a4bcd4c5..78a33030 100644 --- a/.github/workflows/appimage8.yml +++ b/.github/workflows/appimage8.yml @@ -78,6 +78,32 @@ jobs: set -euo pipefail known_sha() { + retry_ls_remote() { + local refs="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tcl.git "$refs"; then + return 0 + fi + echo "Retry $attempt/3 failed for tcl ls-remote $refs" >&2 + sleep "$attempt" + done + return 1 + } + + tk_tag_exists() { + local ref="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$ref" | grep -q .; then + return 0 + fi + echo "Retry $attempt/3 failed for tk ls-remote refs/tags/$ref" >&2 + sleep "$attempt" + done + return 1 + } + case "$1/$2" in tcl/8.6.18) echo "8b9b554f3539b37bea20ee6cef14faa63df1259896e466328f596eca9f0c49a5" ;; tk/8.6.18) echo "8c1d775126c39124c89752737c32c23636b3cd308d0445977aec58cfbc42c46c" ;; @@ -96,12 +122,12 @@ jobs: tcl_ref="$TCL_REF_INPUT" echo "Using workflow_dispatch TCL ref: $tcl_ref" else - tcl_ref=$(git ls-remote --tags --refs https://github.com/tcltk/tcl.git "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) + tcl_ref=$(retry_ls_remote "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) test -n "$tcl_ref" echo "Auto-resolved latest Tcl ref: $tcl_ref" fi - if ! git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$tcl_ref" | grep -q .; then + if ! tk_tag_exists "$tcl_ref"; then echo "Missing matching Tk tag for Tcl ref: $tcl_ref" >&2 exit 1 fi diff --git a/.github/workflows/appimage9.yml b/.github/workflows/appimage9.yml index 37f456c3..7680f763 100644 --- a/.github/workflows/appimage9.yml +++ b/.github/workflows/appimage9.yml @@ -78,6 +78,32 @@ jobs: set -euo pipefail known_sha() { + retry_ls_remote() { + local refs="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tcl.git "$refs"; then + return 0 + fi + echo "Retry $attempt/3 failed for tcl ls-remote $refs" >&2 + sleep "$attempt" + done + return 1 + } + + tk_tag_exists() { + local ref="$1" + local attempt + for attempt in 1 2 3; do + if git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$ref" | grep -q .; then + return 0 + fi + echo "Retry $attempt/3 failed for tk ls-remote refs/tags/$ref" >&2 + sleep "$attempt" + done + return 1 + } + case "$1/$2" in tcl/8.6.18) echo "8b9b554f3539b37bea20ee6cef14faa63df1259896e466328f596eca9f0c49a5" ;; tk/8.6.18) echo "8c1d775126c39124c89752737c32c23636b3cd308d0445977aec58cfbc42c46c" ;; @@ -96,12 +122,12 @@ jobs: tcl_ref="$TCL_REF_INPUT" echo "Using workflow_dispatch TCL ref: $tcl_ref" else - tcl_ref=$(git ls-remote --tags --refs https://github.com/tcltk/tcl.git "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) + tcl_ref=$(retry_ls_remote "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1) test -n "$tcl_ref" echo "Auto-resolved latest Tcl ref: $tcl_ref" fi - if ! git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$tcl_ref" | grep -q .; then + if ! tk_tag_exists "$tcl_ref"; then echo "Missing matching Tk tag for Tcl ref: $tcl_ref" >&2 exit 1 fi diff --git a/appimage/10/Makefile b/appimage/10/Makefile index 246e987b..5fe7c6de 100644 --- a/appimage/10/Makefile +++ b/appimage/10/Makefile @@ -45,7 +45,7 @@ prefix/bin/magic: Dockerfile Makefile docker cp $$id:/prefix ./prefix ; \ docker rm -v $$id mkdir -p prefix/lib/tcl$(TCL_VERSION) - if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; fi + if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; else echo "Missing expected Tcl ABI directory: prefix/lib/tcl$(TCL_ABI_VERSION)" >&2; exit 1; fi appimagetool: curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool diff --git a/appimage/7/Makefile b/appimage/7/Makefile index 16eb92c4..12323fcc 100644 --- a/appimage/7/Makefile +++ b/appimage/7/Makefile @@ -45,7 +45,7 @@ prefix/bin/magic: Dockerfile Makefile docker cp $$id:/prefix ./prefix ; \ docker rm -v $$id mkdir -p prefix/lib/tcl$(TCL_VERSION) - if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; fi + if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; else echo "Missing expected Tcl ABI directory: prefix/lib/tcl$(TCL_ABI_VERSION)" >&2; exit 1; fi appimagetool: curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool diff --git a/appimage/8/Makefile b/appimage/8/Makefile index b9a0c994..94f97d74 100644 --- a/appimage/8/Makefile +++ b/appimage/8/Makefile @@ -45,7 +45,7 @@ prefix/bin/magic: Dockerfile Makefile docker cp $$id:/prefix ./prefix ; \ docker rm -v $$id mkdir -p prefix/lib/tcl$(TCL_VERSION) - if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; fi + if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; else echo "Missing expected Tcl ABI directory: prefix/lib/tcl$(TCL_ABI_VERSION)" >&2; exit 1; fi appimagetool: curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool diff --git a/appimage/9/Makefile b/appimage/9/Makefile index 22bd9c9b..cac4b8fa 100644 --- a/appimage/9/Makefile +++ b/appimage/9/Makefile @@ -45,7 +45,7 @@ prefix/bin/magic: Dockerfile Makefile docker cp $$id:/prefix ./prefix ; \ docker rm -v $$id mkdir -p prefix/lib/tcl$(TCL_VERSION) - if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; fi + if [ -d "prefix/lib/tcl$(TCL_ABI_VERSION)" ]; then cp -r "prefix/lib/tcl$(TCL_ABI_VERSION)" "prefix/lib/tcl$(TCL_VERSION)/library"; else echo "Missing expected Tcl ABI directory: prefix/lib/tcl$(TCL_ABI_VERSION)" >&2; exit 1; fi appimagetool: curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool