aboutsummaryrefslogtreecommitdiff
path: root/aux
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
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 'aux')
-rwxr-xr-xaux/assert-shellcheck.sh2
-rwxr-xr-xaux/ci/ci-build.sh6
-rwxr-xr-xaux/ci/git-post-receive.sh6
-rwxr-xr-xaux/ci/git-pre-push.sh6
-rwxr-xr-xaux/ci/report.sh11
-rwxr-xr-xaux/guix/with-container.sh2
-rwxr-xr-xaux/tests-lib.sh8
-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
17 files changed, 168 insertions, 87 deletions
diff --git a/aux/assert-shellcheck.sh b/aux/assert-shellcheck.sh
index cc01f3a..1779ea8 100755
--- a/aux/assert-shellcheck.sh
+++ b/aux/assert-shellcheck.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-set -eux
+set -eu
git ls-files | \
xargs awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | \
diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh
index 60af813..7fa3382 100755
--- a/aux/ci/ci-build.sh
+++ b/aux/ci/ci-build.sh
@@ -1,7 +1,7 @@
#!/bin/sh
set -eux
-PACKAGE="$1"
+PROJECT="$1"
LOGS_DIR="$2"
read -r _ SHA _ # oldrev newrev refname
FILENAME="$(date -Is)-$SHA.log"
@@ -26,8 +26,8 @@ EOF
git notes append -m "$NOTE"
cd -
- sh aux/ci/report.sh "$PACKAGE"
- rsync -av public/ "/srv/http/$PACKAGE/" --delete
+ sh aux/ci/report.sh "$PROJECT" public
+ rsync -av public/ "/srv/http/$PROJECT/" --delete
printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s" "$STATUS"
}
diff --git a/aux/ci/git-post-receive.sh b/aux/ci/git-post-receive.sh
index ee8075f..167ac4a 100755
--- a/aux/ci/git-post-receive.sh
+++ b/aux/ci/git-post-receive.sh
@@ -9,6 +9,6 @@ for n in $(seq 0 $((GIT_PUSH_OPTION_COUNT - 1))); do
fi
done
-PACKAGE="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix
-LOGS_DIR="/opt/ci/$PACKAGE/logs"
-"/opt/ci/$PACKAGE/ci-build.sh" "$PACKAGE" "$LOGS_DIR"
+PROJECT="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix
+LOGS_DIR="/opt/ci/$PROJECT/logs"
+"/opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR"
diff --git a/aux/ci/git-pre-push.sh b/aux/ci/git-pre-push.sh
index e73b9b8..cccd6e5 100755
--- a/aux/ci/git-pre-push.sh
+++ b/aux/ci/git-pre-push.sh
@@ -3,9 +3,9 @@ set -eux
TLD="$(cat aux/tld.txt)"
-PACKAGE="$(basename "$PWD")"
-LOGS_DIR="/opt/ci/$PACKAGE/logs"
-REMOTE_GIT_DIR="/srv/git/$PACKAGE.git"
+PROJECT="$(basename "$PWD")"
+LOGS_DIR="/opt/ci/$PROJECT/logs"
+REMOTE_GIT_DIR="/srv/git/$PROJECT.git"
DESCRIPTION="$(mktemp)"
if [ -f description ]
diff --git a/aux/ci/report.sh b/aux/ci/report.sh
index e71e1ac..c873f54 100755
--- a/aux/ci/report.sh
+++ b/aux/ci/report.sh
@@ -2,12 +2,13 @@
set -eu
PROJECT="$1"
+OUTDIR="$2"
TLD="$(cat aux/tld.txt)"
PASS='✅'
FAIL='❌'
-mkdir -p public/ci-logs public/ci-data
+mkdir -p "$OUTDIR/ci-logs" "$OUTDIR/ci-data"
OUT="$(mktemp)"
chmod 644 "$OUT"
@@ -20,8 +21,8 @@ wait
for c in $(git notes list | cut -d\ -f2); do
DATA="$(git notes --ref=refs/notes/ci-data show "$c")"
FILENAME="$(echo "$DATA" | cut -d\ -f2)"
- echo "$DATA" > "public/ci-data/$FILENAME"
- git notes --ref=refs/notes/ci-logs show "$c" > "public/ci-logs/$FILENAME"
+ echo "$DATA" > "$OUTDIR/ci-data/$FILENAME"
+ git notes --ref=refs/notes/ci-logs show "$c" > "$OUTDIR/ci-logs/$FILENAME"
done
cat <<EOF >> "$OUT"
@@ -46,7 +47,7 @@ cat <<EOF >> "$OUT"
<ul>
EOF
-for f in $(find public/ci-data/ -type f | LANG=C.UTF-8 sort -r); do
+for f in $(find "$OUTDIR/ci-data/" -type f | LANG=C.UTF-8 sort -r); do
DATA="$(cat "$f")"
STATUS="$(echo "$DATA" | cut -d\ -f1)"
FILENAME="$(echo "$DATA" | cut -d\ -f2)"
@@ -72,4 +73,4 @@ cat <<EOF >> "$OUT"
</html>
EOF
-mv "$OUT" public/ci.html
+mv "$OUT" "$OUTDIR/ci.html"
diff --git a/aux/guix/with-container.sh b/aux/guix/with-container.sh
index b521c82..408fb39 100755
--- a/aux/guix/with-container.sh
+++ b/aux/guix/with-container.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-set -eux
+set -eu
if [ -z "${1:-}" ]; then
guix time-machine --fallback -C aux/guix/pinned-channels.scm -- \
diff --git a/aux/tests-lib.sh b/aux/tests-lib.sh
index 0be4e6f..007282a 100755
--- a/aux/tests-lib.sh
+++ b/aux/tests-lib.sh
@@ -102,3 +102,11 @@ test_ok() {
# shellcheck disable=2059
printf " ${green}OK${end}.\n" >&2
}
+
+uuid() {
+ # Taken from:
+ # https://serverfault.com/a/799198
+ od -xN20 /dev/urandom | \
+ head -1 | \
+ awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}'
+}
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"