aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rwxr-xr-xaux/ci/ci-build.sh2
-rwxr-xr-xaux/ci/report.sh26
-rwxr-xr-xaux/workflow/TODOs.sh40
-rwxr-xr-xaux/workflow/assert-changelog.sh32
-rwxr-xr-xaux/workflow/assert-readme.sh28
-rwxr-xr-xaux/workflow/commonmark.sh66
-rwxr-xr-xaux/workflow/dist.sh51
-rwxr-xr-xaux/workflow/public.sh60
-rwxr-xr-xaux/workflow/sign-tarballs.sh22
10 files changed, 283 insertions, 50 deletions
diff --git a/Makefile b/Makefile
index 3b647ae..3b0bad7 100644
--- a/Makefile
+++ b/Makefile
@@ -21,8 +21,8 @@ dev-check: check
sh aux/assert-nixfmt.sh
sh aux/assert-shellcheck.sh
sh aux/workflow/assert-todos.sh
- sh aux/workflow/assert-changelog.sh $(NAME) $(NAME)
- sh aux/workflow/assert-readme.sh $(NAME) $(MAILING_LIST)
+ sh aux/workflow/assert-changelog.sh -n $(NAME)
+ sh aux/workflow/assert-readme.sh -n $(NAME) -m $(MAILING_LIST)
clean:
rm -rf public/
@@ -36,5 +36,5 @@ public/paku.html: paku.json
sh scripts/paku -l
public: README.md TODOs.md public/dependencies.svg public/paku.html
- sh aux/workflow/public.sh "EuAndreh's package repository" $(NAME) $(MAILING_LIST) public
+ sh aux/workflow/public.sh -N "EuAndreh's package repository" -n $(NAME) -m $(MAILING_LIST) -o public
cp EuAndreh.key public/
diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh
index 7fa3382..be97866 100755
--- a/aux/ci/ci-build.sh
+++ b/aux/ci/ci-build.sh
@@ -26,7 +26,7 @@ EOF
git notes append -m "$NOTE"
cd -
- sh aux/ci/report.sh "$PROJECT" public
+ 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" "$STATUS"
diff --git a/aux/ci/report.sh b/aux/ci/report.sh
index c873f54..69dbea3 100755
--- a/aux/ci/report.sh
+++ b/aux/ci/report.sh
@@ -1,9 +1,31 @@
#!/bin/sh
set -eu
-PROJECT="$1"
-OUTDIR="$2"
TLD="$(cat aux/tld.txt)"
+while getopts 'n:o:' flag; do
+ case "$flag" in
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ o)
+ OUTDIR="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+assert_arg "${PROJECT:-}" '-n PROJECT'
+assert_arg "${OUTDIR:-}" '-o OUTDIR'
PASS='✅'
FAIL='❌'
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh
index f93ece8..6c24c3e 100755
--- a/aux/workflow/TODOs.sh
+++ b/aux/workflow/TODOs.sh
@@ -1,11 +1,43 @@
#!/bin/sh
set -eu
-PROJECT_UC="$1"
-PROJECT="$2"
-MAILING_LIST="$3"
-OUTDIR="$4"
TLD="$(cat aux/tld.txt)"
+PROJECT_UC=
+while getopts 'n:N:m:o:' flag; do
+ case "$flag" in
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ N)
+ PROJECT_UC="$OPTARG"
+ ;;
+ m)
+ MAILING_LIST="$OPTARG"
+ ;;
+ o)
+ OUTDIR="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ 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
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/'
TODOS_CLEANUP_REGEX1='s/(<a><a)/<a/'
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh
index e2cd926..11088a8 100755
--- a/aux/workflow/assert-changelog.sh
+++ b/aux/workflow/assert-changelog.sh
@@ -2,10 +2,34 @@
set -eu
TLD="$(cat aux/tld.txt)"
-PROJECT_UC="$1"
-PROJECT="$2"
-shift
-shift
+PROJECT_UC=
+while getopts 'n:N:' flag; do
+ case "$flag" in
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ N)
+ PROJECT_UC="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+assert_arg "${PROJECT:-}" '-n PROJECT'
+
+if [ -z "${PROJECT_UC:-}" ]; then
+ PROJECT_UC="$PROJECT"
+fi
HOMEPAGE_LINK="Changelog for [$PROJECT_UC](https://$TLD/$PROJECT/)."
diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh
index 2a6c3fd..f8a05a4 100755
--- a/aux/workflow/assert-readme.sh
+++ b/aux/workflow/assert-readme.sh
@@ -1,11 +1,31 @@
#!/bin/sh
set -eu
-PROJECT="$1"
-MAILING_LIST="$2"
-shift
-shift
TLD="$(cat aux/tld.txt)"
+while getopts 'n:m:' flag; do
+ case "$flag" in
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ m)
+ MAILING_LIST="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+assert_arg "${PROJECT:-}" '-n PROJECT'
+assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST'
EXPECTED="$(mktemp)"
cat <<EOF >> "$EXPECTED"
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh
index 7267145..b196867 100755
--- a/aux/workflow/commonmark.sh
+++ b/aux/workflow/commonmark.sh
@@ -1,19 +1,57 @@
#!/bin/sh
set -eu
-PROJECT_UC="$1"
-F="$2"
-OUTDIR="$3"
-OUT="${4:-${F%.*}.html}"
+while getopts 'N:o:r:w:L:' flag; do
+ case "$flag" in
+ N)
+ PROJECT_UC="$OPTARG"
+ ;;
+ o)
+ OUTDIR="$OPTARG"
+ ;;
+ r)
+ IN_FILE="$OPTARG"
+ ;;
+ w)
+ OUT_FILE="$OPTARG"
+ ;;
+ L)
+ THE_LANG="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+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")"
pandoc \
- --toc \
- --highlight-style pygments \
- --toc-depth=2 \
- -s \
- --metadata title="$PROJECT_UC - ${F%.*}" \
- --metadata lang=en \
- -r commonmark \
- -w html \
- -H aux/workflow/favicon.html \
- < "$F" > "$OUTDIR/$OUT"
+ --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"
diff --git a/aux/workflow/dist.sh b/aux/workflow/dist.sh
index ed61ee5..69c0173 100755
--- a/aux/workflow/dist.sh
+++ b/aux/workflow/dist.sh
@@ -1,19 +1,54 @@
#!/bin/sh
set -eu
-DATE="$1"
-VVERSION="v$2"
-PROJECT_UC="$3"
-PROJECT="$4"
-MAILING_LIST="$5"
+PROJECT_UC=
+while getopts 'd:V:n:N:m:' flag; do
+ case "$flag" in
+ d)
+ DATE="$OPTARG"
+ ;;
+ V)
+ VVERSION="v$OPTARG"
+ ;;
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ N)
+ PROJECT_UC="$OPTARG"
+ ;;
+ m)
+ MAILING_LIST="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+assert_arg "${DATE:-}" '-d DATE'
+assert_arg "${VVERSION:-}" '-V VERSION'
+assert_arg "${PROJECT:-}" '-n PROJECT'
+assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST'
+
+if [ -z "${PROJECT_UC:-}" ]; then
+ PROJECT_UC="$PROJECT"
+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 "$PROJECT_UC" "$PROJECT" "$VVERSION"
-sh aux/workflow/assert-readme.sh "$PROJECT" "$MAILING_LIST" "$VVERSION"
+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 [ "$DATE" != "$(git log -1 --format=%cd --date=short HEAD)" ]; then
echo "Date '$DATE' is not up-to-date." >&2
@@ -32,7 +67,7 @@ fi
git tag "$VVERSION"
-sh aux/workflow/sign-tarballs.sh "$PROJECT"
+sh aux/workflow/sign-tarballs.sh -n "$PROJECT"
cat <<EOF >&2
diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh
index 7433595..be32ac1 100755
--- a/aux/workflow/public.sh
+++ b/aux/workflow/public.sh
@@ -1,20 +1,62 @@
#!/bin/sh
set -eu
-PROJECT_UC="$1"
-PROJECT="$2"
-MAILING_LIST="$3"
-OUTDIR="$4"
+PROJECT_UC=
+while getopts 'n:N:m:o:l:' flag; do
+ case "$flag" in
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ N)
+ PROJECT_UC="$OPTARG"
+ ;;
+ m)
+ MAILING_LIST="$OPTARG"
+ ;;
+ o)
+ OUTDIR="$OPTARG"
+ ;;
+ l)
+ LANGS="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ 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
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 ||:
+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 "$PROJECT" CHANGELOG.md "$OUTDIR"
+ 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/ci/report.sh "$PROJECT" "$OUTDIR"
-
+sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR"
cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR"
diff --git a/aux/workflow/sign-tarballs.sh b/aux/workflow/sign-tarballs.sh
index 8de6ac4..168d38d 100755
--- a/aux/workflow/sign-tarballs.sh
+++ b/aux/workflow/sign-tarballs.sh
@@ -1,7 +1,27 @@
#!/bin/sh
set -eu
-PROJECT="$1"
+while getopts 'n:' flag; do
+ case "$flag" in
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND -1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+assert_arg "${PROJECT:-}" '-n PROJECT'
+
SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.gz list | cut -d\ -f2)"
for tag in $(git tag); do