aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-06-26 18:15:33 -0300
committerEuAndreh <eu@euandre.org>2021-06-26 18:17:20 -0300
commite6510c83a2146436778fbd905bf6597eb187ca4f (patch)
treeb0f0abd1aab262756dfd915e980da8844b7df16d /aux/workflow
parentMakefile: Remove fallible/valgrind tests for now (diff)
downloadremembering-e6510c83a2146436778fbd905bf6597eb187ca4f.tar.gz
remembering-e6510c83a2146436778fbd905bf6597eb187ca4f.tar.xz
Makefile, README.md: Adapt to changes in aux/
Diffstat (limited to '')
-rwxr-xr-xaux/workflow/TODOs.sh5
-rwxr-xr-xaux/workflow/assert-changelog.sh3
-rwxr-xr-xaux/workflow/assert-manpages.sh6
-rwxr-xr-xaux/workflow/assert-readme.sh7
-rw-r--r--aux/workflow/assert-spelling.sh0
-rwxr-xr-xaux/workflow/commonmark.sh7
-rwxr-xr-xaux/workflow/dist.sh10
-rwxr-xr-xaux/workflow/l10n.sh50
-rwxr-xr-xaux/workflow/manpages.sh113
-rwxr-xr-xaux/workflow/public.sh13
10 files changed, 143 insertions, 71 deletions
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh
index 160e76f..f93ece8 100755
--- a/aux/workflow/TODOs.sh
+++ b/aux/workflow/TODOs.sh
@@ -1,11 +1,10 @@
#!/bin/sh
set -eu
-mkdir -p public
-
PROJECT_UC="$1"
PROJECT="$2"
MAILING_LIST="$3"
+OUTDIR="$4"
TLD="$(cat aux/tld.txt)"
TODOS_ADD_REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#(.*?)\}$/## <a href="#\3"><span class="\1">\1<\/span> \2<\/a>\n<pre class="header-anchor" id="\3">#\3<\/pre>\n/'
@@ -37,4 +36,4 @@ sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \
| \
perl -pe "$TODOS_CLEANUP_REGEX1" | \
perl -pe "$TODOS_CLEANUP_REGEX2" \
- > public/TODOs.html
+ > "$OUTDIR/TODOs.html"
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh
index 61cd916..e2cd926 100755
--- a/aux/workflow/assert-changelog.sh
+++ b/aux/workflow/assert-changelog.sh
@@ -33,8 +33,7 @@ for VVERSION in $(git tag); do
done
# "$@" represents a list of tags to be also included in the verification.
-# shellcheck disable=2068
-for VVERSION in $@; do
+for VVERSION in "$@"; do
DATE="$(date '+%Y-%m-%d')"
assert "$DATE" "$VVERSION"
done
diff --git a/aux/workflow/assert-manpages.sh b/aux/workflow/assert-manpages.sh
index 7254d60..a2bd3f9 100755
--- a/aux/workflow/assert-manpages.sh
+++ b/aux/workflow/assert-manpages.sh
@@ -111,7 +111,7 @@ Soumettre un bogue dans la
liste
de diffusion
.ME .
-Utilise le sujèt "\f(CR[$PROJECT] BUG ou TASK:
+Utilise le sujet "\f(CR[$PROJECT] BUG ou TASK:
<description>\fR".
.IP \(bu
Parcourir les bogues
@@ -173,6 +173,10 @@ for f in $(find doc -type f -name '*.[0-9]'); do
continue
fi
+ if [ ! -s "$f" ]; then
+ continue
+ fi
+
lang="$(echo "$f" | cut -d. -f2)"
case "$lang" in
pt)
diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh
index 2e5d978..2a6c3fd 100755
--- a/aux/workflow/assert-readme.sh
+++ b/aux/workflow/assert-readme.sh
@@ -1,8 +1,6 @@
#!/bin/sh
set -eu
-mkdir -p public
-
PROJECT="$1"
MAILING_LIST="$2"
shift
@@ -43,7 +41,7 @@ RELEASES_LIST="$(mktemp)"
add_release() {
DATE="$1"
VVERSION="$2"
- echo "- version [$VVERSION](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz.asc)), released in $DATE" >> "$RELEASES_LIST"
+ echo "- [$VVERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) [$PROJECT-$VVERSION.tar.gz](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz.asc)), released in $DATE" >> "$RELEASES_LIST"
}
for VVERSION in $(git tag); do
@@ -52,8 +50,7 @@ for VVERSION in $(git tag); do
done
# "$@" represents a list of tags to be also included in the verification.
-# shellcheck disable=2068
-for VVERSION in $@; do
+for VVERSION in "$@"; do
if ! git tag | grep -qF "$VVERSION"; then
DATE="$(date '+%Y-%m-%d')"
add_release "$DATE" "$VVERSION"
diff --git a/aux/workflow/assert-spelling.sh b/aux/workflow/assert-spelling.sh
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/aux/workflow/assert-spelling.sh
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh
index 6016f51..7267145 100755
--- a/aux/workflow/commonmark.sh
+++ b/aux/workflow/commonmark.sh
@@ -1,11 +1,10 @@
#!/bin/sh
set -eu
-mkdir -p public
-
PROJECT_UC="$1"
F="$2"
-OUT="${3:-${F%.*}.html}"
+OUTDIR="$3"
+OUT="${4:-${F%.*}.html}"
pandoc \
--toc \
@@ -17,4 +16,4 @@ pandoc \
-r commonmark \
-w html \
-H aux/workflow/favicon.html \
- < "$F" > "public/$OUT"
+ < "$F" > "$OUTDIR/$OUT"
diff --git a/aux/workflow/dist.sh b/aux/workflow/dist.sh
index ee67f24..ed61ee5 100755
--- a/aux/workflow/dist.sh
+++ b/aux/workflow/dist.sh
@@ -33,3 +33,13 @@ fi
git tag "$VVERSION"
sh aux/workflow/sign-tarballs.sh "$PROJECT"
+
+
+cat <<EOF >&2
+Now push the tag and the signature before pushing the commit:
+
+git push origin refs/notes/signatures/tar.gz -o skip-ci --no-verify
+git push --tags -o skip-ci --no-verify
+git push
+
+EOF
diff --git a/aux/workflow/l10n.sh b/aux/workflow/l10n.sh
new file mode 100755
index 0000000..e1fd3bb
--- /dev/null
+++ b/aux/workflow/l10n.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+set -eu
+
+LANGS=
+while getopts 'l:' flag; do
+ case "$flag" in
+ l)
+ LANGS="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+if [ -z "$LANGS" ]; then
+ echo "Missing LANG" >&2
+ exit 2
+fi
+
+end="\033[0m"
+yellow="\033[0;33m"
+manpage() {
+ from_f="$1"
+ for l in $LANGS; do
+ to_f="$(echo "$from_f" | sed "s/\.en\./.$l./")"
+
+ printf 'Generating %s...\n' "$to_f"
+ OUT="$(mktemp)"
+ po4a-updatepo -f man -m "$from_f" -p "doc/po/$l.po"
+ po4a-translate -f man -m "$from_f" -p "doc/po/$l.po" -l "$to_f" -k 0 -v 2>&1 | tee "$OUT" >&2
+
+ if ! grep -qF ' is 100% translated (' "$OUT"; then
+ printf "\n\t${yellow}WARNING${end}!\n Missing translations for %s\n\n" "$to_f" >&2
+ fi
+ done
+}
+
+for f in "$@"; do
+ case "$f" in
+ *.en.[1-9].in)
+ mkdir -p doc/po
+ manpage "$f"
+ ;;
+ *)
+ echo "Unsupported file format: $f" >&2
+ exit 2
+ ;;
+ esac
+done
diff --git a/aux/workflow/manpages.sh b/aux/workflow/manpages.sh
index e4ea8f2..fe215f7 100755
--- a/aux/workflow/manpages.sh
+++ b/aux/workflow/manpages.sh
@@ -1,55 +1,66 @@
#!/bin/sh
set -eu
-LANGS="$1"
-OP="$2"
-PREFIX="${3:-}"
+while getopts 'iuHo:p:' flag; do
+ case "$flag" in
+ i)
+ ACTION=install
+ ;;
+ u)
+ ACTION=uninstall
+ ;;
+ H)
+ ACTION=html
+ ;;
+ o)
+ OUTDIR="$OPTARG"
+ ;;
+ p)
+ MANPREFIX="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
-if [ "$OP" = '--update' ]; then
- for f in doc/*.en.[1-9]; do
- for lang in $LANGS; do
- to="$(echo "$f" | sed "s|\.en\.|.$lang.|")"
- po4a-updatepo -f man -m "$f" -p "doc/$lang.po"
- printf 'Translating %s...\n' "$to" >&2
- OUT="$(po4a-translate -f man -m "$f" -p "doc/$lang.po" -l "$to" -k 0 -v 2>&1)"
- echo "$OUT" >&2
- if ! echo "$OUT" | grep -qF ' is 100% translated ('; then
- printf "\n WARNING!\n Missing translations for %s\n\n" "$to" >&2
- fi
- done
- done
-else
- shift 4 ||: # remove up to '--'
- for f in doc/*.en.[1-9]; do
- n="${f##*.}"
- fileto_name="$(basename "${f%.en.$n}").$n"
- for lang in $LANGS en; do
- filefrom_name="${f%.en.$n}.$lang.$n"
- mandir_name="$PREFIX/$lang/man$n"
- htmldir_name="public/$lang/"
- case "$OP" in
- --install)
- mkdir -p "$mandir_name"
- # shellcheck disable=2068
- $@ < "$filefrom_name" > "$mandir_name/$fileto_name"
- mkdir -p "$PREFIX/man$n"
- ln -fs "../en/man$n/$fileto_name" "$PREFIX/man$n/$fileto_name"
- ;;
- --uninstall)
- rm -f \
- "$PREFIX/$lang/man$n/$fileto_name" \
- "$PREFIX/man$n/$fileto_name"
- ;;
- --html)
- mkdir -p "$htmldir_name"
- # shellcheck disable=2068
- $@ < "$filefrom_name" | pandoc -s -r man -w html > "public/$lang/$fileto_name.html"
- ;;
- *)
- echo "Unsupported operation: $OP"
- exit 2
- ;;
- esac
- done
- done
-fi
+assert() {
+ if [ -z "$1" ]; then
+ echo "Missing $2 argument" >&2
+ exit 2
+ fi
+}
+
+assert "${ACTION:-}" ACTION
+
+for f in "$@"; do
+ l="$(echo "$f" | awk -F. '{print $(NF-1)}')"
+ n="$(echo "$f" | awk -F. '{print $NF}')"
+ case "$ACTION" in
+ html)
+ assert "${OUTDIR:-}" OUTDIR
+ to_name="$(basename "${f%.$l.$n}.$n.html")"
+ mkdir -p "$OUTDIR/$l"
+ pandoc -s -r man -w html --metadata "lang=$l" < "$f" > "$OUTDIR/$l/$to_name"
+ ;;
+ install)
+ assert "${MANPREFIX:-}" MANPREFIX
+ to_name="$(basename "${f%.$l.$n}.$n")"
+ mkdir -p "$MANPREFIX/$l/man$n" "$MANPREFIX/man$n"
+ cp "$f" "$MANPREFIX/$l/man$n/$to_name"
+ ln -fs "../en/man$n/$to_name" "$MANPREFIX/man$n/$to_name"
+ ;;
+ uninstall)
+ assert "${MANPREFIX:-}" MANPREFIX
+ to_name="$(basename "${f%.$l.$n}.$n")"
+ rm -f \
+ "$MANPREFIX/$l/man$n/$to_name" \
+ "$MANPREFIX/man$n/$to_name"
+ ;;
+ *)
+ echo "Bad ACTION: $ACTION"
+ exit 1
+ ;;
+ esac
+done
diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh
index 8ecb855..7433595 100755
--- a/aux/workflow/public.sh
+++ b/aux/workflow/public.sh
@@ -4,14 +4,17 @@ set -eu
PROJECT_UC="$1"
PROJECT="$2"
MAILING_LIST="$3"
+OUTDIR="$4"
-sh aux/workflow/TODOs.sh "$PROJECT_UC" "$PROJECT" "$MAILING_LIST"
-sh aux/workflow/commonmark.sh "$PROJECT" README.md index.html ||:
+mkdir -p "$OUTDIR"
+
+sh aux/workflow/TODOs.sh "$PROJECT_UC" "$PROJECT" "$MAILING_LIST" "$OUTDIR"
+sh aux/workflow/commonmark.sh "$PROJECT" README.md "$OUTDIR" index.html ||:
if [ -f CHANGELOG.md ]; then
- sh aux/workflow/commonmark.sh "$PROJECT" CHANGELOG.md
+ sh aux/workflow/commonmark.sh "$PROJECT" CHANGELOG.md "$OUTDIR"
fi
-sh aux/ci/report.sh "$PROJECT"
+sh aux/ci/report.sh "$PROJECT" "$OUTDIR"
-cp aux/workflow/favicon.* public/
+cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR"