diff options
author | EuAndreh <eu@euandre.org> | 2021-07-27 11:31:02 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-07-27 11:58:44 -0300 |
commit | 9e84b309cd0807ff029660d2f42a2397334efb2b (patch) | |
tree | d10f193190726891ff739ecb6655359166947bb5 | |
parent | TODOs.md: Add #task-1f103822-c865-254c-f6b6-4968f2fb473e (diff) | |
download | git-permalink-9e84b309cd0807ff029660d2f42a2397334efb2b.tar.gz git-permalink-9e84b309cd0807ff029660d2f42a2397334efb2b.tar.xz |
aux/: Stick to 80 columns
-rw-r--r-- | README.md | 7 | ||||
-rwxr-xr-x | aux/80-columns.sh | 11 | ||||
-rwxr-xr-x | aux/ci/ci-build.sh | 6 | ||||
-rwxr-xr-x | aux/ci/git-post-receive.sh | 3 | ||||
-rwxr-xr-x | aux/ci/report.sh | 11 | ||||
-rw-r--r-- | aux/guix/pinned-channels.scm | 2 | ||||
-rwxr-xr-x | aux/guix/with-container.sh | 3 | ||||
-rwxr-xr-x | aux/workflow/assert-changelog.sh | 5 | ||||
-rwxr-xr-x | aux/workflow/assert-manpages.sh | 3 | ||||
-rwxr-xr-x | aux/workflow/assert-readme.sh | 7 | ||||
-rwxr-xr-x | aux/workflow/assert-spelling.sh | 25 | ||||
-rwxr-xr-x | aux/workflow/assert-todos.sh | 3 | ||||
-rwxr-xr-x | aux/workflow/installcheck.sh | 3 | ||||
-rwxr-xr-x | aux/workflow/l10n.sh | 17 | ||||
-rwxr-xr-x | aux/workflow/manpages.sh | 6 | ||||
-rwxr-xr-x | aux/workflow/public.sh | 9 | ||||
-rwxr-xr-x | aux/workflow/sign-tarballs.sh | 15 |
17 files changed, 87 insertions, 49 deletions
@@ -107,7 +107,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 @@ -133,6 +134,8 @@ Send contributions to the [mailing list] via [`git send-email`](https://git-send ## 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/git-permalink/tree/COPYING diff --git a/aux/80-columns.sh b/aux/80-columns.sh index 02a8e81..ae4660e 100755 --- a/aux/80-columns.sh +++ b/aux/80-columns.sh @@ -1,9 +1,12 @@ #!/bin/sh set -eu +# shellcheck disable=2068 for f in ${@:-$(cat -)}; do - sed 's/\t/ /g' "$f" | - awk -v FNAME="$f" 'length > 80 { - printf "%s:%s:%s\n", FNAME, NR, $0 - }' + 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/ci/ci-build.sh b/aux/ci/ci-build.sh index 17e9e37..396fbff 100755 --- a/aux/ci/ci-build.sh +++ b/aux/ci/ci-build.sh @@ -8,7 +8,8 @@ FILENAME="$(date -Is)-$SHA.log" LOGFILE="$LOGS_DIR/$FILENAME" mkdtemp() { - name="$(echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" + name="$(echo 'mkstemp(template)' | + m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" rm -f "$name" mkdir "$name" echo "$name" @@ -37,7 +38,8 @@ EOF sh aux/ci/report.sh -n "$PROJECT" -o public rsync -av public/ "/srv/http/$PROJECT/" --delete - printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s\n\n" "$STATUS" + printf "\n>>>\n>>> CI logs added as Git note." + printf "\n>>>\n>>> Run status was %s\n\n" "$STATUS" } trap finish EXIT diff --git a/aux/ci/git-post-receive.sh b/aux/ci/git-post-receive.sh index 426bff3..92bba73 100755 --- a/aux/ci/git-post-receive.sh +++ b/aux/ci/git-post-receive.sh @@ -4,7 +4,8 @@ set -eu for n in $(seq 0 $((GIT_PUSH_OPTION_COUNT - 1))); do opt="$(eval "echo \$GIT_PUSH_OPTION_$n")" if [ "$opt" = skip-ci ] || [ "$opt" = ci-skip ]; then - printf "\n'%s' option detected, not running ci-build.sh\n\n" "$opt" + printf "\n'%s' option detected, not running ci-build.sh\n\n" \ + "$opt" exit 0 fi done diff --git a/aux/ci/report.sh b/aux/ci/report.sh index 1aa41a0..7fa3d08 100755 --- a/aux/ci/report.sh +++ b/aux/ci/report.sh @@ -41,7 +41,8 @@ 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" > "$OUTDIR/ci-data/$FILENAME" - git notes --ref=refs/notes/ci-logs show "$c" > "$OUTDIR/ci-logs/$FILENAME" + git notes --ref=refs/notes/ci-logs show "$c" \ + > "$OUTDIR/ci-logs/$FILENAME" done cat <<EOF >> "$OUT" @@ -49,7 +50,8 @@ cat <<EOF >> "$OUT" <html lang="en"> <head> <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="viewport" + content="width=device-width, initial-scale=1" /> <link rel="icon" type="image/svg+xml" href="favicon.svg" /> <title>CI logs for $PROJECT</title> @@ -61,7 +63,10 @@ cat <<EOF >> "$OUT" </head> <body> <h1> - CI logs for <a href="https://$TLD/$PROJECT/en/">$PROJECT</a> + CI logs for + <a href="https://$TLD/$PROJECT/en/"> + $PROJECT + </a> </h1> <ul> EOF diff --git a/aux/guix/pinned-channels.scm b/aux/guix/pinned-channels.scm index 504406f..f5c039a 100644 --- a/aux/guix/pinned-channels.scm +++ b/aux/guix/pinned-channels.scm @@ -1,7 +1,7 @@ (cons* (channel (name 'xyz-euandreh) - (url "git://euandreh.xyz/package-repository") + (url "git://euandreh.xyz/package-repository.git") (branch "main") (introduction (make-channel-introduction diff --git a/aux/guix/with-container.sh b/aux/guix/with-container.sh index 408fb39..71e13e0 100755 --- a/aux/guix/with-container.sh +++ b/aux/guix/with-container.sh @@ -9,5 +9,6 @@ elif [ "$1" = '-p' ]; then environment --fallback -m aux/guix/manifest.scm --pure -C 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/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-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..6635832 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-spelling.sh b/aux/workflow/assert-spelling.sh index f1eef6f..9418dc2 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 } @@ -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..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/installcheck.sh b/aux/workflow/installcheck.sh index e28f5d1..0aae391 100755 --- a/aux/workflow/installcheck.sh +++ b/aux/workflow/installcheck.sh @@ -28,7 +28,8 @@ shift $((OPTIND - 1)) if [ -n "${UNINSTALL:-}" ]; then if [ "$(find "$PREFIX" -type f | wc -l)" != 0 ]; then - printf 'When uninstalling, left over files in the PREFIX directory:\n' + printf 'When uninstalling, left over files in the' + printf 'PREFIX directory:\n' find "$PREFIX" -type f exit 1 fi diff --git a/aux/workflow/l10n.sh b/aux/workflow/l10n.sh index 66e452a..683758f 100755 --- a/aux/workflow/l10n.sh +++ b/aux/workflow/l10n.sh @@ -36,12 +36,15 @@ for from_f in "$@"; do 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.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 +59,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/manpages.sh b/aux/workflow/manpages.sh index d0d19ae..5c83a37 100755 --- a/aux/workflow/manpages.sh +++ b/aux/workflow/manpages.sh @@ -42,14 +42,16 @@ for f in "$@"; do assert_arg "${OUTDIR:-}" '-o 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" + pandoc -s -r man -w html --metadata "lang=$l" \ + < "$f" > "$OUTDIR/$l/$to_name" ;; install) assert_arg "${MANPREFIX:-}" '-p 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" + ln -fs "../en/man$n/$to_name" \ + "$MANPREFIX/man$n/$to_name" ;; uninstall) assert_arg "${MANPREFIX:-}" '-p MANPREFIX' diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh index f9f3b3d..2276ed3 100755 --- a/aux/workflow/public.sh +++ b/aux/workflow/public.sh @@ -41,12 +41,15 @@ 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" + 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 diff --git a/aux/workflow/sign-tarballs.sh b/aux/workflow/sign-tarballs.sh index 3775e28..295619c 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.xz 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.xz add -C "$( + git archive --format tar.xz --prefix "$PROJECT-$tag/" "$tag" | + gpg --output - --armor --detach-sign | + git hash-object -w --stdin + )" "$tag" done |