aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-09-01 11:18:01 -0300
committerEuAndreh <eu@euandre.org>2021-09-01 11:18:01 -0300
commit692185136a6d7e96660b90370759d1f83a05ec4c (patch)
tree34852b497fd9054ab55ff27045efd4a19dd9f331 /aux/workflow
parentsrc/remembering.c: Enforce C style (diff)
downloadremembering-692185136a6d7e96660b90370759d1f83a05ec4c.tar.gz
remembering-692185136a6d7e96660b90370759d1f83a05ec4c.tar.xz
aux/: Update
Diffstat (limited to 'aux/workflow')
-rwxr-xr-xaux/workflow/TODOs.sh6
-rwxr-xr-xaux/workflow/assert-changelog.sh15
-rwxr-xr-xaux/workflow/assert-manpages.sh3
-rwxr-xr-xaux/workflow/assert-readme.sh13
-rwxr-xr-xaux/workflow/assert-spelling.sh29
-rwxr-xr-xaux/workflow/assert-todos.sh3
-rwxr-xr-xaux/workflow/dist.sh29
-rwxr-xr-xaux/workflow/l10n.sh24
-rwxr-xr-xaux/workflow/public.sh14
-rwxr-xr-xaux/workflow/sign-tarballs.sh17
10 files changed, 101 insertions, 52 deletions
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh
index d875e0e..efc0b04 100755
--- a/aux/workflow/TODOs.sh
+++ b/aux/workflow/TODOs.sh
@@ -46,14 +46,14 @@ IDS_REGEX='s:^## \(TODO\|DOING\|WAITING\|MEETING\|INACTIVE\|NEXT\|CANCELLED\|DON
:g'
TAGS_REGEX='s|tag:\([a-z0-9-]*\)|<span class="tag">\1</span>|g'
-cat aux/workflow/preamble.md TODOs.md | \
+cat aux/workflow/preamble.md TODOs.md |
sed \
-e "s:@PROJECT_UC@:$PROJECT_UC:g" \
-e "s:@PROJECT@:$PROJECT:g" \
-e "s:@MAILING_LIST@:$MAILING_LIST:g" \
-e "s:@TLD@:$TLD:g" \
-e "$IDS_REGEX" \
- -e "$TAGS_REGEX" | \
+ -e "$TAGS_REGEX" |
pandoc \
--toc \
--highlight-style pygments \
@@ -64,7 +64,7 @@ cat aux/workflow/preamble.md TODOs.md | \
-r commonmark \
-w html \
-H aux/workflow/favicon.html \
- -H aux/workflow/style.css | \
+ -H aux/workflow/style.css |
sed \
-e 's:<a><a:<a:g' \
-e 's:</a></a>:</a>:g' \
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh
index 7f9117f..4acc81b 100755
--- a/aux/workflow/assert-changelog.sh
+++ b/aux/workflow/assert-changelog.sh
@@ -43,18 +43,21 @@ assert() {
DATE="$1"
VVERSION="$2"
VERSION="${2#v}"
- CHANGELOG_ENTRY="# [$VERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) - $DATE"
-
+ CHANGELOG_ENTRY="$(printf \
+ '# [%s](https://git.euandreh.xyz/%s/commit/?id=%s) - %s' \
+ "$VERSION" "$PROJECT" "$VVERSION" "$DATE")"
if ! grep -qF "$CHANGELOG_ENTRY" CHANGELOG.md; then
echo "Missing '$CHANGELOG_ENTRY' entry from CHANGELOG.md" >&2
exit 1
fi
}
-for VVERSION in $(git tag); do
- DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
- assert "$DATE" "$VVERSION"
-done
+if [ -e .git ]; then
+ for VVERSION in $(git tag); do
+ DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
+ assert "$DATE" "$VVERSION"
+ done
+fi
# "$@" represents a list of tags to be also included in the verification.
for VVERSION in "$@"; do
diff --git a/aux/workflow/assert-manpages.sh b/aux/workflow/assert-manpages.sh
index b26c7a4..f9a6807 100755
--- a/aux/workflow/assert-manpages.sh
+++ b/aux/workflow/assert-manpages.sh
@@ -207,7 +207,8 @@ for from_f in "$@"; do
esac
f="$(echo "$from_f" | sed "s/\.en\./.$lang./")"
- if ! tail -n "$(wc -l < "$EXPECTED")" "$f" | diff - "$EXPECTED"; then
+ if ! tail -n "$(wc -l < "$EXPECTED")" "$f" |
+ diff - "$EXPECTED"; then
echo "Missing metadata at the end of \"$f\" file"
if [ "$IN_PLACE" = true ]; then
cat "$EXPECTED" >> "$f"
diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh
index 333a753..1e49bfb 100755
--- a/aux/workflow/assert-readme.sh
+++ b/aux/workflow/assert-readme.sh
@@ -1,6 +1,10 @@
#!/bin/sh
set -eu
+if [ ! -e .git ]; then
+ exit
+fi
+
TLD="$(cat aux/tld.txt)"
. aux/lib.sh
@@ -44,7 +48,8 @@ and for generating the documentation HTML and website, run:
$ make public
\`\`\`
-Send contributions to the [mailing list] via [\`git send-email\`](https://git-send-email.io/).
+Send contributions to the [mailing list] via
+[\`git send-email\`](https://git-send-email.io/).
## Links
@@ -63,7 +68,7 @@ RELEASES_LIST="$(mkstemp)"
add_release() {
DATE="$1"
VVERSION="$2"
- echo "- [$VVERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) [$PROJECT-$VVERSION.tar.xz](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.xz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.xz.asc)) - $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)) - $DATE" >> "$RELEASES_LIST"
}
for VVERSION in $(git tag); do
@@ -89,7 +94,9 @@ cat <<EOF >> "$EXPECTED"
## License
-The code is licensed under [GNU Affero General Public License v3.0 or later][AGPL-3.0-or-later] (AGPL-3.0-or-later).
+The code is licensed under
+[GNU Affero General Public License v3.0 or later][AGPL-3.0-or-later]
+(AGPL-3.0-or-later).
[AGPL-3.0-or-later]: https://git.euandreh.xyz/$PROJECT/tree/COPYING
EOF
diff --git a/aux/workflow/assert-spelling.sh b/aux/workflow/assert-spelling.sh
index f1eef6f..853fd5e 100755
--- a/aux/workflow/assert-spelling.sh
+++ b/aux/workflow/assert-spelling.sh
@@ -5,16 +5,18 @@ set -eu
sort_dicts() {
for f in po/spelling/*.txt; do
- if ! LANG=POSIX sort "$f" | diff - "$f"; then
- if [ "$IN_PLACE" = true ]; then
- OUT="$(mkstemp)"
- LANG=POSIX sort "$f" | uniq > "$OUT"
- mv "$OUT" "$f"
- else
- echo "The $f dictionary is unsorted. To fix it, run:" >&2
- echo " sh aux/workflow/assert-spelling.sh -i" >&2
- exit 1
- fi
+ if LANG=POSIX sort "$f" | diff - "$f"; then
+ echo continue
+ fi
+ if [ "$IN_PLACE" = true ]; then
+ OUT="$(mkstemp)"
+ LANG=POSIX sort "$f" | uniq > "$OUT"
+ mv "$OUT" "$f"
+ else
+ printf 'The %s dictionary is unsorted.' "$f" >&2
+ printf " To fix it, run:\n" >&2
+ printf " sh aux/workflow/assert-spelling.sh -i" >&2
+ exit 1
fi
done
}
@@ -50,8 +52,8 @@ mkdir -p po/spelling
eval "touch po/spelling/{international,$(echo "$LANGS" | tr ' ' ,)}.txt"
get_lang() {
- grep lang=.. "$1" | \
- head -n1 | \
+ grep lang=.. "$1" |
+ head -n1 |
awk '
match($0, /lang="(..)"/) {
print substr($0, RSTART+length("lang=\""), 2)
@@ -63,7 +65,8 @@ ACC="$(mkstemp)"
for f in "$@"; do
l="$(get_lang "$f")"
CURR_DICT="$(mkstemp)"
- cat po/spelling/international.txt "po/spelling/$l.txt" | sort | uniq > "$CURR_DICT"
+ cat po/spelling/international.txt "po/spelling/$l.txt" |
+ sort | uniq > "$CURR_DICT"
hunspell -u3 -H -d "$l" -p "$CURR_DICT" "$f" | tee -a "$ACC" >&2
done
diff --git a/aux/workflow/assert-todos.sh b/aux/workflow/assert-todos.sh
index dfa1ab7..bc4907d 100755
--- a/aux/workflow/assert-todos.sh
+++ b/aux/workflow/assert-todos.sh
@@ -1,7 +1,8 @@
#!/bin/sh
set -eu
-if git grep FIXME | grep -v '^TODOs.md' | grep -v '^aux/workflow/assert-todos.sh'; then
+if [ -e .git ] && git grep FIXME | grep -v '^TODOs.md' |
+ grep -v '^aux/workflow/assert-todos.sh'; then
echo "Found dangling FIXME markers on the project."
echo "You should write them down properly on TODOs.md."
exit 1
diff --git a/aux/workflow/dist.sh b/aux/workflow/dist.sh
index 15593f4..a433478 100755
--- a/aux/workflow/dist.sh
+++ b/aux/workflow/dist.sh
@@ -42,13 +42,21 @@ if [ -z "${PROJECT_UC:-}" ]; then
PROJECT_UC="$PROJECT"
fi
+
+if [ "$(git rev-parse --abbrev-ref HEAD)" != 'main' ]; then
+ echo 'Not on branch "main".' >&2
+ exit 1
+fi
+
if git show "$VVERSION" 1>/dev/null 2>/dev/null; then
echo "Version '$VVERSION' already exists." >&2
exit 1
fi
-sh aux/workflow/assert-changelog.sh -N "$PROJECT_UC" -n "$PROJECT" "$VVERSION"
-sh aux/workflow/assert-readme.sh -n "$PROJECT" -m "$MAILING_LIST" "$VVERSION"
+if ! printf '%s\n%s\n' "$(git tag)" "$VVERSION" | sort -nct. -k1 -k2 -k3; then
+ echo 'New tag is not bigger than existing ones.' >&2
+ exit 1
+fi
if [ "$DATE" != "$(git log -1 --format=%cd --date=short HEAD)" ]; then
echo "Date '$DATE' is not up-to-date." >&2
@@ -60,21 +68,32 @@ if [ "Release $VVERSION" != "$(git log --format=%B -1 HEAD | head -n1)" ]; then
exit 1
fi
+make clean public dev-check EXTRA_VERSION="$VVERSION"
+
if ! (git diff --quiet && git diff --quiet --staged); then
echo 'Dirty repository.'
exit 1
fi
-git tag "$VVERSION"
+git tag "$VVERSION"
sh aux/workflow/sign-tarballs.sh -n "$PROJECT"
-cat <<EOF >&2
+printf 'Publish version? [Y/n]: ' >&2
+read -r publish
+
+if [ "$publish" = 'n' ]; then
+ cat <<EOF >&2
Now push the tag and the signature before pushing the commit:
-git push origin refs/notes/signatures/tar.xz -o skip-ci --no-verify
+git push origin refs/notes/signatures/tar.gz -o skip-ci --no-verify
git push --tags -o skip-ci --no-verify
git push
EOF
+else
+ git push origin refs/notes/signatures/tar.gz -o skip-ci --no-verify
+ git push --tags -o skip-ci --no-verify
+ git push
+fi
diff --git a/aux/workflow/l10n.sh b/aux/workflow/l10n.sh
index 66e452a..cf687aa 100755
--- a/aux/workflow/l10n.sh
+++ b/aux/workflow/l10n.sh
@@ -29,19 +29,27 @@ assert_arg "${LANGS:-}" '-l LANGS'
for from_f in "$@"; do
for lang in $LANGS ${CONTRIBLANGS:-}; do
to_f="$(echo "$from_f" | sed "s/\.en\./.$lang./")"
- printf 'Generating %s...\n' "$to_f"
+ printf 'Generating %s...\n' "$to_f" >&2
pofile="po/LC_MESSAGES/$from_f/$lang.po"
mkdir -p "$(dirname "$pofile")"
case "$from_f" in
*.en.[1-9].in)
po4a-updatepo -f man -m "$from_f" -p "$pofile"
- po4a-translate -f man -m "$from_f" -p "$pofile" -l "$to_f" -k 0 -v >&2
+ po4a-translate -f man -m "$from_f" \
+ -p "$pofile" -l "$to_f" -k 0 -v >&2
+ ;;
+ *.en.html)
+ po4a-updatepo -f xhtml -m "$from_f" -p "$pofile"
+ po4a-translate -f xhtml -m "$from_f" \
+ -p "$pofile" -l "$to_f" -k 0 -v >&2
;;
*.en.md)
touch "$pofile"
- md2po --include-codeblocks --quiet --save --po-filepath "$pofile" < "$from_f"
- po2md --pofiles "$pofile" --quiet --save "$to_f" --wrapwidth 999 < "$from_f"
+ md2po --include-codeblocks --quiet --save \
+ --po-filepath "$pofile" < "$from_f"
+ po2md --pofiles "$pofile" --save "$to_f" \
+ --quiet --wrapwidth 999 < "$from_f"
;;
*)
echo "Unsupported file format: $from_f" >&2
@@ -56,8 +64,12 @@ yellowb="\033[1;33m"
for lang in $LANGS; do
# shellcheck disable=2044
for pofile in $(find po/ -type f -name "$lang.po"); do
- if LANG=POSIX msgfmt --statistics "$pofile" 2>&1 | grep untranslated; then
- printf "\n\t${yellowb}WARNING${end}!\n Missing translations for %s\n\n" "$pofile" >&2
+ if ! LANG=POSIX msgfmt --statistics "$pofile" 2>&1 |
+ grep untranslated; then
+ continue
fi
+ # shellcheck disable=2059
+ printf "\n ${yellowb}WARNING${end}!" >&2
+ printf "\n Missing translations for %s\n\n" "$pofile" >&2
done
done
diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh
index f9f3b3d..38613de 100755
--- a/aux/workflow/public.sh
+++ b/aux/workflow/public.sh
@@ -41,17 +41,19 @@ PROJECT_UC="${PROJECT_UC:-$PROJECT}"
mkdir -p "$OUTDIR"
-sh aux/workflow/TODOs.sh -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR"
+sh aux/workflow/TODOs.sh \
+ -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR"
for lang in $LANGS; do
mkdir -p "$OUTDIR/$lang/"
- sh aux/workflow/commonmark.sh -N "$PROJECT" -t README -l "$lang" < "README.$lang.md" > "$OUTDIR/$lang/index.html"
- sh aux/workflow/commonmark.sh -N "$PROJECT" -t CHANGELOG -l "$lang" < "CHANGELOG.$lang.md" > "$OUTDIR/$lang/CHANGELOG.html"
- cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR/$lang"
+ sh aux/workflow/commonmark.sh -N "$PROJECT" -t README -l "$lang" \
+ < "README.$lang.md" > "$OUTDIR/$lang/index.html"
+ sh aux/workflow/commonmark.sh -N "$PROJECT" -t CHANGELOG -l "$lang" \
+ < "CHANGELOG.$lang.md" > "$OUTDIR/$lang/CHANGELOG.html"
+ ln -fs ../favicon.svg "$OUTDIR/$lang"
done
ln -fs en/index.html "$OUTDIR/index.html"
-ln -fs en/CHANGELOG.html "$OUTDIR/CHANGELOG.html"
-cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR"
+cp aux/workflow/favicon.svg "$OUTDIR"
sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR"
diff --git a/aux/workflow/sign-tarballs.sh b/aux/workflow/sign-tarballs.sh
index 3775e28..3ab2bb8 100755
--- a/aux/workflow/sign-tarballs.sh
+++ b/aux/workflow/sign-tarballs.sh
@@ -23,15 +23,16 @@ assert_arg() {
assert_arg "${PROJECT:-}" '-n PROJECT'
-SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.xz list | cut -d\ -f2)"
+SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.gz list | cut -d\ -f2)"
for tag in $(git tag); do
COMMIT="$(git rev-list -n1 "$tag")"
- if ! echo "$SIGNATURES" | grep -qF "$COMMIT"; then
- echo "Adding missing signature to $tag" >&2
- git notes --ref=refs/notes/signatures/tar.xz add -C "$(
- git archive --format tar.xz --prefix "$PROJECT-$tag/" "$tag" |
- gpg --output - --armor --detach-sign |
- git hash-object -w --stdin
- )" "$tag"
+ if echo "$SIGNATURES" | grep -qF "$COMMIT"; then
+ continue
fi
+ echo "Adding missing signature to $tag" >&2
+ git notes --ref=refs/notes/signatures/tar.gz add -C "$(
+ git archive --format tar.gz --prefix "$PROJECT-$tag/" "$tag" |
+ gpg --output - --armor --detach-sign |
+ git hash-object -w --stdin
+ )" "$tag"
done