tobogganSe connecter

packages

The Louise packages, each released on its own

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

39 lignes · 1494 octetsBrut · Historique
1#!/bin/sh
2# A release tag `<package>-v<version>` must name a package whose manifest
3# declares that version, at the tagged commit, and each of its versioned
4# dependencies must have a release that satisfies it.
5#
6# scripts/check-tag.sh TAG
7
8set -eu
9cd "$(dirname "$0")/.."
10tag="$1"
11pkg=${tag%-v*}
12version=${tag##*-v}
13[ "$pkg" != "$tag" ] || { echo "error: $tag is not <package>-v<version>" >&2; exit 1; }
14m=$(git show "$tag:$pkg/louise.toml") || { echo "error: $tag: no $pkg/louise.toml" >&2; exit 1; }
15declared=$(printf '%s\n' "$m" | sed -n 's/^version *= *"\(.*\)"/\1/p' | head -1)
16[ "$declared" = "$version" ] || { echo "error: $tag: $pkg/louise.toml says version \"$declared\"" >&2; exit 1; }
17
18# A scratch app that depends on the tagged package through this repository
19# resolves every versioned requirement against the tags: louise reports a
20# requirement no release satisfies.
21app=$(mktemp -d)
22trap 'rm -rf "$app"' EXIT
23mkdir -p "$app/src"
24cat >"$app/louise.toml" <<TOML
25[package]
26name = "release_check"
27
28[dependencies]
29$pkg = { git = "file://$PWD", subdir = "$pkg", version = "= $version" }
30TOML
31# Its root module if it has one (`src/lib.lse`), else its first module.
32module=$pkg
33if ! git cat-file -e "$tag:$pkg/src/lib.lse" 2>/dev/null; then
34 first=$(git ls-tree --name-only "$tag:$pkg/src/" | grep '\.lse$' | head -1)
35 module="$pkg/${first%.lse}"
36fi
37printf 'import %s\n\npub fn main :: -> () {\n ()\n}\n' "$module" >"$app/src/main.lse"
38(cd "$app" && louise check)
39echo "$tag: ok"