66 lines
1.8 KiB
Bash
Executable File
66 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Initialize pinned components and prepare isolated Python environments.
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
check_only=false
|
|
if [[ "${1:-}" == "--check" ]]; then
|
|
check_only=true
|
|
elif [[ $# -ne 0 ]]; then
|
|
echo "Usage: $0 [--check]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
missing=()
|
|
for command in git uv typst; do
|
|
command -v "$command" >/dev/null 2>&1 || missing+=("$command")
|
|
done
|
|
if ((${#missing[@]})); then
|
|
echo "Missing required tools: ${missing[*]}" >&2
|
|
echo 'Install Git, uv, and Typst, then rerun bootstrap.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! $check_only; then
|
|
git submodule update --init --recursive
|
|
fi
|
|
|
|
for component in win-diagnostics reportist beffroi-reports; do
|
|
if [[ ! -e "$component/.git" ]]; then
|
|
echo "Missing component checkout: $component" >&2
|
|
echo 'Run ./bootstrap.sh with network access to initialize pinned submodules.' >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
while IFS= read -r status; do
|
|
if [[ "$status" == -* || "$status" == +* ]]; then
|
|
echo "Submodule is not at its pinned revision: $status" >&2
|
|
echo 'Run ./bootstrap.sh to restore the recorded component revisions.' >&2
|
|
exit 1
|
|
fi
|
|
done < <(git submodule status --recursive)
|
|
for component in win-diagnostics reportist; do
|
|
if [[ ! -f "$component/requirements.txt" ]]; then
|
|
echo "Missing dependency lock: $component/requirements.txt" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
git --version
|
|
uv --version
|
|
typst --version
|
|
|
|
if $check_only; then
|
|
echo 'Pinned components and required tools are available.'
|
|
exit 0
|
|
fi
|
|
|
|
for component in win-diagnostics reportist; do
|
|
environment=".venv/component-checks/$component"
|
|
uv venv --python 3.11 --allow-existing "$environment"
|
|
uv pip sync --python "$environment/bin/python" "$component/requirements.txt"
|
|
done
|
|
|
|
echo 'Bootstrap complete. Run make check or make help.'
|