#!/bin/sh # A release tag `-v` must name a package whose manifest # declares that version, at the tagged commit, and each of its versioned # dependencies must have a release that satisfies it. # # scripts/check-tag.sh TAG set -eu cd "$(dirname "$0")/.." tag="$1" pkg=${tag%-v*} version=${tag##*-v} [ "$pkg" != "$tag" ] || { echo "error: $tag is not -v" >&2; exit 1; } m=$(git show "$tag:$pkg/louise.toml") || { echo "error: $tag: no $pkg/louise.toml" >&2; exit 1; } declared=$(printf '%s\n' "$m" | sed -n 's/^version *= *"\(.*\)"/\1/p' | head -1) [ "$declared" = "$version" ] || { echo "error: $tag: $pkg/louise.toml says version \"$declared\"" >&2; exit 1; } # A scratch app that depends on the tagged package through this repository # resolves every versioned requirement against the tags: louise reports a # requirement no release satisfies. app=$(mktemp -d) trap 'rm -rf "$app"' EXIT mkdir -p "$app/src" cat >"$app/louise.toml" </dev/null; then first=$(git ls-tree --name-only "$tag:$pkg/src/" | grep '\.lse$' | head -1) module="$pkg/${first%.lse}" fi printf 'import %s\n\npub fn main :: -> () {\n ()\n}\n' "$module" >"$app/src/main.lse" (cd "$app" && louise check) echo "$tag: ok"