clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / test / scenarios / release-checksum.sh
release-checksum.sh 1.6K
1# SHA256SUMS must list every file of a release, each with its sha256 and2# nothing else, in sha256sum's format; otherwise the push is refused and3# nothing is served.4. "$(dirname "$0")/../lib.sh"5user dami6repo dami/greet7clone dami dami/greet "$T/w/d"8at "$T/w/d" commit "first"9at "$T/w/d" git tag v110ok push_as dami "$T/w/d" origin main v111# mk <SHA256SUMS text>: c is a release of greet and notes with that12# SHA256SUMS, signed by dami. try <regex> <text>: it is refused for the reason.13mk() {14 rm -rf "$T/f"15 mkdir "$T/f"16 printf 'greet\n' >"$T/f/greet"17 printf 'notes\n' >"$T/f/notes"18 printf '%s' "$1" >"$T/f/SHA256SUMS"19 c=$(release_commit "$T/w/d" v1 "$T/f")20}21try() {22 mk "$2"23 fails_with "$1" push_as dami "$T/w/d" origin "$c:refs/releases/v1"24}25g=$(printf 'greet\n' | { sha256sum 2>/dev/null || shasum -a 256; } | cut -d' ' -f1)26n=$(printf 'notes\n' | { sha256sum 2>/dev/null || shasum -a 256; } | cut -d' ' -f1)27try "release v1: notes doesn't match its sha256 in SHA256SUMS" "$g greet28$g notes29"30try "release v1: SHA256SUMS doesn't list notes" "$g greet31"32try "SHA256SUMS lists extra, which the release doesn't have" "$g greet33$n notes34$n extra35"36try "SHA256SUMS lists greet twice" "$g greet37$g greet38$n notes39"40try "SHA256SUMS has a line that isn't" "$g greet notes41"42try "SHA256SUMS has a line that isn't" "abc greet43$n notes44"45missing "$FORGE_WWW/dami/greet/releases"46fails git --git-dir="$FORGE_ROOT/dami/greet.git" rev-parse -q --verify refs/releases/v14748# Binary mode's "*name" and blank lines are fine.49mk "$g *greet5051$n notes52"53ok push_as dami "$T/w/d" origin "$c:refs/releases/v1"54exists "$FORGE_WWW/dami/greet/releases/download/v1/notes"