From 30d4dba9afaa1292c7deb585f8d9332d94d295bf Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Mon, 4 May 2026 12:28:55 -0400 Subject: [PATCH] fix(docker): skip tlmgr install for collections install-tl already provided MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 16:23 container rebuild caught a real flaky failure with the previous commit's stricter exit-non-zero behavior: collection-fontsrecommended failed twice when tlmgr's mirror.ctan.org redirect landed on stale mirrors (ctan.math.illinois then mirrors.mit). On a stale mirror tlmgr refuses with a silent 'Remote database at ' / exit 1, never reaching the 'package already present' fast-path that would have succeeded against a fresh mirror. install-tl's scheme-medium already installs basic, fontsrecommended, fontutils, latex, latexrecommended, luatex, pictures, plus most language collections — 7 of the 9 entries in tl_packages. Only fontsextra and latexextra genuinely need a tlmgr install operation. Query the local tlpdb with 'tlmgr info --only-installed' (no network) and skip the network call entirely when the collection is already present, sidestepping the random-mirror staleness for the redundant entries. --- book/docker/linux/install-tl-collections.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/book/docker/linux/install-tl-collections.sh b/book/docker/linux/install-tl-collections.sh index a56440500..3e6a0f976 100755 --- a/book/docker/linux/install-tl-collections.sh +++ b/book/docker/linux/install-tl-collections.sh @@ -43,8 +43,22 @@ failed_packages="" while IFS= read -r collection; do case "$collection" in collection-*) - printf '%s\n' "📦 [$i/$collection_count] Installing $collection..." + printf '%s\n' "📦 [$i/$collection_count] Processing $collection..." if command -v tlmgr >/dev/null 2>&1; then + # install-tl already installs most of these via scheme-medium (basic, + # fontsrecommended, fontutils, latex, latexrecommended, luatex, + # pictures, ...). Calling 'tlmgr install ' against + # mirror.ctan.org's random-mirror redirect can hit a stale mirror that + # refuses with a silent version-mismatch exit 1 — the failure mode that + # took down the 2026-05-04 16:23 build for collection-fontsrecommended. + # Query the local tlpdb (no network) first and skip if already installed; + # only collections that genuinely need network install (e.g. fontsextra, + # latexextra) reach the tlmgr install retry loop. + if tlmgr info --only-installed "$collection" 2>/dev/null | grep -q '^package:'; then + printf '%s\n' "✅ $collection already installed locally (no network call)" + i=$(expr "$i" + 1) + continue + fi success=false for retry in 1 2; do # Capture tlmgr stdout+stderr so its actual error message reaches the