diff options
author | EuAndreh <eu@euandre.org> | 2021-08-15 17:31:16 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-08-15 17:31:16 -0300 |
commit | 651bb5b3fb3a9b36599e1891efb22efb4bf34c3f (patch) | |
tree | efbe3f44dccff3ed8eea651fed57c4ca937c03e9 /aux | |
parent | _articles/2020-11-07-diy-an-offline-bug-tracker-with-text-files-git-and-email... (diff) | |
download | euandre.org-651bb5b3fb3a9b36599e1891efb22efb4bf34c3f.tar.gz euandre.org-651bb5b3fb3a9b36599e1891efb22efb4bf34c3f.tar.xz |
aux/: Update
Diffstat (limited to '')
-rwxr-xr-x | aux/80-columns.sh | 12 | ||||
-rwxr-xr-x | aux/assert-shellcheck.sh | 4 | ||||
-rwxr-xr-x | aux/guix/with-container.sh | 6 | ||||
-rwxr-xr-x | aux/workflow/TODOs.sh | 36 | ||||
-rwxr-xr-x | aux/workflow/assert-changelog.sh | 5 | ||||
-rwxr-xr-x | aux/workflow/assert-readme.sh | 7 | ||||
-rwxr-xr-x | aux/workflow/assert-todos.sh | 3 | ||||
-rwxr-xr-x | aux/workflow/commonmark.sh | 45 | ||||
-rwxr-xr-x | aux/workflow/public.sh | 41 | ||||
-rwxr-xr-x | aux/workflow/sign-tarballs.sh | 15 |
10 files changed, 89 insertions, 85 deletions
diff --git a/aux/80-columns.sh b/aux/80-columns.sh new file mode 100755 index 0000000..ae4660e --- /dev/null +++ b/aux/80-columns.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +# shellcheck disable=2068 +for f in ${@:-$(cat -)}; do + if [ "$(file -i "$f" | cut -d' ' -f2 | cut -d/ -f1)" = 'text' ]; then + sed 's/\t/ /g' "$f" | + awk -v FNAME="$f" 'length > 80 { + printf "%s:%s:%s\n", FNAME, NR, $0 + }' + fi +done diff --git a/aux/assert-shellcheck.sh b/aux/assert-shellcheck.sh index 1779ea8..40fd364 100755 --- a/aux/assert-shellcheck.sh +++ b/aux/assert-shellcheck.sh @@ -1,6 +1,6 @@ #!/bin/sh set -eu -git ls-files | \ - xargs awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | \ +find . -name '*.sh' -print0 | + xargs -0 awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | xargs shellcheck diff --git a/aux/guix/with-container.sh b/aux/guix/with-container.sh index 408fb39..641b455 100755 --- a/aux/guix/with-container.sh +++ b/aux/guix/with-container.sh @@ -7,7 +7,11 @@ if [ -z "${1:-}" ]; then elif [ "$1" = '-p' ]; then guix time-machine --fallback -C aux/guix/pinned-channels.scm -- \ environment --fallback -m aux/guix/manifest.scm --pure -C +elif [ "$1" = '-C' ]; then + guix time-machine --fallback -C aux/guix/pinned-channels.scm -- \ + pack -f docker -S/bin=bin -m aux/guix/manifest.scm else guix time-machine --fallback -C aux/guix/pinned-channels.scm -- \ - environment --fallback -m aux/guix/manifest.scm --pure -C -- sh -c "$@" + environment --fallback -m aux/guix/manifest.scm --pure -C \ + -- sh -c "$@" fi diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh index 96cb064..efc0b04 100755 --- a/aux/workflow/TODOs.sh +++ b/aux/workflow/TODOs.sh @@ -39,21 +39,21 @@ if [ -z "${PROJECT_UC:-}" ]; then PROJECT_UC="$PROJECT" fi -TODOS_ADD_REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE|WONTFIX) (.*) \{#(.*?)\}(.*)$/## <a href="#\3"><span class="\1">\1<\/span> \2<\/a>\4\n<pre class="header-anchor" id="\3">#\3<\/pre>\n/' -TAGS_REGEX='s/tag:([\w-]+)/<span class="tag">\1<\/span>/g' -TODOS_CLEANUP_REGEX1='s/(<a><a)/<a/' -TODOS_CLEANUP_REGEX2='s/<\/a><\/a>/<\/a>/' -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" \ - < aux/workflow/preamble.md | \ - printf \ - '%s\n\n' \ - "$(cat - TODOs.md)" | \ - perl -pe "$TODOS_ADD_REGEX" | \ - perl -pe "$TAGS_REGEX" | \ +# shellcheck disable=1004 +IDS_REGEX='s:^## \(TODO\|DOING\|WAITING\|MEETING\|INACTIVE\|NEXT\|CANCELLED\|DONE\|WONTFIX\) \(.*\) {#\(.*\)}\(.*\)$:## <a href="#\3"><span class="\1">\1</span> \2</a>\4\ +<pre class="header-anchor" id="\3">#\3</pre>\ +:g' +TAGS_REGEX='s|tag:\([a-z0-9-]*\)|<span class="tag">\1</span>|g' + +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" | pandoc \ --toc \ --highlight-style pygments \ @@ -64,8 +64,8 @@ sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \ -r commonmark \ -w html \ -H aux/workflow/favicon.html \ - -H aux/workflow/style.css \ - | \ - perl -pe "$TODOS_CLEANUP_REGEX1" | \ - perl -pe "$TODOS_CLEANUP_REGEX2" \ + -H aux/workflow/style.css | + sed \ + -e 's:<a><a:<a:g' \ + -e 's:</a></a>:</a>:g' \ > "$OUTDIR/TODOs.html" diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh index 7f9117f..ca86407 100755 --- a/aux/workflow/assert-changelog.sh +++ b/aux/workflow/assert-changelog.sh @@ -43,8 +43,9 @@ 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 diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh index 843fd86..dbe657e 100755 --- a/aux/workflow/assert-readme.sh +++ b/aux/workflow/assert-readme.sh @@ -44,7 +44,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 @@ -89,7 +90,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-todos.sh b/aux/workflow/assert-todos.sh index dfa1ab7..c21ebb9 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 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/commonmark.sh b/aux/workflow/commonmark.sh index b196867..6f5e59b 100755 --- a/aux/workflow/commonmark.sh +++ b/aux/workflow/commonmark.sh @@ -1,21 +1,15 @@ #!/bin/sh set -eu -while getopts 'N:o:r:w:L:' flag; do +while getopts 'N:t:l:' flag; do case "$flag" in N) PROJECT_UC="$OPTARG" ;; - o) - OUTDIR="$OPTARG" + t) + TITLE="$OPTARG" ;; - r) - IN_FILE="$OPTARG" - ;; - w) - OUT_FILE="$OPTARG" - ;; - L) + l) THE_LANG="$OPTARG" ;; *) @@ -33,25 +27,16 @@ assert_arg() { } assert_arg "${PROJECT_UC:-}" '-N PROJECT_UC' -assert_arg "${OUTDIR:-}" '-o OUTDIR' -assert_arg "${IN_FILE:-}" '-i IN_FILE' -assert_arg "${THE_LANG:-}" '-L THE_LANG' - -if [ -z "${OUT_FILE:-}" ]; then - OUT_FILE="${IN_FILE%.md}.html" -fi - -OUT="$OUTDIR/$OUT_FILE" -mkdir -p "$(dirname "$OUT")" +assert_arg "${TITLE:-}" '-t TITLE' +assert_arg "${THE_LANG:-}" '-l THE_LANG' pandoc \ - --toc \ - --highlight-style pygments \ - --toc-depth=2 \ - -s \ - --metadata title="$PROJECT_UC - ${IN_FILE%%.*}" \ - --metadata "lang=$THE_LANG" \ - -r commonmark \ - -w html \ - -H aux/workflow/favicon.html \ - < "$IN_FILE" > "$OUT" + --toc \ + --highlight-style pygments \ + --toc-depth=2 \ + -s \ + --metadata title="$PROJECT_UC - $TITLE" \ + --metadata "lang=$THE_LANG" \ + -r commonmark \ + -w html \ + -H aux/workflow/favicon.html diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh index be32ac1..07be9d4 100755 --- a/aux/workflow/public.sh +++ b/aux/workflow/public.sh @@ -33,30 +33,27 @@ assert_arg() { fi } -assert_arg "${PROJECT:-}" '-n PROJECT' -assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' -assert_arg "${OUTDIR:-}" '-o OUTDIR' - -if [ -z "${PROJECT_UC:-}" ]; then - PROJECT_UC="$PROJECT" -fi +assert_arg "${PROJECT:-}" '-n PROJECT' +assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' +assert_arg "${OUTDIR:-}" '-o OUTDIR' +assert_arg "${LANGS:-}" '-l LANGS' +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/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r README.md -w index.html -Len -if [ -f CHANGELOG.md ]; then - sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r CHANGELOG.md -Len -fi -if [ -n "${LANGS:-}" ]; then - for lang in $LANGS; do - sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r "README.$lang.md" -w "$lang/index.html" -L "$lang" - if [ -f CHANGELOG.md ]; then - sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r "CHANGELOG.$lang.md" -w "$lang/CHANGELOG.html" -L "$lang" - fi - done -fi +sh aux/workflow/TODOs.sh \ + -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR" -sh aux/ci/report.sh -n "$PROJECT" -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" +done + +ln -fs en/index.html "$OUTDIR/index.html" cp aux/workflow/favicon.svg aux/workflow/favicon.png "$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 168d38d..3ab2bb8 100755 --- a/aux/workflow/sign-tarballs.sh +++ b/aux/workflow/sign-tarballs.sh @@ -26,12 +26,13 @@ assert_arg "${PROJECT:-}" '-n PROJECT' 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.gz add -f -C "$( - git archive --format tar.gz --prefix "$PROJECT-${tag#v}/" "$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 |