Skip to content

Commit f16fe41

Browse files
committed
Fix CI: copy l10n before docs build, handle manpage build failures
- Move l10n locale copy to a separate workflow step before docs build to avoid triggering uudoc rebuilds with different cargo features - Build uudoc once, then reuse for all languages - Handle per-language build failures gracefully (skip and continue) - Remove unused L10N_DIR parameter from build-all-manpages.sh
1 parent 59735c5 commit f16fe41

2 files changed

Lines changed: 26 additions & 21 deletions

File tree

.github/workflows/website.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ jobs:
5555
with:
5656
tool: mdbook,mdbook-toc
5757

58+
- name: Copy l10n locales into coreutils
59+
run: |
60+
cp -r coreutils-l10n/src/uu/* coreutils/src/uu/ 2>/dev/null || true
61+
cp -r coreutils-l10n/src/uucore/* coreutils/src/uucore/ 2>/dev/null || true
62+
5863
- name: Build Coreutils Docs
5964
run: |
6065
cd coreutils
@@ -67,7 +72,7 @@ jobs:
6772
6873
- name: Build Coreutils Manpages (all languages)
6974
run: |
70-
uutils.github.io/scripts/build-all-manpages.sh coreutils coreutils-l10n manpages-html uutils.github.io/templates
75+
uutils.github.io/scripts/build-all-manpages.sh coreutils manpages-html uutils.github.io/templates
7176
7277
- name: Build Findutils Docs
7378
run: |

scripts/build-all-manpages.sh

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/bin/bash
22
# Build manpages for all languages
3-
# Usage: build-all-manpages.sh <coreutils-dir> <coreutils-l10n-dir> <output-dir> <templates-dir>
3+
# Usage: build-all-manpages.sh <coreutils-dir> <output-dir> <templates-dir>
44

55
set -euo pipefail
66

7-
COREUTILS_DIR="${1:?Usage: $0 <coreutils-dir> <coreutils-l10n-dir> <output-dir> <templates-dir>}"
8-
L10N_DIR="${2:?}"
9-
OUTPUT_DIR="${3:?}"
10-
TEMPLATES_DIR="${4:?}"
7+
COREUTILS_DIR="${1:?Usage: $0 <coreutils-dir> <output-dir> <templates-dir>}"
8+
OUTPUT_DIR="${2:?}"
9+
TEMPLATES_DIR="${3:?}"
1110

1211
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
1312

@@ -41,23 +40,10 @@ declare -A MANPAGE_TO_TLDR=(
4140
[zh-Hans]="zh"
4241
)
4342

44-
# lang code used in output URLs
45-
declare -A LANG_TO_URL=(
46-
[en]="en"
47-
[fr_FR]="fr" [de_DE]="de" [es_ES]="es" [it_IT]="it"
48-
[pt_PT]="pt" [pt_BR]="pt-BR" [ja_JP]="ja" [ko_KR]="ko"
49-
[ru_RU]="ru" [zh_CN]="zh" [uk_UA]="uk" [sv_SE]="sv"
50-
[pl_PL]="pl" [tr_TR]="tr" [ar_SA]="ar" [cs_CZ]="cs"
51-
[da_DK]="da" [id_ID]="id"
52-
)
5343

5444
TMPDIR=$(mktemp -d)
5545
trap 'rm -rf "$TMPDIR"' EXIT
5646

57-
# Copy l10n locales into coreutils so uudoc picks them up
58-
cp -r "$L10N_DIR"/src/uu/* "$COREUTILS_DIR"/src/uu/ 2>/dev/null || true
59-
cp -r "$L10N_DIR"/src/uucore/* "$COREUTILS_DIR"/src/uucore/ 2>/dev/null || true
60-
6147
# Download tldr archives
6248
echo "Downloading tldr archives..."
6349
mkdir -p "$TMPDIR/tldr-archives"
@@ -76,6 +62,9 @@ if [ -f "$TMPDIR/tldr-archives/en.zip" ]; then
7662
find "$TMPDIR/tldr-extract-en" -name "*.md" -exec cp {} "$EN_TLDR_DIR/" \; 2>/dev/null || true
7763
fi
7864

65+
# Build uudoc once (if not already built by the docs step)
66+
make -C "$COREUTILS_DIR" build-uudoc 2>&1 | tail -1
67+
7968
# Generate and build manpages for each language
8069
for lang in "${!LANG_MAP[@]}"; do
8170
echo "=== Building $lang manpages ==="
@@ -97,9 +86,14 @@ for lang in "${!LANG_MAP[@]}"; do
9786
tldr_dir="$EN_TLDR_DIR"
9887
fi
9988

100-
# Generate manpages with the right locale
89+
# Generate manpages with the right locale (reuse already-built uudoc)
10190
manpages_dir="$TMPDIR/manpages-${lang}"
102-
LANG="${LANG_MAP[$lang]}" make -C "$COREUTILS_DIR" install-manpages DESTDIR="$manpages_dir" 2>&1 | tail -1
91+
cd "$COREUTILS_DIR"
92+
if ! LANG="${LANG_MAP[$lang]}" make install-manpages DESTDIR="$manpages_dir" 2>&1; then
93+
echo "WARNING: Failed to generate manpages for $lang, skipping"
94+
continue
95+
fi
96+
cd - > /dev/null
10397

10498
# Determine output subdirectory
10599
if [ "$lang" = "en" ]; then
@@ -108,6 +102,12 @@ for lang in "${!LANG_MAP[@]}"; do
108102
out_subdir="$OUTPUT_DIR/${tldr_lang}"
109103
fi
110104

105+
# Skip if no manpages were generated
106+
if ! ls "$manpages_dir"/usr/local/share/man/man*/*.1 > /dev/null 2>&1; then
107+
echo "WARNING: No manpages found for $lang, skipping HTML generation"
108+
continue
109+
fi
110+
111111
# Build HTML (pass English tldr as fallback for non-English builds)
112112
if [ "$lang" = "en" ]; then
113113
"$SCRIPT_DIR/build-manpages.sh" "$manpages_dir" "$tldr_dir" "$out_subdir" "$TEMPLATES_DIR" "$tldr_lang"

0 commit comments

Comments
 (0)